From 66471336a6a440679fee029a225bd8009bf8049e Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 31 Dec 2024 11:36:28 +0800 Subject: [PATCH 001/106] feat(node): add framework --- sdk/node/.eslintrc | 22 + sdk/node/.gitignore | 24 + sdk/node/.prettierrc | 10 + sdk/node/README.md | 0 sdk/node/package-lock.json | 1073 ++++++++++++++++++++++++++++++++++++ sdk/node/package.json | 43 ++ sdk/node/src/index.ts | 3 + sdk/node/tsconfig.json | 15 + 8 files changed, 1190 insertions(+) create mode 100644 sdk/node/.eslintrc create mode 100644 sdk/node/.gitignore create mode 100644 sdk/node/.prettierrc create mode 100644 sdk/node/README.md create mode 100644 sdk/node/package-lock.json create mode 100644 sdk/node/package.json create mode 100644 sdk/node/src/index.ts create mode 100644 sdk/node/tsconfig.json diff --git a/sdk/node/.eslintrc b/sdk/node/.eslintrc new file mode 100644 index 00000000..19a13ecf --- /dev/null +++ b/sdk/node/.eslintrc @@ -0,0 +1,22 @@ +{ + "env": { + "browser": false, + "node": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2021, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint", "prettier"], + "rules": { + "prettier/prettier": "error", + "@typescript-eslint/no-unused-vars": "warn" + } +} diff --git a/sdk/node/.gitignore b/sdk/node/.gitignore new file mode 100644 index 00000000..a547bf36 --- /dev/null +++ b/sdk/node/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/sdk/node/.prettierrc b/sdk/node/.prettierrc new file mode 100644 index 00000000..b01f6e72 --- /dev/null +++ b/sdk/node/.prettierrc @@ -0,0 +1,10 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf", + "printWidth": 100 +} diff --git a/sdk/node/README.md b/sdk/node/README.md new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json new file mode 100644 index 00000000..0ebb6c1c --- /dev/null +++ b/sdk/node/package-lock.json @@ -0,0 +1,1073 @@ +{ + "name": "kucoin-universal-node-sdk", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.4.3" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + } + } + }, + "@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true + }, + "@eslint/config-array": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", + "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "dev": true, + "requires": { + "@eslint/object-schema": "^2.1.5", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@eslint/core": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", + "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.15" + } + }, + "@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@eslint/js": { + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", + "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "dev": true + }, + "@eslint/object-schema": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", + "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "dev": true + }, + "@eslint/plugin-kit": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", + "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", + "dev": true, + "requires": { + "levn": "^0.4.1" + } + }, + "@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true + }, + "@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "requires": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "dependencies": { + "@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true + } + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true + }, + "@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz", + "integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/type-utils": "8.19.0", + "@typescript-eslint/utils": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" + } + }, + "@typescript-eslint/parser": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", + "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/typescript-estree": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", + "integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz", + "integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "8.19.0", + "@typescript-eslint/utils": "8.19.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + } + }, + "@typescript-eslint/types": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz", + "integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz", + "integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/visitor-keys": "8.19.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + } + }, + "@typescript-eslint/utils": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz", + "integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.19.0", + "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/typescript-estree": "8.19.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz", + "integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.19.0", + "eslint-visitor-keys": "^4.2.0" + } + }, + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "9.17.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", + "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.17.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true + }, + "eslint-plugin-prettier": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" + } + }, + "eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true + }, + "espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "requires": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + } + }, + "esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastq": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", + "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "requires": { + "flat-cache": "^4.0.0" + } + }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "requires": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + } + }, + "flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "requires": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + } + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, + "punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "synckit": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", + "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", + "dev": true, + "requires": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-api-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "dev": true + }, + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "typescript": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/sdk/node/package.json b/sdk/node/package.json new file mode 100644 index 00000000..ae257ee6 --- /dev/null +++ b/sdk/node/package.json @@ -0,0 +1,43 @@ +{ + "name": "kucoin-universal-node-sdk", + "version": "0.0.1", + "description": "Official KuCoin Universal SDK.", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc", + "lint": "eslint 'src/**/*.{ts,js}' --fix", + "format": "prettier --write 'src/**/*.{ts,js,json}'", + "test": "jest", + "clean": "rm -rf dist" + }, + "repository": { + "type": "git", + "url": "https://github.com/Kucoin/kucoin-universal-sdk" + }, + "keywords": [ + "KuCoin", + "SDK", + "Node.js", + "TypeScript", + "crypto" + ], + "author": "KuCoin", + "license": "MIT", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^8.19.0", + "@typescript-eslint/parser": "^8.19.0", + "eslint": "^9.17.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "prettier": "^3.4.2", + "typescript": "^5.7.2" + }, + "peerDependencies": {}, + "engines": { + "node": ">=14" + } +} diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts new file mode 100644 index 00000000..7914f42c --- /dev/null +++ b/sdk/node/src/index.ts @@ -0,0 +1,3 @@ +export const greet = (name: string): string => { + return `Hello, ${name}!`; +}; diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json new file mode 100644 index 00000000..06d4a341 --- /dev/null +++ b/sdk/node/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "Node", + "declaration": true, + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "outDir": "./dist" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "tests"] +} From 1de5a3ce34f108a5ab5c7970ce250f863ca67515 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 3 Jan 2025 17:05:07 +0800 Subject: [PATCH 002/106] feat(nodejs): add nodejs support --- .../plugin/generator/NodeSdkGenerator.java | 512 ++++++++++++++++++ .../org.openapitools.codegen.CodegenConfig | 1 + .../src/main/resources/node-sdk/api.mustache | 38 ++ .../main/resources/node-sdk/model.mustache | 145 +++++ .../node-sdk/partial_header.mustache | 1 + .../main/resources/node-sdk/version.mustache | 2 + .../sdk/plugin/SdkGeneratorTest.java | 56 +- sdk/node/.prettierrc | 2 +- sdk/node/package-lock.json | 10 + sdk/node/package.json | 6 +- sdk/node/src/index.ts | 3 - sdk/node/src/internal/interfaces/response.ts | 13 + .../src/internal/interfaces/serializable.ts | 14 + sdk/node/src/internal/interfaces/transport.ts | 34 ++ sdk/node/src/model/client_option.ts | 168 ++++++ sdk/node/src/model/common.ts | 93 ++++ sdk/node/src/model/constant.ts | 75 +++ sdk/node/src/model/transport_option.ts | 201 +++++++ sdk/node/src/model/websocket_option.ts | 169 ++++++ sdk/node/tsconfig.json | 9 +- 20 files changed, 1518 insertions(+), 34 deletions(-) create mode 100644 generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java create mode 100644 generator/plugin/src/main/resources/node-sdk/api.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/model.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/partial_header.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/version.mustache create mode 100644 sdk/node/src/internal/interfaces/response.ts create mode 100644 sdk/node/src/internal/interfaces/serializable.ts create mode 100644 sdk/node/src/internal/interfaces/transport.ts create mode 100644 sdk/node/src/model/client_option.ts create mode 100644 sdk/node/src/model/common.ts create mode 100644 sdk/node/src/model/constant.ts create mode 100644 sdk/node/src/model/transport_option.ts create mode 100644 sdk/node/src/model/websocket_option.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java new file mode 100644 index 00000000..fd74a329 --- /dev/null +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -0,0 +1,512 @@ +package com.kucoin.universal.sdk.plugin.generator; + +import com.kucoin.universal.sdk.plugin.model.EnumEntry; +import com.kucoin.universal.sdk.plugin.model.Meta; +import com.kucoin.universal.sdk.plugin.model.ModeSwitch; +import com.kucoin.universal.sdk.plugin.service.NameService; +import com.kucoin.universal.sdk.plugin.service.OperationService; +import com.kucoin.universal.sdk.plugin.service.SchemaService; +import com.kucoin.universal.sdk.plugin.service.impl.OperationServiceImpl; +import com.kucoin.universal.sdk.plugin.service.impl.SchemaServiceImpl; +import com.kucoin.universal.sdk.plugin.util.SpecificationUtil; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.servers.Server; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; + +import java.io.File; +import java.util.*; +import java.util.stream.Collectors; + +import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; +import static org.openapitools.codegen.utils.StringUtils.camelize; +import static org.openapitools.codegen.utils.StringUtils.underscore; + +/** + * @author isaac.tang + */ +@Slf4j +public class NodeSdkGenerator extends AbstractTypeScriptClientCodegen implements NameService { + + private static class ImportModel { + public String className; + public Set component; + + public ImportModel(String className) { + this.className = className; + this.component = new HashSet<>(); + } + + public String toImport() { + if (component.isEmpty()) { + return String.format("import \"%s\"", className); + } + + return String.format("import { %s } from \"%s\"", String.join(", ", component), className); + } + } + + + private SchemaService schemaService; + private OperationService operationService; + private ModeSwitch modeSwitch; + + private String service; + private String subService; + + public CodegenType getTag() { + return CodegenType.OTHER; + } + + public String getName() { + return "node-sdk"; + } + + public String getHelp() { + return "Generates a node-sdk library."; + } + + public NodeSdkGenerator() { + super(); + cliOptions.add(ModeSwitch.option); + } + + @Override + public void processOpts() { + super.processOpts(); + modeSwitch = new ModeSwitch(additionalProperties); + + switch (modeSwitch.getMode()) { + case API: { + modelTemplateFiles.put("model.mustache", ".ts"); + apiTemplateFiles.put("api.mustache", ".ts"); + break; + } + case TEST: { + apiTemplateFiles.put("api_test.mustache", ".ts"); + break; + } + case TEST_TEMPLATE: { + apiTemplateFiles.put("api_test_template.mustache", ".template"); + break; + } + case ENTRY: { + apiTemplateFiles.put("api_entry.mustache", ".ts"); + break; + } + case WS: { + modelTemplateFiles.put("model_ws.mustache", ".ts"); + apiTemplateFiles.put("api_ws.mustache", ".ts"); + additionalProperties.put("WS_MODE", "true"); + break; + } + case WS_TEST: { + apiTemplateFiles.put("api_ws_test.mustache", ".ts"); + break; + } + default: + throw new RuntimeException("unsupported mode"); + } + + supportingFiles.add(new SupportingFile("version.mustache", "version.ts")); + + templateDir = "node-sdk"; + + // override parent properties + enablePostProcessFile = true; + + service = openAPI.getInfo().getTitle(); + subService = openAPI.getInfo().getDescription(); + + inlineSchemaOption.put("SKIP_SCHEMA_REUSE", "true"); + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + + // parse and update operations and models + schemaService = new SchemaServiceImpl(openAPI); + operationService = new OperationServiceImpl(openAPI, this); + + operationService.parseOperation(); + schemaService.parseSchema(); + } + + @Override + public String formatParamName(String name) { + return toParamName(name); + } + + @Override + public String formatMethodName(String name) { + return camelize(name); + } + + @Override + public String formatService(String name) { + return camelize(name); + } + + @Override + public String formatPackage(String name) { + return formatService(name).toLowerCase(); + } + + @Override + public CodegenProperty fromProperty(String name, Schema p, boolean required) { + CodegenProperty prop = super.fromProperty(name, p, required); + String cc = camelize(prop.name, LOWERCASE_FIRST_LETTER); + if (isReservedWord(cc)) { + cc = escapeReservedWord(cc); + } + prop.nameInCamelCase = cc; + + if (prop.defaultValue != null && prop.defaultValue.equalsIgnoreCase("undefined")) { + prop.defaultValue = null; + } + + if (prop.isEnum) { + List enums = new ArrayList<>(); + + Map builderVars = new HashMap<>(); + + List> enumList; + if (prop.openApiType.equalsIgnoreCase("array")) { + enumList = (List>) prop.mostInnerItems.vendorExtensions.get("x-api-enum"); + + // list[XX.TypeEnum] + builderVars.put("prefix", "list["); + builderVars.put("suffix", "." + prop.enumName + "]"); + + } else { + enumList = (List>) prop.vendorExtensions.get("x-api-enum"); + + // XX.TypeEnum + builderVars.put("prefix", ""); + builderVars.put("suffix", "." + prop.datatypeWithEnum); + } + + + List names = new ArrayList<>(); + List values = new ArrayList<>(); + List description = new ArrayList<>(); + + enumList.forEach(e -> { + Object enumValueOriginal = e.get("value"); + + String enumValueNameGauss; + if (enumValueOriginal instanceof Integer) { + enumValueNameGauss = "_" + e.get("value"); + } else if (enumValueOriginal instanceof String) { + enumValueNameGauss = enumValueOriginal.toString(); + } else { + throw new IllegalArgumentException("unknown enum value type..." + e.get("value")); + } + + String enumName = (String) e.get("name"); + if (StringUtils.isEmpty(enumName)) { + enumName = enumValueNameGauss; + } + + enumName = toVarName(enumName).toUpperCase(); + String enumValue = toEnumValue(enumValueOriginal.toString().trim(), typeMapping.get(p.getType())); + + names.add(enumName); + values.add(enumValueOriginal.toString().trim()); + description.add(e.get("description").toString()); + + enums.add(new EnumEntry(enumName, enumValue, enumValueOriginal, (String) e.get("description"), enumValueOriginal instanceof String)); + }); + + // update internal enum support + prop._enum = values; + prop.allowableValues.put("values", values); + prop.vendorExtensions.put("x-enum-varnames", names); + prop.vendorExtensions.put("x-enum-descriptions", description); + prop.vendorExtensions.put("x-enum-builder-vars", builderVars); + + prop.vendorExtensions.put("x-enums", enums); + } + + return prop; + } + + public boolean isDataTypeString(String dataType) { + return "string".equals(dataType); + } + + @Override + public String toEnumDefaultValue(String value, String datatype) { + return datatype + "." + value; + } + + @Override + public String getEnumDefaultValue(String defaultValue, String dataType) { + return defaultValue; + } + + @Override + public String toModelName(String name) { + return formatService(schemaService.getGeneratedModelName(name)); + } + + @Override + public String toApiName(String name) { + return camelize(name + "_" + (modeSwitch.isWs() ? "WS" : "API")); + } + + @Override + public String toModelFilename(String name) { + name = schemaService.getGeneratedModelName(name); + name = "model_" + name; + name = underscore(name); + return name; + } + + @Override + public String modelFileFolder() { + switch (modeSwitch.getMode()) { + case ENTRY: + return outputFolder + File.separator + "service"; + default: + return outputFolder + File.separator + service + File.separator + formatPackage(subService); + } + } + + @Override + public String toApiFilename(String name) { + String apiName; + String api = name.replaceAll("-", "_"); + api = "api_" + underscore(api); + apiName = api; + + switch (modeSwitch.getMode()) { + case TEST: + case WS_TEST: { + apiName = apiName + "_test"; + break; + } + } + return apiName; + } + + @Override + public String modelFilename(String templateName, String name) { + String suffix = modelTemplateFiles().get(templateName); + return modelFileFolder() + File.separator + toModelFilename(name) + suffix; + } + + @Override + public String apiFilename(String templateName, String tag) { + String suffix = apiTemplateFiles().get(templateName); + if (modeSwitch.isEntry()) { + String entryType = service + "_api"; + return modelFileFolder() + File.separator + entryType + suffix; + } + return modelFileFolder() + File.separator + toApiFilename(tag) + suffix; + } + + @Override + public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { + CodegenOperation result = super.fromOperation(path, httpMethod, operation, servers); + if (httpMethod.equalsIgnoreCase("patch")) { + result.httpMethod = (String) operation.getExtensions().get("x-original-method"); + } + return result; + } + + private String generateImport(String className, String fileName) { + return String.format("import {%s} from './%s'", className, fileName); + } + + private Set generateApiImport(Meta meta, boolean req) { + Set imports = new HashSet<>(); + switch (modeSwitch.getMode()) { + case API: + case TEST: { + String suffix = "resp"; + if (req) { + suffix = "req"; + } + imports.add(generateImport( + formatService(meta.getMethod() + camelize(suffix)), + toModelFilename(meta.getMethod()) + "_" + suffix)); + break; + } + case WS: { +// String suffix = "event"; +// imports.add(generateImport(meta.getService().toLowerCase(), +// toModelFilename(meta.getMethod()) + "_" + suffix, +// formatService(meta.getMethod() + camelize(suffix + "Callback")), +// formatService(meta.getMethod() + camelize(suffix + "CallbackWrapper")))); +// +// if ((((Map) meta.getOtherProperties().getParas().getType()).containsKey("array"))) { +// imports.add(generateImportSimple("typing", "List")); +// } + + break; + + } + case WS_TEST: { +// String suffix = "event"; +// imports.add(generateImport(meta.getService().toLowerCase(), +// toModelFilename(meta.getMethod()) + "_" + suffix, +// formatService(meta.getMethod() + camelize(suffix)))); +// +// if ((((Map) meta.getOtherProperties().getParas().getType()).containsKey("array"))) { +// imports.add(generateImportSimple("typing", "List")); +// } + + break; + } + case ENTRY: { +// operationService.getServiceMeta().forEach((k, v) -> { +// if (v.getService().equalsIgnoreCase(meta.getService())) { +// imports.add( +// generateImportSimple(String.format("kucoin_universal_sdk.generate.%s.%s.%s", formatPackage(v.getService()), +// formatPackage(v.getSubService()), toApiFilename(formatMethodName(k))), +// formatService(k + "API"), +// formatService(k + "APIImpl"))); +// } +// }); + break; + } + default: { + throw new RuntimeException("unsupported mode"); + } + } + return imports; + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + + OperationMap operationMap = objs.getOperations(); + + Set modelImport = new TreeSet<>(); + + for (CodegenOperation op : operationMap.getOperation()) { + Meta meta = SpecificationUtil.getMeta(op.vendorExtensions); + if (meta != null) { + switch (modeSwitch.getMode()) { + case ENTRY: { + // api entry + List> entryValue = new ArrayList<>(); + operationService.getServiceMeta().forEach((k, v) -> { + if (v.getService().equalsIgnoreCase(meta.getService())) { + Map kv = new HashMap<>(); + kv.put("method", formatMethodName(k)); + kv.put("target_service", formatService(k + "API")); + entryValue.add(kv); + } + }); + Map apiEntryInfo = new HashMap<>(); + apiEntryInfo.put("api_entry_name", formatService(meta.getService() + "Service")); + apiEntryInfo.put("api_entry_value", entryValue); + objs.put("api_entry", apiEntryInfo); + entryValue.forEach(m -> { + modelImport.addAll(generateApiImport(meta, false)); + }); + break; + } + + case API: + case TEST: { + if (op.hasParams) { + modelImport.addAll(generateApiImport(meta, true)); + } + modelImport.addAll(generateApiImport(meta, false)); + break; + } + case WS: + case WS_TEST: { + modelImport.addAll(generateApiImport(meta, false)); + break; + } + case TEST_TEMPLATE: { + String reqName = meta.getMethodServiceFmt().toLowerCase() + "Req"; + allModels.stream().filter(m -> reqName.equalsIgnoreCase((String) m.get("importPath"))). + forEach(m -> op.vendorExtensions.put("x-request-model", m.getModel())); + break; + } + } + } + } + + objs.put("imports", modelImport); + + return objs; + } + + + private String getInnerModelType(CodegenProperty p) { + if (p.isArray || p.isMap) { + return getInnerModelType(p.getItems()); + } + + if (p.isModel) { + return p.getDataType(); + } + + return null; + } + + @Override + public ModelsMap postProcessModels(ModelsMap objs) { + objs = super.postProcessModels(objs); + + Map imports = new HashMap<>(); + + List models = objs.getModels(); + if (models != null) { + for (ModelMap model : models) { + CodegenModel codegenModel = model.getModel(); + if (codegenModel != null) { + + imports.computeIfAbsent("class-transformer", ImportModel::new). + component.addAll(Arrays.asList("plainToInstance", "instanceToPlain")); + + if (codegenModel.getVendorExtensions().containsKey("x-response-model")) { + imports.computeIfAbsent("class-transformer", ImportModel::new).component.add("Exclude"); + } + + for (CodegenProperty var : codegenModel.getVars()) { + + String innerType = getInnerModelType(var); + + if (innerType != null) { + String modelName = "./" + toModelFilename(innerType); + imports.computeIfAbsent(modelName, ImportModel::new).component.add(innerType); + imports.computeIfAbsent("class-transformer", ImportModel::new).component.add("Type"); + var.vendorExtensions.put("x-typed", String.format("@Type(() => %s)", innerType)); + } + + if (var.getBaseName() != null && !var.getName().equals(var.getBaseName())) { + var.vendorExtensions.put("x-use-base-name", true); + imports.computeIfAbsent("class-transformer", ImportModel::new).component.add("Expose"); + } + + if (var.getVendorExtensions().containsKey("x-tag-path")) { + imports.computeIfAbsent("class-transformer", ImportModel::new).component.add("Exclude"); + imports.computeIfAbsent("reflect-metadata", ImportModel::new); + } + } + + codegenModel.getVendorExtensions().put("x-imports", imports.values().stream(). + map(ImportModel::toImport).collect(Collectors.toSet())); + } + } + } + return objs; + } +} diff --git a/generator/plugin/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/generator/plugin/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 02ddd97c..c5ae1d79 100644 --- a/generator/plugin/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/generator/plugin/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -1,2 +1,3 @@ com.kucoin.universal.sdk.plugin.generator.GolangSdkGenerator com.kucoin.universal.sdk.plugin.generator.PythonSdkGenerator +com.kucoin.universal.sdk.plugin.generator.NodeSdkGenerator diff --git a/generator/plugin/src/main/resources/node-sdk/api.mustache b/generator/plugin/src/main/resources/node-sdk/api.mustache new file mode 100644 index 00000000..de4771c7 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/api.mustache @@ -0,0 +1,38 @@ +{{>partial_header}} + +import { Transport } from '@internal/interfaces/transport'; +{{#imports}} +{{{.}}} +{{/imports}} + +export interface {{classname}} { +{{#operations}} + {{#operation}} + /**{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + * {{vendorExtensions.x-meta.method}} {{summary}} + * Description: {{notes}} + * Documentation: {{vendorExtensions.x-api-doc}} + {{#vendorExtensions.x-extra-comment}} + * {{.}} + {{/vendorExtensions.x-extra-comment}} + */ + {{vendorExtensions.x-meta.method}}({{#hasParams}}req :{{vendorExtensions.x-meta.methodServiceFmt}}Req{{/hasParams}}): Promise<{{vendorExtensions.x-meta.methodServiceFmt}}Resp> + + {{/operation}} +{{/operations}} +} + + +export class {{classname}}Impl implements {{classname}} { + constructor(private transport :Transport) {} + +{{#operations}} + {{#operation}} + {{vendorExtensions.x-meta.method}}({{#hasParams}}req :{{vendorExtensions.x-meta.methodServiceFmt}}Req{{/hasParams}}): Promise<{{vendorExtensions.x-meta.methodServiceFmt}}Resp> { + return this.transport.call("{{vendorExtensions.x-meta.domain}}", {{vendorExtensions.x-meta.broker}}, "{{httpMethod}}", "{{path}}", {{#hasParams}}req{{/hasParams}}{{^hasParams}}null{{/hasParams}}, {{#vendorExtensions.x-request-force-json}}true{{/vendorExtensions.x-request-force-json}}{{^vendorExtensions.x-request-force-json}}false{{/vendorExtensions.x-request-force-json}}) + } + + {{/operation}} +{{/operations}} +} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache new file mode 100644 index 00000000..d5341a61 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -0,0 +1,145 @@ +{{>partial_header}} +{{#models}} +{{#model}} +{{#vendorExtensions.x-imports}} +{{{.}}} +{{/vendorExtensions.x-imports}} +{{#vendorExtensions.x-response-model}} +import { RestResponse } from '@model/common'; +import {Response} from '@internal/interfaces/response'; +export class {{classname}} implements Response<{{classname}}> { +{{/vendorExtensions.x-response-model}} +{{^vendorExtensions.x-response-model}} +import { Serializable } from '@internal/interfaces/serializable'; +export class {{classname}} implements Serializable<{{classname}}>{ +{{/vendorExtensions.x-response-model}} +{{#vars}} + /** + * {{#description}}{{{.}}}{{/description}} + */ +{{#vendorExtensions.x-use-base-name}} + @Expose({ name: "{{baseName}}" }) +{{/vendorExtensions.x-use-base-name}} +{{#vendorExtensions.x-tag-path}} + @Exclude() + @Reflect.metadata("path", "{{baseName}}") +{{/vendorExtensions.x-tag-path}} +{{#vendorExtensions.x-typed}} + {{{.}}} +{{/vendorExtensions.x-typed}} + {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; +{{/vars}} +{{#vendorExtensions.x-response-model}} + /** + * common response + */ + @Exclude() + CommonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.CommonResponse = response; + } +{{/vendorExtensions.x-response-model}} +{{#vendorExtensions.x-request-model}} + + /** + * Creates a new instance of the `{{classname}}` class. + * The builder pattern allows step-by-step construction of a `{{classname}}` object. + */ + static builder(): {{classname}}Builder { + return new {{classname}}Builder(); + } + + /** + * Creates a new instance of the `{{classname}}` class with the given data. + */ + static create(data : { + {{#vars}} + /** + * {{#description}}{{{.}}}{{/description}} + */ + {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; + {{/vars}} + }): {{classname}} { + let obj = new {{classname}}() + {{#vars}} + obj.{{name}} = data.{{name}} + {{/vars}} + return obj + } +{{/vendorExtensions.x-request-model}} + +{{#vendorExtensions.x-request-raw-array}} + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, {items : jsonObject}); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.items)); + } +{{/vendorExtensions.x-request-raw-array}} +{{^vendorExtensions.x-request-raw-array}} +{{#vendorExtensions.x-original-response}} + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, {data : jsonObject}); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } +{{/vendorExtensions.x-original-response}} +{{^vendorExtensions.x-original-response}} + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } +{{/vendorExtensions.x-original-response}} +{{/vendorExtensions.x-request-raw-array}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#vendorExtensions.x-enums}} + /** + * {{description}} + */ + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/vendorExtensions.x-enums}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} + + +{{#vendorExtensions.x-request-model}} +export class {{classname}}Builder { + obj :{{classname}} = new {{classname}}() +{{#vars}} + /** + * {{#description}}{{{.}}}{{/description}} + */ + set{{nameInPascalCase}}(value :{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}) :{{classname}}Builder { + this.obj.{{name}} = value + return this + } + +{{/vars}} + build():{{classname}} { + return this.obj + } +} + +{{/vendorExtensions.x-request-model}} + +{{/model}} +{{/models}} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/partial_header.mustache b/generator/plugin/src/main/resources/node-sdk/partial_header.mustache new file mode 100644 index 00000000..6cfefa21 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/partial_header.mustache @@ -0,0 +1 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. diff --git a/generator/plugin/src/main/resources/node-sdk/version.mustache b/generator/plugin/src/main/resources/node-sdk/version.mustache new file mode 100644 index 00000000..9b48f59c --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/version.mustache @@ -0,0 +1,2 @@ +export const SdkVersion="{{API_VERSION}}" +export const SdkGenerateDate="{{API_DATE}}" diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index c71eafe8..f5899765 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -7,8 +7,8 @@ public class SdkGeneratorTest { - private static final String SDK_NAME = "python-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-fee.json"; + private static final String SDK_NAME = "node-sdk"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-order.json"; private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; @@ -20,37 +20,37 @@ public void launchCodeGenerator() { .setInputSpec(SPEC_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "API") - .setOutputDir("out"); - - final ClientOptInput clientOptInput = configurator.toClientOptInput(); - DefaultGenerator generator = new DefaultGenerator(); - generator.opts(clientOptInput).generate(); - } - { - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName(SDK_NAME) - .setInputSpec(SPEC_ENTRY_NAME) - .setValidateSpec(false) - .addAdditionalProperty("GEN_MODE", "ENTRY") - .setOutputDir("out"); - - final ClientOptInput clientOptInput = configurator.toClientOptInput(); - DefaultGenerator generator = new DefaultGenerator(); - generator.opts(clientOptInput).generate(); - } - - { - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName(SDK_NAME) - .setInputSpec(SPEC_NAME) - .setValidateSpec(false) - .addAdditionalProperty("GEN_MODE", "TEST") - .setOutputDir("out"); + .setOutputDir("/Users/isaactang/Project/kucoin-universal-sdk/sdk/node/src/generate"); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); generator.opts(clientOptInput).generate(); } +// { +// final CodegenConfigurator configurator = new CodegenConfigurator() +// .setGeneratorName(SDK_NAME) +// .setInputSpec(SPEC_ENTRY_NAME) +// .setValidateSpec(false) +// .addAdditionalProperty("GEN_MODE", "ENTRY") +// .setOutputDir("out"); +// +// final ClientOptInput clientOptInput = configurator.toClientOptInput(); +// DefaultGenerator generator = new DefaultGenerator(); +// generator.opts(clientOptInput).generate(); +// } +// +// { +// final CodegenConfigurator configurator = new CodegenConfigurator() +// .setGeneratorName(SDK_NAME) +// .setInputSpec(SPEC_NAME) +// .setValidateSpec(false) +// .addAdditionalProperty("GEN_MODE", "TEST") +// .setOutputDir("out"); +// +// final ClientOptInput clientOptInput = configurator.toClientOptInput(); +// DefaultGenerator generator = new DefaultGenerator(); +// generator.opts(clientOptInput).generate(); +// } } @Test diff --git a/sdk/node/.prettierrc b/sdk/node/.prettierrc index b01f6e72..a6b1fc70 100644 --- a/sdk/node/.prettierrc +++ b/sdk/node/.prettierrc @@ -1,7 +1,7 @@ { "semi": true, "singleQuote": true, - "tabWidth": 2, + "tabWidth": 4, "trailingComma": "all", "bracketSpacing": true, "arrowParens": "always", diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 0ebb6c1c..71f4cdb7 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -388,6 +388,11 @@ "supports-color": "^7.1.0" } }, + "class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -936,6 +941,11 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==" + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index ae257ee6..2fba4150 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -38,6 +38,10 @@ }, "peerDependencies": {}, "engines": { - "node": ">=14" + "node": ">=18" + }, + "dependencies": { + "class-transformer": "^0.5.1", + "reflect-metadata": "^0.2.2" } } diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index 7914f42c..e69de29b 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -1,3 +0,0 @@ -export const greet = (name: string): string => { - return `Hello, ${name}!`; -}; diff --git a/sdk/node/src/internal/interfaces/response.ts b/sdk/node/src/internal/interfaces/response.ts new file mode 100644 index 00000000..663ee66c --- /dev/null +++ b/sdk/node/src/internal/interfaces/response.ts @@ -0,0 +1,13 @@ +import { RestResponse } from '@model/common'; +import { Serializable } from '@internal/interfaces/serializable'; + +/** + * Abstract class Response + * Represents a response handler with a method to set common response data. + */ +export abstract class Response extends Serializable { + /** + * Set common response data. + */ + abstract setCommonResponse(response: RestResponse): void; +} diff --git a/sdk/node/src/internal/interfaces/serializable.ts b/sdk/node/src/internal/interfaces/serializable.ts new file mode 100644 index 00000000..66fc2e42 --- /dev/null +++ b/sdk/node/src/internal/interfaces/serializable.ts @@ -0,0 +1,14 @@ +/** + * An abstract base class for serializable objects. + */ +export abstract class Serializable { + /** + * Parses a JSON string and populates the object's properties. + */ + abstract fromJson(input: string): T; + + /** + * Converts the current object into a JSON string. + */ + abstract toJson(): string; +} diff --git a/sdk/node/src/internal/interfaces/transport.ts b/sdk/node/src/internal/interfaces/transport.ts new file mode 100644 index 00000000..55f4478a --- /dev/null +++ b/sdk/node/src/internal/interfaces/transport.ts @@ -0,0 +1,34 @@ +import { Response } from './response'; + +/** + * Transport interface represents a generic transport layer. + */ +export interface Transport { + /** + * Makes a call to a remote service with the provided parameters. + * @param domain The domain name of the remote service. + * @param isBroker Indicates if the domain is a broker. + * @param method HTTP method (GET, POST, etc.). + * @param path The endpoint path for the request. + * @param request Request payload to be sent. + * @param requestJson Indicates if the request payload should be JSON-encoded. + * @param args Additional arguments or options for the transport layer + * @returns A Promise that resolves to a `Response` object containing the result of the remote + * call, or rejects with an error if the all fails. + */ + call( + domain: string, + isBroker: boolean, + method: string, + path: string, + request: any, + requestJson: boolean, + args?: any, + ): Promise>; + + /** + * Closes the transport and releases any resources. + * @returns A Promise that resolves when the transport is closed. + */ + close(): Promise; +} diff --git a/sdk/node/src/model/client_option.ts b/sdk/node/src/model/client_option.ts new file mode 100644 index 00000000..8e3556d8 --- /dev/null +++ b/sdk/node/src/model/client_option.ts @@ -0,0 +1,168 @@ +import { TransportOption } from './transport_option'; +import { WebSocketClientOption } from './websocket_option'; + +/** + * ClientOption holds the configuration details for a client including authentication keys, API endpoints, and transport options. + */ +interface ClientOption { + /** + * Key is the authentication key for the client + */ + key: string; + /** + * Secret is the authentication secret for the client + */ + secret: string; + /** + * Passphrase is the authentication passphrase for the client + */ + passphrase: string; + /** + * BrokerName The name of the broker + */ + brokerName: string; + /** + * BrokerPartner The partner associated with the broker + */ + brokerPartner: string; + /** + * BrokerKey The secret key for the broker + */ + brokerKey: string; + /** + * SpotEndpoint is the spot market API endpoint for the client + */ + spotEndpoint: string; + /** + * FuturesEndpoint is the futures market API endpoint for the client + */ + futuresEndpoint: string; + /** + * BrokerEndpoint is the broker API endpoint for the client + */ + brokerEndpoint: string; + /** + * TransportOption is an optional configuration for HTTP network transport + */ + transportOption?: TransportOption; + /** + * WebSocketClientOption is an optional configuration for websocket transport + */ + webSocketClientOption?: WebSocketClientOption; +} + +/** + * ClientOptionBuilder is the builder for ClientOption + */ +class ClientOptionBuilder { + private clientOption: ClientOption; + + constructor() { + this.clientOption = { + key: '', + secret: '', + passphrase: '', + brokerName: '', + brokerPartner: '', + brokerKey: '', + spotEndpoint: '', + futuresEndpoint: '', + brokerEndpoint: '', + }; + } + + /** + * WithKey sets the authentication key + */ + withKey(key: string): ClientOptionBuilder { + this.clientOption.key = key; + return this; + } + + /** + * WithSecret sets the authentication secret + */ + withSecret(secret: string): ClientOptionBuilder { + this.clientOption.secret = secret; + return this; + } + + /** + * WithPassphrase sets the authentication passphrase + */ + withPassphrase(passphrase: string): ClientOptionBuilder { + this.clientOption.passphrase = passphrase; + return this; + } + + /** + * WithBrokerName sets the broker name + */ + withBrokerName(brokerName: string): ClientOptionBuilder { + this.clientOption.brokerName = brokerName; + return this; + } + + /** + * WithBrokerPartner sets the broker partner + */ + withBrokerPartner(brokerPartner: string): ClientOptionBuilder { + this.clientOption.brokerPartner = brokerPartner; + return this; + } + + /** + * WithBrokerKey sets the broker key + */ + withBrokerKey(brokerKey: string): ClientOptionBuilder { + this.clientOption.brokerKey = brokerKey; + return this; + } + + /** + * WithSpotEndpoint sets the spot market API endpoint + */ + withSpotEndpoint(endpoint: string): ClientOptionBuilder { + this.clientOption.spotEndpoint = endpoint; + return this; + } + + /** + * WithFuturesEndpoint sets the futures market API endpoint + */ + withFuturesEndpoint(endpoint: string): ClientOptionBuilder { + this.clientOption.futuresEndpoint = endpoint; + return this; + } + + /** + * WithBrokerEndpoint sets the broker API endpoint + */ + withBrokerEndpoint(endpoint: string): ClientOptionBuilder { + this.clientOption.brokerEndpoint = endpoint; + return this; + } + + /** + * WithTransportOption sets the HTTP transport options + */ + withTransportOption(option: TransportOption): ClientOptionBuilder { + this.clientOption.transportOption = option; + return this; + } + + /** + * WithWebSocketClientOption sets the WebSocket client options + */ + withWebSocketClientOption(option: WebSocketClientOption): ClientOptionBuilder { + this.clientOption.webSocketClientOption = option; + return this; + } + + /** + * Build builds and returns the ClientOption + */ + build(): ClientOption { + return this.clientOption; + } +} diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts new file mode 100644 index 00000000..84d29ea2 --- /dev/null +++ b/sdk/node/src/model/common.ts @@ -0,0 +1,93 @@ +/** + * RestRateLimit represents the rate limiting information for a REST API. + */ +export interface RestRateLimit { + /** + * Total resource pool quota + */ + limit: number; + /** + * Resource pool remaining quota + */ + remaining: number; + /** + * Resource pool quota reset countdown (milliseconds) + */ + reset: number; +} + +/** + * RestResponse represents a generic response from the REST API. + */ +export interface RestResponse { + /** + * Optional rate limit information + */ + rateLimit?: RestRateLimit; + /** + * Response code + */ + code: string; + /** + * Response data (typed) + */ + data: T; + /** + * Optional response message + */ + message?: string; +} + +/** + * Function to check if a RestResponse indicates an error. + */ +export function checkRestResponseError(resp: RestResponse): Error | null { + /** + * Code for success + */ + const CodeSuccess = '200000'; + if (resp.code === CodeSuccess) { + return null; + } + return new Error( + `Server returned error, code: {${resp.code}}, message: {${resp.message || 'unknown'}}`, + ); +} + +/** + * WsMessage represents a message between the WebSocket client and server. + */ +export interface WsMessage { + /** + * A unique identifier for the message + */ + id: string; + /** + * The type of the message (e.g., WelcomeMessage) + */ + type: string; + /** + * Sequence number to track the order of messages + */ + sn: number; + /** + * The topic or channel the message is associated with + */ + topic: string; + /** + * The subject of the message, providing additional context + */ + subject: string; + /** + * Indicates if the message belongs to a private channel + */ + privateChannel: boolean; + /** + * Specifies whether the message is a response + */ + response: boolean; + /** + * Raw JSON payload containing additional message data + */ + rawData: any; +} diff --git a/sdk/node/src/model/constant.ts b/sdk/node/src/model/constant.ts new file mode 100644 index 00000000..c0a80731 --- /dev/null +++ b/sdk/node/src/model/constant.ts @@ -0,0 +1,75 @@ +/** + * Global API endpoints + */ +export const GlobalApiEndpoint = 'https://api.kucoin.com'; +export const GlobalFuturesApiEndpoint = 'https://api-futures.kucoin.com'; +export const GlobalBrokerApiEndpoint = 'https://api-broker.kucoin.com'; + +/** + * Domain types + */ +export enum DomainType { + /** + * Spot domain type + */ + Spot = 'spot', + /** + * Futures domain type + */ + Futures = 'futures', + /** + * Broker domain type + */ + Broker = 'broker', +} + +/** + * MessageType defines various types of messages that can be sent or received + */ +export enum MessageType { + /** + * Welcome message type + */ + WelcomeMessage = 'welcome', + /** + * Ping message type + */ + PingMessage = 'ping', + /** + * Pong message type + */ + PongMessage = 'pong', + /** + * Subscribe message type + */ + SubscribeMessage = 'subscribe', + /** + * Acknowledgment message type + */ + AckMessage = 'ack', + /** + * Unsubscribe message type + */ + UnsubscribeMessage = 'unsubscribe', + /** + * Error message type + */ + ErrorMessage = 'error', + /** + * General message type + */ + Message = 'message', + /** + * Notice message type + */ + Notice = 'notice', + /** + * Command message type + */ + Command = 'command', +} + +/** + * API result codes + */ +export const CodeSuccess = '200000'; diff --git a/sdk/node/src/model/transport_option.ts b/sdk/node/src/model/transport_option.ts new file mode 100644 index 00000000..bee75801 --- /dev/null +++ b/sdk/node/src/model/transport_option.ts @@ -0,0 +1,201 @@ +/** + * Interceptor interface for defining HTTP request interceptors + */ +export interface Interceptor { + /** + * Before the request is sent. Allows modification of the request before sending + */ + before(req: Request): Promise | Request; + + /** + * After the request is completed. Allows processing of the response or error. + */ + after( + req: Request, + resp: Response | null, + err?: Error, + ): Promise | Response | null; +} + +/** + * TransportOption interface for storing various HTTP request configurations + */ +export interface TransportOption { + /** + * Request timeout duration (in milliseconds) + */ + timeout: number; + /** + * Whether to enable keep-alive (persistent connection) + */ + keepAlive: boolean; + /** + * Maximum number of idle (keep-alive) connections across all hosts + */ + maxIdleConns: number; + /** + * Maximum idle connections per host + */ + maxIdleConnsPerHost: number; + /** + * Total number of connections per host + */ + maxConnsPerHost: number; + /** + * Maximum time to wait for a TLS handshake (in milliseconds) + */ + tlsHandshakeTimeout: number; + /** + * Maximum time an idle connection will remain idle (in milliseconds) + */ + idleConnTimeout: number; + /** + * HTTP proxy function + */ + proxy?: (req: Request) => Promise | URL | null; + /** + * Maximum number of retry attempts + */ + maxRetries: number; + /** + * Delay duration between retries (in milliseconds) + */ + retryDelay: number; + /** + * HTTP interceptors + */ + interceptors?: Interceptor[]; +} + +/** + * Default values for TransportOption + */ +const DEFAULT_TRANSPORT_OPTION: TransportOption = { + timeout: 30000, // 30 seconds + keepAlive: true, + maxIdleConns: 100, + maxIdleConnsPerHost: 2, + maxConnsPerHost: 10, + tlsHandshakeTimeout: 10000, // 10 seconds + idleConnTimeout: 90000, // 90 seconds + maxRetries: 3, + retryDelay: 2000, // 2 seconds + interceptors: [], +}; + +/** + * TransportOptionBuilder for creating and customizing TransportOption instances + */ +export class TransportOptionBuilder { + private option: TransportOption; + + constructor() { + this.option = { ...DEFAULT_TRANSPORT_OPTION }; + } + + /** + * Set the request timeout duration (in milliseconds) + */ + setTimeout(timeout: number): TransportOptionBuilder { + this.option.timeout = timeout; + return this; + } + + /** + * Set whether to enable keep-alive (persistent connection) + */ + setKeepAlive(keepAlive: boolean): TransportOptionBuilder { + this.option.keepAlive = keepAlive; + return this; + } + + /** + * Set the maximum number of idle (keep-alive) connections across all hosts + */ + setMaxIdleConns(maxIdleConns: number): TransportOptionBuilder { + this.option.maxIdleConns = maxIdleConns; + return this; + } + + /** + * Set the maximum idle connections per host + */ + setMaxIdleConnsPerHost(maxIdleConnsPerHost: number): TransportOptionBuilder { + this.option.maxIdleConnsPerHost = maxIdleConnsPerHost; + return this; + } + + /** + * Set the total number of connections per host + */ + setMaxConnsPerHost(maxConnsPerHost: number): TransportOptionBuilder { + this.option.maxConnsPerHost = maxConnsPerHost; + return this; + } + + /** + * Set the maximum time an idle connection will remain idle (in milliseconds) + */ + setIdleConnTimeout(idleConnTimeout: number): TransportOptionBuilder { + this.option.idleConnTimeout = idleConnTimeout; + return this; + } + + /** + * Set the maximum time to wait for a TLS handshake (in milliseconds) + */ + setTLSHandshakeTimeout(tlsHandshakeTimeout: number): TransportOptionBuilder { + this.option.tlsHandshakeTimeout = tlsHandshakeTimeout; + return this; + } + + /** + * Set the HTTP proxy function + */ + setProxy(proxy: (req: Request) => Promise | URL | null): TransportOptionBuilder { + this.option.proxy = proxy; + return this; + } + + /** + * Set the maximum number of retry attempts + */ + setMaxRetries(maxRetries: number): TransportOptionBuilder { + this.option.maxRetries = maxRetries; + return this; + } + + /** + * Set the delay duration between retries (in milliseconds) + */ + setRetryDelay(retryDelay: number): TransportOptionBuilder { + this.option.retryDelay = retryDelay; + return this; + } + + /** + * Set the HTTP interceptors + */ + setInterceptors(interceptors: Interceptor[]): TransportOptionBuilder { + this.option.interceptors = interceptors; + return this; + } + + /** + * Add an HTTP interceptor + */ + addInterceptor(interceptor: Interceptor): TransportOptionBuilder { + if (!this.option.interceptors) { + this.option.interceptors = []; + } + this.option.interceptors.push(interceptor); + return this; + } + + /** + * Build and return the TransportOption instance + */ + build(): TransportOption { + return this.option; + } +} diff --git a/sdk/node/src/model/websocket_option.ts b/sdk/node/src/model/websocket_option.ts new file mode 100644 index 00000000..313d8bca --- /dev/null +++ b/sdk/node/src/model/websocket_option.ts @@ -0,0 +1,169 @@ +/** + * WebSocketEvent defines the types of WebSocket events + */ +export enum WebSocketEvent { + EventConnected = 'EventConnected', + EventDisconnected = 'EventDisconnected', + EventTryReconnect = 'EventTryReconnect', + EventMessageReceived = 'EventMessageReceived', + EventErrorReceived = 'EventErrorReceived', + EventPongReceived = 'EventPongReceived', + EventReadBufferFull = 'EventReadBufferFull', + EventWriteBufferFull = 'EventWriteBufferFull', + EventCallbackError = 'EventCallbackError', + EventReSubscribeOK = 'EventReSubscribeOK', + EventReSubscribeError = 'EventReSubscribeError', + EventClientFail = 'EventClientFail', + EventClientShutdown = 'EventClientShutdown', +} + +/** + * WebSocketCallback is a generic callback function type that handles all WebSocket events + */ +export type WebSocketCallback = (event: WebSocketEvent, msg: string) => void; + +/** + * WebSocketClientOption contains the settings for the WebSocket client + */ +export interface WebSocketClientOption { + /** + * Enable auto-reconnect; default: true + */ + reconnect: boolean; + /** + * Maximum reconnect attempts, -1 means forever; default: -1 + */ + reconnectAttempts: number; + /** + * Interval between reconnect attempts (milliseconds); default: 5000 + */ + reconnectInterval: number; + /** + * Timeout for establishing a WebSocket connection (milliseconds); default: 10000 + */ + dialTimeout: number; + /** + * I/O buffer size in bytes; default: 2048000 + */ + readBufferBytes: number; + /** + * Read buffer for messages; default: 1024 + */ + readMessageBuffer: number; + /** + * Write buffer for messages; default: 256 + */ + writeMessageBuffer: number; + /** + * Write timeout (milliseconds); default: 30000 + */ + writeTimeout: number; + /** + * General callback function to handle all WebSocket events + */ + eventCallback?: WebSocketCallback; +} + +/** + * Default values for WebSocketClientOption + */ +const DEFAULT_WEBSOCKET_CLIENT_OPTION: WebSocketClientOption = { + reconnect: true, + reconnectAttempts: -1, + reconnectInterval: 5000, // 5 seconds + dialTimeout: 10000, // 10 seconds + readBufferBytes: 2048000, + readMessageBuffer: 1024, + writeMessageBuffer: 256, + writeTimeout: 30000, // 30 seconds +}; + +/** + * WebSocketClientOptionBuilder is a builder for WebSocketClientOption + */ +export class WebSocketClientOptionBuilder { + private option: WebSocketClientOption; + + constructor() { + this.option = { ...DEFAULT_WEBSOCKET_CLIENT_OPTION }; + } + + /** + * Set whether to enable auto-reconnect + */ + withReconnect(reconnect: boolean): WebSocketClientOptionBuilder { + this.option.reconnect = reconnect; + return this; + } + + /** + * Set the maximum reconnect attempts + */ + withReconnectAttempts(attempts: number): WebSocketClientOptionBuilder { + this.option.reconnectAttempts = attempts; + return this; + } + + /** + * Set the interval between reconnect attempts (milliseconds) + */ + withReconnectInterval(interval: number): WebSocketClientOptionBuilder { + this.option.reconnectInterval = interval; + return this; + } + + /** + * Set the timeout for establishing a WebSocket connection (milliseconds) + */ + withDialTimeout(timeout: number): WebSocketClientOptionBuilder { + this.option.dialTimeout = timeout; + return this; + } + + /** + * Set the I/O buffer size in bytes + */ + withReadBufferBytes(readBufferBytes: number): WebSocketClientOptionBuilder { + this.option.readBufferBytes = readBufferBytes; + return this; + } + + /** + * Set the read buffer size for messages + */ + withReadMessageBuffer(readMessageBuffer: number): WebSocketClientOptionBuilder { + this.option.readMessageBuffer = readMessageBuffer; + return this; + } + + /** + * Set the write buffer size for messages + */ + withWriteMessageBuffer(writeMessageBuffer: number): WebSocketClientOptionBuilder { + this.option.writeMessageBuffer = writeMessageBuffer; + return this; + } + + /** + * Set the write timeout (milliseconds) + */ + withWriteTimeout(timeout: number): WebSocketClientOptionBuilder { + this.option.writeTimeout = timeout; + return this; + } + + /** + * Set the callback function to handle WebSocket events + */ + withEventCallback(callback: WebSocketCallback): WebSocketClientOptionBuilder { + this.option.eventCallback = callback; + return this; + } + + /** + * Build and return the WebSocketClientOption instance + */ + build(): WebSocketClientOption { + return this.option; + } +} diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index 06d4a341..6dd32239 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -8,7 +8,14 @@ "strict": true, "esModuleInterop": true, "skipLibCheck": true, - "outDir": "./dist" + "outDir": "./dist", + "baseUrl": "./", + "paths": { + "@model/*": ["src/model/*"], + "@internal/*": ["src/internal/*"] + }, + "experimentalDecorators": true, + "emitDecoratorMetadata": true }, "include": ["src/**/*"], "exclude": ["node_modules", "tests"] From d27d6b7e6b55948702ac681e1091c71f4dc1c150 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Sat, 4 Jan 2025 12:07:51 +0800 Subject: [PATCH 003/106] feat(nodejs): add entry and auto test --- .../plugin/generator/NodeSdkGenerator.java | 51 +- .../resources/node-sdk/api_entry.mustache | 36 + .../main/resources/node-sdk/api_test.mustache | 41 + .../main/resources/node-sdk/model.mustache | 37 +- .../sdk/plugin/SdkGeneratorTest.java | 61 +- sdk/node/jest.config.js | 11 + sdk/node/package-lock.json | 2481 ++++++++++++++++- sdk/node/package.json | 3 + sdk/node/src/api/api_rest.ts | 41 + sdk/node/src/api/api_ws.ts | 33 + sdk/node/src/api/client.ts | 90 + sdk/node/src/internal/interfaces/response.ts | 5 + sdk/node/src/model/common.ts | 12 +- sdk/node/tsconfig.json | 3 +- 14 files changed, 2820 insertions(+), 85 deletions(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/api_entry.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/api_test.mustache create mode 100644 sdk/node/jest.config.js create mode 100644 sdk/node/src/api/api_rest.ts create mode 100644 sdk/node/src/api/api_ws.ts create mode 100644 sdk/node/src/api/client.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index fd74a329..4fc83ba9 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -21,6 +21,7 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.utils.CamelizeOption; import java.io.File; import java.util.*; @@ -148,7 +149,7 @@ public String formatParamName(String name) { @Override public String formatMethodName(String name) { - return camelize(name); + return camelize(name, LOWERCASE_FIRST_LETTER); } @Override @@ -292,7 +293,7 @@ public String toApiFilename(String name) { switch (modeSwitch.getMode()) { case TEST: case WS_TEST: { - apiName = apiName + "_test"; + apiName = apiName + ".test"; break; } } @@ -324,12 +325,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation return result; } - private String generateImport(String className, String fileName) { - return String.format("import {%s} from './%s'", className, fileName); - } - - private Set generateApiImport(Meta meta, boolean req) { - Set imports = new HashSet<>(); + private void generateApiImport(Meta meta, boolean req, Map imports) { switch (modeSwitch.getMode()) { case API: case TEST: { @@ -337,9 +333,10 @@ private Set generateApiImport(Meta meta, boolean req) { if (req) { suffix = "req"; } - imports.add(generateImport( - formatService(meta.getMethod() + camelize(suffix)), - toModelFilename(meta.getMethod()) + "_" + suffix)); + String fileName = "./" + toModelFilename(meta.getMethod()) + "_" + suffix; + String service = formatService(meta.getMethod() + camelize(suffix)); + + imports.computeIfAbsent(fileName, ImportModel::new).component.add(service); break; } case WS: { @@ -369,22 +366,20 @@ private Set generateApiImport(Meta meta, boolean req) { break; } case ENTRY: { -// operationService.getServiceMeta().forEach((k, v) -> { -// if (v.getService().equalsIgnoreCase(meta.getService())) { -// imports.add( -// generateImportSimple(String.format("kucoin_universal_sdk.generate.%s.%s.%s", formatPackage(v.getService()), -// formatPackage(v.getSubService()), toApiFilename(formatMethodName(k))), -// formatService(k + "API"), -// formatService(k + "APIImpl"))); -// } -// }); + operationService.getServiceMeta().forEach((k, v) -> { + if (v.getService().equalsIgnoreCase(meta.getService())) { + List services = Arrays.asList(formatService(k + "API"), formatService(k + "APIImpl")); + String fileName = String.format("@generate/%s/%s/%s", formatPackage(v.getService()), + formatPackage(v.getSubService()), toApiFilename(formatMethodName(k))); + imports.computeIfAbsent(fileName, ImportModel::new).component.addAll(services); + } + }); break; } default: { throw new RuntimeException("unsupported mode"); } } - return imports; } @Override @@ -393,7 +388,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List modelImport = new TreeSet<>(); + Map imports = new HashMap<>(); for (CodegenOperation op : operationMap.getOperation()) { Meta meta = SpecificationUtil.getMeta(op.vendorExtensions); @@ -406,6 +401,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List kv = new HashMap<>(); kv.put("method", formatMethodName(k)); + kv.put("methodUppercase", camelize(formatMethodName(k))); kv.put("target_service", formatService(k + "API")); entryValue.add(kv); } @@ -415,7 +411,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { - modelImport.addAll(generateApiImport(meta, false)); + generateApiImport(meta, false, imports); }); break; } @@ -423,14 +419,14 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, Listpartial_header}} +import { Transport } from '@internal/interfaces/transport'; + +{{#api_entry}} +{{#imports}} +{{{.}}} +{{/imports}} + +export abstract class {{api_entry_name}} { +{{#api_entry_value}} + + abstract get{{methodUppercase}}Api(): {{target_service}}; +{{/api_entry_value}} +} + +export class {{api_entry_name}}Impl implements {{api_entry_name}}{ + private readonly transport :Transport; +{{#api_entry_value}} + private readonly {{method}} :{{target_service}}; +{{/api_entry_value}} + + constructor(transport: Transport) { + this.transport = transport; + {{#api_entry_value}} + this.{{method}} = new {{target_service}}Impl(transport); + {{/api_entry_value}} + } + +{{#api_entry_value}} + + get{{methodUppercase}}Api() :{{target_service}} { + return this.{{method}} + } +{{/api_entry_value}} +{{/api_entry}} +} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/api_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_test.mustache new file mode 100644 index 00000000..4092a6bd --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/api_test.mustache @@ -0,0 +1,41 @@ +{{#imports}} +{{{.}}} +{{/imports}} +import { RestResponse } from '@model/common'; + +describe('Auto Test', ()=> { +{{#operations}} + {{#operation}} + test('{{vendorExtensions.x-meta.method}} request test', ()=> { + /** + * {{vendorExtensions.x-meta.method}} + * {{summary}} + * {{path}} + */ + {{#hasParams}} + let data = "{{{vendorExtensions.x-request-example}}}"; + let req = new {{vendorExtensions.x-meta.methodServiceFmt}}Req(); + req = req.fromJson(data); + expect(Object.values(req).every(value => value === null || value === undefined)).toBe(false); + console.log(req); + {{/hasParams}} + }) + + test('{{vendorExtensions.x-meta.method}} response test', ()=> { + /** + * {{vendorExtensions.x-meta.method}} + * {{summary}} + * {{path}} + */ + {{#hasParams}} + let data = "{{{vendorExtensions.x-response-example}}}"; + let commonResp = RestResponse.fromJson(data); + let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(); + resp = resp.fromObject(commonResp.data) + expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); + console.log(resp); + {{/hasParams}} + }) + {{/operation}} +{{/operations}} +}) \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index d5341a61..7ad1159a 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -21,7 +21,6 @@ export class {{classname}} implements Serializable<{{classname}}>{ @Expose({ name: "{{baseName}}" }) {{/vendorExtensions.x-use-base-name}} {{#vendorExtensions.x-tag-path}} - @Exclude() @Reflect.metadata("path", "{{baseName}}") {{/vendorExtensions.x-tag-path}} {{#vendorExtensions.x-typed}} @@ -39,6 +38,26 @@ export class {{classname}} implements Serializable<{{classname}}>{ setCommonResponse(response: RestResponse): void { this.CommonResponse = response; } + +{{#vendorExtensions.x-original-response}} + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, {data : jsonObject}); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, {data : jsonObject}); + } +{{/vendorExtensions.x-original-response}} +{{^vendorExtensions.x-original-response}} + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, jsonObject); + } +{{/vendorExtensions.x-original-response}} {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-request-model}} @@ -67,7 +86,6 @@ export class {{classname}} implements Serializable<{{classname}}>{ {{/vars}} return obj } -{{/vendorExtensions.x-request-model}} {{#vendorExtensions.x-request-raw-array}} fromJson(input: string): {{classname}} { @@ -79,18 +97,10 @@ export class {{classname}} implements Serializable<{{classname}}>{ return JSON.stringify(instanceToPlain(this.items)); } {{/vendorExtensions.x-request-raw-array}} -{{^vendorExtensions.x-request-raw-array}} -{{#vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, {data : jsonObject}); - } +{{/vendorExtensions.x-request-model}} - toJson(): string { - return JSON.stringify(instanceToPlain(this.data)); - } -{{/vendorExtensions.x-original-response}} {{^vendorExtensions.x-original-response}} +{{^vendorExtensions.x-request-raw-array}} fromJson(input: string): {{classname}} { const jsonObject = JSON.parse(input) return plainToInstance( {{classname}}, jsonObject); @@ -99,8 +109,9 @@ export class {{classname}} implements Serializable<{{classname}}>{ toJson(): string { return JSON.stringify(instanceToPlain(this)); } -{{/vendorExtensions.x-original-response}} {{/vendorExtensions.x-request-raw-array}} +{{/vendorExtensions.x-original-response}} + } {{#hasEnums}} diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index f5899765..5a573461 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -9,8 +9,9 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-order.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; + private static final String OUTPUT_DIR = "/Users/isaactang/Project/kucoin-universal-sdk/sdk/node/src/generate"; @Test public void launchCodeGenerator() { @@ -20,37 +21,37 @@ public void launchCodeGenerator() { .setInputSpec(SPEC_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "API") - .setOutputDir("/Users/isaactang/Project/kucoin-universal-sdk/sdk/node/src/generate"); + .setOutputDir(OUTPUT_DIR); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(clientOptInput).generate(); + } + { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(SDK_NAME) + .setInputSpec(SPEC_ENTRY_NAME) + .setValidateSpec(false) + .addAdditionalProperty("GEN_MODE", "ENTRY") + .setOutputDir(OUTPUT_DIR); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(clientOptInput).generate(); + } + + { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(SDK_NAME) + .setInputSpec(SPEC_NAME) + .setValidateSpec(false) + .addAdditionalProperty("GEN_MODE", "TEST") + .setOutputDir(OUTPUT_DIR); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); generator.opts(clientOptInput).generate(); } -// { -// final CodegenConfigurator configurator = new CodegenConfigurator() -// .setGeneratorName(SDK_NAME) -// .setInputSpec(SPEC_ENTRY_NAME) -// .setValidateSpec(false) -// .addAdditionalProperty("GEN_MODE", "ENTRY") -// .setOutputDir("out"); -// -// final ClientOptInput clientOptInput = configurator.toClientOptInput(); -// DefaultGenerator generator = new DefaultGenerator(); -// generator.opts(clientOptInput).generate(); -// } -// -// { -// final CodegenConfigurator configurator = new CodegenConfigurator() -// .setGeneratorName(SDK_NAME) -// .setInputSpec(SPEC_NAME) -// .setValidateSpec(false) -// .addAdditionalProperty("GEN_MODE", "TEST") -// .setOutputDir("out"); -// -// final ClientOptInput clientOptInput = configurator.toClientOptInput(); -// DefaultGenerator generator = new DefaultGenerator(); -// generator.opts(clientOptInput).generate(); -// } } @Test @@ -61,7 +62,7 @@ public void launchCodeGeneratorWs() { .setInputSpec(WS_SPEC_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "WS") - .setOutputDir("out"); + .setOutputDir(OUTPUT_DIR); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); @@ -74,7 +75,7 @@ public void launchCodeGeneratorWs() { .setInputSpec(WS_SPEC_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "WS_TEST") - .setOutputDir("out"); + .setOutputDir(OUTPUT_DIR); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); @@ -90,7 +91,7 @@ public void launchCodeGeneratorTemplate() { .setInputSpec(SPEC_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "test_template") - .setOutputDir("out"); + .setOutputDir(OUTPUT_DIR); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); diff --git a/sdk/node/jest.config.js b/sdk/node/jest.config.js new file mode 100644 index 00000000..34680eed --- /dev/null +++ b/sdk/node/jest.config.js @@ -0,0 +1,11 @@ +const { compilerOptions } = require('./tsconfig.json'); +const { pathsToModuleNameMapper } = require('ts-jest'); + +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + transform: { + '^.+\\.ts$': 'ts-jest', + }, + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }), +}; diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 71f4cdb7..14fae1d5 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -4,6 +4,357 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + } + }, + "@babel/compat-data": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", + "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", + "dev": true + }, + "@babel/core": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", + "dev": true, + "requires": { + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "requires": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + } + }, + "@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", + "dev": true + }, + "@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "dev": true + }, + "@babel/helpers": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "dev": true, + "requires": { + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" + } + }, + "@babel/parser": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", + "dev": true, + "requires": { + "@babel/types": "^7.26.3" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/template": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" + } + }, + "@babel/traverse": { + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", + "debug": "^4.3.1", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, "@eslint-community/eslint-utils": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", @@ -169,6 +520,348 @@ "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", "dev": true }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } + }, + "@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "requires": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + } + }, + "@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3" + } + }, + "@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + } + }, + "@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + } + }, + "@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + } + }, + "@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -201,16 +894,154 @@ "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true }, - "@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true - }, - "@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, + "@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, + "@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", + "dev": true, + "requires": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "@types/node": { + "version": "22.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", + "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", + "dev": true, + "requires": { + "undici-types": "~6.20.0" + } + }, + "@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true + }, + "@types/yargs": { + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, "@typescript-eslint/eslint-plugin": { @@ -333,6 +1164,21 @@ "uri-js": "^4.2.2" } }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -342,12 +1188,122 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true + }, + "babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "requires": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + } + }, + "babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -372,12 +1328,60 @@ "fill-range": "^7.1.1" } }, + "browserslist": { + "version": "4.24.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", + "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + } + }, + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001690", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", + "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", + "dev": true + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -388,11 +1392,52 @@ "supports-color": "^7.1.0" } }, + "char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true + }, + "ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", + "dev": true + }, "class-transformer": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==" }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -414,6 +1459,27 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + } + }, "cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -434,12 +1500,78 @@ "ms": "^2.1.3" } }, + "dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true + }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true + }, + "ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "requires": { + "jake": "^10.8.5" + } + }, + "electron-to-chromium": { + "version": "1.5.76", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.76.tgz", + "integrity": "sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -561,6 +1693,12 @@ "eslint-visitor-keys": "^4.2.0" } }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, "esquery": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", @@ -591,6 +1729,42 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -637,6 +1811,15 @@ "reusify": "^1.0.4" } }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, "file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -646,6 +1829,26 @@ "flat-cache": "^4.0.0" } }, + "filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "requires": { + "minimatch": "^5.0.1" + }, + "dependencies": { + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -681,6 +1884,84 @@ "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -690,6 +1971,18 @@ "is-glob": "^4.0.1" } }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, "graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -702,6 +1995,27 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, "ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -718,18 +2032,71 @@ "resolve-from": "^4.0.0" } }, + "import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "requires": { + "hasown": "^2.0.2" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -745,12 +2112,535 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "requires": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + } + }, + "istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "requires": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "dependencies": { + "jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + } + } + } + }, + "jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + } + }, + "jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true + }, + "jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true + }, + "jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true + }, + "jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + } + }, + "jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + } + }, + "jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -760,12 +2650,24 @@ "argparse": "^2.0.1" } }, + "jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true + }, "json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -778,6 +2680,12 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, "keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -787,6 +2695,18 @@ "json-buffer": "3.0.1" } }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -797,6 +2717,12 @@ "type-check": "~0.4.0" } }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -806,12 +2732,57 @@ "p-locate": "^5.0.0" } }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "requires": { + "semver": "^7.5.3" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -828,6 +2799,12 @@ "picomatch": "^2.3.1" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, "minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -849,6 +2826,51 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -881,6 +2903,12 @@ "p-limit": "^3.0.2" } }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -890,24 +2918,108 @@ "callsites": "^3.0.0" } }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + } + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -929,29 +3041,110 @@ "fast-diff": "^1.1.2" } }, + "pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, "punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true }, + "pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "reflect-metadata": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==" }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "requires": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -988,6 +3181,105 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1003,6 +3295,12 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "synckit": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", @@ -1013,6 +3311,44 @@ "tslib": "^2.6.2" } }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1028,6 +3364,23 @@ "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", "dev": true }, + "ts-jest": { + "version": "29.2.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz", + "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==", + "dev": true, + "requires": { + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.6.3", + "yargs-parser": "^21.1.1" + } + }, "tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -1043,12 +3396,40 @@ "prelude-ls": "^1.2.1" } }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, "typescript": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true }, + "undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true + }, + "update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "requires": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -1058,6 +3439,26 @@ "punycode": "^2.1.0" } }, + "v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1073,6 +3474,66 @@ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index 2fba4150..b02f17c9 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -28,12 +28,15 @@ "author": "KuCoin", "license": "MIT", "devDependencies": { + "@types/jest": "^29.5.14", "@typescript-eslint/eslint-plugin": "^8.19.0", "@typescript-eslint/parser": "^8.19.0", "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", + "jest": "^29.7.0", "prettier": "^3.4.2", + "ts-jest": "^29.2.5", "typescript": "^5.7.2" }, "peerDependencies": {}, diff --git a/sdk/node/src/api/api_rest.ts b/sdk/node/src/api/api_rest.ts new file mode 100644 index 00000000..94c63ec8 --- /dev/null +++ b/sdk/node/src/api/api_rest.ts @@ -0,0 +1,41 @@ +export interface KucoinRestService { + /** + * AccountService provides functions to access and manipulate account related data. + */ + GetAccountService(): AccountService; + + /** + * AffiliateService provides functions to access affiliate-related data. + */ + GetAffiliateService(): AffiliateService; + + /** + * BrokerService provides functions to access and manage broker-related data. + */ + GetBrokerService(): BrokerService; + + /** + * EarnService provides functions to access and manage earn-related data. + */ + GetEarnService(): EarnService; + + /** + * FuturesService provides functions to perform actions in the futures market. + */ + GetFuturesService(): FuturesService; + + /** + * MarginService provides functions to access and manage margin-related data. + */ + GetMarginService(): MarginService; + + /** + * SpotService provides functions to perform actions in the spot market. + */ + GetSpotService(): SpotService; + + /** + * VipLendingService provides functions to access and manage VIP lending-related data. + */ + GetVipLendingService(): ViplendingService; +} diff --git a/sdk/node/src/api/api_ws.ts b/sdk/node/src/api/api_ws.ts new file mode 100644 index 00000000..6d5b3de6 --- /dev/null +++ b/sdk/node/src/api/api_ws.ts @@ -0,0 +1,33 @@ + + +export interface KucoinWSService { + /** + * Returns the interface to interact with the Spot Trading WebSocket (public channel) API of KuCoin. + */ + NewSpotPublicWS(): SpotPublicWS; + + /** + * Returns the interface to interact with the Spot Trading WebSocket (private channel) API of KuCoin. + */ + NewSpotPrivateWS(): SpotPrivateWS; + + /** + * Returns the interface to interact with the Margin Trading WebSocket (public channel) API of KuCoin. + */ + NewMarginPublicWS(): MarginPublicWS; + + /** + * Returns the interface to interact with the Margin Trading WebSocket (private channel) API of KuCoin. + */ + NewMarginPrivateWS(): MarginPrivateWS; + + /** + * Returns the interface to interact with the Futures Trading WebSocket (public channel) API of KuCoin. + */ + NewFuturesPublicWS(): FuturesPublicWS; + + /** + * Returns the interface to interact with the Futures Trading WebSocket (private channel) API of KuCoin. + */ + NewFuturesPrivateWS(): FuturesPrivateWS; +} \ No newline at end of file diff --git a/sdk/node/src/api/client.ts b/sdk/node/src/api/client.ts new file mode 100644 index 00000000..8eaff456 --- /dev/null +++ b/sdk/node/src/api/client.ts @@ -0,0 +1,90 @@ +/* +Client +REST API Notes + +Client Features: + - Advanced HTTP Handling: + Supports retries, persistent connections, and connection pooling for efficient HTTP request handling. + - Extensible Interceptors: + Provides support for HTTP interceptors, allowing users to extend and customize request and response processing. + - Rich Response Details: + API responses include rate-limiting information and raw data to aid debugging and ensure precise control. + - Public API Access: + Public API endpoints do not require authentication, enabling non-authenticated use cases. + +--- + +# WebSocket API Notes + +Client Features: + - Flexible Service Creation: + Users can create WebSocket services for public/private channels in Spot, Futures, or Margin trading as needed. + Multiple independent services can be created simultaneously. + - Service Lifecycle: + If a WebSocket service is closed, always create a new service instead of reusing it to prevent undefined behavior. + - Connection-to-Channel Mapping: + Each WebSocket connection corresponds to a specific channel type. + For example, Spot public/private and Futures public/private require 4 active WebSocket connections. + +Threading and Callbacks: + - Simple Thread Model: + WebSocket services use a simple thread model, ensuring that all callbacks are executed on a single thread. + - Subscription Management: + Subscriptions are synchronous and require acknowledgment (ACK) from the server to be considered successful. + Each subscription is assigned a unique ID, which can be used to cancel the subscription. + +Data and Message Handling: + - Framework-Managed Threads: + All data messages are processed by a single framework-managed thread, maintaining orderly callback execution. + - Buffer Management: + When the message buffer is full, new messages are discarded, and a notification event is triggered. + - Duplicate Subscriptions: + Avoid overlapping subscription parameters. For instance: + Subscribing to ["BTC-USDT", "ETH-USDT"] and ["ETH-USDT", "DOGE-USDT"] may lead to undefined behavior. + Identical subscription parameters will raise an error indicating duplicate subscriptions. +*/ + +import { KucoinRestService } from './api_rest'; +import { KucoinWSService } from './api_ws'; + +/** + * Client interface defines the methods to get REST and WebSocket services. + */ +export interface Client { + /** + * Get RESTful service. + */ + RestService(): KucoinRestService; + + /** + * Get WebSocket service. + */ + WsService(): KucoinWSService; +} + +/** + * DefaultClient provides the default implementation of the Client interface. + */ +export class DefaultClient implements Client { + private restImpl: KuCoinDefaultRestImpl; + private wsImpl: KuCoinDefaultWsImpl; + + constructor(op: ClientOption) { + this.restImpl = new KuCoinDefaultRestImpl(op); + this.wsImpl = new KuCoinDefaultWsImpl(op); + } + + /** + * Get RESTful service implementation. + */ + RestService(): KucoinRestService { + return this.restImpl; + } + + /** + * Get WebSocket service implementation. + */ + WsService(): KucoinWSService { + return this.wsImpl; + } +} diff --git a/sdk/node/src/internal/interfaces/response.ts b/sdk/node/src/internal/interfaces/response.ts index 663ee66c..383958cf 100644 --- a/sdk/node/src/internal/interfaces/response.ts +++ b/sdk/node/src/internal/interfaces/response.ts @@ -10,4 +10,9 @@ export abstract class Response extends Serializable { * Set common response data. */ abstract setCommonResponse(response: RestResponse): void; + + /** + * Populates the object's properties. + */ + abstract fromObject(jsonObject: Object): T; } diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index 84d29ea2..24b9c580 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -1,3 +1,5 @@ +import { plainToInstance } from 'class-transformer'; + /** * RestRateLimit represents the rate limiting information for a REST API. */ @@ -19,7 +21,7 @@ export interface RestRateLimit { /** * RestResponse represents a generic response from the REST API. */ -export interface RestResponse { +export class RestResponse { /** * Optional rate limit information */ @@ -27,15 +29,19 @@ export interface RestResponse { /** * Response code */ - code: string; + code?: string; /** * Response data (typed) */ - data: T; + data?: any; /** * Optional response message */ message?: string; + + static fromJson(json: string): RestResponse { + return plainToInstance(RestResponse, JSON.parse(json)); + } } /** diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index 6dd32239..6d57397a 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -12,7 +12,8 @@ "baseUrl": "./", "paths": { "@model/*": ["src/model/*"], - "@internal/*": ["src/internal/*"] + "@internal/*": ["src/internal/*"], + "@generate/*": ["src/generate/*"] }, "experimentalDecorators": true, "emitDecoratorMetadata": true From b07c4e0e49d43ccc270ccd0d93670703b5565844 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 6 Jan 2025 17:43:50 +0800 Subject: [PATCH 004/106] feat(nodejs): update model --- .../plugin/generator/NodeSdkGenerator.java | 15 +-- .../src/main/resources/node-sdk/api.mustache | 2 +- .../main/resources/node-sdk/api_test.mustache | 2 +- .../main/resources/node-sdk/api_ws.mustache | 66 +++++++++++ .../resources/node-sdk/api_ws_test.mustache | 0 .../main/resources/node-sdk/model.mustache | 20 ++-- .../main/resources/node-sdk/model_ws.mustache | 104 ++++++++++++++++++ .../sdk/plugin/SdkGeneratorTest.java | 2 +- sdk/node/src/internal/interfaces/response.ts | 10 +- .../src/internal/interfaces/serializable.ts | 5 + sdk/node/src/internal/interfaces/transport.ts | 55 ++++----- sdk/node/src/internal/interfaces/websocket.ts | 103 +++++++++++++++++ 12 files changed, 328 insertions(+), 56 deletions(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/api_ws.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/model_ws.mustache create mode 100644 sdk/node/src/internal/interfaces/websocket.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 4fc83ba9..93b810c6 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -21,7 +21,6 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; -import org.openapitools.codegen.utils.CamelizeOption; import java.io.File; import java.util.*; @@ -340,16 +339,12 @@ private void generateApiImport(Meta meta, boolean req, Map break; } case WS: { -// String suffix = "event"; -// imports.add(generateImport(meta.getService().toLowerCase(), -// toModelFilename(meta.getMethod()) + "_" + suffix, -// formatService(meta.getMethod() + camelize(suffix + "Callback")), -// formatService(meta.getMethod() + camelize(suffix + "CallbackWrapper")))); -// -// if ((((Map) meta.getOtherProperties().getParas().getType()).containsKey("array"))) { -// imports.add(generateImportSimple("typing", "List")); -// } + String suffix = "event"; + String fileName = "./" + toModelFilename(meta.getMethod()) + "_" + suffix; + String service1 = formatService(meta.getMethod() + camelize(suffix + "Callback")); + String service2 = formatService(meta.getMethod() + camelize(suffix + "CallbackWrapper")); + imports.computeIfAbsent(fileName, ImportModel::new).component.addAll(Arrays.asList(service1, service2)); break; } diff --git a/generator/plugin/src/main/resources/node-sdk/api.mustache b/generator/plugin/src/main/resources/node-sdk/api.mustache index de4771c7..8cd4a910 100644 --- a/generator/plugin/src/main/resources/node-sdk/api.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api.mustache @@ -30,7 +30,7 @@ export class {{classname}}Impl implements {{classname}} { {{#operations}} {{#operation}} {{vendorExtensions.x-meta.method}}({{#hasParams}}req :{{vendorExtensions.x-meta.methodServiceFmt}}Req{{/hasParams}}): Promise<{{vendorExtensions.x-meta.methodServiceFmt}}Resp> { - return this.transport.call("{{vendorExtensions.x-meta.domain}}", {{vendorExtensions.x-meta.broker}}, "{{httpMethod}}", "{{path}}", {{#hasParams}}req{{/hasParams}}{{^hasParams}}null{{/hasParams}}, {{#vendorExtensions.x-request-force-json}}true{{/vendorExtensions.x-request-force-json}}{{^vendorExtensions.x-request-force-json}}false{{/vendorExtensions.x-request-force-json}}) + return this.transport.call("{{vendorExtensions.x-meta.domain}}", {{vendorExtensions.x-meta.broker}}, "{{httpMethod}}", "{{path}}", {{#hasParams}}req{{/hasParams}}{{^hasParams}}null{{/hasParams}}, new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(), {{#vendorExtensions.x-request-force-json}}true{{/vendorExtensions.x-request-force-json}}{{^vendorExtensions.x-request-force-json}}false{{/vendorExtensions.x-request-force-json}}) } {{/operation}} diff --git a/generator/plugin/src/main/resources/node-sdk/api_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_test.mustache index 4092a6bd..a8ec46c0 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_test.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_test.mustache @@ -31,7 +31,7 @@ describe('Auto Test', ()=> { let data = "{{{vendorExtensions.x-response-example}}}"; let commonResp = RestResponse.fromJson(data); let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(); - resp = resp.fromObject(commonResp.data) + resp = resp.fromObject(commonResp.data ) expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); console.log(resp); {{/hasParams}} diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache new file mode 100644 index 00000000..8b157544 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache @@ -0,0 +1,66 @@ +{{>partial_header}} +{{#imports}} +{{{.}}} +{{/imports}} +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface {{classname}} { + +{{#operations}} + {{#operation}} + + /** + * {{vendorExtensions.x-meta.method}} {{summary}} + * {{notes}} + * push frequency: {{vendorExtensions.x-push_frequency}} + */ + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :string + {{/operation}} + + // Unsubscribe from topics + unSubscribe(id :string) :void + + // Start websocket + start() :void + + // Stop websocket + stop() :void +{{/operations}} +} + +export class {{classname}}Impl implements {{classname}} { + private wsService :WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + +{{#operations}} + {{#operation}} + + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :string { + let topicPrefix = "{{vendorExtensions.x-meta.otherProperties.topic}}" + {{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}} + {{#type.none}}let args :string[] = []{{/type.none}} + {{#type.simple}}let args:string[] = [ {{#paras}}{{.}}{{/paras}}] {{/type.simple}} + {{#type.array}}let args:string[] = {{paras}}{{/type.array}} + {{#type.object}}let args:string[] = [Array.join(([{{#paras}}{{.}},{{/paras}}], "_")]{{/type.object}} + {{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}} + return this.wsService.subscribe(topicPrefix, args, new {{vendorExtensions.x-meta.methodServiceFmt}}EventCallbackWrapper(callback)) + } + {{/operation}} +{{/operations}} + + unSubscribe(id :string) { + return this.wsService.unsubscribe(id) + } + + start() { + return this.wsService.start() + } + + stop() { + return this.wsService.stop() + } + +} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache new file mode 100644 index 00000000..e69de29b diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index 7ad1159a..d1c97e37 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -7,7 +7,7 @@ {{#vendorExtensions.x-response-model}} import { RestResponse } from '@model/common'; import {Response} from '@internal/interfaces/response'; -export class {{classname}} implements Response<{{classname}}> { +export class {{classname}} implements Response<{{classname}}, RestResponse> { {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; @@ -33,10 +33,10 @@ export class {{classname}} implements Serializable<{{classname}}>{ * common response */ @Exclude() - CommonResponse?: RestResponse; + commonResponse?: RestResponse; setCommonResponse(response: RestResponse): void { - this.CommonResponse = response; + this.commonResponse = response; } {{#vendorExtensions.x-original-response}} @@ -53,11 +53,6 @@ export class {{classname}} implements Serializable<{{classname}}>{ return plainToInstance( {{classname}}, {data : jsonObject}); } {{/vendorExtensions.x-original-response}} -{{^vendorExtensions.x-original-response}} - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, jsonObject); - } -{{/vendorExtensions.x-original-response}} {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-request-model}} @@ -96,9 +91,12 @@ export class {{classname}} implements Serializable<{{classname}}>{ toJson(): string { return JSON.stringify(instanceToPlain(this.items)); } + + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, {items: jsonObject}); + } {{/vendorExtensions.x-request-raw-array}} {{/vendorExtensions.x-request-model}} - {{^vendorExtensions.x-original-response}} {{^vendorExtensions.x-request-raw-array}} fromJson(input: string): {{classname}} { @@ -109,6 +107,10 @@ export class {{classname}} implements Serializable<{{classname}}>{ toJson(): string { return JSON.stringify(instanceToPlain(this)); } + + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, jsonObject); + } {{/vendorExtensions.x-request-raw-array}} {{/vendorExtensions.x-original-response}} diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache new file mode 100644 index 00000000..0458ef4f --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -0,0 +1,104 @@ +{{>partial_header}} +{{#models}} +{{#model}} +{{#vendorExtensions.x-imports}} +{{{.}}} +{{/vendorExtensions.x-imports}} +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +{{#vendorExtensions.x-response-model}} +import { Response } from '@internal/interfaces/response'; +export class {{classname}} implements Response<{{classname}}, WsMessage>{ +{{/vendorExtensions.x-response-model}} +{{^vendorExtensions.x-response-model}} +import { Serializable } from '@internal/interfaces/serializable'; +export class {{classname}} implements Serializable{ +{{/vendorExtensions.x-response-model}} + +{{#vars}} + /** + * {{#description}}{{{.}}}{{/description}} + */ + {{#vendorExtensions.x-use-base-name}} + @Expose({ name: "{{baseName}}" }) + {{/vendorExtensions.x-use-base-name}} + {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; +{{/vars}} +{{#vendorExtensions.x-response-model}} + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } +{{/vendorExtensions.x-response-model}} +{{#vendorExtensions.x-original-response}} + + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, {data : jsonObject}); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, {data : jsonObject}); + } +{{/vendorExtensions.x-original-response}} +{{^vendorExtensions.x-original-response}} + + fromJson(input: string): {{classname}} { + const jsonObject = JSON.parse(input) + return plainToInstance( {{classname}}, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): {{classname}} { + return plainToInstance( {{classname}}, jsonObject); + } +{{/vendorExtensions.x-original-response}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#vendorExtensions.x-enums}} + /** + * {{description}} + */ + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/vendorExtensions.x-enums}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} + +{{#vendorExtensions.x-response-model}} +export type {{classname}}Callback = (topic: string, subject: string, data: {{classname}}) => void; + +export class {{classname}}CallbackWrapper implements WebSocketMessageCallback { + callback: {{classname}}Callback; + + constructor(callback: {{classname}}Callback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = (new {{classname}}()).fromObject(msg.rawData) + event.setCommonResponse(msg) + this.callback(msg.topic, msg.subject, event) + } +} +{{/vendorExtensions.x-response-model}} +{{/model}} +{{/models}} diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 5a573461..8752805e 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -11,7 +11,7 @@ public class SdkGeneratorTest { private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-order.json"; private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; - private static final String OUTPUT_DIR = "/Users/isaactang/Project/kucoin-universal-sdk/sdk/node/src/generate"; + private static final String OUTPUT_DIR = "../../sdk/node/src/generate"; @Test public void launchCodeGenerator() { diff --git a/sdk/node/src/internal/interfaces/response.ts b/sdk/node/src/internal/interfaces/response.ts index 383958cf..65f2759a 100644 --- a/sdk/node/src/internal/interfaces/response.ts +++ b/sdk/node/src/internal/interfaces/response.ts @@ -1,18 +1,12 @@ -import { RestResponse } from '@model/common'; import { Serializable } from '@internal/interfaces/serializable'; /** * Abstract class Response * Represents a response handler with a method to set common response data. */ -export abstract class Response extends Serializable { +export abstract class Response extends Serializable { /** * Set common response data. */ - abstract setCommonResponse(response: RestResponse): void; - - /** - * Populates the object's properties. - */ - abstract fromObject(jsonObject: Object): T; + abstract setCommonResponse(response: R): void; } diff --git a/sdk/node/src/internal/interfaces/serializable.ts b/sdk/node/src/internal/interfaces/serializable.ts index 66fc2e42..cd1b3c3f 100644 --- a/sdk/node/src/internal/interfaces/serializable.ts +++ b/sdk/node/src/internal/interfaces/serializable.ts @@ -11,4 +11,9 @@ export abstract class Serializable { * Converts the current object into a JSON string. */ abstract toJson(): string; + + /** + * Populates the object's properties. + */ + abstract fromObject(jsonObject: Object): T; } diff --git a/sdk/node/src/internal/interfaces/transport.ts b/sdk/node/src/internal/interfaces/transport.ts index 55f4478a..e2606dab 100644 --- a/sdk/node/src/internal/interfaces/transport.ts +++ b/sdk/node/src/internal/interfaces/transport.ts @@ -1,34 +1,37 @@ import { Response } from './response'; +import { Serializable } from '@internal/interfaces/serializable'; /** * Transport interface represents a generic transport layer. */ export interface Transport { - /** - * Makes a call to a remote service with the provided parameters. - * @param domain The domain name of the remote service. - * @param isBroker Indicates if the domain is a broker. - * @param method HTTP method (GET, POST, etc.). - * @param path The endpoint path for the request. - * @param request Request payload to be sent. - * @param requestJson Indicates if the request payload should be JSON-encoded. - * @param args Additional arguments or options for the transport layer - * @returns A Promise that resolves to a `Response` object containing the result of the remote - * call, or rejects with an error if the all fails. - */ - call( - domain: string, - isBroker: boolean, - method: string, - path: string, - request: any, - requestJson: boolean, - args?: any, - ): Promise>; + /** + * Makes a call to a remote service with the provided parameters. + * @param domain The domain name of the remote service. + * @param isBroker Indicates if the domain is a broker. + * @param method HTTP method (GET, POST, etc.). + * @param path The endpoint path for the request. + * @param requestObj Request payload to be sent. + * @param responseObj An instance of a Response subclass, to be filled with data from the remote call + * @param requestJson Indicates if the request payload should be JSON-encoded. + * @param args Additional arguments or options for the transport layer + * @returns A Promise that resolves to a `Response` object containing the result of the remote + * call, or rejects with an error if the all fails. + */ + call( + domain: string, + isBroker: boolean, + method: string, + path: string, + requestObj: Serializable | null, + responseObj: Response, + requestJson: boolean, + args?: any, + ): Promise>; - /** - * Closes the transport and releases any resources. - * @returns A Promise that resolves when the transport is closed. - */ - close(): Promise; + /** + * Closes the transport and releases any resources. + * @returns A Promise that resolves when the transport is closed. + */ + close(): Promise; } diff --git a/sdk/node/src/internal/interfaces/websocket.ts b/sdk/node/src/internal/interfaces/websocket.ts new file mode 100644 index 00000000..2eb0a128 --- /dev/null +++ b/sdk/node/src/internal/interfaces/websocket.ts @@ -0,0 +1,103 @@ +// WsToken represents the token and API endpoint for a WebSocket connection +import { WsMessage } from '@model/common'; + +export interface WsToken { + token: string; + pingInterval: number; + endpoint: string; + protocol: string; + encrypt: boolean; + pingTimeout: number; +} + +// WsTokenProvider defines a method for retrieving a WebSocket token +export interface WsTokenProvider { + /** + * Retrieves the WebSocket token. + * @returns A promise that resolves to an array of WsToken or rejects with an error. + */ + getToken(): Promise; + + /** + * Closes the token provider. + * @returns A promise that resolves when the provider is closed. + */ + close(): Promise; +} + +// WebSocketMessageCallback defines a method for handling WebSocket messages +export interface WebSocketMessageCallback { + /** + * Handles the incoming WebSocket messages. + * @param message The WebSocket message. + * @returns A promise that resolves on successful processing of the message or rejects with an error. + */ + onMessage(message: WsMessage): void; +} + +// WebSocketService defines methods for subscribing to +// and unsubscribing from topics in a WebSocket connection +export interface WebSocketService { + /** + * Starts the WebSocket service and handles incoming WebSocket messages. + * @returns A promise that resolves when the service is started. + */ + start(): void; + + /** + * Stops the WebSocket service. + * @returns A promise that resolves when the service is stopped. + */ + stop(): void; + + /** + * Subscribes to a topic with a provided message callback. + * @param topic The topic to subscribe to. + * @param args Additional arguments for the subscription. + * @param callback The callback to handle incoming messages for the topic. + * @returns A promise that resolves to the subscription ID or rejects with an error. + */ + subscribe(topic: string, args: string[], callback: WebSocketMessageCallback): string; + + /** + * Unsubscribes from a topic. + * @param id The subscription ID. + * @returns A promise that resolves when the subscription is cancelled. + */ + unsubscribe(id: string): void; +} + +// WebsocketTransport defines methods required for managing a WebSocket connection. +export interface WebsocketTransport { + /** + * Starts the WebSocket connection. + * @returns A promise that resolves when the connection is established. + */ + start(): Promise; + + /** + * Stops the WebSocket connection. + * @returns A promise that resolves when the connection is closed. + */ + stop(): Promise; + + /** + * Writes a message to the WebSocket connection. + * @param context The context for the operation. + * @param message The message to send. + * @returns A channel (promise) that resolves when the message is sent or rejects with an error. + */ + write(context: any, message: WsMessage): Promise; + + /** + * Reads messages from the WebSocket connection. + * @returns A channel (promise) that resolves to the received message or rejects with an error. + */ + read(): Promise; + + /** + * A channel that signals when the WebSocket connection is reconnected. + * @returns A promise that resolves when the connection is reconnected. + */ + reconnected(): Promise; +} From 14ee01a031bf2acdf7fd890ff7e29758bb125726 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 7 Jan 2025 15:35:07 +0800 Subject: [PATCH 005/106] feat(nodejs): async websocket api --- .../main/resources/node-sdk/api_ws.mustache | 28 +++++++++++-------- sdk/node/src/internal/interfaces/websocket.ts | 8 +++--- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache index 8b157544..9ba7e6ee 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache @@ -14,17 +14,23 @@ export interface {{classname}} { * {{notes}} * push frequency: {{vendorExtensions.x-push_frequency}} */ - {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :string + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise {{/operation}} - // Unsubscribe from topics - unSubscribe(id :string) :void + /** + * Unsubscribe from topics + */ + unSubscribe(id :string) :Promise - // Start websocket - start() :void + /** + * Start websocket + */ + start() :Promise - // Stop websocket - stop() :void + /** + * Stop websocket + */ + stop() :Promise {{/operations}} } @@ -38,7 +44,7 @@ export class {{classname}}Impl implements {{classname}} { {{#operations}} {{#operation}} - {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :string { + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise { let topicPrefix = "{{vendorExtensions.x-meta.otherProperties.topic}}" {{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}} {{#type.none}}let args :string[] = []{{/type.none}} @@ -51,15 +57,15 @@ export class {{classname}}Impl implements {{classname}} { {{/operation}} {{/operations}} - unSubscribe(id :string) { + unSubscribe(id :string) : Promise{ return this.wsService.unsubscribe(id) } - start() { + start() : Promise{ return this.wsService.start() } - stop() { + stop() : Promise{ return this.wsService.stop() } diff --git a/sdk/node/src/internal/interfaces/websocket.ts b/sdk/node/src/internal/interfaces/websocket.ts index 2eb0a128..476d1efb 100644 --- a/sdk/node/src/internal/interfaces/websocket.ts +++ b/sdk/node/src/internal/interfaces/websocket.ts @@ -42,13 +42,13 @@ export interface WebSocketService { * Starts the WebSocket service and handles incoming WebSocket messages. * @returns A promise that resolves when the service is started. */ - start(): void; + start(): Promise; /** * Stops the WebSocket service. * @returns A promise that resolves when the service is stopped. */ - stop(): void; + stop(): Promise; /** * Subscribes to a topic with a provided message callback. @@ -57,14 +57,14 @@ export interface WebSocketService { * @param callback The callback to handle incoming messages for the topic. * @returns A promise that resolves to the subscription ID or rejects with an error. */ - subscribe(topic: string, args: string[], callback: WebSocketMessageCallback): string; + subscribe(topic: string, args: string[], callback: WebSocketMessageCallback): Promise; /** * Unsubscribes from a topic. * @param id The subscription ID. * @returns A promise that resolves when the subscription is cancelled. */ - unsubscribe(id: string): void; + unsubscribe(id: string): Promise; } // WebsocketTransport defines methods required for managing a WebSocket connection. From ffb6ec244d6dcc1270d69c16c5473757352417e3 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 7 Jan 2025 16:08:39 +0800 Subject: [PATCH 006/106] feat(nodejs): update makefile --- Dockerfile | 5 ++++- Makefile | 1 + .../src/main/resources/node-sdk/api_test_template.mustache | 0 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/api_test_template.mustache diff --git a/Dockerfile b/Dockerfile index f177fecd..29e732d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN --mount=type=cache,target=/root/.m2,sharing=locked mvn -U clean package -Dsk # build tools FROM openapitools/openapi-generator-cli:v7.7.0 -RUN apt-get update && apt-get install python3 python3-pip python3.8-venv -y +RUN apt-get update && apt-get install python3 python3-pip python3.8-venv nodejs npm -y RUN pip install yapf ENV GOLANG_VERSION=1.22.2 RUN curl -OL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \ @@ -30,6 +30,8 @@ RUN curl -OL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \ rm go${GOLANG_VERSION}.linux-amd64.tar.gz WORKDIR /APP COPY --from=generator-builder /build/target/sdk-openapi-generator-1.0.0.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar +RUN npm install -g prettier + ENV CGO_ENABLED=0 ENV PATH="/usr/local/go/bin:$PATH" ENV GOPATH="/go" @@ -37,6 +39,7 @@ ENV PATH="$GOPATH/bin:$PATH" ENV GO_POST_PROCESS_FILE="/usr/local/go/bin/gofmt -w" ENV PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i" +ENV TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write" ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Makefile b/Makefile index b1188552..8f563b22 100644 --- a/Makefile +++ b/Makefile @@ -93,6 +93,7 @@ generate: setup-logs $(call generate-postman) $(call generate-code,golang,/pkg/generate) $(call generate-code,python,/kucoin_universal_sdk/generate) + $(call generate-code,node,/src/generate) .PHONY: gen-postman gen-postman: preprocessor diff --git a/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache b/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache new file mode 100644 index 00000000..e69de29b From da8d0c90e500c2ddc44967db1881e539cb1549f5 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 8 Jan 2025 15:09:23 +0800 Subject: [PATCH 007/106] feat(nodejs): add generated source --- Dockerfile | 6 +- Makefile | 4 +- generate.mk | 5 +- .../main/resources/node-sdk/api_ws.mustache | 6 +- .../main/resources/node-sdk/model_ws.mustache | 2 +- sdk/node/src/api/api_rest.ts | 25 +- sdk/node/src/api/api_ws.ts | 57 +- sdk/node/src/api/client.ts | 11 +- .../account/account/api_account.template | 0 .../account/account/api_account.test.ts | 436 ++ .../generate/account/account/api_account.ts | 470 +++ .../account/model_get_account_info_resp.ts | 77 + .../account/model_get_apikey_info_resp.ts | 65 + ...model_get_cross_margin_account_accounts.ts | 50 + .../model_get_cross_margin_account_req.ts | 112 + .../model_get_cross_margin_account_resp.ts | 78 + .../account/model_get_futures_account_req.ts | 60 + .../account/model_get_futures_account_resp.ts | 65 + .../model_get_futures_ledger_data_list.ts | 54 + .../account/model_get_futures_ledger_req.ts | 162 + .../account/model_get_futures_ledger_resp.ts | 39 + ...odel_get_isolated_margin_account_assets.ts | 69 + ...olated_margin_account_assets_base_asset.ts | 52 + ...lated_margin_account_assets_quote_asset.ts | 52 + ...ted_margin_account_detail_v1_base_asset.ts | 48 + ...ed_margin_account_detail_v1_quote_asset.ts | 48 + ...t_isolated_margin_account_detail_v1_req.ts | 64 + ..._isolated_margin_account_detail_v1_resp.ts | 88 + ..._isolated_margin_account_list_v1_assets.ts | 77 + ...argin_account_list_v1_assets_base_asset.ts | 48 + ...rgin_account_list_v1_assets_quote_asset.ts | 48 + ...get_isolated_margin_account_list_v1_req.ts | 82 + ...et_isolated_margin_account_list_v1_resp.ts | 45 + .../model_get_isolated_margin_account_req.ts | 131 + .../model_get_isolated_margin_account_resp.ts | 49 + ...odel_get_margin_account_detail_accounts.ts | 44 + .../model_get_margin_account_detail_resp.ts | 41 + .../model_get_margin_hf_ledger_data.ts | 62 + .../account/model_get_margin_hf_ledger_req.ts | 175 + .../model_get_margin_hf_ledger_resp.ts | 35 + .../model_get_spot_account_detail_req.ts | 62 + .../model_get_spot_account_detail_resp.ts | 45 + .../model_get_spot_account_list_data.ts | 55 + .../model_get_spot_account_list_req.ts | 90 + .../model_get_spot_account_list_resp.ts | 35 + .../model_get_spot_account_type_resp.ts | 33 + .../account/model_get_spot_hf_ledger_data.ts | 75 + .../account/model_get_spot_hf_ledger_req.ts | 185 + .../account/model_get_spot_hf_ledger_resp.ts | 35 + .../account/model_get_spot_ledger_items.ts | 58 + .../account/model_get_spot_ledger_req.ts | 175 + .../account/model_get_spot_ledger_resp.ts | 51 + .../account/deposit/api_deposit.template | 0 .../account/deposit/api_deposit.test.ts | 238 ++ .../generate/account/deposit/api_deposit.ts | 223 + .../model_add_deposit_address_v1_req.ts | 77 + .../model_add_deposit_address_v1_resp.ts | 66 + .../model_add_deposit_address_v3_req.ts | 124 + .../model_add_deposit_address_v3_resp.ts | 57 + .../model_get_deposit_address_v1_req.ts | 77 + .../model_get_deposit_address_v1_resp.ts | 70 + .../model_get_deposit_address_v2_data.ts | 59 + .../model_get_deposit_address_v2_req.ts | 60 + .../model_get_deposit_address_v2_resp.ts | 35 + .../model_get_deposit_address_v3_data.ts | 50 + .../model_get_deposit_address_v3_req.ts | 94 + .../model_get_deposit_address_v3_resp.ts | 35 + .../model_get_deposit_history_items.ts | 87 + .../model_get_deposit_history_old_items.ts | 59 + .../model_get_deposit_history_old_req.ts | 128 + .../model_get_deposit_history_old_resp.ts | 51 + .../deposit/model_get_deposit_history_req.ts | 162 + .../deposit/model_get_deposit_history_resp.ts | 51 + .../src/generate/account/fee/api_fee.template | 0 .../src/generate/account/fee/api_fee.test.ts | 103 + sdk/node/src/generate/account/fee/api_fee.ts | 99 + .../account/fee/model_get_basic_fee_req.ts | 73 + .../account/fee/model_get_basic_fee_resp.ts | 37 + .../fee/model_get_futures_actual_fee_req.ts | 60 + .../fee/model_get_futures_actual_fee_resp.ts | 41 + .../fee/model_get_spot_actual_fee_data.ts | 30 + .../fee/model_get_spot_actual_fee_req.ts | 60 + .../fee/model_get_spot_actual_fee_resp.ts | 35 + .../subaccount/api_sub_account.template | 0 .../subaccount/api_sub_account.test.ts | 401 ++ .../account/subaccount/api_sub_account.ts | 415 ++ .../model_add_sub_account_api_req.ts | 170 + .../model_add_sub_account_api_resp.ts | 65 + ..._add_sub_account_futures_permission_req.ts | 62 + ...add_sub_account_futures_permission_resp.ts | 35 + ...l_add_sub_account_margin_permission_req.ts | 62 + ..._add_sub_account_margin_permission_resp.ts | 35 + .../subaccount/model_add_sub_account_req.ts | 128 + .../subaccount/model_add_sub_account_resp.ts | 45 + .../model_delete_sub_account_api_req.ts | 94 + .../model_delete_sub_account_api_resp.ts | 37 + ...et_futures_sub_account_list_v2_accounts.ts | 56 + ...del_get_futures_sub_account_list_v2_req.ts | 60 + ...el_get_futures_sub_account_list_v2_resp.ts | 43 + ...get_futures_sub_account_list_v2_summary.ts | 52 + ...t_spot_sub_account_detail_main_accounts.ts | 52 + ...spot_sub_account_detail_margin_accounts.ts | 52 + .../model_get_spot_sub_account_detail_req.ts | 79 + .../model_get_spot_sub_account_detail_resp.ts | 61 + ..._spot_sub_account_detail_trade_accounts.ts | 52 + ...model_get_spot_sub_account_list_v1_data.ts | 48 + ..._sub_account_list_v1_data_main_accounts.ts | 52 + ...ub_account_list_v1_data_margin_accounts.ts | 52 + ...sub_account_list_v1_data_trade_accounts.ts | 52 + ...model_get_spot_sub_account_list_v1_resp.ts | 37 + ...odel_get_spot_sub_account_list_v2_items.ts | 48 + ...sub_account_list_v2_items_main_accounts.ts | 52 + ...b_account_list_v2_items_margin_accounts.ts | 52 + ...ub_account_list_v2_items_trade_accounts.ts | 52 + .../model_get_spot_sub_account_list_v2_req.ts | 77 + ...model_get_spot_sub_account_list_v2_resp.ts | 53 + ...l_get_spot_sub_accounts_summary_v1_data.ts | 44 + ...l_get_spot_sub_accounts_summary_v1_resp.ts | 37 + ..._get_spot_sub_accounts_summary_v2_items.ts | 95 + ...el_get_spot_sub_accounts_summary_v2_req.ts | 79 + ...l_get_spot_sub_accounts_summary_v2_resp.ts | 53 + .../model_get_sub_account_api_list_data.ts | 54 + .../model_get_sub_account_api_list_req.ts | 77 + .../model_get_sub_account_api_list_resp.ts | 35 + .../model_modify_sub_account_api_req.ts | 170 + .../model_modify_sub_account_api_resp.ts | 45 + .../account/transfer/api_transfer.template | 0 .../account/transfer/api_transfer.test.ts | 236 ++ .../generate/account/transfer/api_transfer.ts | 236 ++ .../transfer/model_flex_transfer_req.ts | 298 ++ .../transfer/model_flex_transfer_resp.ts | 33 + .../model_futures_account_transfer_in_req.ts | 109 + .../model_futures_account_transfer_in_resp.ts | 35 + .../model_futures_account_transfer_out_req.ts | 109 + ...model_futures_account_transfer_out_resp.ts | 99 + ...tures_account_transfer_out_ledger_items.ts | 77 + ...futures_account_transfer_out_ledger_req.ts | 187 + ...utures_account_transfer_out_ledger_resp.ts | 53 + .../transfer/model_get_transfer_quotas_req.ts | 119 + .../model_get_transfer_quotas_resp.ts | 49 + .../transfer/model_inner_transfer_req.ts | 225 + .../transfer/model_inner_transfer_resp.ts | 33 + .../model_sub_account_transfer_req.ts | 219 + .../model_sub_account_transfer_resp.ts | 33 + .../withdrawal/api_withdrawal.template | 0 .../account/withdrawal/api_withdrawal.test.ts | 203 + .../account/withdrawal/api_withdrawal.ts | 191 + .../withdrawal/model_cancel_withdrawal_req.ts | 62 + .../model_cancel_withdrawal_resp.ts | 33 + .../model_get_withdrawal_history_items.ts | 91 + .../model_get_withdrawal_history_old_items.ts | 63 + .../model_get_withdrawal_history_old_req.ts | 162 + .../model_get_withdrawal_history_old_resp.ts | 53 + .../model_get_withdrawal_history_req.ts | 166 + .../model_get_withdrawal_history_resp.ts | 51 + .../model_get_withdrawal_quotas_req.ts | 77 + .../model_get_withdrawal_quotas_resp.ts | 93 + .../withdrawal/model_withdrawal_v1_req.ts | 179 + .../withdrawal/model_withdrawal_v1_resp.ts | 33 + .../withdrawal/model_withdrawal_v3_req.ts | 217 + .../withdrawal/model_withdrawal_v3_resp.ts | 33 + .../affiliate/api_affiliate.template | 0 .../affiliate/affiliate/api_affiliate.test.ts | 20 + .../affiliate/affiliate/api_affiliate.ts | 38 + .../affiliate/model_get_account_ltv.ts | 38 + .../affiliate/model_get_account_margins.ts | 30 + .../affiliate/model_get_account_orders.ts | 34 + .../affiliate/model_get_account_resp.ts | 59 + .../broker/apibroker/api_api_broker.template | 0 .../broker/apibroker/api_api_broker.test.ts | 37 + .../broker/apibroker/api_api_broker.ts | 39 + .../broker/apibroker/model_get_rebase_req.ts | 107 + .../broker/apibroker/model_get_rebase_resp.ts | 33 + .../broker/ndbroker/api_nd_broker.template | 0 .../broker/ndbroker/api_nd_broker.test.ts | 436 ++ .../generate/broker/ndbroker/api_nd_broker.ts | 399 ++ .../ndbroker/model_add_sub_account_api_req.ts | 145 + .../model_add_sub_account_api_resp.ts | 61 + .../ndbroker/model_add_sub_account_req.ts | 60 + .../ndbroker/model_add_sub_account_resp.ts | 45 + .../model_delete_sub_account_api_req.ts | 77 + .../model_delete_sub_account_api_resp.ts | 33 + .../ndbroker/model_get_broker_info_req.ts | 107 + .../ndbroker/model_get_broker_info_resp.ts | 41 + .../ndbroker/model_get_deposit_detail_req.ts | 77 + .../ndbroker/model_get_deposit_detail_resp.ts | 102 + .../ndbroker/model_get_deposit_list_data.ts | 91 + .../ndbroker/model_get_deposit_list_req.ts | 145 + .../ndbroker/model_get_deposit_list_resp.ts | 35 + .../broker/ndbroker/model_get_rebase_req.ts | 107 + .../broker/ndbroker/model_get_rebase_resp.ts | 33 + .../model_get_sub_account_api_data.ts | 63 + .../ndbroker/model_get_sub_account_api_req.ts | 77 + .../model_get_sub_account_api_resp.ts | 35 + .../ndbroker/model_get_sub_account_items.ts | 34 + .../ndbroker/model_get_sub_account_req.ts | 94 + .../ndbroker/model_get_sub_account_resp.ts | 51 + .../model_get_transfer_history_req.ts | 60 + .../model_get_transfer_history_resp.ts | 138 + .../ndbroker/model_get_withdraw_detail_req.ts | 60 + .../model_get_withdraw_detail_resp.ts | 110 + .../model_modify_sub_account_api_req.ts | 147 + .../model_modify_sub_account_api_resp.ts | 57 + .../broker/ndbroker/model_transfer_req.ts | 195 + .../broker/ndbroker/model_transfer_resp.ts | 33 + .../src/generate/earn/earn/api_earn.template | 0 .../src/generate/earn/earn/api_earn.test.ts | 303 ++ sdk/node/src/generate/earn/earn/api_earn.ts | 279 ++ .../earn/model_get_account_holding_items.ts | 105 + .../earn/model_get_account_holding_req.ts | 155 + .../earn/model_get_account_holding_resp.ts | 51 + .../model_get_eth_staking_products_data.ts | 187 + .../model_get_eth_staking_products_req.ts | 60 + .../model_get_eth_staking_products_resp.ts | 37 + .../model_get_kcs_staking_products_data.ts | 191 + .../model_get_kcs_staking_products_req.ts | 60 + .../model_get_kcs_staking_products_resp.ts | 37 + .../earn/model_get_promotion_products_data.ts | 191 + .../earn/model_get_promotion_products_req.ts | 60 + .../earn/model_get_promotion_products_resp.ts | 35 + .../earn/earn/model_get_redeem_preview_req.ts | 90 + .../earn/model_get_redeem_preview_resp.ts | 57 + .../earn/model_get_savings_products_data.ts | 191 + .../earn/model_get_savings_products_req.ts | 60 + .../earn/model_get_savings_products_resp.ts | 35 + .../earn/model_get_staking_products_data.ts | 191 + .../earn/model_get_staking_products_req.ts | 60 + .../earn/model_get_staking_products_resp.ts | 35 + .../generate/earn/earn/model_purchase_req.ts | 107 + .../generate/earn/earn/model_purchase_resp.ts | 37 + .../generate/earn/earn/model_redeem_req.ts | 124 + .../generate/earn/earn/model_redeem_resp.ts | 58 + .../fundingfees/api_funding_fees.template | 0 .../fundingfees/api_funding_fees.test.ts | 104 + .../futures/fundingfees/api_funding_fees.ts | 103 + .../model_get_current_funding_rate_req.ts | 62 + .../model_get_current_funding_rate_resp.ts | 59 + ...l_get_private_funding_history_data_list.ts | 77 + .../model_get_private_funding_history_req.ts | 162 + .../model_get_private_funding_history_resp.ts | 41 + .../model_get_public_funding_history_data.ts | 30 + .../model_get_public_funding_history_req.ts | 94 + .../model_get_public_funding_history_resp.ts | 37 + .../api_futures_private.test.ts | 0 .../futuresprivate/api_futures_private.ts | 202 + .../futuresprivate/model_all_order_event.ts | 232 ++ .../model_all_position_event.ts | 252 ++ .../futuresprivate/model_balance_event.ts | 105 + .../model_cross_leverage_data_value.ts | 24 + .../model_cross_leverage_event.ts | 55 + .../futuresprivate/model_margin_mode_event.ts | 53 + .../futuresprivate/model_order_event.ts | 232 ++ .../futuresprivate/model_position_event.ts | 248 ++ .../futuresprivate/model_stop_orders_event.ts | 154 + .../futurespublic/api_futures_public.test.ts | 0 .../futurespublic/api_futures_public.ts | 255 ++ .../futurespublic/model_announcement_event.ts | 65 + .../futurespublic/model_execution_event.ts | 81 + .../futurespublic/model_instrument_event.ts | 69 + .../futurespublic/model_klines_event.ts | 57 + .../model_orderbook_increment_event.ts | 61 + .../model_orderbook_level50_event.ts | 69 + .../model_orderbook_level5_event.ts | 69 + .../model_symbol_snapshot_event.ts | 89 + .../futurespublic/model_ticker_v1_event.ts | 89 + .../futurespublic/model_ticker_v2_event.ts | 73 + .../futures/market/api_market.template | 0 .../futures/market/api_market.test.ts | 450 ++ .../src/generate/futures/market/api_market.ts | 512 +++ .../market/model_get24hr_stats_resp.ts | 33 + .../market/model_get_all_symbols_data.ts | 321 ++ .../market/model_get_all_symbols_resp.ts | 35 + .../market/model_get_all_tickers_data.ts | 75 + .../market/model_get_all_tickers_resp.ts | 35 + .../market/model_get_full_order_book_req.ts | 60 + .../market/model_get_full_order_book_resp.ts | 49 + ...model_get_interest_rate_index_data_list.ts | 34 + .../model_get_interest_rate_index_req.ts | 162 + .../model_get_interest_rate_index_resp.ts | 39 + .../futures/market/model_get_klines_req.ts | 160 + .../futures/market/model_get_klines_resp.ts | 33 + .../market/model_get_mark_price_req.ts | 62 + .../market/model_get_mark_price_resp.ts | 49 + .../market/model_get_part_order_book_req.ts | 79 + .../market/model_get_part_order_book_resp.ts | 49 + .../model_get_premium_index_data_list.ts | 34 + .../market/model_get_premium_index_req.ts | 162 + .../market/model_get_premium_index_resp.ts | 39 + ...odel_get_private_token_instance_servers.ts | 49 + .../market/model_get_private_token_resp.ts | 39 + ...model_get_public_token_instance_servers.ts | 47 + .../market/model_get_public_token_resp.ts | 39 + .../market/model_get_server_time_resp.ts | 33 + .../market/model_get_service_status_resp.ts | 54 + .../model_get_spot_index_price_data_list.ts | 40 + ..._index_price_data_list_decomposion_list.ts | 32 + .../market/model_get_spot_index_price_req.ts | 162 + .../market/model_get_spot_index_price_resp.ts | 39 + .../futures/market/model_get_symbol_req.ts | 62 + .../futures/market/model_get_symbol_resp.ts | 332 ++ .../futures/market/model_get_ticker_req.ts | 60 + .../futures/market/model_get_ticker_resp.ts | 86 + .../market/model_get_trade_history_data.ts | 67 + .../market/model_get_trade_history_req.ts | 60 + .../market/model_get_trade_history_resp.ts | 35 + .../generate/futures/order/api_order.template | 0 .../generate/futures/order/api_order.test.ts | 605 +++ .../src/generate/futures/order/api_order.ts | 550 +++ .../futures/order/model_add_order_req.ts | 515 +++ .../futures/order/model_add_order_resp.ts | 37 + .../futures/order/model_add_order_test_req.ts | 516 +++ .../order/model_add_order_test_resp.ts | 37 + .../futures/order/model_add_tpsl_order_req.ts | 506 +++ .../order/model_add_tpsl_order_resp.ts | 37 + .../order/model_batch_add_orders_data.ts | 38 + .../order/model_batch_add_orders_item.ts | 516 +++ .../order/model_batch_add_orders_req.ts | 62 + .../order/model_batch_add_orders_resp.ts | 35 + ...el_batch_cancel_orders_client_oids_list.ts | 79 + .../order/model_batch_cancel_orders_data.ts | 34 + .../order/model_batch_cancel_orders_req.ts | 79 + .../order/model_batch_cancel_orders_resp.ts | 35 + .../order/model_cancel_all_orders_v1_req.ts | 60 + .../order/model_cancel_all_orders_v1_resp.ts | 33 + .../order/model_cancel_all_orders_v3_req.ts | 60 + .../order/model_cancel_all_orders_v3_resp.ts | 33 + .../order/model_cancel_all_stop_orders_req.ts | 60 + .../model_cancel_all_stop_orders_resp.ts | 33 + .../model_cancel_order_by_client_oid_req.ts | 79 + .../model_cancel_order_by_client_oid_resp.ts | 35 + .../order/model_cancel_order_by_id_req.ts | 62 + .../order/model_cancel_order_by_id_resp.ts | 33 + .../order/model_get_open_order_value_req.ts | 60 + .../order/model_get_open_order_value_resp.ts | 49 + .../model_get_order_by_client_oid_req.ts | 60 + .../model_get_order_by_client_oid_resp.ts | 260 ++ .../order/model_get_order_by_order_id_req.ts | 63 + .../order/model_get_order_by_order_id_resp.ts | 260 ++ .../order/model_get_order_list_items.ts | 170 + .../futures/order/model_get_order_list_req.ts | 212 + .../order/model_get_order_list_resp.ts | 51 + .../model_get_recent_closed_orders_data.ts | 170 + .../model_get_recent_closed_orders_req.ts | 60 + .../model_get_recent_closed_orders_resp.ts | 37 + .../model_get_recent_trade_history_data.ts | 197 + .../model_get_recent_trade_history_req.ts | 60 + .../model_get_recent_trade_history_resp.ts | 37 + .../order/model_get_stop_order_list_items.ts | 170 + .../order/model_get_stop_order_list_req.ts | 185 + .../order/model_get_stop_order_list_resp.ts | 51 + .../order/model_get_trade_history_items.ts | 193 + .../order/model_get_trade_history_req.ts | 227 ++ .../order/model_get_trade_history_resp.ts | 51 + .../futures/positions/api_positions.template | 0 .../futures/positions/api_positions.test.ts | 464 +++ .../futures/positions/api_positions.ts | 438 ++ .../model_add_isolated_margin_req.ts | 94 + .../model_add_isolated_margin_resp.ts | 177 + .../model_get_cross_margin_leverage_req.ts | 60 + .../model_get_cross_margin_leverage_resp.ts | 39 + ...del_get_isolated_margin_risk_limit_data.ts | 48 + ...odel_get_isolated_margin_risk_limit_req.ts | 62 + ...del_get_isolated_margin_risk_limit_resp.ts | 37 + .../positions/model_get_margin_mode_req.ts | 60 + .../positions/model_get_margin_mode_resp.ts | 50 + .../positions/model_get_max_open_size_req.ts | 94 + .../positions/model_get_max_open_size_resp.ts | 41 + .../model_get_max_withdraw_margin_req.ts | 60 + .../model_get_max_withdraw_margin_resp.ts | 33 + .../model_get_position_details_req.ts | 60 + .../model_get_position_details_resp.ts | 224 + .../positions/model_get_position_list_data.ts | 213 + .../positions/model_get_position_list_req.ts | 60 + .../positions/model_get_position_list_resp.ts | 35 + .../model_get_positions_history_items.ts | 95 + .../model_get_positions_history_req.ts | 128 + .../model_get_positions_history_resp.ts | 51 + .../model_modify_auto_deposit_status_req.ts | 77 + .../model_modify_auto_deposit_status_resp.ts | 35 + ...el_modify_isolated_margin_risk_limt_req.ts | 79 + ...l_modify_isolated_margin_risk_limt_resp.ts | 35 + .../model_modify_margin_leverage_req.ts | 77 + .../model_modify_margin_leverage_resp.ts | 37 + .../model_remove_isolated_margin_req.ts | 77 + .../model_remove_isolated_margin_resp.ts | 33 + .../positions/model_switch_margin_mode_req.ts | 90 + .../model_switch_margin_mode_resp.ts | 50 + .../margin/credit/api_credit.template | 0 .../generate/margin/credit/api_credit.test.ts | 238 ++ .../src/generate/margin/credit/api_credit.ts | 223 + .../credit/model_get_loan_market_data.ts | 62 + ...odel_get_loan_market_interest_rate_data.ts | 26 + ...model_get_loan_market_interest_rate_req.ts | 60 + ...odel_get_loan_market_interest_rate_resp.ts | 37 + .../credit/model_get_loan_market_req.ts | 60 + .../credit/model_get_loan_market_resp.ts | 35 + .../credit/model_get_purchase_orders_items.ts | 63 + .../credit/model_get_purchase_orders_req.ts | 141 + .../credit/model_get_purchase_orders_resp.ts | 51 + .../credit/model_get_redeem_orders_items.ts | 46 + .../credit/model_get_redeem_orders_req.ts | 141 + .../credit/model_get_redeem_orders_resp.ts | 51 + .../credit/model_modify_purchase_req.ts | 94 + .../credit/model_modify_purchase_resp.ts | 33 + .../margin/credit/model_purchase_req.ts | 94 + .../margin/credit/model_purchase_resp.ts | 33 + .../margin/credit/model_redeem_req.ts | 94 + .../margin/credit/model_redeem_resp.ts | 33 + .../generate/margin/debit/api_debit.template | 0 .../generate/margin/debit/api_debit.test.ts | 205 + .../src/generate/margin/debit/api_debit.ts | 189 + .../generate/margin/debit/model_borrow_req.ts | 158 + .../margin/debit/model_borrow_resp.ts | 37 + .../debit/model_get_borrow_history_items.ts | 63 + .../debit/model_get_borrow_history_req.ts | 179 + .../debit/model_get_borrow_history_resp.ts | 55 + .../debit/model_get_interest_history_items.ts | 34 + .../debit/model_get_interest_history_req.ts | 162 + .../debit/model_get_interest_history_resp.ts | 55 + .../debit/model_get_repay_history_items.ts | 67 + .../debit/model_get_repay_history_req.ts | 179 + .../debit/model_get_repay_history_resp.ts | 55 + .../margin/debit/model_modify_leverage_req.ts | 94 + .../debit/model_modify_leverage_resp.ts | 33 + .../generate/margin/debit/model_repay_req.ts | 128 + .../generate/margin/debit/model_repay_resp.ts | 41 + .../marginprivate/api_margin_private.test.ts | 0 .../marginprivate/api_margin_private.ts | 92 + ..._cross_margin_position_asset_list_value.ts | 34 + .../model_cross_margin_position_event.ts | 111 + ...ted_margin_position_change_assets_value.ts | 38 + .../model_isolated_margin_position_event.ts | 147 + .../marginpublic/api_margin_public.test.ts | 0 .../margin/marginpublic/api_margin_public.ts | 80 + .../marginpublic/model_index_price_event.ts | 65 + .../marginpublic/model_mark_price_event.ts | 61 + .../margin/market/api_market.template | 0 .../generate/margin/market/api_market.test.ts | 151 + .../src/generate/margin/market/api_market.ts | 186 + .../model_get_cross_margin_symbols_items.ts | 82 + .../model_get_cross_margin_symbols_req.ts | 60 + .../model_get_cross_margin_symbols_resp.ts | 41 + .../margin/market/model_get_etf_info_data.ts | 42 + .../margin/market/model_get_etf_info_req.ts | 60 + .../margin/market/model_get_etf_info_resp.ts | 35 + .../model_get_isolated_margin_symbols_data.ts | 74 + .../model_get_isolated_margin_symbols_resp.ts | 37 + .../market/model_get_margin_config_resp.ts | 45 + .../market/model_get_mark_price_detail_req.ts | 62 + .../model_get_mark_price_detail_resp.ts | 41 + .../market/model_get_mark_price_list_data.ts | 30 + .../market/model_get_mark_price_list_resp.ts | 35 + .../generate/margin/order/api_order.template | 0 .../generate/margin/order/api_order.test.ts | 436 ++ .../src/generate/margin/order/api_order.ts | 401 ++ .../margin/order/model_add_order_req.ts | 391 ++ .../margin/order/model_add_order_resp.ts | 45 + .../margin/order/model_add_order_test_req.ts | 391 ++ .../margin/order/model_add_order_test_resp.ts | 45 + .../order/model_add_order_test_v1_req.ts | 401 ++ .../order/model_add_order_test_v1_resp.ts | 45 + .../margin/order/model_add_order_v1_req.ts | 401 ++ .../margin/order/model_add_order_v1_resp.ts | 45 + .../model_cancel_all_orders_by_symbol_req.ts | 92 + .../model_cancel_all_orders_by_symbol_resp.ts | 35 + .../model_cancel_order_by_client_oid_req.ts | 79 + .../model_cancel_order_by_client_oid_resp.ts | 35 + .../model_cancel_order_by_order_id_req.ts | 79 + .../model_cancel_order_by_order_id_resp.ts | 33 + .../order/model_get_closed_orders_items.ts | 215 + .../order/model_get_closed_orders_req.ts | 212 + .../order/model_get_closed_orders_resp.ts | 39 + .../order/model_get_open_orders_data.ts | 225 + .../margin/order/model_get_open_orders_req.ts | 90 + .../order/model_get_open_orders_resp.ts | 35 + .../model_get_order_by_client_oid_req.ts | 79 + .../model_get_order_by_client_oid_resp.ts | 236 ++ .../order/model_get_order_by_order_id_req.ts | 79 + .../order/model_get_order_by_order_id_resp.ts | 236 ++ .../model_get_symbols_with_open_order_req.ts | 75 + .../model_get_symbols_with_open_order_resp.ts | 39 + .../order/model_get_trade_history_items.ts | 131 + .../order/model_get_trade_history_req.ts | 229 ++ .../order/model_get_trade_history_resp.ts | 39 + .../margin/risklimit/api_risk_limit.template | 0 .../margin/risklimit/api_risk_limit.test.ts | 37 + .../margin/risklimit/api_risk_limit.ts | 39 + .../model_get_margin_risk_limit_data.ts | 138 + .../model_get_margin_risk_limit_req.ts | 94 + .../model_get_margin_risk_limit_resp.ts | 35 + sdk/node/src/generate/service/account_api.ts | 68 + .../src/generate/service/affiliate_api.ts | 23 + sdk/node/src/generate/service/broker_api.ts | 32 + sdk/node/src/generate/service/earn_api.ts | 23 + sdk/node/src/generate/service/futures_api.ts | 50 + sdk/node/src/generate/service/margin_api.ts | 59 + sdk/node/src/generate/service/spot_api.ts | 32 + .../src/generate/service/viplending_api.ts | 23 + .../generate/spot/market/api_market.template | 0 .../generate/spot/market/api_market.test.ts | 481 +++ .../src/generate/spot/market/api_market.ts | 542 +++ .../spot/market/model_get24hr_stats_req.ts | 60 + .../spot/market/model_get24hr_stats_resp.ts | 93 + .../market/model_get_all_currencies_data.ts | 56 + .../model_get_all_currencies_data_chains.ts | 90 + .../market/model_get_all_currencies_resp.ts | 35 + .../spot/market/model_get_all_symbols_data.ts | 119 + .../spot/market/model_get_all_symbols_req.ts | 60 + .../spot/market/model_get_all_symbols_resp.ts | 35 + .../spot/market/model_get_all_tickers_resp.ts | 39 + .../market/model_get_all_tickers_ticker.ts | 113 + .../market/model_get_announcements_items.ts | 46 + .../market/model_get_announcements_req.ts | 277 ++ .../market/model_get_announcements_resp.ts | 51 + .../spot/market/model_get_currency_chains.ts | 78 + .../spot/market/model_get_currency_req.ts | 79 + .../spot/market/model_get_currency_resp.ts | 67 + .../spot/market/model_get_fiat_price_req.ts | 77 + .../spot/market/model_get_fiat_price_resp.ts | 3615 +++++++++++++++++ .../market/model_get_full_order_book_req.ts | 60 + .../market/model_get_full_order_book_resp.ts | 45 + .../spot/market/model_get_klines_req.ts | 172 + .../spot/market/model_get_klines_resp.ts | 33 + .../spot/market/model_get_market_list_resp.ts | 33 + .../market/model_get_part_order_book_req.ts | 79 + .../market/model_get_part_order_book_resp.ts | 45 + ...odel_get_private_token_instance_servers.ts | 49 + .../market/model_get_private_token_resp.ts | 39 + ...model_get_public_token_instance_servers.ts | 47 + .../market/model_get_public_token_resp.ts | 39 + .../spot/market/model_get_server_time_resp.ts | 33 + .../market/model_get_service_status_resp.ts | 54 + .../spot/market/model_get_symbol_req.ts | 62 + .../spot/market/model_get_symbol_resp.ts | 130 + .../spot/market/model_get_ticker_req.ts | 60 + .../spot/market/model_get_ticker_resp.ts | 61 + .../market/model_get_trade_history_data.ts | 51 + .../market/model_get_trade_history_req.ts | 60 + .../market/model_get_trade_history_resp.ts | 35 + .../generate/spot/order/api_order.template | 0 .../src/generate/spot/order/api_order.test.ts | 1554 +++++++ sdk/node/src/generate/spot/order/api_order.ts | 1500 +++++++ .../spot/order/model_add_oco_order_req.ts | 215 + .../spot/order/model_add_oco_order_resp.ts | 33 + .../spot/order/model_add_order_old_req.ts | 384 ++ .../spot/order/model_add_order_old_resp.ts | 33 + .../spot/order/model_add_order_req.ts | 374 ++ .../spot/order/model_add_order_resp.ts | 37 + .../spot/order/model_add_order_sync_req.ts | 374 ++ .../spot/order/model_add_order_sync_resp.ts | 78 + .../order/model_add_order_test_old_req.ts | 384 ++ .../order/model_add_order_test_old_resp.ts | 33 + .../spot/order/model_add_order_test_req.ts | 374 ++ .../spot/order/model_add_order_test_resp.ts | 37 + .../spot/order/model_add_stop_order_req.ts | 391 ++ .../spot/order/model_add_stop_order_resp.ts | 37 + .../spot/order/model_batch_add_orders_data.ts | 34 + .../order/model_batch_add_orders_old_data.ts | 102 + .../model_batch_add_orders_old_order_list.ts | 409 ++ .../order/model_batch_add_orders_old_req.ts | 79 + .../order/model_batch_add_orders_old_resp.ts | 35 + .../model_batch_add_orders_order_list.ts | 371 ++ .../spot/order/model_batch_add_orders_req.ts | 62 + .../spot/order/model_batch_add_orders_resp.ts | 35 + .../order/model_batch_add_orders_sync_data.ts | 75 + .../model_batch_add_orders_sync_order_list.ts | 373 ++ .../order/model_batch_add_orders_sync_req.ts | 62 + .../order/model_batch_add_orders_sync_resp.ts | 35 + .../model_batch_cancel_oco_orders_req.ts | 77 + .../model_batch_cancel_oco_orders_resp.ts | 33 + .../order/model_batch_cancel_order_old_req.ts | 94 + .../model_batch_cancel_order_old_resp.ts | 33 + .../model_batch_cancel_stop_order_req.ts | 94 + .../model_batch_cancel_stop_order_resp.ts | 33 + .../model_cancel_all_orders_by_symbol_req.ts | 60 + .../model_cancel_all_orders_by_symbol_resp.ts | 35 + .../model_cancel_all_orders_failed_symbols.ts | 26 + .../order/model_cancel_all_orders_resp.ts | 39 + ...odel_cancel_oco_order_by_client_oid_req.ts | 62 + ...del_cancel_oco_order_by_client_oid_resp.ts | 35 + .../model_cancel_oco_order_by_order_id_req.ts | 62 + ...model_cancel_oco_order_by_order_id_resp.ts | 35 + ...odel_cancel_order_by_client_oid_old_req.ts | 79 + ...del_cancel_order_by_client_oid_old_resp.ts | 43 + .../model_cancel_order_by_client_oid_req.ts | 79 + .../model_cancel_order_by_client_oid_resp.ts | 35 + ...del_cancel_order_by_client_oid_sync_req.ts | 79 + ...el_cancel_order_by_client_oid_sync_resp.ts | 68 + .../model_cancel_order_by_order_id_old_req.ts | 79 + ...model_cancel_order_by_order_id_old_resp.ts | 35 + .../model_cancel_order_by_order_id_req.ts | 79 + .../model_cancel_order_by_order_id_resp.ts | 33 + ...model_cancel_order_by_order_id_sync_req.ts | 79 + ...odel_cancel_order_by_order_id_sync_resp.ts | 68 + .../order/model_cancel_partial_order_req.ts | 96 + .../order/model_cancel_partial_order_resp.ts | 37 + ...del_cancel_stop_order_by_client_oid_req.ts | 77 + ...el_cancel_stop_order_by_client_oid_resp.ts | 39 + ...model_cancel_stop_order_by_order_id_req.ts | 62 + ...odel_cancel_stop_order_by_order_id_resp.ts | 35 + .../order/model_get_closed_orders_items.ts | 213 + .../spot/order/model_get_closed_orders_req.ts | 185 + .../order/model_get_closed_orders_resp.ts | 39 + .../generate/spot/order/model_get_dcp_resp.ts | 45 + .../model_get_oco_order_by_client_oid_req.ts | 62 + .../model_get_oco_order_by_client_oid_resp.ts | 51 + .../model_get_oco_order_by_order_id_req.ts | 62 + .../model_get_oco_order_by_order_id_resp.ts | 70 + ...get_oco_order_detail_by_order_id_orders.ts | 48 + ...el_get_oco_order_detail_by_order_id_req.ts | 62 + ...l_get_oco_order_detail_by_order_id_resp.ts | 57 + .../order/model_get_oco_order_list_items.ts | 59 + .../order/model_get_oco_order_list_req.ts | 145 + .../order/model_get_oco_order_list_resp.ts | 51 + .../spot/order/model_get_open_orders_data.ts | 213 + .../spot/order/model_get_open_orders_req.ts | 60 + .../spot/order/model_get_open_orders_resp.ts | 35 + .../model_get_order_by_client_oid_old_req.ts | 62 + .../model_get_order_by_client_oid_old_resp.ts | 151 + .../model_get_order_by_client_oid_req.ts | 79 + .../model_get_order_by_client_oid_resp.ts | 224 + .../model_get_order_by_order_id_old_req.ts | 62 + .../model_get_order_by_order_id_old_resp.ts | 149 + .../order/model_get_order_by_order_id_req.ts | 79 + .../order/model_get_order_by_order_id_resp.ts | 224 + .../order/model_get_orders_list_old_items.ts | 138 + .../order/model_get_orders_list_old_req.ts | 251 ++ .../order/model_get_orders_list_old_resp.ts | 51 + .../model_get_recent_orders_list_old_data.ts | 138 + .../model_get_recent_orders_list_old_req.ts | 77 + .../model_get_recent_orders_list_old_resp.ts | 37 + ...model_get_recent_trade_history_old_data.ts | 86 + .../model_get_recent_trade_history_old_req.ts | 77 + ...model_get_recent_trade_history_old_resp.ts | 37 + ...model_get_stop_order_by_client_oid_data.ts | 142 + .../model_get_stop_order_by_client_oid_req.ts | 77 + ...model_get_stop_order_by_client_oid_resp.ts | 37 + .../model_get_stop_order_by_order_id_req.ts | 62 + .../model_get_stop_order_by_order_id_resp.ts | 155 + .../order/model_get_stop_orders_list_items.ts | 142 + .../order/model_get_stop_orders_list_req.ts | 258 ++ .../order/model_get_stop_orders_list_resp.ts | 51 + .../model_get_symbols_with_open_order_resp.ts | 35 + .../order/model_get_trade_history_items.ts | 131 + .../model_get_trade_history_old_items.ts | 86 + .../order/model_get_trade_history_old_req.ts | 241 ++ .../order/model_get_trade_history_old_resp.ts | 51 + .../spot/order/model_get_trade_history_req.ts | 202 + .../order/model_get_trade_history_resp.ts | 39 + .../spot/order/model_modify_order_req.ts | 128 + .../spot/order/model_modify_order_resp.ts | 37 + .../generate/spot/order/model_set_dcp_req.ts | 77 + .../generate/spot/order/model_set_dcp_resp.ts | 37 + .../spot/spotprivate/api_spot_private.test.ts | 0 .../spot/spotprivate/api_spot_private.ts | 100 + .../spot/spotprivate/model_account_event.ts | 90 + .../model_account_relation_context.ts | 28 + .../spot/spotprivate/model_order_v1_event.ts | 216 + .../spot/spotprivate/model_order_v2_event.ts | 220 + .../spot/spotpublic/api_spot_public.test.ts | 0 .../spot/spotpublic/api_spot_public.ts | 272 ++ .../spotpublic/model_all_tickers_event.ts | 81 + .../spot/spotpublic/model_klines_event.ts | 57 + .../spotpublic/model_market_snapshot_data.ts | 186 + ...el_market_snapshot_data_market_change1h.ts | 50 + ...l_market_snapshot_data_market_change24h.ts | 50 + ...el_market_snapshot_data_market_change4h.ts | 50 + .../spotpublic/model_market_snapshot_event.ts | 58 + .../model_orderbook_increment_changes.ts | 28 + .../model_orderbook_increment_event.ts | 70 + .../model_orderbook_level1_event.ts | 61 + .../model_orderbook_level50_changes.ts | 28 + .../model_orderbook_level50_event.ts | 70 + .../model_orderbook_level5_event.ts | 61 + .../spotpublic/model_symbol_snapshot_data.ts | 186 + ...el_symbol_snapshot_data_market_change1h.ts | 50 + ...l_symbol_snapshot_data_market_change24h.ts | 50 + ...el_symbol_snapshot_data_market_change4h.ts | 50 + .../spotpublic/model_symbol_snapshot_event.ts | 58 + .../spot/spotpublic/model_ticker_event.ts | 77 + .../spot/spotpublic/model_trade_event.ts | 85 + sdk/node/src/generate/version.ts | 2 + .../viplending/api_vip_lending.template | 0 .../viplending/api_vip_lending.test.ts | 36 + .../viplending/viplending/api_vip_lending.ts | 67 + .../model_get_account_detail_ltv.ts | 38 + .../model_get_account_detail_margins.ts | 30 + .../model_get_account_detail_orders.ts | 34 + .../model_get_account_detail_resp.ts | 59 + .../viplending/model_get_accounts_data.ts | 42 + .../viplending/model_get_accounts_resp.ts | 35 + .../src/internal/infra/default_transport.ts | 32 + .../src/internal/infra/default_ws_service.ts | 38 + .../src/internal/rest/default_rest_impl.ts | 74 + sdk/node/src/internal/ws/default_ws_impl.ts | 61 + sdk/node/src/model/client_option.ts | 2 +- sdk/node/tsconfig.json | 3 +- 697 files changed, 72112 insertions(+), 48 deletions(-) create mode 100644 sdk/node/src/generate/account/account/api_account.template create mode 100644 sdk/node/src/generate/account/account/api_account.test.ts create mode 100644 sdk/node/src/generate/account/account/api_account.ts create mode 100644 sdk/node/src/generate/account/account/model_get_account_info_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts create mode 100644 sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_futures_account_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_futures_account_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts create mode 100644 sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts create mode 100644 sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts create mode 100644 sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts create mode 100644 sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/api_deposit.template create mode 100644 sdk/node/src/generate/account/deposit/api_deposit.test.ts create mode 100644 sdk/node/src/generate/account/deposit/api_deposit.ts create mode 100644 sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts create mode 100644 sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts create mode 100644 sdk/node/src/generate/account/fee/api_fee.template create mode 100644 sdk/node/src/generate/account/fee/api_fee.test.ts create mode 100644 sdk/node/src/generate/account/fee/api_fee.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts create mode 100644 sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/api_sub_account.template create mode 100644 sdk/node/src/generate/account/subaccount/api_sub_account.test.ts create mode 100644 sdk/node/src/generate/account/subaccount/api_sub_account.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/api_transfer.template create mode 100644 sdk/node/src/generate/account/transfer/api_transfer.test.ts create mode 100644 sdk/node/src/generate/account/transfer/api_transfer.ts create mode 100644 sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts create mode 100644 sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts create mode 100644 sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts create mode 100644 sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/api_withdrawal.template create mode 100644 sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts create mode 100644 sdk/node/src/generate/account/withdrawal/api_withdrawal.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts create mode 100644 sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/api_affiliate.template create mode 100644 sdk/node/src/generate/affiliate/affiliate/api_affiliate.test.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/api_affiliate.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts create mode 100644 sdk/node/src/generate/broker/apibroker/api_api_broker.template create mode 100644 sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts create mode 100644 sdk/node/src/generate/broker/apibroker/api_api_broker.ts create mode 100644 sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts create mode 100644 sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/api_nd_broker.template create mode 100644 sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/api_earn.template create mode 100644 sdk/node/src/generate/earn/earn/api_earn.test.ts create mode 100644 sdk/node/src/generate/earn/earn/api_earn.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_purchase_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_purchase_resp.ts create mode 100644 sdk/node/src/generate/earn/earn/model_redeem_req.ts create mode 100644 sdk/node/src/generate/earn/earn/model_redeem_resp.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/api_funding_fees.template create mode 100644 sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_order_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_position_event.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/api_futures_public.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_execution_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_klines_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts create mode 100644 sdk/node/src/generate/futures/market/api_market.template create mode 100644 sdk/node/src/generate/futures/market/api_market.test.ts create mode 100644 sdk/node/src/generate/futures/market/api_market.ts create mode 100644 sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_klines_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_klines_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_mark_price_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_premium_index_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_private_token_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_public_token_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_server_time_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_service_status_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_symbol_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_symbol_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_ticker_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_ticker_resp.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_trade_history_data.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_trade_history_req.ts create mode 100644 sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts create mode 100644 sdk/node/src/generate/futures/order/api_order.template create mode 100644 sdk/node/src/generate/futures/order/api_order.test.ts create mode 100644 sdk/node/src/generate/futures/order/api_order.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_order_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_order_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_order_test_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_order_test_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_list_items.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_list_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_order_list_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_trade_history_items.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_trade_history_req.ts create mode 100644 sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/api_positions.template create mode 100644 sdk/node/src/generate/futures/positions/api_positions.test.ts create mode 100644 sdk/node/src/generate/futures/positions/api_positions.ts create mode 100644 sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_position_details_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_position_list_data.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_position_list_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts create mode 100644 sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts create mode 100644 sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/api_credit.template create mode 100644 sdk/node/src/generate/margin/credit/api_credit.test.ts create mode 100644 sdk/node/src/generate/margin/credit/api_credit.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_purchase_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_purchase_resp.ts create mode 100644 sdk/node/src/generate/margin/credit/model_redeem_req.ts create mode 100644 sdk/node/src/generate/margin/credit/model_redeem_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/api_debit.template create mode 100644 sdk/node/src/generate/margin/debit/api_debit.test.ts create mode 100644 sdk/node/src/generate/margin/debit/api_debit.ts create mode 100644 sdk/node/src/generate/margin/debit/model_borrow_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_borrow_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts create mode 100644 sdk/node/src/generate/margin/debit/model_repay_req.ts create mode 100644 sdk/node/src/generate/margin/debit/model_repay_resp.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/api_margin_private.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/api_margin_public.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts create mode 100644 sdk/node/src/generate/margin/market/api_market.template create mode 100644 sdk/node/src/generate/margin/market/api_market.test.ts create mode 100644 sdk/node/src/generate/margin/market/api_market.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_etf_info_data.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_etf_info_req.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts create mode 100644 sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts create mode 100644 sdk/node/src/generate/margin/order/api_order.template create mode 100644 sdk/node/src/generate/margin/order/api_order.test.ts create mode 100644 sdk/node/src/generate/margin/order/api_order.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_test_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_test_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_v1_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_open_orders_data.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_open_orders_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_trade_history_items.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_trade_history_req.ts create mode 100644 sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts create mode 100644 sdk/node/src/generate/margin/risklimit/api_risk_limit.template create mode 100644 sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts create mode 100644 sdk/node/src/generate/margin/risklimit/api_risk_limit.ts create mode 100644 sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts create mode 100644 sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts create mode 100644 sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts create mode 100644 sdk/node/src/generate/service/account_api.ts create mode 100644 sdk/node/src/generate/service/affiliate_api.ts create mode 100644 sdk/node/src/generate/service/broker_api.ts create mode 100644 sdk/node/src/generate/service/earn_api.ts create mode 100644 sdk/node/src/generate/service/futures_api.ts create mode 100644 sdk/node/src/generate/service/margin_api.ts create mode 100644 sdk/node/src/generate/service/spot_api.ts create mode 100644 sdk/node/src/generate/service/viplending_api.ts create mode 100644 sdk/node/src/generate/spot/market/api_market.template create mode 100644 sdk/node/src/generate/spot/market/api_market.test.ts create mode 100644 sdk/node/src/generate/spot/market/api_market.ts create mode 100644 sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_announcements_items.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_announcements_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_announcements_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_currency_chains.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_currency_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_currency_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_klines_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_klines_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_market_list_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_private_token_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_public_token_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_server_time_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_service_status_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_symbol_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_symbol_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_ticker_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_ticker_resp.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_trade_history_data.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_trade_history_req.ts create mode 100644 sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts create mode 100644 sdk/node/src/generate/spot/order/api_order.template create mode 100644 sdk/node/src/generate/spot/order/api_order.test.ts create mode 100644 sdk/node/src/generate/spot/order/api_order.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_oco_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_sync_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_test_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_order_test_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_stop_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_dcp_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_open_orders_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_open_orders_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_modify_order_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_modify_order_resp.ts create mode 100644 sdk/node/src/generate/spot/order/model_set_dcp_req.ts create mode 100644 sdk/node/src/generate/spot/order/model_set_dcp_resp.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/api_spot_private.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/model_account_event.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/api_spot_public.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_klines_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/model_trade_event.ts create mode 100644 sdk/node/src/generate/version.ts create mode 100644 sdk/node/src/generate/viplending/viplending/api_vip_lending.template create mode 100644 sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts create mode 100644 sdk/node/src/generate/viplending/viplending/api_vip_lending.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts create mode 100644 sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts create mode 100644 sdk/node/src/internal/infra/default_transport.ts create mode 100644 sdk/node/src/internal/infra/default_ws_service.ts create mode 100644 sdk/node/src/internal/rest/default_rest_impl.ts create mode 100644 sdk/node/src/internal/ws/default_ws_impl.ts diff --git a/Dockerfile b/Dockerfile index 29e732d6..e322e739 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,10 @@ RUN curl -OL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \ rm go${GOLANG_VERSION}.linux-amd64.tar.gz WORKDIR /APP COPY --from=generator-builder /build/target/sdk-openapi-generator-1.0.0.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar + +# node & npm +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - +RUN apt-get install -y nodejs RUN npm install -g prettier ENV CGO_ENABLED=0 @@ -39,7 +43,7 @@ ENV PATH="$GOPATH/bin:$PATH" ENV GO_POST_PROCESS_FILE="/usr/local/go/bin/gofmt -w" ENV PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i" -ENV TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write" +ENV TS_POST_PROCESS_FILE="/usr/bin/prettier --write" ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Makefile b/Makefile index 8f563b22..4893f318 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ define generate-code @echo "$(GREEN)lang: $(lang), clean...$(NC)" docker run --rm -v "${PWD}:/local" $(IMAGE_NAME):$(IMAGE_TAG) rm -rf $(outdir) - @make -f generate.mk generate lang=$(1) subdir=$(2) + @make -f generate.mk generate lang=$(1) subdir=$(2) USER_VERSION=$(3) @echo "$(GREEN)lang: $(lang), clean...$(NC)" docker run --rm -v "${PWD}:/local" $(IMAGE_NAME):$(IMAGE_TAG) rm -rf $(outdir)/.openapi-generator @@ -93,7 +93,7 @@ generate: setup-logs $(call generate-postman) $(call generate-code,golang,/pkg/generate) $(call generate-code,python,/kucoin_universal_sdk/generate) - $(call generate-code,node,/src/generate) + $(call generate-code,node,/src/generate,v0.1.0-alpha) .PHONY: gen-postman gen-postman: preprocessor diff --git a/generate.mk b/generate.mk index 0c3e64f3..2197652e 100644 --- a/generate.mk +++ b/generate.mk @@ -1,8 +1,11 @@ IMAGE_NAME=sdk-tools IMAGE_TAG=1.0 -VERSION := $(shell cat VERSION) DATE := $(shell date +%Y-%m-%d) +FILE_VERSION := $(shell cat VERSION) +USER_VERSION ?= +VERSION := $(if $(USER_VERSION),$(USER_VERSION),$(FILE_VERSION)) + RED=\033[0;31m GREEN=\033[0;32m NC=\033[0m diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache index 9ba7e6ee..f92e434f 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_ws.mustache @@ -14,7 +14,7 @@ export interface {{classname}} { * {{notes}} * push frequency: {{vendorExtensions.x-push_frequency}} */ - {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} :string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise {{/operation}} /** @@ -44,13 +44,13 @@ export class {{classname}}Impl implements {{classname}} { {{#operations}} {{#operation}} - {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise { + {{vendorExtensions.x-meta.method}}{{operationName}}({{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}}{{#type.simple}}{{paras}} :string,{{/type.simple}}{{#type.array}}{{paras}} :Array,{{/type.array}}{{#type.object}}{{#paras}}{{.}} :string,{{/paras}}{{/type.object}}{{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}}callback :{{vendorExtensions.x-meta.methodServiceFmt}}EventCallback) :Promise { let topicPrefix = "{{vendorExtensions.x-meta.otherProperties.topic}}" {{#vendorExtensions.x-meta.otherProperties}}{{#parameters}}{{#type}} {{#type.none}}let args :string[] = []{{/type.none}} {{#type.simple}}let args:string[] = [ {{#paras}}{{.}}{{/paras}}] {{/type.simple}} {{#type.array}}let args:string[] = {{paras}}{{/type.array}} - {{#type.object}}let args:string[] = [Array.join(([{{#paras}}{{.}},{{/paras}}], "_")]{{/type.object}} + {{#type.object}}let args:string[] = [[{{#paras}}{{.}},{{/paras}}].join("_")]{{/type.object}} {{/type}}{{/parameters}}{{/vendorExtensions.x-meta.otherProperties}} return this.wsService.subscribe(topicPrefix, args, new {{vendorExtensions.x-meta.methodServiceFmt}}EventCallbackWrapper(callback)) } diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 0458ef4f..141ba88c 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -12,7 +12,7 @@ export class {{classname}} implements Response<{{classname}}, WsMessage>{ {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; -export class {{classname}} implements Serializable{ +export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-response-model}} {{#vars}} diff --git a/sdk/node/src/api/api_rest.ts b/sdk/node/src/api/api_rest.ts index 94c63ec8..995413d9 100644 --- a/sdk/node/src/api/api_rest.ts +++ b/sdk/node/src/api/api_rest.ts @@ -1,41 +1,50 @@ +import { AccountService } from '@generate/service/account_api'; +import { AffiliateService } from '@generate/service/affiliate_api'; +import { BrokerService } from '@generate/service/broker_api'; +import { EarnService } from '@generate/service/earn_api'; +import { FuturesService } from '@generate/service/futures_api'; +import { MarginService } from '@generate/service/margin_api'; +import { SpotService } from '@generate/service/spot_api'; +import { VIPLendingService } from '@generate/service/viplending_api'; + export interface KucoinRestService { /** * AccountService provides functions to access and manipulate account related data. */ - GetAccountService(): AccountService; + getAccountService(): AccountService; /** * AffiliateService provides functions to access affiliate-related data. */ - GetAffiliateService(): AffiliateService; + getAffiliateService(): AffiliateService; /** * BrokerService provides functions to access and manage broker-related data. */ - GetBrokerService(): BrokerService; + getBrokerService(): BrokerService; /** * EarnService provides functions to access and manage earn-related data. */ - GetEarnService(): EarnService; + getEarnService(): EarnService; /** * FuturesService provides functions to perform actions in the futures market. */ - GetFuturesService(): FuturesService; + getFuturesService(): FuturesService; /** * MarginService provides functions to access and manage margin-related data. */ - GetMarginService(): MarginService; + getMarginService(): MarginService; /** * SpotService provides functions to perform actions in the spot market. */ - GetSpotService(): SpotService; + getSpotService(): SpotService; /** * VipLendingService provides functions to access and manage VIP lending-related data. */ - GetVipLendingService(): ViplendingService; + getVipLendingService(): VIPLendingService; } diff --git a/sdk/node/src/api/api_ws.ts b/sdk/node/src/api/api_ws.ts index 6d5b3de6..156f126b 100644 --- a/sdk/node/src/api/api_ws.ts +++ b/sdk/node/src/api/api_ws.ts @@ -1,33 +1,38 @@ - +import { SpotPublicWS } from '@generate/spot/spotpublic/api_spot_public'; +import { SpotPrivateWS } from '@generate/spot/spotprivate/api_spot_private'; +import { MarginPublicWS } from '@generate/margin/marginpublic/api_margin_public'; +import { MarginPrivateWS } from '@generate/margin/marginprivate/api_margin_private'; +import { FuturesPublicWS } from '@generate/futures/futurespublic/api_futures_public'; +import { FuturesPrivateWS } from '@generate/futures/futuresprivate/api_futures_private'; export interface KucoinWSService { - /** - * Returns the interface to interact with the Spot Trading WebSocket (public channel) API of KuCoin. - */ - NewSpotPublicWS(): SpotPublicWS; + /** + * Returns the interface to interact with the Spot Trading WebSocket (public channel) API of KuCoin. + */ + newSpotPublicWS(): SpotPublicWS; - /** - * Returns the interface to interact with the Spot Trading WebSocket (private channel) API of KuCoin. - */ - NewSpotPrivateWS(): SpotPrivateWS; + /** + * Returns the interface to interact with the Spot Trading WebSocket (private channel) API of KuCoin. + */ + newSpotPrivateWS(): SpotPrivateWS; - /** - * Returns the interface to interact with the Margin Trading WebSocket (public channel) API of KuCoin. - */ - NewMarginPublicWS(): MarginPublicWS; + /** + * Returns the interface to interact with the Margin Trading WebSocket (public channel) API of KuCoin. + */ + newMarginPublicWS(): MarginPublicWS; - /** - * Returns the interface to interact with the Margin Trading WebSocket (private channel) API of KuCoin. - */ - NewMarginPrivateWS(): MarginPrivateWS; + /** + * Returns the interface to interact with the Margin Trading WebSocket (private channel) API of KuCoin. + */ + newMarginPrivateWS(): MarginPrivateWS; - /** - * Returns the interface to interact with the Futures Trading WebSocket (public channel) API of KuCoin. - */ - NewFuturesPublicWS(): FuturesPublicWS; + /** + * Returns the interface to interact with the Futures Trading WebSocket (public channel) API of KuCoin. + */ + newFuturesPublicWS(): FuturesPublicWS; - /** - * Returns the interface to interact with the Futures Trading WebSocket (private channel) API of KuCoin. - */ - NewFuturesPrivateWS(): FuturesPrivateWS; -} \ No newline at end of file + /** + * Returns the interface to interact with the Futures Trading WebSocket (private channel) API of KuCoin. + */ + newFuturesPrivateWS(): FuturesPrivateWS; +} diff --git a/sdk/node/src/api/client.ts b/sdk/node/src/api/client.ts index 8eaff456..645d853a 100644 --- a/sdk/node/src/api/client.ts +++ b/sdk/node/src/api/client.ts @@ -46,6 +46,9 @@ Data and Message Handling: import { KucoinRestService } from './api_rest'; import { KucoinWSService } from './api_ws'; +import { DefaultKucoinRestAPIImpl } from '@internal/rest/default_rest_impl'; +import { ClientOption } from '@model/client_option'; +import { KucoinDefaultWsImpl } from '@internal/ws/default_ws_impl'; /** * Client interface defines the methods to get REST and WebSocket services. @@ -66,12 +69,12 @@ export interface Client { * DefaultClient provides the default implementation of the Client interface. */ export class DefaultClient implements Client { - private restImpl: KuCoinDefaultRestImpl; - private wsImpl: KuCoinDefaultWsImpl; + private restImpl: KucoinRestService; + private wsImpl: KucoinWSService; constructor(op: ClientOption) { - this.restImpl = new KuCoinDefaultRestImpl(op); - this.wsImpl = new KuCoinDefaultWsImpl(op); + this.restImpl = new DefaultKucoinRestAPIImpl(op); + this.wsImpl = new KucoinDefaultWsImpl(op); } /** diff --git a/sdk/node/src/generate/account/account/api_account.template b/sdk/node/src/generate/account/account/api_account.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/account/api_account.test.ts b/sdk/node/src/generate/account/account/api_account.test.ts new file mode 100644 index 00000000..7eff14a9 --- /dev/null +++ b/sdk/node/src/generate/account/account/api_account.test.ts @@ -0,0 +1,436 @@ +import { GetFuturesLedgerReq } from './model_get_futures_ledger_req'; +import { GetCrossMarginAccountReq } from './model_get_cross_margin_account_req'; +import { GetAccountInfoResp } from './model_get_account_info_resp'; +import { GetIsolatedMarginAccountListV1Req } from './model_get_isolated_margin_account_list_v1_req'; +import { GetFuturesAccountReq } from './model_get_futures_account_req'; +import { GetCrossMarginAccountResp } from './model_get_cross_margin_account_resp'; +import { GetSpotLedgerReq } from './model_get_spot_ledger_req'; +import { GetSpotAccountListReq } from './model_get_spot_account_list_req'; +import { GetSpotAccountDetailReq } from './model_get_spot_account_detail_req'; +import { GetMarginHFLedgerResp } from './model_get_margin_hf_ledger_resp'; +import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; +import { GetFuturesAccountResp } from './model_get_futures_account_resp'; +import { GetIsolatedMarginAccountDetailV1Req } from './model_get_isolated_margin_account_detail_v1_req'; +import { GetSpotHFLedgerResp } from './model_get_spot_hf_ledger_resp'; +import { GetSpotLedgerResp } from './model_get_spot_ledger_resp'; +import { GetIsolatedMarginAccountDetailV1Resp } from './model_get_isolated_margin_account_detail_v1_resp'; +import { GetIsolatedMarginAccountResp } from './model_get_isolated_margin_account_resp'; +import { GetSpotHFLedgerReq } from './model_get_spot_hf_ledger_req'; +import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; +import { GetFuturesLedgerResp } from './model_get_futures_ledger_resp'; +import { GetSpotAccountListResp } from './model_get_spot_account_list_resp'; +import { GetMarginAccountDetailResp } from './model_get_margin_account_detail_resp'; +import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; +import { GetIsolatedMarginAccountListV1Resp } from './model_get_isolated_margin_account_list_v1_resp'; +import { GetSpotAccountDetailResp } from './model_get_spot_account_detail_resp'; +import { GetSpotAccountTypeResp } from './model_get_spot_account_type_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getFuturesAccount request test', () => { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let data = '{"currency": "USDT"}'; + let req = new GetFuturesAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFuturesAccount response test', () => { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let data = + '{\n "code": "200000",\n "data": {\n "currency": "USDT",\n "accountEquity": 48.921913718,\n "unrealisedPNL": 1.59475,\n "marginBalance": 47.548728628,\n "positionMargin": 34.1577964733,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 14.7876172447,\n "riskRatio": 0.0090285199\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFuturesAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotAccountDetail request test', () => { + /** + * getSpotAccountDetail + * Get Account Detail - Spot + * /api/v1/accounts/{accountId} + */ + let data = '{"accountId": "548674591753"}'; + let req = new GetSpotAccountDetailReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotAccountDetail response test', () => { + /** + * getSpotAccountDetail + * Get Account Detail - Spot + * /api/v1/accounts/{accountId} + */ + let data = + '{"code":"200000","data":{"currency":"USDT","balance":"26.66759503","available":"26.66759503","holds":"0"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotAccountDetailResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotAccountList request test', () => { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let data = '{"currency": "USDT", "type": "main"}'; + let req = new GetSpotAccountListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotAccountList response test', () => { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "548674591753",\n "currency": "USDT",\n "type": "trade",\n "balance": "26.66759503",\n "available": "26.66759503",\n "holds": "0"\n },\n {\n "id": "63355cd156298d0001b66e61",\n "currency": "USDT",\n "type": "main",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotAccountListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotLedger request test', () => { + /** + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers + */ + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetSpotLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotLedger response test', () => { + /** + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "265329987780896",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "balance": "0",\n "accountType": "TRADE",\n "bizType": "SUB_TRANSFER",\n "direction": "out",\n "createdAt": 1728658481484,\n "context": ""\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotLedgerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotHFLedger request test', () => { + /** + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers + */ + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetSpotHFLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotHFLedger response test', () => { + /** + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "254062248624417",\n "currency": "USDT",\n "amount": "1.59760080",\n "fee": "0.00159920",\n "tax": "0",\n "balance": "26.73759503",\n "accountType": "TRADE_HF",\n "bizType": "TRADE_EXCHANGE",\n "direction": "in",\n "createdAt": "1728443957539",\n "context": "{\\"symbol\\":\\"KCS-USDT\\",\\"orderId\\":\\"6705f6350dc7210007d6a36d\\",\\"tradeId\\":\\"10046097631627265\\"}"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotHFLedgerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotAccountType request test', () => { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + }); + + test('getSpotAccountType response test', () => { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + }); + test('getIsolatedMarginAccountDetailV1 request test', () => { + /** + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} + */ + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetIsolatedMarginAccountDetailV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getIsolatedMarginAccountDetailV1 response test', () => { + /** + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetIsolatedMarginAccountDetailV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getIsolatedMarginAccountListV1 request test', () => { + /** + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts + */ + let data = '{"balanceCurrency": "USDT"}'; + let req = new GetIsolatedMarginAccountListV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getIsolatedMarginAccountListV1 response test', () => { + /** + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts + */ + let data = + '{\n "code": "200000",\n "data": {\n "totalConversionBalance": "0.01",\n "liabilityConversionBalance": "0",\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetIsolatedMarginAccountListV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMarginAccountDetail request test', () => { + /** + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account + */ + }); + + test('getMarginAccountDetail response test', () => { + /** + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account + */ + }); + test('getFuturesLedger request test', () => { + /** + * getFuturesLedger + * Get Account Ledgers - Futures + * /api/v1/transaction-history + */ + let data = + '{"currency": "XBT", "type": "Transferin", "offset": 254062248624417, "forward": true, "maxCount": 50, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetFuturesLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFuturesLedger response test', () => { + /** + * getFuturesLedger + * Get Account Ledgers - Futures + * /api/v1/transaction-history + */ + let data = + '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "time": 1728665747000,\n "type": "TransferIn",\n "amount": 0.01,\n "fee": 0.0,\n "accountEquity": 14.02924938,\n "status": "Completed",\n "remark": "Transferred from High-Frequency Trading Account",\n "offset": 51360793,\n "currency": "USDT"\n },\n {\n "time": 1728648000000,\n "type": "RealisedPNL",\n "amount": 0.00630042,\n "fee": 0.0,\n "accountEquity": 20.0,\n "status": "Completed",\n "remark": "XBTUSDTM",\n "offset": 51352430,\n "currency": "USDT"\n }\n ],\n "hasMore": false\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFuturesLedgerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getApikeyInfo request test', () => { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + }); + + test('getApikeyInfo response test', () => { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + }); + test('getAccountInfo request test', () => { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + }); + + test('getAccountInfo response test', () => { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + }); + test('getMarginHFLedger request test', () => { + /** + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers + */ + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetMarginHFLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMarginHFLedger response test', () => { + /** + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers + */ + let data = + '{"code":"200000","data":[{"id":1949641706720,"currency":"USDT","amount":"0.01000000","fee":"0.00000000","balance":"0.01000000","accountType":"MARGIN_V2","bizType":"TRANSFER","direction":"in","createdAt":1728664091208,"context":"{}","tax":"0.00000000"}]}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarginHFLedgerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getIsolatedMarginAccount request test', () => { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let data = + '{"symbol": "example_string_default_value", "quoteCurrency": "USDT", "queryType": "ISOLATED"}'; + let req = new GetIsolatedMarginAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getIsolatedMarginAccount response test', () => { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let data = + '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.01",\n "totalLiabilityOfQuoteCurrency": "0",\n "timestamp": 1728725465994,\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "EFFECTIVE",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0",\n "available": "0",\n "hold": "0",\n "maxBorrowSize": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0.01",\n "available": "0.01",\n "hold": "0",\n "maxBorrowSize": "0"\n }\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetIsolatedMarginAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getCrossMarginAccount request test', () => { + /** + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts + */ + let data = '{"quoteCurrency": "USDT", "queryType": "MARGIN"}'; + let req = new GetCrossMarginAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCrossMarginAccount response test', () => { + /** + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts + */ + let data = + '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.02",\n "totalLiabilityOfQuoteCurrency": "0",\n "debtRatio": "0",\n "status": "EFFECTIVE",\n "accounts": [\n {\n "currency": "USDT",\n "total": "0.02",\n "available": "0.02",\n "hold": "0",\n "liability": "0",\n "maxBorrowSize": "0",\n "borrowEnabled": true,\n "transferInEnabled": true\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCrossMarginAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/account/api_account.ts b/sdk/node/src/generate/account/account/api_account.ts new file mode 100644 index 00000000..5ebcd871 --- /dev/null +++ b/sdk/node/src/generate/account/account/api_account.ts @@ -0,0 +1,470 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetFuturesLedgerReq } from './model_get_futures_ledger_req'; +import { GetCrossMarginAccountReq } from './model_get_cross_margin_account_req'; +import { GetAccountInfoResp } from './model_get_account_info_resp'; +import { GetIsolatedMarginAccountListV1Req } from './model_get_isolated_margin_account_list_v1_req'; +import { GetFuturesAccountReq } from './model_get_futures_account_req'; +import { GetCrossMarginAccountResp } from './model_get_cross_margin_account_resp'; +import { GetSpotLedgerReq } from './model_get_spot_ledger_req'; +import { GetSpotAccountListReq } from './model_get_spot_account_list_req'; +import { GetSpotAccountDetailReq } from './model_get_spot_account_detail_req'; +import { GetMarginHFLedgerResp } from './model_get_margin_hf_ledger_resp'; +import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; +import { GetFuturesAccountResp } from './model_get_futures_account_resp'; +import { GetIsolatedMarginAccountDetailV1Req } from './model_get_isolated_margin_account_detail_v1_req'; +import { GetSpotHFLedgerResp } from './model_get_spot_hf_ledger_resp'; +import { GetSpotLedgerResp } from './model_get_spot_ledger_resp'; +import { GetIsolatedMarginAccountDetailV1Resp } from './model_get_isolated_margin_account_detail_v1_resp'; +import { GetIsolatedMarginAccountResp } from './model_get_isolated_margin_account_resp'; +import { GetSpotHFLedgerReq } from './model_get_spot_hf_ledger_req'; +import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; +import { GetFuturesLedgerResp } from './model_get_futures_ledger_resp'; +import { GetSpotAccountListResp } from './model_get_spot_account_list_resp'; +import { GetMarginAccountDetailResp } from './model_get_margin_account_detail_resp'; +import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; +import { GetIsolatedMarginAccountListV1Resp } from './model_get_isolated_margin_account_list_v1_resp'; +import { GetSpotAccountDetailResp } from './model_get_spot_account_detail_resp'; +import { GetSpotAccountTypeResp } from './model_get_spot_account_type_resp'; + +export interface AccountAPI { + /** + * getFuturesAccount Get Account - Futures + * Description: Request via this endpoint to get the info of the futures account. + * Documentation: https://www.kucoin.com/docs-new/api-3470129 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getFuturesAccount(req: GetFuturesAccountReq): Promise; + + /** + * getSpotAccountDetail Get Account Detail - Spot + * Description: get Information for a single spot account. Use this endpoint when you know the accountId. + * Documentation: https://www.kucoin.com/docs-new/api-3470126 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise; + + /** + * getSpotAccountList Get Account List - Spot + * Description: Get a list of accounts. Please Deposit to the main account firstly, then transfer the funds to the trade account via Inner Transfer before transaction. + * Documentation: https://www.kucoin.com/docs-new/api-3470125 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getSpotAccountList(req: GetSpotAccountListReq): Promise; + + /** + * getSpotLedger Get Account Ledgers - Spot/Margin + * Description: This interface is for transaction records from all types of your accounts, supporting inquiry of various currencies. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470121 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 2 | + * +---------------------+------------+ + */ + getSpotLedger(req: GetSpotLedgerReq): Promise; + + /** + * getSpotHFLedger Get Account Ledgers - Trade_hf + * Description: This API endpoint returns all transfer (in and out) records in high-frequency trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. + * Documentation: https://www.kucoin.com/docs-new/api-3470122 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSpotHFLedger(req: GetSpotHFLedgerReq): Promise; + + /** + * getSpotAccountType Get Account Type - Spot + * Description: This interface determines whether the current user is a spot high-frequency user or a spot low-frequency user. + * Documentation: https://www.kucoin.com/docs-new/api-3470120 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 30 | + * +---------------------+---------+ + */ + getSpotAccountType(): Promise; + + /** + * @deprecated + * getIsolatedMarginAccountDetailV1 Get Account Detail - Isolated Margin - V1 + * Description: Request via this endpoint to get the info of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470315 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 50 | + * +---------------------+---------+ + */ + getIsolatedMarginAccountDetailV1( + req: GetIsolatedMarginAccountDetailV1Req, + ): Promise; + + /** + * @deprecated + * getIsolatedMarginAccountListV1 Get Account List - Isolated Margin - V1 + * Description: Request via this endpoint to get the info list of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470314 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 50 | + * +---------------------+---------+ + */ + getIsolatedMarginAccountListV1( + req: GetIsolatedMarginAccountListV1Req, + ): Promise; + + /** + * @deprecated + * getMarginAccountDetail Get Account Detail - Margin + * Description: Request via this endpoint to get the info of the margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470311 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 40 | + * +---------------------+---------+ + */ + getMarginAccountDetail(): Promise; + + /** + * getFuturesLedger Get Account Ledgers - Futures + * Description: This interface can query the ledger records of the futures business line + * Documentation: https://www.kucoin.com/docs-new/api-3470124 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getFuturesLedger(req: GetFuturesLedgerReq): Promise; + + /** + * getApikeyInfo Get Apikey Info + * Description: Get the information of the api key. Use the api key pending to be checked to call the endpoint. Both master and sub user\'s api key are applicable. + * Documentation: https://www.kucoin.com/docs-new/api-3470130 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getApikeyInfo(): Promise; + + /** + * getAccountInfo Get Account Summary Info + * Description: This endpoint can be used to obtain account summary information. + * Documentation: https://www.kucoin.com/docs-new/api-3470119 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getAccountInfo(): Promise; + + /** + * getMarginHFLedger Get Account Ledgers - Margin_hf + * Description: This API endpoint returns all transfer (in and out) records in high-frequency margin trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. + * Documentation: https://www.kucoin.com/docs-new/api-3470123 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getMarginHFLedger(req: GetMarginHFLedgerReq): Promise; + + /** + * getIsolatedMarginAccount Get Account - Isolated Margin + * Description: Request via this endpoint to get the info of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470128 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + getIsolatedMarginAccount( + req: GetIsolatedMarginAccountReq, + ): Promise; + + /** + * getCrossMarginAccount Get Account - Cross Margin + * Description: Request via this endpoint to get the info of the cross margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470127 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise; +} + +export class AccountAPIImpl implements AccountAPI { + constructor(private transport: Transport) {} + + getFuturesAccount(req: GetFuturesAccountReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/account-overview', + req, + new GetFuturesAccountResp(), + false, + ); + } + + getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/accounts/{accountId}', + req, + new GetSpotAccountDetailResp(), + false, + ); + } + + getSpotAccountList(req: GetSpotAccountListReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/accounts', + req, + new GetSpotAccountListResp(), + false, + ); + } + + getSpotLedger(req: GetSpotLedgerReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/accounts/ledgers', + req, + new GetSpotLedgerResp(), + false, + ); + } + + getSpotHFLedger(req: GetSpotHFLedgerReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/accounts/ledgers', + req, + new GetSpotHFLedgerResp(), + false, + ); + } + + getSpotAccountType(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/accounts/opened', + null, + new GetSpotAccountTypeResp(), + false, + ); + } + + getIsolatedMarginAccountDetailV1( + req: GetIsolatedMarginAccountDetailV1Req, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/isolated/account/{symbol}', + req, + new GetIsolatedMarginAccountDetailV1Resp(), + false, + ); + } + + getIsolatedMarginAccountListV1( + req: GetIsolatedMarginAccountListV1Req, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/isolated/accounts', + req, + new GetIsolatedMarginAccountListV1Resp(), + false, + ); + } + + getMarginAccountDetail(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/margin/account', + null, + new GetMarginAccountDetailResp(), + false, + ); + } + + getFuturesLedger(req: GetFuturesLedgerReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/transaction-history', + req, + new GetFuturesLedgerResp(), + false, + ); + } + + getApikeyInfo(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/user/api-key', + null, + new GetApikeyInfoResp(), + false, + ); + } + + getAccountInfo(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/user-info', + null, + new GetAccountInfoResp(), + false, + ); + } + + getMarginHFLedger(req: GetMarginHFLedgerReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/account/ledgers', + req, + new GetMarginHFLedgerResp(), + false, + ); + } + + getIsolatedMarginAccount( + req: GetIsolatedMarginAccountReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/isolated/accounts', + req, + new GetIsolatedMarginAccountResp(), + false, + ); + } + + getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/accounts', + req, + new GetCrossMarginAccountResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts new file mode 100644 index 00000000..b9552073 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAccountInfoResp implements Response { + /** + * User VIP level + */ + level?: number; + /** + * Number of sub-accounts + */ + subQuantity?: number; + /** + * Number of sub-accounts with spot trading permissions enabled + */ + spotSubQuantity?: number; + /** + * Number of sub-accounts with margin trading permissions enabled + */ + marginSubQuantity?: number; + /** + * Number of sub-accounts with futures trading permissions enabled + */ + futuresSubQuantity?: number; + /** + * Number of sub-accounts with option trading permissions enabled + */ + optionSubQuantity?: number; + /** + * Max number of sub-accounts = maxDefaultSubQuantity + maxSpotSubQuantity + */ + maxSubQuantity?: number; + /** + * Max number of default open sub-accounts (according to VIP level) + */ + maxDefaultSubQuantity?: number; + /** + * Max number of sub-accounts with additional Spot trading permissions + */ + maxSpotSubQuantity?: number; + /** + * Max number of sub-accounts with additional margin trading permissions + */ + maxMarginSubQuantity?: number; + /** + * Max number of sub-accounts with additional futures trading permissions + */ + maxFuturesSubQuantity?: number; + /** + * Max number of sub-accounts with additional Option trading permissions + */ + maxOptionSubQuantity?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAccountInfoResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountInfoResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountInfoResp { + return plainToInstance(GetAccountInfoResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts new file mode 100644 index 00000000..01440d30 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts @@ -0,0 +1,65 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetApikeyInfoResp implements Response { + /** + * Remarks + */ + remark?: string; + /** + * Apikey + */ + apiKey?: string; + /** + * API Version + */ + apiVersion?: number; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144), possible values: General, Spot, Margin, Futures, InnerTransfer, Transfer, Earn + */ + permission?: string; + /** + * IP whitelist + */ + ipWhitelist?: string; + /** + * Apikey create time + */ + createdAt?: number; + /** + * Account UID + */ + uid?: number; + /** + * Whether it is the master account. + */ + isMaster?: boolean; + /** + * Sub Name, There is no such param for the master account + */ + subName?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetApikeyInfoResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetApikeyInfoResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetApikeyInfoResp { + return plainToInstance(GetApikeyInfoResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts new file mode 100644 index 00000000..578dac4c --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCrossMarginAccountAccounts implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Total Assets + */ + total?: string; + /** + * Account available assets (total assets - frozen) + */ + available?: string; + /** + * Account frozen assets + */ + hold?: string; + /** + * Liabilities + */ + liability?: string; + /** + * The user\'s remaining maximum loan amount + */ + maxBorrowSize?: string; + /** + * Support borrow or not + */ + borrowEnabled?: boolean; + /** + * Support transfer or not + */ + transferInEnabled?: boolean; + fromJson(input: string): GetCrossMarginAccountAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginAccountAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginAccountAccounts { + return plainToInstance(GetCrossMarginAccountAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts new file mode 100644 index 00000000..b153f0c6 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts @@ -0,0 +1,112 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCrossMarginAccountReq implements Serializable { + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + quoteCurrency?: GetCrossMarginAccountReq.QuoteCurrencyEnum = + GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT; + /** + * Query account type (default MARGIN), MARGIN - only query low frequency cross margin account, MARGIN_V2-only query high frequency cross margin account, ALL - consistent aggregate query with the web side + */ + queryType?: GetCrossMarginAccountReq.QueryTypeEnum = + GetCrossMarginAccountReq.QueryTypeEnum.MARGIN; + + /** + * Creates a new instance of the `GetCrossMarginAccountReq` class. + * The builder pattern allows step-by-step construction of a `GetCrossMarginAccountReq` object. + */ + static builder(): GetCrossMarginAccountReqBuilder { + return new GetCrossMarginAccountReqBuilder(); + } + + /** + * Creates a new instance of the `GetCrossMarginAccountReq` class with the given data. + */ + static create(data: { + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + quoteCurrency?: GetCrossMarginAccountReq.QuoteCurrencyEnum; + /** + * Query account type (default MARGIN), MARGIN - only query low frequency cross margin account, MARGIN_V2-only query high frequency cross margin account, ALL - consistent aggregate query with the web side + */ + queryType?: GetCrossMarginAccountReq.QueryTypeEnum; + }): GetCrossMarginAccountReq { + let obj = new GetCrossMarginAccountReq(); + obj.quoteCurrency = data.quoteCurrency; + obj.queryType = data.queryType; + return obj; + } + + fromJson(input: string): GetCrossMarginAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginAccountReq { + return plainToInstance(GetCrossMarginAccountReq, jsonObject); + } +} + +export namespace GetCrossMarginAccountReq { + export enum QuoteCurrencyEnum { + /** + * + */ + USDT = 'USDT', + /** + * + */ + KCS = 'KCS', + /** + * + */ + BTC = 'BTC', + } + export enum QueryTypeEnum { + /** + * + */ + MARGIN = 'MARGIN', + /** + * + */ + MARGIN_V2 = 'MARGIN_V2', + /** + * + */ + ALL = 'ALL', + } +} + +export class GetCrossMarginAccountReqBuilder { + obj: GetCrossMarginAccountReq = new GetCrossMarginAccountReq(); + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + setQuoteCurrency( + value: GetCrossMarginAccountReq.QuoteCurrencyEnum, + ): GetCrossMarginAccountReqBuilder { + this.obj.quoteCurrency = value; + return this; + } + + /** + * Query account type (default MARGIN), MARGIN - only query low frequency cross margin account, MARGIN_V2-only query high frequency cross margin account, ALL - consistent aggregate query with the web side + */ + setQueryType(value: GetCrossMarginAccountReq.QueryTypeEnum): GetCrossMarginAccountReqBuilder { + this.obj.queryType = value; + return this; + } + + build(): GetCrossMarginAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts new file mode 100644 index 00000000..ca5baf3a --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetCrossMarginAccountAccounts } from './model_get_cross_margin_account_accounts'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetCrossMarginAccountResp + implements Response +{ + /** + * Total Assets in Quote Currency + */ + totalAssetOfQuoteCurrency?: string; + /** + * Total Liability in Quote Currency + */ + totalLiabilityOfQuoteCurrency?: string; + /** + * debt ratio + */ + debtRatio?: string; + /** + * Position status; EFFECTIVE-effective, BANKRUPTCY-bankruptcy liquidation, LIQUIDATION-closing, REPAY-repayment, BORROW borrowing + */ + status?: GetCrossMarginAccountResp.StatusEnum; + /** + * Margin account list + */ + @Type(() => GetCrossMarginAccountAccounts) + accounts?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetCrossMarginAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginAccountResp { + return plainToInstance(GetCrossMarginAccountResp, jsonObject); + } +} + +export namespace GetCrossMarginAccountResp { + export enum StatusEnum { + /** + * Effective + */ + EFFECTIVE = 'EFFECTIVE', + /** + * Bankruptcy liquidation + */ + BANKRUPTCY = 'BANKRUPTCY', + /** + * Closing + */ + LIQUIDATION = 'LIQUIDATION', + /** + * Repayment + */ + REPAY = 'REPAY', + /** + * Borrowing + */ + BORROW = 'BORROW', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts new file mode 100644 index 00000000..884993c9 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesAccountReq implements Serializable { + /** + * Currecny, Default XBT + */ + currency?: string = 'XBT'; + + /** + * Creates a new instance of the `GetFuturesAccountReq` class. + * The builder pattern allows step-by-step construction of a `GetFuturesAccountReq` object. + */ + static builder(): GetFuturesAccountReqBuilder { + return new GetFuturesAccountReqBuilder(); + } + + /** + * Creates a new instance of the `GetFuturesAccountReq` class with the given data. + */ + static create(data: { + /** + * Currecny, Default XBT + */ + currency?: string; + }): GetFuturesAccountReq { + let obj = new GetFuturesAccountReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetFuturesAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesAccountReq { + return plainToInstance(GetFuturesAccountReq, jsonObject); + } +} + +export class GetFuturesAccountReqBuilder { + obj: GetFuturesAccountReq = new GetFuturesAccountReq(); + /** + * Currecny, Default XBT + */ + setCurrency(value: string): GetFuturesAccountReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetFuturesAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts new file mode 100644 index 00000000..f9ceee00 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts @@ -0,0 +1,65 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFuturesAccountResp implements Response { + /** + * Account equity = marginBalance + Unrealised PNL + */ + accountEquity?: number; + /** + * Unrealised profit and loss + */ + unrealisedPNL?: number; + /** + * Margin balance = positionMargin + orderMargin + frozenFunds + availableBalance - unrealisedPNL + */ + marginBalance?: number; + /** + * Position margin + */ + positionMargin?: number; + /** + * Order margin + */ + orderMargin?: number; + /** + * Frozen funds for out-transfer + */ + frozenFunds?: number; + /** + * Available balance + */ + availableBalance?: number; + /** + * Currency + */ + currency?: string; + /** + * Cross margin risk rate + */ + riskRatio?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFuturesAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesAccountResp { + return plainToInstance(GetFuturesAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts new file mode 100644 index 00000000..d45bd6f4 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts @@ -0,0 +1,54 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesLedgerDataList implements Serializable { + /** + * ledger time + */ + time?: number; + /** + * Type: RealisedPNL, Deposit, Withdrawal, TransferIn, TransferOut + */ + type?: string; + /** + * Transaction amount + */ + amount?: number; + /** + * Fee + */ + fee?: number; + /** + * Account equity + */ + accountEquity?: number; + /** + * Status: Completed, Pending + */ + status?: string; + /** + * Ticker symbol of the contract + */ + remark?: string; + /** + * Offset + */ + offset?: number; + /** + * Currency + */ + currency?: string; + fromJson(input: string): GetFuturesLedgerDataList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesLedgerDataList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesLedgerDataList { + return plainToInstance(GetFuturesLedgerDataList, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts new file mode 100644 index 00000000..ab1c5c94 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesLedgerReq implements Serializable { + /** + * Currency of transaction history, XBT or USDT + */ + currency?: string; + /** + * Type RealisedPNL-Realised profit and loss, Deposit-Deposit, Withdrawal-withdraw, Transferin-Transfer in, TransferOut-Transfer out + */ + type?: string; + /** + * Start offset. Generally, the only attribute of the last returned result of the previous request is used, and the first page is returned by default + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean = true; + /** + * Displayed size per page. The default size is 50 + */ + maxCount?: number = 50; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetFuturesLedgerReq` class. + * The builder pattern allows step-by-step construction of a `GetFuturesLedgerReq` object. + */ + static builder(): GetFuturesLedgerReqBuilder { + return new GetFuturesLedgerReqBuilder(); + } + + /** + * Creates a new instance of the `GetFuturesLedgerReq` class with the given data. + */ + static create(data: { + /** + * Currency of transaction history, XBT or USDT + */ + currency?: string; + /** + * Type RealisedPNL-Realised profit and loss, Deposit-Deposit, Withdrawal-withdraw, Transferin-Transfer in, TransferOut-Transfer out + */ + type?: string; + /** + * Start offset. Generally, the only attribute of the last returned result of the previous request is used, and the first page is returned by default + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Displayed size per page. The default size is 50 + */ + maxCount?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetFuturesLedgerReq { + let obj = new GetFuturesLedgerReq(); + obj.currency = data.currency; + obj.type = data.type; + obj.offset = data.offset; + obj.forward = data.forward; + obj.maxCount = data.maxCount; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetFuturesLedgerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesLedgerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesLedgerReq { + return plainToInstance(GetFuturesLedgerReq, jsonObject); + } +} + +export class GetFuturesLedgerReqBuilder { + obj: GetFuturesLedgerReq = new GetFuturesLedgerReq(); + /** + * Currency of transaction history, XBT or USDT + */ + setCurrency(value: string): GetFuturesLedgerReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Type RealisedPNL-Realised profit and loss, Deposit-Deposit, Withdrawal-withdraw, Transferin-Transfer in, TransferOut-Transfer out + */ + setType(value: string): GetFuturesLedgerReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Start offset. Generally, the only attribute of the last returned result of the previous request is used, and the first page is returned by default + */ + setOffset(value: number): GetFuturesLedgerReqBuilder { + this.obj.offset = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setForward(value: boolean): GetFuturesLedgerReqBuilder { + this.obj.forward = value; + return this; + } + + /** + * Displayed size per page. The default size is 50 + */ + setMaxCount(value: number): GetFuturesLedgerReqBuilder { + this.obj.maxCount = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetFuturesLedgerReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetFuturesLedgerReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetFuturesLedgerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts new file mode 100644 index 00000000..07d556e3 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetFuturesLedgerDataList } from './model_get_futures_ledger_data_list'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFuturesLedgerResp implements Response { + /** + * + */ + @Type(() => GetFuturesLedgerDataList) + dataList?: Array; + /** + * Is it the last page. If it is false, it means it is the last page, and if it is true, it means need to turn the page. + */ + hasMore?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFuturesLedgerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesLedgerResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesLedgerResp { + return plainToInstance(GetFuturesLedgerResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts new file mode 100644 index 00000000..b3848c95 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts @@ -0,0 +1,69 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetIsolatedMarginAccountAssetsBaseAsset } from './model_get_isolated_margin_account_assets_base_asset'; +import { GetIsolatedMarginAccountAssetsQuoteAsset } from './model_get_isolated_margin_account_assets_quote_asset'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountAssets + implements Serializable +{ + /** + * Symbol + */ + symbol?: string; + /** + * Position status; EFFECTIVE-effective, BANKRUPTCY-bankruptcy liquidation, LIQUIDATION-closing, REPAY-repayment, BORROW borrowing + */ + status?: GetIsolatedMarginAccountAssets.StatusEnum; + /** + * debt ratio + */ + debtRatio?: string; + /** + * + */ + @Type(() => GetIsolatedMarginAccountAssetsBaseAsset) + baseAsset?: GetIsolatedMarginAccountAssetsBaseAsset; + /** + * + */ + @Type(() => GetIsolatedMarginAccountAssetsQuoteAsset) + quoteAsset?: GetIsolatedMarginAccountAssetsQuoteAsset; + fromJson(input: string): GetIsolatedMarginAccountAssets { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountAssets, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountAssets { + return plainToInstance(GetIsolatedMarginAccountAssets, jsonObject); + } +} + +export namespace GetIsolatedMarginAccountAssets { + export enum StatusEnum { + /** + * Effective + */ + EFFECTIVE = 'EFFECTIVE', + /** + * Bankruptcy liquidation + */ + BANKRUPTCY = 'BANKRUPTCY', + /** + * Closing + */ + LIQUIDATION = 'LIQUIDATION', + /** + * Repayment + */ + REPAY = 'REPAY', + /** + * Borrowing + */ + BORROW = 'BORROW', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts new file mode 100644 index 00000000..e265d4e5 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountAssetsBaseAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Support borrow or not + */ + borrowEnabled?: boolean; + /** + * Support transfer or not + */ + transferInEnabled?: boolean; + /** + * Liabilities + */ + liability?: string; + /** + * Total Assets + */ + total?: string; + /** + * Account available assets (total assets - frozen) + */ + available?: string; + /** + * Account frozen assets + */ + hold?: string; + /** + * The user\'s remaining maximum loan amount + */ + maxBorrowSize?: string; + fromJson(input: string): GetIsolatedMarginAccountAssetsBaseAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountAssetsBaseAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsBaseAsset { + return plainToInstance(GetIsolatedMarginAccountAssetsBaseAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts new file mode 100644 index 00000000..978133bf --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountAssetsQuoteAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Support borrow or not + */ + borrowEnabled?: boolean; + /** + * Support transfer or not + */ + transferInEnabled?: boolean; + /** + * Liabilities + */ + liability?: string; + /** + * Total Assets + */ + total?: string; + /** + * Account available assets (total assets - frozen) + */ + available?: string; + /** + * Account frozen assets + */ + hold?: string; + /** + * The user\'s remaining maximum loan amount + */ + maxBorrowSize?: string; + fromJson(input: string): GetIsolatedMarginAccountAssetsQuoteAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountAssetsQuoteAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsQuoteAsset { + return plainToInstance(GetIsolatedMarginAccountAssetsQuoteAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts new file mode 100644 index 00000000..da21b8a7 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountDetailV1BaseAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Current currency total asset amount + */ + totalBalance?: string; + /** + * Current currency holding asset amount + */ + holdBalance?: string; + /** + * Current available asset amount + */ + availableBalance?: string; + /** + * Liabilities + */ + liability?: string; + /** + * + */ + interest?: string; + /** + * + */ + borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountDetailV1BaseAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountDetailV1BaseAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1BaseAsset { + return plainToInstance(GetIsolatedMarginAccountDetailV1BaseAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts new file mode 100644 index 00000000..2af81dba --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountDetailV1QuoteAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Current currency total asset amount + */ + totalBalance?: string; + /** + * Current currency holding asset amount + */ + holdBalance?: string; + /** + * Current available asset amount + */ + availableBalance?: string; + /** + * Liabilities + */ + liability?: string; + /** + * + */ + interest?: string; + /** + * + */ + borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountDetailV1QuoteAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountDetailV1QuoteAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1QuoteAsset { + return plainToInstance(GetIsolatedMarginAccountDetailV1QuoteAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts new file mode 100644 index 00000000..c099aa82 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts @@ -0,0 +1,64 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountDetailV1Req + implements Serializable +{ + /** + * + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetIsolatedMarginAccountDetailV1Req` class. + * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountDetailV1Req` object. + */ + static builder(): GetIsolatedMarginAccountDetailV1ReqBuilder { + return new GetIsolatedMarginAccountDetailV1ReqBuilder(); + } + + /** + * Creates a new instance of the `GetIsolatedMarginAccountDetailV1Req` class with the given data. + */ + static create(data: { + /** + * + */ + symbol?: string; + }): GetIsolatedMarginAccountDetailV1Req { + let obj = new GetIsolatedMarginAccountDetailV1Req(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetIsolatedMarginAccountDetailV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountDetailV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Req { + return plainToInstance(GetIsolatedMarginAccountDetailV1Req, jsonObject); + } +} + +export class GetIsolatedMarginAccountDetailV1ReqBuilder { + obj: GetIsolatedMarginAccountDetailV1Req = new GetIsolatedMarginAccountDetailV1Req(); + /** + * + */ + setSymbol(value: string): GetIsolatedMarginAccountDetailV1ReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetIsolatedMarginAccountDetailV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts new file mode 100644 index 00000000..d6f42c83 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts @@ -0,0 +1,88 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetIsolatedMarginAccountDetailV1BaseAsset } from './model_get_isolated_margin_account_detail_v1_base_asset'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetIsolatedMarginAccountDetailV1QuoteAsset } from './model_get_isolated_margin_account_detail_v1_quote_asset'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetIsolatedMarginAccountDetailV1Resp + implements Response +{ + /** + * Symbol + */ + symbol?: string; + /** + * The position status: Existing liabilities-DEBT, No liabilities-CLEAR, Bankrupcy (after position enters a negative balance)-BANKRUPTCY, Existing borrowings-IN_BORROW, Existing repayments-IN_REPAY, Under liquidation-IN_LIQUIDATION, Under auto-renewal assets-IN_AUTO_RENEW . + */ + status?: GetIsolatedMarginAccountDetailV1Resp.StatusEnum; + /** + * debt ratio + */ + debtRatio?: string; + /** + * + */ + @Type(() => GetIsolatedMarginAccountDetailV1BaseAsset) + baseAsset?: GetIsolatedMarginAccountDetailV1BaseAsset; + /** + * + */ + @Type(() => GetIsolatedMarginAccountDetailV1QuoteAsset) + quoteAsset?: GetIsolatedMarginAccountDetailV1QuoteAsset; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetIsolatedMarginAccountDetailV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountDetailV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Resp { + return plainToInstance(GetIsolatedMarginAccountDetailV1Resp, jsonObject); + } +} + +export namespace GetIsolatedMarginAccountDetailV1Resp { + export enum StatusEnum { + /** + * + */ + DEBT = 'DEBT', + /** + * + */ + CLEAR = 'CLEAR', + /** + * + */ + BANKRUPTCY = 'BANKRUPTCY', + /** + * + */ + IN_BORROW = 'IN_BORROW', + /** + * + */ + IN_REPAY = 'IN_REPAY', + /** + * + */ + IN_LIQUIDATION = 'IN_LIQUIDATION', + /** + * + */ + IN_AUTO_RENEW = 'IN_AUTO_RENEW', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts new file mode 100644 index 00000000..b1e954f7 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetIsolatedMarginAccountListV1AssetsBaseAsset } from './model_get_isolated_margin_account_list_v1_assets_base_asset'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { GetIsolatedMarginAccountListV1AssetsQuoteAsset } from './model_get_isolated_margin_account_list_v1_assets_quote_asset'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountListV1Assets + implements Serializable +{ + /** + * Symbol + */ + symbol?: string; + /** + * The position status: Existing liabilities-DEBT, No liabilities-CLEAR, Bankrupcy (after position enters a negative balance)-BANKRUPTCY, Existing borrowings-IN_BORROW, Existing repayments-IN_REPAY, Under liquidation-IN_LIQUIDATION, Under auto-renewal assets-IN_AUTO_RENEW . + */ + status?: GetIsolatedMarginAccountListV1Assets.StatusEnum; + /** + * debt ratio + */ + debtRatio?: string; + /** + * + */ + @Type(() => GetIsolatedMarginAccountListV1AssetsBaseAsset) + baseAsset?: GetIsolatedMarginAccountListV1AssetsBaseAsset; + /** + * + */ + @Type(() => GetIsolatedMarginAccountListV1AssetsQuoteAsset) + quoteAsset?: GetIsolatedMarginAccountListV1AssetsQuoteAsset; + fromJson(input: string): GetIsolatedMarginAccountListV1Assets { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountListV1Assets, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Assets { + return plainToInstance(GetIsolatedMarginAccountListV1Assets, jsonObject); + } +} + +export namespace GetIsolatedMarginAccountListV1Assets { + export enum StatusEnum { + /** + * + */ + DEBT = 'DEBT', + /** + * + */ + CLEAR = 'CLEAR', + /** + * + */ + BANKRUPTCY = 'BANKRUPTCY', + /** + * + */ + IN_BORROW = 'IN_BORROW', + /** + * + */ + IN_REPAY = 'IN_REPAY', + /** + * + */ + IN_LIQUIDATION = 'IN_LIQUIDATION', + /** + * + */ + IN_AUTO_RENEW = 'IN_AUTO_RENEW', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts new file mode 100644 index 00000000..a0ca8f1a --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountListV1AssetsBaseAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Current currency total asset amount + */ + totalBalance?: string; + /** + * Current currency holding asset amount + */ + holdBalance?: string; + /** + * Current available asset amount + */ + availableBalance?: string; + /** + * Liabilities + */ + liability?: string; + /** + * + */ + interest?: string; + /** + * + */ + borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountListV1AssetsBaseAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountListV1AssetsBaseAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsBaseAsset { + return plainToInstance(GetIsolatedMarginAccountListV1AssetsBaseAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts new file mode 100644 index 00000000..01d8d827 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountListV1AssetsQuoteAsset + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Current currency total asset amount + */ + totalBalance?: string; + /** + * Current currency holding asset amount + */ + holdBalance?: string; + /** + * Current available asset amount + */ + availableBalance?: string; + /** + * Liabilities + */ + liability?: string; + /** + * + */ + interest?: string; + /** + * + */ + borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountListV1AssetsQuoteAsset { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountListV1AssetsQuoteAsset, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsQuoteAsset { + return plainToInstance(GetIsolatedMarginAccountListV1AssetsQuoteAsset, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts new file mode 100644 index 00000000..a42f5ccc --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts @@ -0,0 +1,82 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountListV1Req + implements Serializable +{ + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + balanceCurrency?: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum = + GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC; + + /** + * Creates a new instance of the `GetIsolatedMarginAccountListV1Req` class. + * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountListV1Req` object. + */ + static builder(): GetIsolatedMarginAccountListV1ReqBuilder { + return new GetIsolatedMarginAccountListV1ReqBuilder(); + } + + /** + * Creates a new instance of the `GetIsolatedMarginAccountListV1Req` class with the given data. + */ + static create(data: { + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + balanceCurrency?: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum; + }): GetIsolatedMarginAccountListV1Req { + let obj = new GetIsolatedMarginAccountListV1Req(); + obj.balanceCurrency = data.balanceCurrency; + return obj; + } + + fromJson(input: string): GetIsolatedMarginAccountListV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountListV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Req { + return plainToInstance(GetIsolatedMarginAccountListV1Req, jsonObject); + } +} + +export namespace GetIsolatedMarginAccountListV1Req { + export enum BalanceCurrencyEnum { + /** + * + */ + USDT = 'USDT', + /** + * + */ + KCS = 'KCS', + /** + * + */ + BTC = 'BTC', + } +} + +export class GetIsolatedMarginAccountListV1ReqBuilder { + obj: GetIsolatedMarginAccountListV1Req = new GetIsolatedMarginAccountListV1Req(); + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + setBalanceCurrency( + value: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum, + ): GetIsolatedMarginAccountListV1ReqBuilder { + this.obj.balanceCurrency = value; + return this; + } + + build(): GetIsolatedMarginAccountListV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts new file mode 100644 index 00000000..ba2053c6 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetIsolatedMarginAccountListV1Assets } from './model_get_isolated_margin_account_list_v1_assets'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetIsolatedMarginAccountListV1Resp + implements Response +{ + /** + * The total balance of the isolated margin account(in the request coin) + */ + totalConversionBalance?: string; + /** + * Total liabilities of the isolated margin account(in the request coin) + */ + liabilityConversionBalance?: string; + /** + * Account list + */ + @Type(() => GetIsolatedMarginAccountListV1Assets) + assets?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetIsolatedMarginAccountListV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountListV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Resp { + return plainToInstance(GetIsolatedMarginAccountListV1Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts new file mode 100644 index 00000000..aea8b4ba --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts @@ -0,0 +1,131 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginAccountReq implements Serializable { + /** + * For isolated trading pairs, query all without passing + */ + symbol?: string; + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + quoteCurrency?: GetIsolatedMarginAccountReq.QuoteCurrencyEnum = + GetIsolatedMarginAccountReq.QuoteCurrencyEnum.USDT; + /** + * Query account type (default ISOLATED), ISOLATED- - only query low frequency isolated margin account, ISOLATED_V2-only query high frequency isolated margin account, ALL - consistent aggregate query with the web side + */ + queryType?: GetIsolatedMarginAccountReq.QueryTypeEnum = + GetIsolatedMarginAccountReq.QueryTypeEnum.ISOLATED; + + /** + * Creates a new instance of the `GetIsolatedMarginAccountReq` class. + * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountReq` object. + */ + static builder(): GetIsolatedMarginAccountReqBuilder { + return new GetIsolatedMarginAccountReqBuilder(); + } + + /** + * Creates a new instance of the `GetIsolatedMarginAccountReq` class with the given data. + */ + static create(data: { + /** + * For isolated trading pairs, query all without passing + */ + symbol?: string; + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + quoteCurrency?: GetIsolatedMarginAccountReq.QuoteCurrencyEnum; + /** + * Query account type (default ISOLATED), ISOLATED- - only query low frequency isolated margin account, ISOLATED_V2-only query high frequency isolated margin account, ALL - consistent aggregate query with the web side + */ + queryType?: GetIsolatedMarginAccountReq.QueryTypeEnum; + }): GetIsolatedMarginAccountReq { + let obj = new GetIsolatedMarginAccountReq(); + obj.symbol = data.symbol; + obj.quoteCurrency = data.quoteCurrency; + obj.queryType = data.queryType; + return obj; + } + + fromJson(input: string): GetIsolatedMarginAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountReq { + return plainToInstance(GetIsolatedMarginAccountReq, jsonObject); + } +} + +export namespace GetIsolatedMarginAccountReq { + export enum QuoteCurrencyEnum { + /** + * + */ + USDT = 'USDT', + /** + * + */ + KCS = 'KCS', + /** + * + */ + BTC = 'BTC', + } + export enum QueryTypeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + ISOLATED_V2 = 'ISOLATED_V2', + /** + * + */ + ALL = 'ALL', + } +} + +export class GetIsolatedMarginAccountReqBuilder { + obj: GetIsolatedMarginAccountReq = new GetIsolatedMarginAccountReq(); + /** + * For isolated trading pairs, query all without passing + */ + setSymbol(value: string): GetIsolatedMarginAccountReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * quote currency, currently only supports USDT, KCS, BTC, USDT as default + */ + setQuoteCurrency( + value: GetIsolatedMarginAccountReq.QuoteCurrencyEnum, + ): GetIsolatedMarginAccountReqBuilder { + this.obj.quoteCurrency = value; + return this; + } + + /** + * Query account type (default ISOLATED), ISOLATED- - only query low frequency isolated margin account, ISOLATED_V2-only query high frequency isolated margin account, ALL - consistent aggregate query with the web side + */ + setQueryType( + value: GetIsolatedMarginAccountReq.QueryTypeEnum, + ): GetIsolatedMarginAccountReqBuilder { + this.obj.queryType = value; + return this; + } + + build(): GetIsolatedMarginAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts new file mode 100644 index 00000000..b67e6ac0 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetIsolatedMarginAccountAssets } from './model_get_isolated_margin_account_assets'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetIsolatedMarginAccountResp + implements Response +{ + /** + * Total Assets in Quote Currency + */ + totalAssetOfQuoteCurrency?: string; + /** + * Total Liability in Quote Currency + */ + totalLiabilityOfQuoteCurrency?: string; + /** + * timestamp + */ + timestamp?: number; + /** + * + */ + @Type(() => GetIsolatedMarginAccountAssets) + assets?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetIsolatedMarginAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginAccountResp { + return plainToInstance(GetIsolatedMarginAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts new file mode 100644 index 00000000..5b1fae6d --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts @@ -0,0 +1,44 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginAccountDetailAccounts + implements Serializable +{ + /** + * Currency + */ + currency?: string; + /** + * Total funds in the account + */ + totalBalance?: string; + /** + * Available funds in the account + */ + availableBalance?: string; + /** + * Funds on hold in the account + */ + holdBalance?: string; + /** + * Total liabilities + */ + liability?: string; + /** + * Available size to borrow + */ + maxBorrowSize?: string; + fromJson(input: string): GetMarginAccountDetailAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginAccountDetailAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginAccountDetailAccounts { + return plainToInstance(GetMarginAccountDetailAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts new file mode 100644 index 00000000..e3067063 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetMarginAccountDetailAccounts } from './model_get_margin_account_detail_accounts'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarginAccountDetailResp + implements Response +{ + /** + * Debt ratio + */ + debtRatio?: string; + /** + * Margin account list + */ + @Type(() => GetMarginAccountDetailAccounts) + accounts?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarginAccountDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginAccountDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginAccountDetailResp { + return plainToInstance(GetMarginAccountDetailResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts new file mode 100644 index 00000000..507d22b3 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginHFLedgerData implements Serializable { + /** + * + */ + id?: number; + /** + * currency + */ + currency?: string; + /** + * Change in funds balance + */ + amount?: string; + /** + * Deposit or withdrawal fee + */ + fee?: string; + /** + * Total balance of funds after change + */ + balance?: string; + /** + * Master account type TRADE_HF + */ + accountType?: string; + /** + * Trnasaction type,such as TRANSFER, TRADE_EXCHANGE, etc. + */ + bizType?: string; + /** + * Direction of transfer( out or in) + */ + direction?: string; + /** + * Ledger creation time + */ + createdAt?: number; + /** + * Core transaction parameter + */ + context?: string; + /** + * + */ + tax?: string; + fromJson(input: string): GetMarginHFLedgerData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginHFLedgerData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginHFLedgerData { + return plainToInstance(GetMarginHFLedgerData, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts new file mode 100644 index 00000000..167e8f1d --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts @@ -0,0 +1,175 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginHFLedgerReq implements Serializable { + /** + * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetMarginHFLedgerReq.DirectionEnum; + /** + * Transaction type: TRANSFER- transfer funds, MARGIN_EXCHANGE - cross margin trade, ISOLATED_EXCHANGE - isolated margin trade, LIQUIDATION - liquidation, ASSERT_RETURN - forced liquidation asset return + */ + bizType?: string; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number = 100; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetMarginHFLedgerReq` class. + * The builder pattern allows step-by-step construction of a `GetMarginHFLedgerReq` object. + */ + static builder(): GetMarginHFLedgerReqBuilder { + return new GetMarginHFLedgerReqBuilder(); + } + + /** + * Creates a new instance of the `GetMarginHFLedgerReq` class with the given data. + */ + static create(data: { + /** + * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetMarginHFLedgerReq.DirectionEnum; + /** + * Transaction type: TRANSFER- transfer funds, MARGIN_EXCHANGE - cross margin trade, ISOLATED_EXCHANGE - isolated margin trade, LIQUIDATION - liquidation, ASSERT_RETURN - forced liquidation asset return + */ + bizType?: string; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetMarginHFLedgerReq { + let obj = new GetMarginHFLedgerReq(); + obj.currency = data.currency; + obj.direction = data.direction; + obj.bizType = data.bizType; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetMarginHFLedgerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginHFLedgerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginHFLedgerReq { + return plainToInstance(GetMarginHFLedgerReq, jsonObject); + } +} + +export namespace GetMarginHFLedgerReq { + export enum DirectionEnum { + /** + * + */ + _IN = 'in', + /** + * + */ + OUT = 'out', + } +} + +export class GetMarginHFLedgerReqBuilder { + obj: GetMarginHFLedgerReq = new GetMarginHFLedgerReq(); + /** + * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty + */ + setCurrency(value: string): GetMarginHFLedgerReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * direction: in, out + */ + setDirection(value: GetMarginHFLedgerReq.DirectionEnum): GetMarginHFLedgerReqBuilder { + this.obj.direction = value; + return this; + } + + /** + * Transaction type: TRANSFER- transfer funds, MARGIN_EXCHANGE - cross margin trade, ISOLATED_EXCHANGE - isolated margin trade, LIQUIDATION - liquidation, ASSERT_RETURN - forced liquidation asset return + */ + setBizType(value: string): GetMarginHFLedgerReqBuilder { + this.obj.bizType = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + setLastId(value: number): GetMarginHFLedgerReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default100,Max200 + */ + setLimit(value: number): GetMarginHFLedgerReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetMarginHFLedgerReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetMarginHFLedgerReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetMarginHFLedgerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts new file mode 100644 index 00000000..d9ecd149 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetMarginHFLedgerData } from './model_get_margin_hf_ledger_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarginHFLedgerResp implements Response { + /** + * + */ + @Type(() => GetMarginHFLedgerData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarginHFLedgerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginHFLedgerResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMarginHFLedgerResp { + return plainToInstance(GetMarginHFLedgerResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts new file mode 100644 index 00000000..3886a620 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotAccountDetailReq implements Serializable { + /** + * Path parameter. Account ID + */ + @Reflect.metadata('path', 'accountId') + accountId?: string; + + /** + * Creates a new instance of the `GetSpotAccountDetailReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotAccountDetailReq` object. + */ + static builder(): GetSpotAccountDetailReqBuilder { + return new GetSpotAccountDetailReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotAccountDetailReq` class with the given data. + */ + static create(data: { + /** + * Path parameter. Account ID + */ + accountId?: string; + }): GetSpotAccountDetailReq { + let obj = new GetSpotAccountDetailReq(); + obj.accountId = data.accountId; + return obj; + } + + fromJson(input: string): GetSpotAccountDetailReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountDetailReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotAccountDetailReq { + return plainToInstance(GetSpotAccountDetailReq, jsonObject); + } +} + +export class GetSpotAccountDetailReqBuilder { + obj: GetSpotAccountDetailReq = new GetSpotAccountDetailReq(); + /** + * Path parameter. Account ID + */ + setAccountId(value: string): GetSpotAccountDetailReqBuilder { + this.obj.accountId = value; + return this; + } + + build(): GetSpotAccountDetailReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts new file mode 100644 index 00000000..b657ef89 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotAccountDetailResp implements Response { + /** + * The currency of the account + */ + currency?: string; + /** + * Total funds in the account + */ + balance?: string; + /** + * Funds available to withdraw or trade + */ + available?: string; + /** + * Funds on hold (not available for use) + */ + holds?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotAccountDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotAccountDetailResp { + return plainToInstance(GetSpotAccountDetailResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts new file mode 100644 index 00000000..ed47319c --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts @@ -0,0 +1,55 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotAccountListData implements Serializable { + /** + * Account ID + */ + id?: string; + /** + * Currency + */ + currency?: string; + /** + * Account type:,main、trade、isolated(abandon)、margin(abandon) + */ + type?: GetSpotAccountListData.TypeEnum; + /** + * Total funds in the account + */ + balance?: string; + /** + * Funds available to withdraw or trade + */ + available?: string; + /** + * Funds on hold (not available for use) + */ + holds?: string; + fromJson(input: string): GetSpotAccountListData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountListData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotAccountListData { + return plainToInstance(GetSpotAccountListData, jsonObject); + } +} + +export namespace GetSpotAccountListData { + export enum TypeEnum { + /** + * Funding account + */ + MAIN = 'main', + /** + * Spot account + */ + TRADE = 'trade', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts new file mode 100644 index 00000000..f12d23e9 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotAccountListReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Account type main、trade + */ + type?: GetSpotAccountListReq.TypeEnum; + + /** + * Creates a new instance of the `GetSpotAccountListReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotAccountListReq` object. + */ + static builder(): GetSpotAccountListReqBuilder { + return new GetSpotAccountListReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotAccountListReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Account type main、trade + */ + type?: GetSpotAccountListReq.TypeEnum; + }): GetSpotAccountListReq { + let obj = new GetSpotAccountListReq(); + obj.currency = data.currency; + obj.type = data.type; + return obj; + } + + fromJson(input: string): GetSpotAccountListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotAccountListReq { + return plainToInstance(GetSpotAccountListReq, jsonObject); + } +} + +export namespace GetSpotAccountListReq { + export enum TypeEnum { + /** + * Funding account + */ + MAIN = 'main', + /** + * Spot account + */ + TRADE = 'trade', + } +} + +export class GetSpotAccountListReqBuilder { + obj: GetSpotAccountListReq = new GetSpotAccountListReq(); + /** + * currency + */ + setCurrency(value: string): GetSpotAccountListReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Account type main、trade + */ + setType(value: GetSpotAccountListReq.TypeEnum): GetSpotAccountListReqBuilder { + this.obj.type = value; + return this; + } + + build(): GetSpotAccountListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts new file mode 100644 index 00000000..0f9622a1 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotAccountListData } from './model_get_spot_account_list_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotAccountListResp implements Response { + /** + * + */ + @Type(() => GetSpotAccountListData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotAccountListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotAccountListResp { + return plainToInstance(GetSpotAccountListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts new file mode 100644 index 00000000..8aa7a56d --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotAccountTypeResp implements Response { + /** + * Spot account type. True means the current user is a high-frequency spot user, False means the current user is a low-frequency spot user + */ + data?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotAccountTypeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotAccountTypeResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotAccountTypeResp { + return plainToInstance(GetSpotAccountTypeResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts new file mode 100644 index 00000000..941c96ea --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts @@ -0,0 +1,75 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotHFLedgerData implements Serializable { + /** + * Unique id + */ + id?: string; + /** + * currency + */ + currency?: string; + /** + * Change in funds balance + */ + amount?: string; + /** + * Deposit or withdrawal fee + */ + fee?: string; + /** + * + */ + tax?: string; + /** + * Total balance of funds after change + */ + balance?: string; + /** + * Master account type TRADE_HF + */ + accountType?: string; + /** + * Trnasaction type,such as TRANSFER, TRADE_EXCHANGE, etc. + */ + bizType?: string; + /** + * Direction of transfer( out or in) + */ + direction?: GetSpotHFLedgerData.DirectionEnum; + /** + * Created time + */ + createdAt?: string; + /** + * Core transaction parameter + */ + context?: string; + fromJson(input: string): GetSpotHFLedgerData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotHFLedgerData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotHFLedgerData { + return plainToInstance(GetSpotHFLedgerData, jsonObject); + } +} + +export namespace GetSpotHFLedgerData { + export enum DirectionEnum { + /** + * + */ + _IN = 'in', + /** + * + */ + OUT = 'out', + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts new file mode 100644 index 00000000..15f64fa4 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts @@ -0,0 +1,185 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotHFLedgerReq implements Serializable { + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetSpotHFLedgerReq.DirectionEnum; + /** + * Transaction type: TRANSFER-transfer funds,TRADE_EXCHANGE-Trade + */ + bizType?: GetSpotHFLedgerReq.BizTypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number = 100; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetSpotHFLedgerReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotHFLedgerReq` object. + */ + static builder(): GetSpotHFLedgerReqBuilder { + return new GetSpotHFLedgerReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotHFLedgerReq` class with the given data. + */ + static create(data: { + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetSpotHFLedgerReq.DirectionEnum; + /** + * Transaction type: TRANSFER-transfer funds,TRADE_EXCHANGE-Trade + */ + bizType?: GetSpotHFLedgerReq.BizTypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetSpotHFLedgerReq { + let obj = new GetSpotHFLedgerReq(); + obj.currency = data.currency; + obj.direction = data.direction; + obj.bizType = data.bizType; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetSpotHFLedgerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotHFLedgerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotHFLedgerReq { + return plainToInstance(GetSpotHFLedgerReq, jsonObject); + } +} + +export namespace GetSpotHFLedgerReq { + export enum DirectionEnum { + /** + * + */ + _IN = 'in', + /** + * + */ + OUT = 'out', + } + export enum BizTypeEnum { + /** + * + */ + TRADE_EXCHANGE = 'TRADE_EXCHANGE', + /** + * + */ + TRANSFER = 'TRANSFER', + } +} + +export class GetSpotHFLedgerReqBuilder { + obj: GetSpotHFLedgerReq = new GetSpotHFLedgerReq(); + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + setCurrency(value: string): GetSpotHFLedgerReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * direction: in, out + */ + setDirection(value: GetSpotHFLedgerReq.DirectionEnum): GetSpotHFLedgerReqBuilder { + this.obj.direction = value; + return this; + } + + /** + * Transaction type: TRANSFER-transfer funds,TRADE_EXCHANGE-Trade + */ + setBizType(value: GetSpotHFLedgerReq.BizTypeEnum): GetSpotHFLedgerReqBuilder { + this.obj.bizType = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. + */ + setLastId(value: number): GetSpotHFLedgerReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default100,Max200 + */ + setLimit(value: number): GetSpotHFLedgerReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetSpotHFLedgerReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetSpotHFLedgerReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetSpotHFLedgerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts new file mode 100644 index 00000000..114082fc --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotHFLedgerData } from './model_get_spot_hf_ledger_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotHFLedgerResp implements Response { + /** + * + */ + @Type(() => GetSpotHFLedgerData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotHFLedgerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotHFLedgerResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotHFLedgerResp { + return plainToInstance(GetSpotHFLedgerResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts new file mode 100644 index 00000000..7230be7b --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts @@ -0,0 +1,58 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotLedgerItems implements Serializable { + /** + * unique id + */ + id?: string; + /** + * The currency of an account + */ + currency?: string; + /** + * The total amount of assets (fees included) involved in assets changes such as transaction, withdrawal and bonus distribution. + */ + amount?: string; + /** + * Fees generated in transaction, withdrawal, etc. + */ + fee?: string; + /** + * Remaining funds after the transaction. + */ + balance?: string; + /** + * The account type of the master user: MAIN, TRADE, MARGIN or CONTRACT. + */ + accountType?: string; + /** + * Business type leading to the changes in funds, such as exchange, withdrawal, deposit, KUCOIN_BONUS, REFERRAL_BONUS, Lendings etc. + */ + bizType?: string; + /** + * Side, out or in + */ + direction?: string; + /** + * Time of the event + */ + createdAt?: number; + /** + * Business related information such as order ID, serial No., etc. + */ + context?: string; + fromJson(input: string): GetSpotLedgerItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotLedgerItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotLedgerItems { + return plainToInstance(GetSpotLedgerItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts new file mode 100644 index 00000000..edbf13f7 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts @@ -0,0 +1,175 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotLedgerReq implements Serializable { + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetSpotLedgerReq.DirectionEnum; + /** + * Type: DEPOSIT -deposit, WITHDRAW -withdraw, TRANSFER -transfer, SUB_TRANSFER -subaccount transfer,TRADE_EXCHANGE -trade, MARGIN_EXCHANGE -margin trade, KUCOIN_BONUS -bonus, BROKER_TRANSFER -Broker transfer record + */ + bizType?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetSpotLedgerReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotLedgerReq` object. + */ + static builder(): GetSpotLedgerReqBuilder { + return new GetSpotLedgerReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotLedgerReq` class with the given data. + */ + static create(data: { + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + currency?: string; + /** + * direction: in, out + */ + direction?: GetSpotLedgerReq.DirectionEnum; + /** + * Type: DEPOSIT -deposit, WITHDRAW -withdraw, TRANSFER -transfer, SUB_TRANSFER -subaccount transfer,TRADE_EXCHANGE -trade, MARGIN_EXCHANGE -margin trade, KUCOIN_BONUS -bonus, BROKER_TRANSFER -Broker transfer record + */ + bizType?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetSpotLedgerReq { + let obj = new GetSpotLedgerReq(); + obj.currency = data.currency; + obj.direction = data.direction; + obj.bizType = data.bizType; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetSpotLedgerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotLedgerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotLedgerReq { + return plainToInstance(GetSpotLedgerReq, jsonObject); + } +} + +export namespace GetSpotLedgerReq { + export enum DirectionEnum { + /** + * + */ + _IN = 'in', + /** + * + */ + OUT = 'out', + } +} + +export class GetSpotLedgerReqBuilder { + obj: GetSpotLedgerReq = new GetSpotLedgerReq(); + /** + * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. + */ + setCurrency(value: string): GetSpotLedgerReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * direction: in, out + */ + setDirection(value: GetSpotLedgerReq.DirectionEnum): GetSpotLedgerReqBuilder { + this.obj.direction = value; + return this; + } + + /** + * Type: DEPOSIT -deposit, WITHDRAW -withdraw, TRANSFER -transfer, SUB_TRANSFER -subaccount transfer,TRADE_EXCHANGE -trade, MARGIN_EXCHANGE -margin trade, KUCOIN_BONUS -bonus, BROKER_TRANSFER -Broker transfer record + */ + setBizType(value: string): GetSpotLedgerReqBuilder { + this.obj.bizType = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetSpotLedgerReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetSpotLedgerReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetSpotLedgerReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetSpotLedgerReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetSpotLedgerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts new file mode 100644 index 00000000..39f931e6 --- /dev/null +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSpotLedgerItems } from './model_get_spot_ledger_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotLedgerResp implements Response { + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetSpotLedgerItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotLedgerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotLedgerResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotLedgerResp { + return plainToInstance(GetSpotLedgerResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/deposit/api_deposit.template b/sdk/node/src/generate/account/deposit/api_deposit.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/deposit/api_deposit.test.ts b/sdk/node/src/generate/account/deposit/api_deposit.test.ts new file mode 100644 index 00000000..5e011957 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/api_deposit.test.ts @@ -0,0 +1,238 @@ +import { AddDepositAddressV3Resp } from './model_add_deposit_address_v3_resp'; +import { GetDepositAddressV1Resp } from './model_get_deposit_address_v1_resp'; +import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; +import { GetDepositHistoryOldResp } from './model_get_deposit_history_old_resp'; +import { AddDepositAddressV1Req } from './model_add_deposit_address_v1_req'; +import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; +import { GetDepositHistoryOldReq } from './model_get_deposit_history_old_req'; +import { GetDepositHistoryResp } from './model_get_deposit_history_resp'; +import { GetDepositAddressV3Resp } from './model_get_deposit_address_v3_resp'; +import { GetDepositAddressV3Req } from './model_get_deposit_address_v3_req'; +import { GetDepositHistoryReq } from './model_get_deposit_history_req'; +import { AddDepositAddressV1Resp } from './model_add_deposit_address_v1_resp'; +import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; +import { GetDepositAddressV1Req } from './model_get_deposit_address_v1_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getDepositAddressV1 request test', () => { + /** + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses + */ + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetDepositAddressV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositAddressV1 response test', () => { + /** + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses + */ + let data = + '{\n "code": "200000",\n "data": {\n "address": "0xea220bf61c3c2b0adc2cfa29fec3d2677745a379",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "USDT"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositAddressV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addDepositAddressV1 request test', () => { + /** + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses + */ + let data = '{"currency": "ETH", "chain": "eth"}'; + let req = new AddDepositAddressV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addDepositAddressV1 response test', () => { + /** + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses + */ + let data = + '{"code":"200000","data":{"address":"0x02028456f38e78609904e8a002c787ede7a73d7c","memo":null,"chain":"ERC20","chainId":"eth","to":"MAIN","currency":"ETH"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddDepositAddressV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDepositHistory request test', () => { + /** + * getDepositHistory + * Get Deposit History + * /api/v1/deposits + */ + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetDepositHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositHistory response test', () => { + /** + * getDepositHistory + * Get Deposit History + * /api/v1/deposits + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDepositHistoryOld request test', () => { + /** + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits + */ + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetDepositHistoryOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositHistoryOld response test', () => { + /** + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 0,\n "totalPage": 0,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1528536998,\n "amount": "0.03266638",\n "walletTxId": "55c643bc2c68d6f17266383ac1be9e454038864b929ae7cee0bc408cc5c869e8@12ffGWmMMD1zA1WbFm7Ho3JZ1w6NYXjpFk@234",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositHistoryOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDepositAddressV2 request test', () => { + /** + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses + */ + let data = '{"currency": "BTC"}'; + let req = new GetDepositAddressV2Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositAddressV2 response test', () => { + /** + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "address": "0x02028456*****87ede7a73d7c",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "ETH",\n "contractAddress": ""\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositAddressV2Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addDepositAddressV3 request test', () => { + /** + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create + */ + let data = '{"currency": "TON", "chain": "ton", "to": "trade"}'; + let req = new AddDepositAddressV3Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addDepositAddressV3 response test', () => { + /** + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create + */ + let data = + '{"code":"200000","data":{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2090821203","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"TON","chainName":"TON"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddDepositAddressV3Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDepositAddressV3 request test', () => { + /** + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses + */ + let data = + '{"currency": "BTC", "amount": "example_string_default_value", "chain": "example_string_default_value"}'; + let req = new GetDepositAddressV3Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositAddressV3 response test', () => { + /** + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses + */ + let data = + '{"code":"200000","data":[{"address":"TSv3L1fS7yA3SxzKD8c1qdX4nLP6rqNxYz","memo":"","chainId":"trx","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","chainName":"TRC20"},{"address":"0x551e823a3b36865e8c5dc6e6ac6cc0b00d98533e","memo":"","chainId":"kcc","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48","chainName":"KCC"},{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2085202643","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs","chainName":"TON"},{"address":"0x0a2586d5a901c8e7e68f6b0dc83bfd8bd8600ff5","memo":"","chainId":"eth","to":"MAIN","expirationDate":0,"currency":"USDT","contractAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7","chainName":"ERC20"}]}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositAddressV3Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/deposit/api_deposit.ts b/sdk/node/src/generate/account/deposit/api_deposit.ts new file mode 100644 index 00000000..4ae9e185 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/api_deposit.ts @@ -0,0 +1,223 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { AddDepositAddressV3Resp } from './model_add_deposit_address_v3_resp'; +import { GetDepositAddressV1Resp } from './model_get_deposit_address_v1_resp'; +import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; +import { GetDepositHistoryOldResp } from './model_get_deposit_history_old_resp'; +import { AddDepositAddressV1Req } from './model_add_deposit_address_v1_req'; +import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; +import { GetDepositHistoryOldReq } from './model_get_deposit_history_old_req'; +import { GetDepositHistoryResp } from './model_get_deposit_history_resp'; +import { GetDepositAddressV3Resp } from './model_get_deposit_address_v3_resp'; +import { GetDepositAddressV3Req } from './model_get_deposit_address_v3_req'; +import { GetDepositHistoryReq } from './model_get_deposit_history_req'; +import { AddDepositAddressV1Resp } from './model_add_deposit_address_v1_resp'; +import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; +import { GetDepositAddressV1Req } from './model_get_deposit_address_v1_req'; + +export interface DepositAPI { + /** + * @deprecated + * getDepositAddressV1 Get Deposit Addresses - V1 + * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. + * Documentation: https://www.kucoin.com/docs-new/api-3470305 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getDepositAddressV1(req: GetDepositAddressV1Req): Promise; + + /** + * @deprecated + * addDepositAddressV1 Add Deposit Address - V1 + * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. + * Documentation: https://www.kucoin.com/docs-new/api-3470309 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + addDepositAddressV1(req: AddDepositAddressV1Req): Promise; + + /** + * getDepositHistory Get Deposit History + * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470141 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getDepositHistory(req: GetDepositHistoryReq): Promise; + + /** + * @deprecated + * getDepositHistoryOld Get Deposit History - Old + * Description: Request via this endpoint to get the V1 historical deposits list on KuCoin. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470306 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise; + + /** + * @deprecated + * getDepositAddressV2 Get Deposit Addresses(V2) + * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. + * Documentation: https://www.kucoin.com/docs-new/api-3470300 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getDepositAddressV2(req: GetDepositAddressV2Req): Promise; + + /** + * addDepositAddressV3 Add Deposit Address(V3) + * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. + * Documentation: https://www.kucoin.com/docs-new/api-3470142 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + addDepositAddressV3(req: AddDepositAddressV3Req): Promise; + + /** + * getDepositAddressV3 Get Deposit Address(V3) + * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. + * Documentation: https://www.kucoin.com/docs-new/api-3470140 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + getDepositAddressV3(req: GetDepositAddressV3Req): Promise; +} + +export class DepositAPIImpl implements DepositAPI { + constructor(private transport: Transport) {} + + getDepositAddressV1(req: GetDepositAddressV1Req): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/deposit-addresses', + req, + new GetDepositAddressV1Resp(), + false, + ); + } + + addDepositAddressV1(req: AddDepositAddressV1Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/deposit-addresses', + req, + new AddDepositAddressV1Resp(), + false, + ); + } + + getDepositHistory(req: GetDepositHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/deposits', + req, + new GetDepositHistoryResp(), + false, + ); + } + + getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hist-deposits', + req, + new GetDepositHistoryOldResp(), + false, + ); + } + + getDepositAddressV2(req: GetDepositAddressV2Req): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/deposit-addresses', + req, + new GetDepositAddressV2Resp(), + false, + ); + } + + addDepositAddressV3(req: AddDepositAddressV3Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/deposit-address/create', + req, + new AddDepositAddressV3Resp(), + false, + ); + } + + getDepositAddressV3(req: GetDepositAddressV3Req): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/deposit-addresses', + req, + new GetDepositAddressV3Resp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts new file mode 100644 index 00000000..cfe07df0 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddDepositAddressV1Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string = 'eth'; + + /** + * Creates a new instance of the `AddDepositAddressV1Req` class. + * The builder pattern allows step-by-step construction of a `AddDepositAddressV1Req` object. + */ + static builder(): AddDepositAddressV1ReqBuilder { + return new AddDepositAddressV1ReqBuilder(); + } + + /** + * Creates a new instance of the `AddDepositAddressV1Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + }): AddDepositAddressV1Req { + let obj = new AddDepositAddressV1Req(); + obj.currency = data.currency; + obj.chain = data.chain; + return obj; + } + + fromJson(input: string): AddDepositAddressV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(AddDepositAddressV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddDepositAddressV1Req { + return plainToInstance(AddDepositAddressV1Req, jsonObject); + } +} + +export class AddDepositAddressV1ReqBuilder { + obj: AddDepositAddressV1Req = new AddDepositAddressV1Req(); + /** + * currency + */ + setCurrency(value: string): AddDepositAddressV1ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + setChain(value: string): AddDepositAddressV1ReqBuilder { + this.obj.chain = value; + return this; + } + + build(): AddDepositAddressV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts new file mode 100644 index 00000000..47b5cfc1 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts @@ -0,0 +1,66 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddDepositAddressV1Resp implements Response { + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * The chainName of currency + */ + chain?: string; + /** + * The chainId of currency + */ + chainId?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account) + */ + to?: AddDepositAddressV1Resp.ToEnum; + /** + * currency + */ + currency?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddDepositAddressV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddDepositAddressV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddDepositAddressV1Resp { + return plainToInstance(AddDepositAddressV1Resp, jsonObject); + } +} + +export namespace AddDepositAddressV1Resp { + export enum ToEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts new file mode 100644 index 00000000..4defb7e4 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts @@ -0,0 +1,124 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddDepositAddressV3Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string = 'eth'; + /** + * Deposit account type: main (funding account), trade (spot trading account), the default is main + */ + to?: AddDepositAddressV3Req.ToEnum = AddDepositAddressV3Req.ToEnum.MAIN; + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + amount?: string; + + /** + * Creates a new instance of the `AddDepositAddressV3Req` class. + * The builder pattern allows step-by-step construction of a `AddDepositAddressV3Req` object. + */ + static builder(): AddDepositAddressV3ReqBuilder { + return new AddDepositAddressV3ReqBuilder(); + } + + /** + * Creates a new instance of the `AddDepositAddressV3Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account), the default is main + */ + to?: AddDepositAddressV3Req.ToEnum; + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + amount?: string; + }): AddDepositAddressV3Req { + let obj = new AddDepositAddressV3Req(); + obj.currency = data.currency; + obj.chain = data.chain; + obj.to = data.to; + obj.amount = data.amount; + return obj; + } + + fromJson(input: string): AddDepositAddressV3Req { + const jsonObject = JSON.parse(input); + return plainToInstance(AddDepositAddressV3Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddDepositAddressV3Req { + return plainToInstance(AddDepositAddressV3Req, jsonObject); + } +} + +export namespace AddDepositAddressV3Req { + export enum ToEnum { + /** + * + */ + MAIN = 'main', + /** + * + */ + TRADE = 'trade', + } +} + +export class AddDepositAddressV3ReqBuilder { + obj: AddDepositAddressV3Req = new AddDepositAddressV3Req(); + /** + * currency + */ + setCurrency(value: string): AddDepositAddressV3ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + setChain(value: string): AddDepositAddressV3ReqBuilder { + this.obj.chain = value; + return this; + } + + /** + * Deposit account type: main (funding account), trade (spot trading account), the default is main + */ + setTo(value: AddDepositAddressV3Req.ToEnum): AddDepositAddressV3ReqBuilder { + this.obj.to = value; + return this; + } + + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + setAmount(value: string): AddDepositAddressV3ReqBuilder { + this.obj.amount = value; + return this; + } + + build(): AddDepositAddressV3Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts new file mode 100644 index 00000000..bcf8279b --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddDepositAddressV3Resp implements Response { + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * The chainId of currency + */ + chainId?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account) + */ + to?: string; + /** + * Expiration time, Lightning network expiration time, non-Lightning network this field is invalid + */ + expirationDate?: number; + /** + * currency + */ + currency?: string; + /** + * The chainName of currency + */ + chainName?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddDepositAddressV3Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddDepositAddressV3Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddDepositAddressV3Resp { + return plainToInstance(AddDepositAddressV3Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts new file mode 100644 index 00000000..8bf4cd89 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositAddressV1Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string = 'eth'; + + /** + * Creates a new instance of the `GetDepositAddressV1Req` class. + * The builder pattern allows step-by-step construction of a `GetDepositAddressV1Req` object. + */ + static builder(): GetDepositAddressV1ReqBuilder { + return new GetDepositAddressV1ReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositAddressV1Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + }): GetDepositAddressV1Req { + let obj = new GetDepositAddressV1Req(); + obj.currency = data.currency; + obj.chain = data.chain; + return obj; + } + + fromJson(input: string): GetDepositAddressV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV1Req { + return plainToInstance(GetDepositAddressV1Req, jsonObject); + } +} + +export class GetDepositAddressV1ReqBuilder { + obj: GetDepositAddressV1Req = new GetDepositAddressV1Req(); + /** + * currency + */ + setCurrency(value: string): GetDepositAddressV1ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + setChain(value: string): GetDepositAddressV1ReqBuilder { + this.obj.chain = value; + return this; + } + + build(): GetDepositAddressV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts new file mode 100644 index 00000000..2a702fa5 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts @@ -0,0 +1,70 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositAddressV1Resp implements Response { + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * The chainName of currency + */ + chain?: string; + /** + * The chainId of currency + */ + chainId?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account) + */ + to?: GetDepositAddressV1Resp.ToEnum; + /** + * currency + */ + currency?: string; + /** + * The token contract address. + */ + contractAddress?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositAddressV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV1Resp { + return plainToInstance(GetDepositAddressV1Resp, jsonObject); + } +} + +export namespace GetDepositAddressV1Resp { + export enum ToEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts new file mode 100644 index 00000000..505a954a --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositAddressV2Data implements Serializable { + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * The chainName of currency + */ + chain?: string; + /** + * The chainId of currency + */ + chainId?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account) + */ + to?: GetDepositAddressV2Data.ToEnum; + /** + * currency + */ + currency?: string; + /** + * The token contract address. + */ + contractAddress?: string; + fromJson(input: string): GetDepositAddressV2Data { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV2Data, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV2Data { + return plainToInstance(GetDepositAddressV2Data, jsonObject); + } +} + +export namespace GetDepositAddressV2Data { + export enum ToEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts new file mode 100644 index 00000000..2cb0dfb1 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositAddressV2Req implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetDepositAddressV2Req` class. + * The builder pattern allows step-by-step construction of a `GetDepositAddressV2Req` object. + */ + static builder(): GetDepositAddressV2ReqBuilder { + return new GetDepositAddressV2ReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositAddressV2Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetDepositAddressV2Req { + let obj = new GetDepositAddressV2Req(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetDepositAddressV2Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV2Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV2Req { + return plainToInstance(GetDepositAddressV2Req, jsonObject); + } +} + +export class GetDepositAddressV2ReqBuilder { + obj: GetDepositAddressV2Req = new GetDepositAddressV2Req(); + /** + * currency + */ + setCurrency(value: string): GetDepositAddressV2ReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetDepositAddressV2Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts new file mode 100644 index 00000000..9884eda2 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetDepositAddressV2Data } from './model_get_deposit_address_v2_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositAddressV2Resp implements Response { + /** + * + */ + @Type(() => GetDepositAddressV2Data) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositAddressV2Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV2Resp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetDepositAddressV2Resp { + return plainToInstance(GetDepositAddressV2Resp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts new file mode 100644 index 00000000..b4555f45 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositAddressV3Data implements Serializable { + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * The chainId of currency + */ + chainId?: string; + /** + * Deposit account type: main (funding account), trade (spot trading account) + */ + to?: string; + /** + * Expiration time, Lightning network expiration time, non-Lightning network this field is invalid + */ + expirationDate?: number; + /** + * currency + */ + currency?: string; + /** + * The token contract address. + */ + contractAddress?: string; + /** + * The chainName of currency + */ + chainName?: string; + fromJson(input: string): GetDepositAddressV3Data { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV3Data, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV3Data { + return plainToInstance(GetDepositAddressV3Data, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts new file mode 100644 index 00000000..f738d93e --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositAddressV3Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + amount?: string; + /** + * The chain Id of currency. + */ + chain?: string; + + /** + * Creates a new instance of the `GetDepositAddressV3Req` class. + * The builder pattern allows step-by-step construction of a `GetDepositAddressV3Req` object. + */ + static builder(): GetDepositAddressV3ReqBuilder { + return new GetDepositAddressV3ReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositAddressV3Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + amount?: string; + /** + * The chain Id of currency. + */ + chain?: string; + }): GetDepositAddressV3Req { + let obj = new GetDepositAddressV3Req(); + obj.currency = data.currency; + obj.amount = data.amount; + obj.chain = data.chain; + return obj; + } + + fromJson(input: string): GetDepositAddressV3Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV3Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositAddressV3Req { + return plainToInstance(GetDepositAddressV3Req, jsonObject); + } +} + +export class GetDepositAddressV3ReqBuilder { + obj: GetDepositAddressV3Req = new GetDepositAddressV3Req(); + /** + * currency + */ + setCurrency(value: string): GetDepositAddressV3ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. + */ + setAmount(value: string): GetDepositAddressV3ReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * The chain Id of currency. + */ + setChain(value: string): GetDepositAddressV3ReqBuilder { + this.obj.chain = value; + return this; + } + + build(): GetDepositAddressV3Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts new file mode 100644 index 00000000..66a3cb3c --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetDepositAddressV3Data } from './model_get_deposit_address_v3_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositAddressV3Resp implements Response { + /** + * + */ + @Type(() => GetDepositAddressV3Data) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositAddressV3Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositAddressV3Resp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetDepositAddressV3Resp { + return plainToInstance(GetDepositAddressV3Resp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts new file mode 100644 index 00000000..02dcd415 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts @@ -0,0 +1,87 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositHistoryItems implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * The chainName of currency + */ + chain?: string; + /** + * Status + */ + status?: GetDepositHistoryItems.StatusEnum; + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. + */ + memo?: string; + /** + * Internal deposit or not + */ + isInner?: boolean; + /** + * Deposit amount + */ + amount?: string; + /** + * Fees charged for deposit + */ + fee?: string; + /** + * Wallet Txid + */ + walletTxId?: string; + /** + * Creation time of the database record + */ + createdAt?: number; + /** + * Update time of the database record + */ + updatedAt?: number; + /** + * remark + */ + remark?: string; + /** + * Whether there is any debt.A quick rollback will cause the deposit to fail. If the deposit fails, you will need to repay the balance. + */ + arrears?: boolean; + fromJson(input: string): GetDepositHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryItems { + return plainToInstance(GetDepositHistoryItems, jsonObject); + } +} + +export namespace GetDepositHistoryItems { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts new file mode 100644 index 00000000..7891ba8f --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositHistoryOldItems implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Creation time of the database record + */ + createAt?: number; + /** + * Deposit amount + */ + amount?: string; + /** + * Wallet Txid + */ + walletTxId?: string; + /** + * Internal deposit or not + */ + isInner?: boolean; + /** + * + */ + status?: GetDepositHistoryOldItems.StatusEnum; + fromJson(input: string): GetDepositHistoryOldItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryOldItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryOldItems { + return plainToInstance(GetDepositHistoryOldItems, jsonObject); + } +} + +export namespace GetDepositHistoryOldItems { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts new file mode 100644 index 00000000..a4c45d9d --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts @@ -0,0 +1,128 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositHistoryOldReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetDepositHistoryOldReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetDepositHistoryOldReq` class. + * The builder pattern allows step-by-step construction of a `GetDepositHistoryOldReq` object. + */ + static builder(): GetDepositHistoryOldReqBuilder { + return new GetDepositHistoryOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositHistoryOldReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetDepositHistoryOldReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetDepositHistoryOldReq { + let obj = new GetDepositHistoryOldReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetDepositHistoryOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryOldReq { + return plainToInstance(GetDepositHistoryOldReq, jsonObject); + } +} + +export namespace GetDepositHistoryOldReq { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} + +export class GetDepositHistoryOldReqBuilder { + obj: GetDepositHistoryOldReq = new GetDepositHistoryOldReq(); + /** + * currency + */ + setCurrency(value: string): GetDepositHistoryOldReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + setStatus(value: GetDepositHistoryOldReq.StatusEnum): GetDepositHistoryOldReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetDepositHistoryOldReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetDepositHistoryOldReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetDepositHistoryOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts new file mode 100644 index 00000000..a0ef4169 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetDepositHistoryOldItems } from './model_get_deposit_history_old_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositHistoryOldResp implements Response { + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetDepositHistoryOldItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositHistoryOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryOldResp { + return plainToInstance(GetDepositHistoryOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts new file mode 100644 index 00000000..5e30ea29 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositHistoryReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetDepositHistoryReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetDepositHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetDepositHistoryReq` object. + */ + static builder(): GetDepositHistoryReqBuilder { + return new GetDepositHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositHistoryReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetDepositHistoryReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetDepositHistoryReq { + let obj = new GetDepositHistoryReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetDepositHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryReq { + return plainToInstance(GetDepositHistoryReq, jsonObject); + } +} + +export namespace GetDepositHistoryReq { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} + +export class GetDepositHistoryReqBuilder { + obj: GetDepositHistoryReq = new GetDepositHistoryReq(); + /** + * currency + */ + setCurrency(value: string): GetDepositHistoryReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + setStatus(value: GetDepositHistoryReq.StatusEnum): GetDepositHistoryReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetDepositHistoryReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetDepositHistoryReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetDepositHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetDepositHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetDepositHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts new file mode 100644 index 00000000..fb68e251 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetDepositHistoryItems } from './model_get_deposit_history_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositHistoryResp implements Response { + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetDepositHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositHistoryResp { + return plainToInstance(GetDepositHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/fee/api_fee.template b/sdk/node/src/generate/account/fee/api_fee.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/fee/api_fee.test.ts b/sdk/node/src/generate/account/fee/api_fee.test.ts new file mode 100644 index 00000000..c8a113cc --- /dev/null +++ b/sdk/node/src/generate/account/fee/api_fee.test.ts @@ -0,0 +1,103 @@ +import { GetSpotActualFeeResp } from './model_get_spot_actual_fee_resp'; +import { GetFuturesActualFeeReq } from './model_get_futures_actual_fee_req'; +import { GetSpotActualFeeReq } from './model_get_spot_actual_fee_req'; +import { GetBasicFeeResp } from './model_get_basic_fee_resp'; +import { GetFuturesActualFeeResp } from './model_get_futures_actual_fee_resp'; +import { GetBasicFeeReq } from './model_get_basic_fee_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getBasicFee request test', () => { + /** + * getBasicFee + * Get Basic Fee - Spot/Margin + * /api/v1/base-fee + */ + let data = '{"currencyType": 1}'; + let req = new GetBasicFeeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getBasicFee response test', () => { + /** + * getBasicFee + * Get Basic Fee - Spot/Margin + * /api/v1/base-fee + */ + let data = + '{\n "code": "200000",\n "data": {\n "takerFeeRate": "0.001",\n "makerFeeRate": "0.001"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetBasicFeeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotActualFee request test', () => { + /** + * getSpotActualFee + * Get Actual Fee - Spot/Margin + * /api/v1/trade-fees + */ + let data = '{"symbols": "BTC-USDT,ETH-USDT"}'; + let req = new GetSpotActualFeeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotActualFee response test', () => { + /** + * getSpotActualFee + * Get Actual Fee - Spot/Margin + * /api/v1/trade-fees + */ + let data = + '{"code":"200000","data":[{"symbol":"BTC-USDT","takerFeeRate":"0.001","makerFeeRate":"0.001"},{"symbol":"ETH-USDT","takerFeeRate":"0.001","makerFeeRate":"0.001"}]}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotActualFeeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getFuturesActualFee request test', () => { + /** + * getFuturesActualFee + * Get Actual Fee - Futures + * /api/v1/trade-fees + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetFuturesActualFeeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFuturesActualFee response test', () => { + /** + * getFuturesActualFee + * Get Actual Fee - Futures + * /api/v1/trade-fees + */ + let data = + '{"code":"200000","data":{"symbol":"XBTUSDTM","takerFeeRate":"0.0006","makerFeeRate":"0.0002"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFuturesActualFeeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/fee/api_fee.ts b/sdk/node/src/generate/account/fee/api_fee.ts new file mode 100644 index 00000000..d0b4afe9 --- /dev/null +++ b/sdk/node/src/generate/account/fee/api_fee.ts @@ -0,0 +1,99 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetSpotActualFeeResp } from './model_get_spot_actual_fee_resp'; +import { GetFuturesActualFeeReq } from './model_get_futures_actual_fee_req'; +import { GetSpotActualFeeReq } from './model_get_spot_actual_fee_req'; +import { GetBasicFeeResp } from './model_get_basic_fee_resp'; +import { GetFuturesActualFeeResp } from './model_get_futures_actual_fee_resp'; +import { GetBasicFeeReq } from './model_get_basic_fee_req'; + +export interface FeeAPI { + /** + * getBasicFee Get Basic Fee - Spot/Margin + * Description: This interface is for the spot/margin basic fee rate of users + * Documentation: https://www.kucoin.com/docs-new/api-3470149 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getBasicFee(req: GetBasicFeeReq): Promise; + + /** + * getSpotActualFee Get Actual Fee - Spot/Margin + * Description: This interface is for the actual fee rate of the trading pair. You can inquire about fee rates of 10 trading pairs each time at most. The fee rate of your sub-account is the same as that of the master account. + * Documentation: https://www.kucoin.com/docs-new/api-3470150 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getSpotActualFee(req: GetSpotActualFeeReq): Promise; + + /** + * getFuturesActualFee Get Actual Fee - Futures + * Description: This interface is for the actual futures fee rate of the trading pair. The fee rate of your sub-account is the same as that of the master account. + * Documentation: https://www.kucoin.com/docs-new/api-3470151 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getFuturesActualFee(req: GetFuturesActualFeeReq): Promise; +} + +export class FeeAPIImpl implements FeeAPI { + constructor(private transport: Transport) {} + + getBasicFee(req: GetBasicFeeReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/base-fee', + req, + new GetBasicFeeResp(), + false, + ); + } + + getSpotActualFee(req: GetSpotActualFeeReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/trade-fees', + req, + new GetSpotActualFeeResp(), + false, + ); + } + + getFuturesActualFee(req: GetFuturesActualFeeReq): Promise { + return this.transport.call( + 'futures', + false, + 'get', + '/api/v1/trade-fees', + req, + new GetFuturesActualFeeResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts new file mode 100644 index 00000000..9d9f956f --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts @@ -0,0 +1,73 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetBasicFeeReq implements Serializable { + /** + * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency + */ + currencyType?: GetBasicFeeReq.CurrencyTypeEnum = GetBasicFeeReq.CurrencyTypeEnum._0; + + /** + * Creates a new instance of the `GetBasicFeeReq` class. + * The builder pattern allows step-by-step construction of a `GetBasicFeeReq` object. + */ + static builder(): GetBasicFeeReqBuilder { + return new GetBasicFeeReqBuilder(); + } + + /** + * Creates a new instance of the `GetBasicFeeReq` class with the given data. + */ + static create(data: { + /** + * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency + */ + currencyType?: GetBasicFeeReq.CurrencyTypeEnum; + }): GetBasicFeeReq { + let obj = new GetBasicFeeReq(); + obj.currencyType = data.currencyType; + return obj; + } + + fromJson(input: string): GetBasicFeeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBasicFeeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBasicFeeReq { + return plainToInstance(GetBasicFeeReq, jsonObject); + } +} + +export namespace GetBasicFeeReq { + export enum CurrencyTypeEnum { + /** + * crypto currency + */ + _0 = 0, + /** + * fiat currency + */ + _1 = 1, + } +} + +export class GetBasicFeeReqBuilder { + obj: GetBasicFeeReq = new GetBasicFeeReq(); + /** + * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency + */ + setCurrencyType(value: GetBasicFeeReq.CurrencyTypeEnum): GetBasicFeeReqBuilder { + this.obj.currencyType = value; + return this; + } + + build(): GetBasicFeeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts new file mode 100644 index 00000000..f17de2d2 --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetBasicFeeResp implements Response { + /** + * Base taker fee rate + */ + takerFeeRate?: string; + /** + * Base maker fee rate + */ + makerFeeRate?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetBasicFeeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBasicFeeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBasicFeeResp { + return plainToInstance(GetBasicFeeResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts new file mode 100644 index 00000000..488eaf04 --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesActualFeeReq implements Serializable { + /** + * Trading pair + */ + symbol?: string; + + /** + * Creates a new instance of the `GetFuturesActualFeeReq` class. + * The builder pattern allows step-by-step construction of a `GetFuturesActualFeeReq` object. + */ + static builder(): GetFuturesActualFeeReqBuilder { + return new GetFuturesActualFeeReqBuilder(); + } + + /** + * Creates a new instance of the `GetFuturesActualFeeReq` class with the given data. + */ + static create(data: { + /** + * Trading pair + */ + symbol?: string; + }): GetFuturesActualFeeReq { + let obj = new GetFuturesActualFeeReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetFuturesActualFeeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesActualFeeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesActualFeeReq { + return plainToInstance(GetFuturesActualFeeReq, jsonObject); + } +} + +export class GetFuturesActualFeeReqBuilder { + obj: GetFuturesActualFeeReq = new GetFuturesActualFeeReq(); + /** + * Trading pair + */ + setSymbol(value: string): GetFuturesActualFeeReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetFuturesActualFeeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts new file mode 100644 index 00000000..bc93d093 --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFuturesActualFeeResp implements Response { + /** + * The unique identity of the trading pair and will not change even if the trading pair is renamed + */ + symbol?: string; + /** + * Actual taker fee rate of the trading pair + */ + takerFeeRate?: string; + /** + * Actual maker fee rate of the trading pair + */ + makerFeeRate?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFuturesActualFeeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesActualFeeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesActualFeeResp { + return plainToInstance(GetFuturesActualFeeResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts new file mode 100644 index 00000000..f254426f --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts @@ -0,0 +1,30 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotActualFeeData implements Serializable { + /** + * The unique identity of the trading pair and will not change even if the trading pair is renamed + */ + symbol?: string; + /** + * Actual taker fee rate of the symbol + */ + takerFeeRate?: string; + /** + * Actual maker fee rate of the symbol + */ + makerFeeRate?: string; + fromJson(input: string): GetSpotActualFeeData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotActualFeeData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotActualFeeData { + return plainToInstance(GetSpotActualFeeData, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts new file mode 100644 index 00000000..0b0fbcdb --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotActualFeeReq implements Serializable { + /** + * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) + */ + symbols?: string; + + /** + * Creates a new instance of the `GetSpotActualFeeReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotActualFeeReq` object. + */ + static builder(): GetSpotActualFeeReqBuilder { + return new GetSpotActualFeeReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotActualFeeReq` class with the given data. + */ + static create(data: { + /** + * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) + */ + symbols?: string; + }): GetSpotActualFeeReq { + let obj = new GetSpotActualFeeReq(); + obj.symbols = data.symbols; + return obj; + } + + fromJson(input: string): GetSpotActualFeeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotActualFeeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotActualFeeReq { + return plainToInstance(GetSpotActualFeeReq, jsonObject); + } +} + +export class GetSpotActualFeeReqBuilder { + obj: GetSpotActualFeeReq = new GetSpotActualFeeReq(); + /** + * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) + */ + setSymbols(value: string): GetSpotActualFeeReqBuilder { + this.obj.symbols = value; + return this; + } + + build(): GetSpotActualFeeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts new file mode 100644 index 00000000..2e44329c --- /dev/null +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotActualFeeData } from './model_get_spot_actual_fee_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotActualFeeResp implements Response { + /** + * + */ + @Type(() => GetSpotActualFeeData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotActualFeeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotActualFeeResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotActualFeeResp { + return plainToInstance(GetSpotActualFeeResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.template b/sdk/node/src/generate/account/subaccount/api_sub_account.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts new file mode 100644 index 00000000..010d6d95 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts @@ -0,0 +1,401 @@ +import { GetSpotSubAccountListV2Resp } from './model_get_spot_sub_account_list_v2_resp'; +import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; +import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; +import { AddSubAccountReq } from './model_add_sub_account_req'; +import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; +import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; +import { GetSubAccountApiListResp } from './model_get_sub_account_api_list_resp'; +import { GetSpotSubAccountDetailResp } from './model_get_spot_sub_account_detail_resp'; +import { DeleteSubAccountApiReq } from './model_delete_sub_account_api_req'; +import { GetSpotSubAccountListV1Resp } from './model_get_spot_sub_account_list_v1_resp'; +import { GetSpotSubAccountListV2Req } from './model_get_spot_sub_account_list_v2_req'; +import { GetFuturesSubAccountListV2Req } from './model_get_futures_sub_account_list_v2_req'; +import { GetFuturesSubAccountListV2Resp } from './model_get_futures_sub_account_list_v2_resp'; +import { AddSubAccountFuturesPermissionReq } from './model_add_sub_account_futures_permission_req'; +import { AddSubAccountMarginPermissionResp } from './model_add_sub_account_margin_permission_resp'; +import { GetSpotSubAccountsSummaryV1Resp } from './model_get_spot_sub_accounts_summary_v1_resp'; +import { GetSpotSubAccountsSummaryV2Req } from './model_get_spot_sub_accounts_summary_v2_req'; +import { AddSubAccountFuturesPermissionResp } from './model_add_sub_account_futures_permission_resp'; +import { AddSubAccountResp } from './model_add_sub_account_resp'; +import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; +import { DeleteSubAccountApiResp } from './model_delete_sub_account_api_resp'; +import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; +import { GetSpotSubAccountDetailReq } from './model_get_spot_sub_account_detail_req'; +import { GetSpotSubAccountsSummaryV2Resp } from './model_get_spot_sub_accounts_summary_v2_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getFuturesSubAccountListV2 request test', () => { + /** + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all + */ + let data = '{"currency": "USDT"}'; + let req = new GetFuturesSubAccountListV2Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFuturesSubAccountListV2 response test', () => { + /** + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all + */ + let data = + '{\n "code": "200000",\n "data": {\n "summary": {\n "accountEquityTotal": 103.899081508,\n "unrealisedPNLTotal": 38.81075,\n "marginBalanceTotal": 65.336985668,\n "positionMarginTotal": 68.9588320683,\n "orderMarginTotal": 0,\n "frozenFundsTotal": 0,\n "availableBalanceTotal": 67.2492494397,\n "currency": "USDT"\n },\n "accounts": [\n {\n "accountName": "Name1234567",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "LTkucoin1491",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "manage112233",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "testapi6",\n "accountEquity": 27.30545128,\n "unrealisedPNL": 22.549,\n "marginBalance": 4.75645128,\n "positionMargin": 24.1223749975,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 25.7320762825,\n "currency": "USDT"\n },\n {\n "accountName": "main",\n "accountEquity": 76.593630228,\n "unrealisedPNL": 16.26175,\n "marginBalance": 60.580534388,\n "positionMargin": 44.8364570708,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 41.5171731572,\n "currency": "USDT"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFuturesSubAccountListV2Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotSubAccountListV1 request test', () => { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + }); + + test('getSpotSubAccountListV1 response test', () => { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + }); + test('getSpotSubAccountDetail request test', () => { + /** + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} + */ + let data = '{"subUserId": "63743f07e0c5230001761d08", "includeBaseAmount": true}'; + let req = new GetSpotSubAccountDetailReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotSubAccountDetail response test', () => { + /** + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotSubAccountDetailResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('deleteSubAccountApi request test', () => { + /** + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key + */ + let data = + '{"apiKey": "670621e3a25958000159c82f", "subName": "testapi6", "passphrase": "11223344"}'; + let req = new DeleteSubAccountApiReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('deleteSubAccountApi response test', () => { + /** + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key + */ + let data = + '{"code":"200000","data":{"subName":"testapi6","apiKey":"670621e3a25958000159c82f"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new DeleteSubAccountApiResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSubAccountApiList request test', () => { + /** + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key + */ + let data = '{"apiKey": "example_string_default_value", "subName": "testapi6"}'; + let req = new GetSubAccountApiListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSubAccountApiList response test', () => { + /** + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "subName": "apiSdkTest",\n "remark": "sdk_test_integration",\n "apiKey": "673eab2a955ebf000195d7e4",\n "apiVersion": 3,\n "permission": "General",\n "ipWhitelist": "10.**.1",\n "createdAt": 1732160298000,\n "uid": 215112467,\n "isMaster": false\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSubAccountApiListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccountApi request test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key + */ + let data = + '{"subName": "testapi6", "passphrase": "11223344", "remark": "TheRemark", "permission": "General,Spot,Futures"}'; + let req = new AddSubAccountApiReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccountApi response test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key + */ + let data = + '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "remark": "TheRemark",\n "apiKey": "670621e3a25958000159c82f",\n "apiSecret": "46fd8974******896f005b2340",\n "apiVersion": 3,\n "passphrase": "11223344",\n "permission": "General,Futures",\n "createdAt": 1728455139000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountApiResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifySubAccountApi request test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update + */ + let data = + '{"subName": "testapi6", "apiKey": "670621e3a25958000159c82f", "passphrase": "11223344", "permission": "General,Spot,Futures"}'; + let req = new ModifySubAccountApiReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifySubAccountApi response test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update + */ + let data = + '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "apiKey": "670621e3a25958000159c82f",\n "permission": "General,Futures,Spot"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifySubAccountApiResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotSubAccountsSummaryV1 request test', () => { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + }); + + test('getSpotSubAccountsSummaryV1 response test', () => { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + }); + test('getSpotSubAccountListV2 request test', () => { + /** + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts + */ + let data = '{"currentPage": 1, "pageSize": 10}'; + let req = new GetSpotSubAccountListV2Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotSubAccountListV2 response test', () => { + /** + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "670538a31037eb000115b076",\n "subName": "Name1234567",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "66b0c0905fc1480001c14c36",\n "subName": "LTkucoin1491",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotSubAccountListV2Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccount request test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created + */ + let data = + '{"password": "1234567", "remarks": "TheRemark", "subName": "Name1234567", "access": "Spot"}'; + let req = new AddSubAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccount response test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotSubAccountsSummaryV2 request test', () => { + /** + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user + */ + let data = '{"currentPage": 1, "pageSize": 10}'; + let req = new GetSpotSubAccountsSummaryV2Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotSubAccountsSummaryV2 response test', () => { + /** + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotSubAccountsSummaryV2Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccountFuturesPermission request test', () => { + /** + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable + */ + let data = '{"uid": "169579801"}'; + let req = new AddSubAccountFuturesPermissionReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccountFuturesPermission response test', () => { + /** + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable + */ + let data = '{\n "code": "200000",\n "data": null\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountFuturesPermissionResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccountMarginPermission request test', () => { + /** + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable + */ + let data = '{"uid": "169579801"}'; + let req = new AddSubAccountMarginPermissionReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccountMarginPermission response test', () => { + /** + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable + */ + let data = '{\n "code": "200000",\n "data": null\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountMarginPermissionResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.ts new file mode 100644 index 00000000..d022f474 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.ts @@ -0,0 +1,415 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetSpotSubAccountListV2Resp } from './model_get_spot_sub_account_list_v2_resp'; +import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; +import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; +import { AddSubAccountReq } from './model_add_sub_account_req'; +import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; +import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; +import { GetSubAccountApiListResp } from './model_get_sub_account_api_list_resp'; +import { GetSpotSubAccountDetailResp } from './model_get_spot_sub_account_detail_resp'; +import { DeleteSubAccountApiReq } from './model_delete_sub_account_api_req'; +import { GetSpotSubAccountListV1Resp } from './model_get_spot_sub_account_list_v1_resp'; +import { GetSpotSubAccountListV2Req } from './model_get_spot_sub_account_list_v2_req'; +import { GetFuturesSubAccountListV2Req } from './model_get_futures_sub_account_list_v2_req'; +import { GetFuturesSubAccountListV2Resp } from './model_get_futures_sub_account_list_v2_resp'; +import { AddSubAccountFuturesPermissionReq } from './model_add_sub_account_futures_permission_req'; +import { AddSubAccountMarginPermissionResp } from './model_add_sub_account_margin_permission_resp'; +import { GetSpotSubAccountsSummaryV1Resp } from './model_get_spot_sub_accounts_summary_v1_resp'; +import { GetSpotSubAccountsSummaryV2Req } from './model_get_spot_sub_accounts_summary_v2_req'; +import { AddSubAccountFuturesPermissionResp } from './model_add_sub_account_futures_permission_resp'; +import { AddSubAccountResp } from './model_add_sub_account_resp'; +import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; +import { DeleteSubAccountApiResp } from './model_delete_sub_account_api_resp'; +import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; +import { GetSpotSubAccountDetailReq } from './model_get_spot_sub_account_detail_req'; +import { GetSpotSubAccountsSummaryV2Resp } from './model_get_spot_sub_accounts_summary_v2_resp'; + +export interface SubAccountAPI { + /** + * getFuturesSubAccountListV2 Get SubAccount List - Futures Balance(V2) + * Description: This endpoint can be used to get Futures sub-account information. + * Documentation: https://www.kucoin.com/docs-new/api-3470134 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 6 | + * +---------------------+---------+ + */ + getFuturesSubAccountListV2( + req: GetFuturesSubAccountListV2Req, + ): Promise; + + /** + * @deprecated + * getSpotSubAccountListV1 Get SubAccount List - Spot Balance(V1) + * Description: This endpoint returns the account info of all sub-users. + * Documentation: https://www.kucoin.com/docs-new/api-3470299 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getSpotSubAccountListV1(): Promise; + + /** + * getSpotSubAccountDetail Get SubAccount Detail - Balance + * Description: This endpoint returns the account info of a sub-user specified by the subUserId. + * Documentation: https://www.kucoin.com/docs-new/api-3470132 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 15 | + * +---------------------+------------+ + */ + getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise; + + /** + * deleteSubAccountApi Delete SubAccount API + * Description: This endpoint can be used to delete sub-account APIs. + * Documentation: https://www.kucoin.com/docs-new/api-3470137 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 30 | + * +---------------------+------------+ + */ + deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise; + + /** + * getSubAccountApiList Get SubAccount API List + * Description: This endpoint can be used to obtain a list of APIs pertaining to a sub-account.(Not contain ND Broker Sub Account) + * Documentation: https://www.kucoin.com/docs-new/api-3470136 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getSubAccountApiList(req: GetSubAccountApiListReq): Promise; + + /** + * addSubAccountApi Add SubAccount API + * Description: This endpoint can be used to create APIs for sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470138 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + addSubAccountApi(req: AddSubAccountApiReq): Promise; + + /** + * modifySubAccountApi Modify SubAccount API + * Description: This endpoint can be used to modify sub-account APIs. + * Documentation: https://www.kucoin.com/docs-new/api-3470139 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 30 | + * +---------------------+------------+ + */ + modifySubAccountApi(req: ModifySubAccountApiReq): Promise; + + /** + * @deprecated + * getSpotSubAccountsSummaryV1 Get SubAccount List - Summary Info(V1) + * Description: You can get the user info of all sub-account via this interface It is recommended to use the GET /api/v2/sub/user interface for paging query + * Documentation: https://www.kucoin.com/docs-new/api-3470298 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getSpotSubAccountsSummaryV1(): Promise; + + /** + * getSpotSubAccountListV2 Get SubAccount List - Spot Balance(V2) + * Description: This endpoint can be used to get paginated Spot sub-account information. Pagination is required. + * Documentation: https://www.kucoin.com/docs-new/api-3470133 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise; + + /** + * addSubAccount Add SubAccount + * Description: This endpoint can be used to create sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470135 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 15 | + * +---------------------+------------+ + */ + addSubAccount(req: AddSubAccountReq): Promise; + + /** + * getSpotSubAccountsSummaryV2 Get SubAccount List - Summary Info + * Description: This endpoint can be used to get a paginated list of sub-accounts. Pagination is required. + * Documentation: https://www.kucoin.com/docs-new/api-3470131 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getSpotSubAccountsSummaryV2( + req: GetSpotSubAccountsSummaryV2Req, + ): Promise; + + /** + * addSubAccountFuturesPermission Add SubAccount Futures Permission + * Description: This endpoint can be used to add sub-accounts Futures permission. Before using this endpoints, you need to ensure that the master account apikey has Futures permissions and the Futures function has been activated. + * Documentation: https://www.kucoin.com/docs-new/api-3470332 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 15 | + * +---------------------+------------+ + */ + addSubAccountFuturesPermission( + req: AddSubAccountFuturesPermissionReq, + ): Promise; + + /** + * addSubAccountMarginPermission Add SubAccount Margin Permission + * Description: This endpoint can be used to add sub-accounts Margin permission. Before using this endpoints, you need to ensure that the master account apikey has Margin permissions and the Margin function has been activated. + * Documentation: https://www.kucoin.com/docs-new/api-3470331 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 15 | + * +---------------------+------------+ + */ + addSubAccountMarginPermission( + req: AddSubAccountMarginPermissionReq, + ): Promise; +} + +export class SubAccountAPIImpl implements SubAccountAPI { + constructor(private transport: Transport) {} + + getFuturesSubAccountListV2( + req: GetFuturesSubAccountListV2Req, + ): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/account-overview-all', + req, + new GetFuturesSubAccountListV2Resp(), + false, + ); + } + + getSpotSubAccountListV1(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/sub-accounts', + null, + new GetSpotSubAccountListV1Resp(), + false, + ); + } + + getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/sub-accounts/{subUserId}', + req, + new GetSpotSubAccountDetailResp(), + false, + ); + } + + deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/sub/api-key', + req, + new DeleteSubAccountApiResp(), + false, + ); + } + + getSubAccountApiList(req: GetSubAccountApiListReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/sub/api-key', + req, + new GetSubAccountApiListResp(), + false, + ); + } + + addSubAccountApi(req: AddSubAccountApiReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/sub/api-key', + req, + new AddSubAccountApiResp(), + false, + ); + } + + modifySubAccountApi(req: ModifySubAccountApiReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/sub/api-key/update', + req, + new ModifySubAccountApiResp(), + false, + ); + } + + getSpotSubAccountsSummaryV1(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/sub/user', + null, + new GetSpotSubAccountsSummaryV1Resp(), + false, + ); + } + + getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/sub-accounts', + req, + new GetSpotSubAccountListV2Resp(), + false, + ); + } + + addSubAccount(req: AddSubAccountReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v2/sub/user/created', + req, + new AddSubAccountResp(), + false, + ); + } + + getSpotSubAccountsSummaryV2( + req: GetSpotSubAccountsSummaryV2Req, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/sub/user', + req, + new GetSpotSubAccountsSummaryV2Resp(), + false, + ); + } + + addSubAccountFuturesPermission( + req: AddSubAccountFuturesPermissionReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/sub/user/futures/enable', + req, + new AddSubAccountFuturesPermissionResp(), + false, + ); + } + + addSubAccountMarginPermission( + req: AddSubAccountMarginPermissionReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/sub/user/margin/enable', + req, + new AddSubAccountMarginPermissionResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts new file mode 100644 index 00000000..6c957121 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts @@ -0,0 +1,170 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountApiReq implements Serializable { + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + passphrase?: string; + /** + * Remarks(1~24 characters) + */ + remark?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + permission?: string = 'General'; + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + ipWhitelist?: string; + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + expire?: AddSubAccountApiReq.ExpireEnum = AddSubAccountApiReq.ExpireEnum._1; + /** + * Sub-account name, create sub account name of API Key. + */ + subName?: string; + + /** + * Creates a new instance of the `AddSubAccountApiReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountApiReq` object. + */ + static builder(): AddSubAccountApiReqBuilder { + return new AddSubAccountApiReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountApiReq` class with the given data. + */ + static create(data: { + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + passphrase?: string; + /** + * Remarks(1~24 characters) + */ + remark?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + permission?: string; + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + ipWhitelist?: string; + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + expire?: AddSubAccountApiReq.ExpireEnum; + /** + * Sub-account name, create sub account name of API Key. + */ + subName?: string; + }): AddSubAccountApiReq { + let obj = new AddSubAccountApiReq(); + obj.passphrase = data.passphrase; + obj.remark = data.remark; + obj.permission = data.permission; + obj.ipWhitelist = data.ipWhitelist; + obj.expire = data.expire; + obj.subName = data.subName; + return obj; + } + + fromJson(input: string): AddSubAccountApiReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountApiReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountApiReq { + return plainToInstance(AddSubAccountApiReq, jsonObject); + } +} + +export namespace AddSubAccountApiReq { + export enum ExpireEnum { + /** + * + */ + _1 = '-1', + /** + * + */ + _30 = '30', + /** + * + */ + _90 = '90', + /** + * + */ + _180 = '180', + /** + * + */ + _360 = '360', + } +} + +export class AddSubAccountApiReqBuilder { + obj: AddSubAccountApiReq = new AddSubAccountApiReq(); + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + setPassphrase(value: string): AddSubAccountApiReqBuilder { + this.obj.passphrase = value; + return this; + } + + /** + * Remarks(1~24 characters) + */ + setRemark(value: string): AddSubAccountApiReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + setPermission(value: string): AddSubAccountApiReqBuilder { + this.obj.permission = value; + return this; + } + + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + setIpWhitelist(value: string): AddSubAccountApiReqBuilder { + this.obj.ipWhitelist = value; + return this; + } + + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + setExpire(value: AddSubAccountApiReq.ExpireEnum): AddSubAccountApiReqBuilder { + this.obj.expire = value; + return this; + } + + /** + * Sub-account name, create sub account name of API Key. + */ + setSubName(value: string): AddSubAccountApiReqBuilder { + this.obj.subName = value; + return this; + } + + build(): AddSubAccountApiReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts new file mode 100644 index 00000000..07e87b25 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts @@ -0,0 +1,65 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountApiResp implements Response { + /** + * Sub-account name + */ + subName?: string; + /** + * Remarks + */ + remark?: string; + /** + * API Key + */ + apiKey?: string; + /** + * API Secret Key + */ + apiSecret?: string; + /** + * API Version + */ + apiVersion?: number; + /** + * Password + */ + passphrase?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) + */ + permission?: string; + /** + * IP whitelist + */ + ipWhitelist?: string; + /** + * Time of the event + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountApiResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountApiResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountApiResp { + return plainToInstance(AddSubAccountApiResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts new file mode 100644 index 00000000..4b6c7c06 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountFuturesPermissionReq + implements Serializable +{ + /** + * Sub account UID + */ + uid?: string; + + /** + * Creates a new instance of the `AddSubAccountFuturesPermissionReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountFuturesPermissionReq` object. + */ + static builder(): AddSubAccountFuturesPermissionReqBuilder { + return new AddSubAccountFuturesPermissionReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountFuturesPermissionReq` class with the given data. + */ + static create(data: { + /** + * Sub account UID + */ + uid?: string; + }): AddSubAccountFuturesPermissionReq { + let obj = new AddSubAccountFuturesPermissionReq(); + obj.uid = data.uid; + return obj; + } + + fromJson(input: string): AddSubAccountFuturesPermissionReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountFuturesPermissionReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountFuturesPermissionReq { + return plainToInstance(AddSubAccountFuturesPermissionReq, jsonObject); + } +} + +export class AddSubAccountFuturesPermissionReqBuilder { + obj: AddSubAccountFuturesPermissionReq = new AddSubAccountFuturesPermissionReq(); + /** + * Sub account UID + */ + setUid(value: string): AddSubAccountFuturesPermissionReqBuilder { + this.obj.uid = value; + return this; + } + + build(): AddSubAccountFuturesPermissionReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts new file mode 100644 index 00000000..4763645c --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountFuturesPermissionResp + implements Response +{ + /** + * + */ + data?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountFuturesPermissionResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountFuturesPermissionResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): AddSubAccountFuturesPermissionResp { + return plainToInstance(AddSubAccountFuturesPermissionResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts new file mode 100644 index 00000000..d46bdc89 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountMarginPermissionReq + implements Serializable +{ + /** + * Sub account UID + */ + uid?: string; + + /** + * Creates a new instance of the `AddSubAccountMarginPermissionReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountMarginPermissionReq` object. + */ + static builder(): AddSubAccountMarginPermissionReqBuilder { + return new AddSubAccountMarginPermissionReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountMarginPermissionReq` class with the given data. + */ + static create(data: { + /** + * Sub account UID + */ + uid?: string; + }): AddSubAccountMarginPermissionReq { + let obj = new AddSubAccountMarginPermissionReq(); + obj.uid = data.uid; + return obj; + } + + fromJson(input: string): AddSubAccountMarginPermissionReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountMarginPermissionReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountMarginPermissionReq { + return plainToInstance(AddSubAccountMarginPermissionReq, jsonObject); + } +} + +export class AddSubAccountMarginPermissionReqBuilder { + obj: AddSubAccountMarginPermissionReq = new AddSubAccountMarginPermissionReq(); + /** + * Sub account UID + */ + setUid(value: string): AddSubAccountMarginPermissionReqBuilder { + this.obj.uid = value; + return this; + } + + build(): AddSubAccountMarginPermissionReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts new file mode 100644 index 00000000..0e4f47ea --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountMarginPermissionResp + implements Response +{ + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountMarginPermissionResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountMarginPermissionResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): AddSubAccountMarginPermissionResp { + return plainToInstance(AddSubAccountMarginPermissionResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts new file mode 100644 index 00000000..1d491f7c --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts @@ -0,0 +1,128 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountReq implements Serializable { + /** + * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) + */ + password?: string; + /** + * Remarks(1~24 characters) + */ + remarks?: string; + /** + * Sub-account name(must contain 7-32 characters, at least one number and one letter. Cannot contain any spaces.) + */ + subName?: string; + /** + * Permission (types include Spot, Futures, Margin permissions, which can be used alone or in combination). + */ + access?: AddSubAccountReq.AccessEnum; + + /** + * Creates a new instance of the `AddSubAccountReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountReq` object. + */ + static builder(): AddSubAccountReqBuilder { + return new AddSubAccountReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountReq` class with the given data. + */ + static create(data: { + /** + * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) + */ + password?: string; + /** + * Remarks(1~24 characters) + */ + remarks?: string; + /** + * Sub-account name(must contain 7-32 characters, at least one number and one letter. Cannot contain any spaces.) + */ + subName?: string; + /** + * Permission (types include Spot, Futures, Margin permissions, which can be used alone or in combination). + */ + access?: AddSubAccountReq.AccessEnum; + }): AddSubAccountReq { + let obj = new AddSubAccountReq(); + obj.password = data.password; + obj.remarks = data.remarks; + obj.subName = data.subName; + obj.access = data.access; + return obj; + } + + fromJson(input: string): AddSubAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountReq { + return plainToInstance(AddSubAccountReq, jsonObject); + } +} + +export namespace AddSubAccountReq { + export enum AccessEnum { + /** + * Spot Account + */ + SPOT = 'Spot', + /** + * Futures Account + */ + FUTURES = 'Futures', + /** + * Margin Account + */ + MARGIN = 'Margin', + } +} + +export class AddSubAccountReqBuilder { + obj: AddSubAccountReq = new AddSubAccountReq(); + /** + * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) + */ + setPassword(value: string): AddSubAccountReqBuilder { + this.obj.password = value; + return this; + } + + /** + * Remarks(1~24 characters) + */ + setRemarks(value: string): AddSubAccountReqBuilder { + this.obj.remarks = value; + return this; + } + + /** + * Sub-account name(must contain 7-32 characters, at least one number and one letter. Cannot contain any spaces.) + */ + setSubName(value: string): AddSubAccountReqBuilder { + this.obj.subName = value; + return this; + } + + /** + * Permission (types include Spot, Futures, Margin permissions, which can be used alone or in combination). + */ + setAccess(value: AddSubAccountReq.AccessEnum): AddSubAccountReqBuilder { + this.obj.access = value; + return this; + } + + build(): AddSubAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts new file mode 100644 index 00000000..27ee1bf1 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountResp implements Response { + /** + * Sub-account UID + */ + uid?: number; + /** + * Sub-account name + */ + subName?: string; + /** + * Remarks + */ + remarks?: string; + /** + * Permission + */ + access?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountResp { + return plainToInstance(AddSubAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts new file mode 100644 index 00000000..41cfca83 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class DeleteSubAccountApiReq implements Serializable { + /** + * API-Key + */ + apiKey?: string; + /** + * Sub-account name. + */ + subName?: string; + /** + * Password(Password of the API key) + */ + passphrase?: string; + + /** + * Creates a new instance of the `DeleteSubAccountApiReq` class. + * The builder pattern allows step-by-step construction of a `DeleteSubAccountApiReq` object. + */ + static builder(): DeleteSubAccountApiReqBuilder { + return new DeleteSubAccountApiReqBuilder(); + } + + /** + * Creates a new instance of the `DeleteSubAccountApiReq` class with the given data. + */ + static create(data: { + /** + * API-Key + */ + apiKey?: string; + /** + * Sub-account name. + */ + subName?: string; + /** + * Password(Password of the API key) + */ + passphrase?: string; + }): DeleteSubAccountApiReq { + let obj = new DeleteSubAccountApiReq(); + obj.apiKey = data.apiKey; + obj.subName = data.subName; + obj.passphrase = data.passphrase; + return obj; + } + + fromJson(input: string): DeleteSubAccountApiReq { + const jsonObject = JSON.parse(input); + return plainToInstance(DeleteSubAccountApiReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): DeleteSubAccountApiReq { + return plainToInstance(DeleteSubAccountApiReq, jsonObject); + } +} + +export class DeleteSubAccountApiReqBuilder { + obj: DeleteSubAccountApiReq = new DeleteSubAccountApiReq(); + /** + * API-Key + */ + setApiKey(value: string): DeleteSubAccountApiReqBuilder { + this.obj.apiKey = value; + return this; + } + + /** + * Sub-account name. + */ + setSubName(value: string): DeleteSubAccountApiReqBuilder { + this.obj.subName = value; + return this; + } + + /** + * Password(Password of the API key) + */ + setPassphrase(value: string): DeleteSubAccountApiReqBuilder { + this.obj.passphrase = value; + return this; + } + + build(): DeleteSubAccountApiReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts new file mode 100644 index 00000000..ac1885cf --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class DeleteSubAccountApiResp implements Response { + /** + * The username of a sub-user. + */ + subName?: string; + /** + * The APIKEY of a sub-user. + */ + apiKey?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): DeleteSubAccountApiResp { + const jsonObject = JSON.parse(input); + return plainToInstance(DeleteSubAccountApiResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): DeleteSubAccountApiResp { + return plainToInstance(DeleteSubAccountApiResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts new file mode 100644 index 00000000..f44f6858 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts @@ -0,0 +1,56 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesSubAccountListV2Accounts + implements Serializable +{ + /** + * Account name, main account is main + */ + accountName?: string; + /** + * + */ + accountEquity?: number; + /** + * + */ + unrealisedPNL?: number; + /** + * + */ + marginBalance?: number; + /** + * + */ + positionMargin?: number; + /** + * + */ + orderMargin?: number; + /** + * + */ + frozenFunds?: number; + /** + * + */ + availableBalance?: number; + /** + * currency + */ + currency?: string; + fromJson(input: string): GetFuturesSubAccountListV2Accounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesSubAccountListV2Accounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesSubAccountListV2Accounts { + return plainToInstance(GetFuturesSubAccountListV2Accounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts new file mode 100644 index 00000000..cd6a28cb --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesSubAccountListV2Req implements Serializable { + /** + * Currecny, Default XBT + */ + currency?: string = 'XBT'; + + /** + * Creates a new instance of the `GetFuturesSubAccountListV2Req` class. + * The builder pattern allows step-by-step construction of a `GetFuturesSubAccountListV2Req` object. + */ + static builder(): GetFuturesSubAccountListV2ReqBuilder { + return new GetFuturesSubAccountListV2ReqBuilder(); + } + + /** + * Creates a new instance of the `GetFuturesSubAccountListV2Req` class with the given data. + */ + static create(data: { + /** + * Currecny, Default XBT + */ + currency?: string; + }): GetFuturesSubAccountListV2Req { + let obj = new GetFuturesSubAccountListV2Req(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetFuturesSubAccountListV2Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesSubAccountListV2Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesSubAccountListV2Req { + return plainToInstance(GetFuturesSubAccountListV2Req, jsonObject); + } +} + +export class GetFuturesSubAccountListV2ReqBuilder { + obj: GetFuturesSubAccountListV2Req = new GetFuturesSubAccountListV2Req(); + /** + * Currecny, Default XBT + */ + setCurrency(value: string): GetFuturesSubAccountListV2ReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetFuturesSubAccountListV2Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts new file mode 100644 index 00000000..96953d18 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts @@ -0,0 +1,43 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetFuturesSubAccountListV2Summary } from './model_get_futures_sub_account_list_v2_summary'; +import { GetFuturesSubAccountListV2Accounts } from './model_get_futures_sub_account_list_v2_accounts'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFuturesSubAccountListV2Resp + implements Response +{ + /** + * + */ + @Type(() => GetFuturesSubAccountListV2Summary) + summary?: GetFuturesSubAccountListV2Summary; + /** + * Account List + */ + @Type(() => GetFuturesSubAccountListV2Accounts) + accounts?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFuturesSubAccountListV2Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesSubAccountListV2Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesSubAccountListV2Resp { + return plainToInstance(GetFuturesSubAccountListV2Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts new file mode 100644 index 00000000..1e59585c --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesSubAccountListV2Summary + implements Serializable +{ + /** + * Total Account Equity + */ + accountEquityTotal?: number; + /** + * Total unrealisedPNL + */ + unrealisedPNLTotal?: number; + /** + * Total Margin Balance + */ + marginBalanceTotal?: number; + /** + * Total Position margin + */ + positionMarginTotal?: number; + /** + * + */ + orderMarginTotal?: number; + /** + * Total frozen funds for withdrawal and out-transfer + */ + frozenFundsTotal?: number; + /** + * total available balance + */ + availableBalanceTotal?: number; + /** + * + */ + currency?: string; + fromJson(input: string): GetFuturesSubAccountListV2Summary { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesSubAccountListV2Summary, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesSubAccountListV2Summary { + return plainToInstance(GetFuturesSubAccountListV2Summary, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts new file mode 100644 index 00000000..e7b06b81 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountDetailMainAccounts + implements Serializable +{ + /** + * Currency + */ + currency?: string; + /** + * Total funds in an account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountDetailMainAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountDetailMainAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountDetailMainAccounts { + return plainToInstance(GetSpotSubAccountDetailMainAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts new file mode 100644 index 00000000..91aa554b --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountDetailMarginAccounts + implements Serializable +{ + /** + * Currency + */ + currency?: string; + /** + * Total funds in an account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountDetailMarginAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountDetailMarginAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountDetailMarginAccounts { + return plainToInstance(GetSpotSubAccountDetailMarginAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts new file mode 100644 index 00000000..f0debc96 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountDetailReq implements Serializable { + /** + * the userID of a sub-account. + */ + @Reflect.metadata('path', 'subUserId') + subUserId?: string; + /** + * false: do not display the currency which asset is 0, true: display all currency + */ + includeBaseAmount?: boolean; + + /** + * Creates a new instance of the `GetSpotSubAccountDetailReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotSubAccountDetailReq` object. + */ + static builder(): GetSpotSubAccountDetailReqBuilder { + return new GetSpotSubAccountDetailReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotSubAccountDetailReq` class with the given data. + */ + static create(data: { + /** + * the userID of a sub-account. + */ + subUserId?: string; + /** + * false: do not display the currency which asset is 0, true: display all currency + */ + includeBaseAmount?: boolean; + }): GetSpotSubAccountDetailReq { + let obj = new GetSpotSubAccountDetailReq(); + obj.subUserId = data.subUserId; + obj.includeBaseAmount = data.includeBaseAmount; + return obj; + } + + fromJson(input: string): GetSpotSubAccountDetailReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountDetailReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountDetailReq { + return plainToInstance(GetSpotSubAccountDetailReq, jsonObject); + } +} + +export class GetSpotSubAccountDetailReqBuilder { + obj: GetSpotSubAccountDetailReq = new GetSpotSubAccountDetailReq(); + /** + * the userID of a sub-account. + */ + setSubUserId(value: string): GetSpotSubAccountDetailReqBuilder { + this.obj.subUserId = value; + return this; + } + + /** + * false: do not display the currency which asset is 0, true: display all currency + */ + setIncludeBaseAmount(value: boolean): GetSpotSubAccountDetailReqBuilder { + this.obj.includeBaseAmount = value; + return this; + } + + build(): GetSpotSubAccountDetailReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts new file mode 100644 index 00000000..e2973b68 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountDetailMarginAccounts } from './model_get_spot_sub_account_detail_margin_accounts'; +import { GetSpotSubAccountDetailMainAccounts } from './model_get_spot_sub_account_detail_main_accounts'; +import { GetSpotSubAccountDetailTradeAccounts } from './model_get_spot_sub_account_detail_trade_accounts'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotSubAccountDetailResp + implements Response +{ + /** + * The user ID of a sub-user. + */ + subUserId?: string; + /** + * The username of a sub-user. + */ + subName?: string; + /** + * Funding Account + */ + @Type(() => GetSpotSubAccountDetailMainAccounts) + mainAccounts?: Array; + /** + * Spot Account + */ + @Type(() => GetSpotSubAccountDetailTradeAccounts) + tradeAccounts?: Array; + /** + * Margin Account + */ + @Type(() => GetSpotSubAccountDetailMarginAccounts) + marginAccounts?: Array; + /** + * This param is deprecated and only valid for some old users + */ + tradeHFAccounts?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotSubAccountDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountDetailResp { + return plainToInstance(GetSpotSubAccountDetailResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts new file mode 100644 index 00000000..3a142c4e --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountDetailTradeAccounts + implements Serializable +{ + /** + * Currency + */ + currency?: string; + /** + * Total funds in an account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountDetailTradeAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountDetailTradeAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountDetailTradeAccounts { + return plainToInstance(GetSpotSubAccountDetailTradeAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts new file mode 100644 index 00000000..985b1650 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSpotSubAccountListV1DataMarginAccounts } from './model_get_spot_sub_account_list_v1_data_margin_accounts'; +import { GetSpotSubAccountListV1DataMainAccounts } from './model_get_spot_sub_account_list_v1_data_main_accounts'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountListV1DataTradeAccounts } from './model_get_spot_sub_account_list_v1_data_trade_accounts'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV1Data implements Serializable { + /** + * The user ID of the sub-user. + */ + subUserId?: string; + /** + * The username of the sub-user. + */ + subName?: string; + /** + * Funding Account + */ + @Type(() => GetSpotSubAccountListV1DataMainAccounts) + mainAccounts?: Array; + /** + * Spot Account + */ + @Type(() => GetSpotSubAccountListV1DataTradeAccounts) + tradeAccounts?: Array; + /** + * Margin Account + */ + @Type(() => GetSpotSubAccountListV1DataMarginAccounts) + marginAccounts?: Array; + /** + * This param is deprecated and only valid for some old users + */ + tradeHFAccounts?: Array; + fromJson(input: string): GetSpotSubAccountListV1Data { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV1Data, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV1Data { + return plainToInstance(GetSpotSubAccountListV1Data, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts new file mode 100644 index 00000000..23778ae3 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV1DataMainAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataMainAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV1DataMainAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMainAccounts { + return plainToInstance(GetSpotSubAccountListV1DataMainAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts new file mode 100644 index 00000000..96cacf00 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV1DataMarginAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataMarginAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV1DataMarginAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMarginAccounts { + return plainToInstance(GetSpotSubAccountListV1DataMarginAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts new file mode 100644 index 00000000..545ab049 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV1DataTradeAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataTradeAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV1DataTradeAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV1DataTradeAccounts { + return plainToInstance(GetSpotSubAccountListV1DataTradeAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts new file mode 100644 index 00000000..6fa5c58d --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSpotSubAccountListV1Data } from './model_get_spot_sub_account_list_v1_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotSubAccountListV1Resp + implements Response +{ + /** + * + */ + @Type(() => GetSpotSubAccountListV1Data) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotSubAccountListV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV1Resp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV1Resp { + return plainToInstance(GetSpotSubAccountListV1Resp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts new file mode 100644 index 00000000..60731cbc --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSpotSubAccountListV2ItemsMarginAccounts } from './model_get_spot_sub_account_list_v2_items_margin_accounts'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountListV2ItemsMainAccounts } from './model_get_spot_sub_account_list_v2_items_main_accounts'; +import { GetSpotSubAccountListV2ItemsTradeAccounts } from './model_get_spot_sub_account_list_v2_items_trade_accounts'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV2Items implements Serializable { + /** + * The user ID of the sub-user. + */ + subUserId?: string; + /** + * The username of the sub-user. + */ + subName?: string; + /** + * Funding Account + */ + @Type(() => GetSpotSubAccountListV2ItemsMainAccounts) + mainAccounts?: Array; + /** + * Spot Account + */ + @Type(() => GetSpotSubAccountListV2ItemsTradeAccounts) + tradeAccounts?: Array; + /** + * Margin Account + */ + @Type(() => GetSpotSubAccountListV2ItemsMarginAccounts) + marginAccounts?: Array; + /** + * This param is deprecated and only valid for some old users + */ + tradeHFAccounts?: Array; + fromJson(input: string): GetSpotSubAccountListV2Items { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2Items, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2Items { + return plainToInstance(GetSpotSubAccountListV2Items, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts new file mode 100644 index 00000000..85a6a02e --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV2ItemsMainAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsMainAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2ItemsMainAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMainAccounts { + return plainToInstance(GetSpotSubAccountListV2ItemsMainAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts new file mode 100644 index 00000000..e9a70669 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV2ItemsMarginAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsMarginAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2ItemsMarginAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMarginAccounts { + return plainToInstance(GetSpotSubAccountListV2ItemsMarginAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts new file mode 100644 index 00000000..fc6b248e --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts @@ -0,0 +1,52 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV2ItemsTradeAccounts + implements Serializable +{ + /** + * The currency of the account. + */ + currency?: string; + /** + * Total funds in the account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Calculated on this currency. + */ + baseCurrency?: string; + /** + * The base currency price. + */ + baseCurrencyPrice?: string; + /** + * The base currency amount. + */ + baseAmount?: string; + /** + * + */ + tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsTradeAccounts { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2ItemsTradeAccounts, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsTradeAccounts { + return plainToInstance(GetSpotSubAccountListV2ItemsTradeAccounts, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts new file mode 100644 index 00000000..bac23891 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountListV2Req implements Serializable { + /** + * Current request page. Default is 1 + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 100, default is 10. + */ + pageSize?: number = 10; + + /** + * Creates a new instance of the `GetSpotSubAccountListV2Req` class. + * The builder pattern allows step-by-step construction of a `GetSpotSubAccountListV2Req` object. + */ + static builder(): GetSpotSubAccountListV2ReqBuilder { + return new GetSpotSubAccountListV2ReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotSubAccountListV2Req` class with the given data. + */ + static create(data: { + /** + * Current request page. Default is 1 + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 100, default is 10. + */ + pageSize?: number; + }): GetSpotSubAccountListV2Req { + let obj = new GetSpotSubAccountListV2Req(); + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetSpotSubAccountListV2Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2Req { + return plainToInstance(GetSpotSubAccountListV2Req, jsonObject); + } +} + +export class GetSpotSubAccountListV2ReqBuilder { + obj: GetSpotSubAccountListV2Req = new GetSpotSubAccountListV2Req(); + /** + * Current request page. Default is 1 + */ + setCurrentPage(value: number): GetSpotSubAccountListV2ReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 100, default is 10. + */ + setPageSize(value: number): GetSpotSubAccountListV2ReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetSpotSubAccountListV2Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts new file mode 100644 index 00000000..1fa69017 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts @@ -0,0 +1,53 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountListV2Items } from './model_get_spot_sub_account_list_v2_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotSubAccountListV2Resp + implements Response +{ + /** + * + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetSpotSubAccountListV2Items) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotSubAccountListV2Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountListV2Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountListV2Resp { + return plainToInstance(GetSpotSubAccountListV2Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts new file mode 100644 index 00000000..9a827a3b --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts @@ -0,0 +1,44 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountsSummaryV1Data + implements Serializable +{ + /** + * + */ + userId?: string; + /** + * + */ + uid?: number; + /** + * + */ + subName?: string; + /** + * + */ + type?: number; + /** + * + */ + remarks?: string; + /** + * Sub-account Permission + */ + access?: string; + fromJson(input: string): GetSpotSubAccountsSummaryV1Data { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountsSummaryV1Data, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Data { + return plainToInstance(GetSpotSubAccountsSummaryV1Data, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts new file mode 100644 index 00000000..566dbba2 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountsSummaryV1Data } from './model_get_spot_sub_accounts_summary_v1_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotSubAccountsSummaryV1Resp + implements Response +{ + /** + * + */ + @Type(() => GetSpotSubAccountsSummaryV1Data) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotSubAccountsSummaryV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountsSummaryV1Resp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Resp { + return plainToInstance(GetSpotSubAccountsSummaryV1Resp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts new file mode 100644 index 00000000..77423189 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts @@ -0,0 +1,95 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountsSummaryV2Items + implements Serializable +{ + /** + * Sub-account User Id + */ + userId?: string; + /** + * Sub-account UID + */ + uid?: number; + /** + * Sub-account name + */ + subName?: string; + /** + * Sub-account; 2:Enable, 3:Frozen + */ + status?: GetSpotSubAccountsSummaryV2Items.StatusEnum; + /** + * Sub-account type + */ + type?: GetSpotSubAccountsSummaryV2Items.TypeEnum; + /** + * Sub-account Permission + */ + access?: string; + /** + * Time of the event + */ + createdAt?: number; + /** + * Remarks + */ + remarks?: string; + /** + * Subaccount Permissions + */ + tradeTypes?: Array; + /** + * Subaccount active permissions,If do not have the corresponding permissions, need to log in to the sub-account and go to the corresponding web page to activate + */ + openedTradeTypes?: Array; + /** + * + */ + hostedStatus?: string; + fromJson(input: string): GetSpotSubAccountsSummaryV2Items { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountsSummaryV2Items, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Items { + return plainToInstance(GetSpotSubAccountsSummaryV2Items, jsonObject); + } +} + +export namespace GetSpotSubAccountsSummaryV2Items { + export enum StatusEnum { + /** + * Enable + */ + _2 = 2, + /** + * Frozen + */ + _3 = 3, + } + export enum TypeEnum { + /** + * Normal subaccount + */ + NORMAL = 0, + /** + * Robot subaccount + */ + ROBOT = 1, + /** + * New financial sub-account + */ + NOVICE = 2, + /** + * Asset management subaccount + */ + HOSTED = 5, + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts new file mode 100644 index 00000000..31d69001 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotSubAccountsSummaryV2Req + implements Serializable +{ + /** + * Current request page. Default is 1 + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 1, maximum is 100, default is 10. + */ + pageSize?: number = 10; + + /** + * Creates a new instance of the `GetSpotSubAccountsSummaryV2Req` class. + * The builder pattern allows step-by-step construction of a `GetSpotSubAccountsSummaryV2Req` object. + */ + static builder(): GetSpotSubAccountsSummaryV2ReqBuilder { + return new GetSpotSubAccountsSummaryV2ReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotSubAccountsSummaryV2Req` class with the given data. + */ + static create(data: { + /** + * Current request page. Default is 1 + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 1, maximum is 100, default is 10. + */ + pageSize?: number; + }): GetSpotSubAccountsSummaryV2Req { + let obj = new GetSpotSubAccountsSummaryV2Req(); + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetSpotSubAccountsSummaryV2Req { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountsSummaryV2Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Req { + return plainToInstance(GetSpotSubAccountsSummaryV2Req, jsonObject); + } +} + +export class GetSpotSubAccountsSummaryV2ReqBuilder { + obj: GetSpotSubAccountsSummaryV2Req = new GetSpotSubAccountsSummaryV2Req(); + /** + * Current request page. Default is 1 + */ + setCurrentPage(value: number): GetSpotSubAccountsSummaryV2ReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 1, maximum is 100, default is 10. + */ + setPageSize(value: number): GetSpotSubAccountsSummaryV2ReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetSpotSubAccountsSummaryV2Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts new file mode 100644 index 00000000..ca357bf4 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts @@ -0,0 +1,53 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotSubAccountsSummaryV2Items } from './model_get_spot_sub_accounts_summary_v2_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotSubAccountsSummaryV2Resp + implements Response +{ + /** + * Current request page + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 1, maximum is 100 + */ + pageSize?: number; + /** + * Total number of messages + */ + totalNum?: number; + /** + * Total number of page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetSpotSubAccountsSummaryV2Items) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotSubAccountsSummaryV2Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotSubAccountsSummaryV2Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Resp { + return plainToInstance(GetSpotSubAccountsSummaryV2Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts new file mode 100644 index 00000000..ab656c17 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts @@ -0,0 +1,54 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountApiListData implements Serializable { + /** + * Sub Name + */ + subName?: string; + /** + * Remarks + */ + remark?: string; + /** + * API Key + */ + apiKey?: string; + /** + * API Version + */ + apiVersion?: number; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) + */ + permission?: string; + /** + * IP whitelist + */ + ipWhitelist?: string; + /** + * Apikey create time + */ + createdAt?: number; + /** + * Sub-account UID + */ + uid?: number; + /** + * Whether it is the master account. + */ + isMaster?: boolean; + fromJson(input: string): GetSubAccountApiListData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountApiListData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountApiListData { + return plainToInstance(GetSubAccountApiListData, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts new file mode 100644 index 00000000..c51f7db1 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountApiListReq implements Serializable { + /** + * API-Key + */ + apiKey?: string; + /** + * Sub-account name. + */ + subName?: string; + + /** + * Creates a new instance of the `GetSubAccountApiListReq` class. + * The builder pattern allows step-by-step construction of a `GetSubAccountApiListReq` object. + */ + static builder(): GetSubAccountApiListReqBuilder { + return new GetSubAccountApiListReqBuilder(); + } + + /** + * Creates a new instance of the `GetSubAccountApiListReq` class with the given data. + */ + static create(data: { + /** + * API-Key + */ + apiKey?: string; + /** + * Sub-account name. + */ + subName?: string; + }): GetSubAccountApiListReq { + let obj = new GetSubAccountApiListReq(); + obj.apiKey = data.apiKey; + obj.subName = data.subName; + return obj; + } + + fromJson(input: string): GetSubAccountApiListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountApiListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountApiListReq { + return plainToInstance(GetSubAccountApiListReq, jsonObject); + } +} + +export class GetSubAccountApiListReqBuilder { + obj: GetSubAccountApiListReq = new GetSubAccountApiListReq(); + /** + * API-Key + */ + setApiKey(value: string): GetSubAccountApiListReqBuilder { + this.obj.apiKey = value; + return this; + } + + /** + * Sub-account name. + */ + setSubName(value: string): GetSubAccountApiListReqBuilder { + this.obj.subName = value; + return this; + } + + build(): GetSubAccountApiListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts new file mode 100644 index 00000000..3a44bbcc --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSubAccountApiListData } from './model_get_sub_account_api_list_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSubAccountApiListResp implements Response { + /** + * + */ + @Type(() => GetSubAccountApiListData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSubAccountApiListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountApiListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSubAccountApiListResp { + return plainToInstance(GetSubAccountApiListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts new file mode 100644 index 00000000..1b2e1d96 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts @@ -0,0 +1,170 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifySubAccountApiReq implements Serializable { + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + passphrase?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + permission?: string = 'General'; + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + ipWhitelist?: string; + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + expire?: ModifySubAccountApiReq.ExpireEnum = ModifySubAccountApiReq.ExpireEnum._1; + /** + * Sub-account name, create sub account name of API Key. + */ + subName?: string; + /** + * API-Key(Sub-account APIKey) + */ + apiKey?: string; + + /** + * Creates a new instance of the `ModifySubAccountApiReq` class. + * The builder pattern allows step-by-step construction of a `ModifySubAccountApiReq` object. + */ + static builder(): ModifySubAccountApiReqBuilder { + return new ModifySubAccountApiReqBuilder(); + } + + /** + * Creates a new instance of the `ModifySubAccountApiReq` class with the given data. + */ + static create(data: { + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + passphrase?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + permission?: string; + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + ipWhitelist?: string; + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + expire?: ModifySubAccountApiReq.ExpireEnum; + /** + * Sub-account name, create sub account name of API Key. + */ + subName?: string; + /** + * API-Key(Sub-account APIKey) + */ + apiKey?: string; + }): ModifySubAccountApiReq { + let obj = new ModifySubAccountApiReq(); + obj.passphrase = data.passphrase; + obj.permission = data.permission; + obj.ipWhitelist = data.ipWhitelist; + obj.expire = data.expire; + obj.subName = data.subName; + obj.apiKey = data.apiKey; + return obj; + } + + fromJson(input: string): ModifySubAccountApiReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifySubAccountApiReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifySubAccountApiReq { + return plainToInstance(ModifySubAccountApiReq, jsonObject); + } +} + +export namespace ModifySubAccountApiReq { + export enum ExpireEnum { + /** + * + */ + _1 = '-1', + /** + * + */ + _30 = '30', + /** + * + */ + _90 = '90', + /** + * + */ + _180 = '180', + /** + * + */ + _360 = '360', + } +} + +export class ModifySubAccountApiReqBuilder { + obj: ModifySubAccountApiReq = new ModifySubAccountApiReq(); + /** + * Password(Must contain 7-32 characters. Cannot contain any spaces.) + */ + setPassphrase(value: string): ModifySubAccountApiReqBuilder { + this.obj.passphrase = value; + return this; + } + + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") + */ + setPermission(value: string): ModifySubAccountApiReqBuilder { + this.obj.permission = value; + return this; + } + + /** + * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) + */ + setIpWhitelist(value: string): ModifySubAccountApiReqBuilder { + this.obj.ipWhitelist = value; + return this; + } + + /** + * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 + */ + setExpire(value: ModifySubAccountApiReq.ExpireEnum): ModifySubAccountApiReqBuilder { + this.obj.expire = value; + return this; + } + + /** + * Sub-account name, create sub account name of API Key. + */ + setSubName(value: string): ModifySubAccountApiReqBuilder { + this.obj.subName = value; + return this; + } + + /** + * API-Key(Sub-account APIKey) + */ + setApiKey(value: string): ModifySubAccountApiReqBuilder { + this.obj.apiKey = value; + return this; + } + + build(): ModifySubAccountApiReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts new file mode 100644 index 00000000..dc83a073 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifySubAccountApiResp implements Response { + /** + * Sub-account name + */ + subName?: string; + /** + * API Key + */ + apiKey?: string; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) + */ + permission?: string; + /** + * IP whitelist + */ + ipWhitelist?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifySubAccountApiResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifySubAccountApiResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifySubAccountApiResp { + return plainToInstance(ModifySubAccountApiResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/api_transfer.template b/sdk/node/src/generate/account/transfer/api_transfer.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/transfer/api_transfer.test.ts b/sdk/node/src/generate/account/transfer/api_transfer.test.ts new file mode 100644 index 00000000..2f8392e2 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/api_transfer.test.ts @@ -0,0 +1,236 @@ +import { GetFuturesAccountTransferOutLedgerResp } from './model_get_futures_account_transfer_out_ledger_resp'; +import { FuturesAccountTransferInResp } from './model_futures_account_transfer_in_resp'; +import { InnerTransferResp } from './model_inner_transfer_resp'; +import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; +import { InnerTransferReq } from './model_inner_transfer_req'; +import { FlexTransferResp } from './model_flex_transfer_resp'; +import { SubAccountTransferReq } from './model_sub_account_transfer_req'; +import { GetTransferQuotasResp } from './model_get_transfer_quotas_resp'; +import { GetTransferQuotasReq } from './model_get_transfer_quotas_req'; +import { FuturesAccountTransferOutResp } from './model_futures_account_transfer_out_resp'; +import { FuturesAccountTransferOutReq } from './model_futures_account_transfer_out_req'; +import { FlexTransferReq } from './model_flex_transfer_req'; +import { FuturesAccountTransferInReq } from './model_futures_account_transfer_in_req'; +import { GetFuturesAccountTransferOutLedgerReq } from './model_get_futures_account_transfer_out_ledger_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getTransferQuotas request test', () => { + /** + * getTransferQuotas + * Get Transfer Quotas + * /api/v1/accounts/transferable + */ + let data = '{"currency": "BTC", "type": "MAIN", "tag": "ETH-USDT"}'; + let req = new GetTransferQuotasReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTransferQuotas response test', () => { + /** + * getTransferQuotas + * Get Transfer Quotas + * /api/v1/accounts/transferable + */ + let data = + '{"code":"200000","data":{"currency":"USDT","balance":"10.5","available":"10.5","holds":"0","transferable":"10.5"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTransferQuotasResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('futuresAccountTransferIn request test', () => { + /** + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in + */ + let data = '{"currency": "USDT", "amount": 0.01, "payAccountType": "MAIN"}'; + let req = new FuturesAccountTransferInReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('futuresAccountTransferIn response test', () => { + /** + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in + */ + let data = '{"code":"200000","data":null}'; + let commonResp = RestResponse.fromJson(data); + let resp = new FuturesAccountTransferInResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getFuturesAccountTransferOutLedger request test', () => { + /** + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list + */ + let data = + '{"currency": "XBT", "type": "MAIN", "tag": ["mock_a", "mock_b"], "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetFuturesAccountTransferOutLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFuturesAccountTransferOutLedger response test', () => { + /** + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list + */ + let data = + '{"code":"200000","data":{"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"applyId":"670bf84c577f6c00017a1c48","currency":"USDT","recRemark":"","recSystem":"KUCOIN","status":"SUCCESS","amount":"0.01","reason":"","offset":1519769124134806,"createdAt":1728837708000,"remark":""}]}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFuturesAccountTransferOutLedgerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('innerTransfer request test', () => { + /** + * innerTransfer + * Inner Transfer + * /api/v2/accounts/inner-transfer + */ + let data = + '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "from": "main", "to": "trade"}'; + let req = new InnerTransferReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('innerTransfer response test', () => { + /** + * innerTransfer + * Inner Transfer + * /api/v2/accounts/inner-transfer + */ + let data = '{"code":"200000","data":{"orderId":"670beb3482a1bb0007dec644"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new InnerTransferResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('subAccountTransfer request test', () => { + /** + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer + */ + let data = + '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "direction": "OUT", "accountType": "MAIN", "subAccountType": "MAIN", "subUserId": "63743f07e0c5230001761d08"}'; + let req = new SubAccountTransferReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('subAccountTransfer response test', () => { + /** + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer + */ + let data = '{"code":"200000","data":{"orderId":"670be6b0b1b9080007040a9b"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new SubAccountTransferResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('flexTransfer request test', () => { + /** + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer + */ + let data = + '{"clientOid": "64ccc0f164781800010d8c09", "type": "PARENT_TO_SUB", "currency": "USDT", "amount": "0.01", "fromAccountType": "TRADE", "toUserId": "63743f07e0c5230001761d08", "toAccountType": "TRADE"}'; + let req = new FlexTransferReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('flexTransfer response test', () => { + /** + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "6705f7248c6954000733ecac"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new FlexTransferResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('futuresAccountTransferOut request test', () => { + /** + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out + */ + let data = '{"currency": "USDT", "amount": 0.01, "recAccountType": "MAIN"}'; + let req = new FuturesAccountTransferOutReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('futuresAccountTransferOut response test', () => { + /** + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out + */ + let data = + '{\n "code": "200000",\n "data": {\n "applyId": "670bf84c577f6c00017a1c48",\n "bizNo": "670bf84c577f6c00017a1c47",\n "payAccountType": "CONTRACT",\n "payTag": "DEFAULT",\n "remark": "",\n "recAccountType": "MAIN",\n "recTag": "DEFAULT",\n "recRemark": "",\n "recSystem": "KUCOIN",\n "status": "PROCESSING",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "sn": 1519769124134806,\n "reason": "",\n "createdAt": 1728837708000,\n "updatedAt": 1728837708000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new FuturesAccountTransferOutResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/transfer/api_transfer.ts b/sdk/node/src/generate/account/transfer/api_transfer.ts new file mode 100644 index 00000000..bb3bf51c --- /dev/null +++ b/sdk/node/src/generate/account/transfer/api_transfer.ts @@ -0,0 +1,236 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetFuturesAccountTransferOutLedgerResp } from './model_get_futures_account_transfer_out_ledger_resp'; +import { FuturesAccountTransferInResp } from './model_futures_account_transfer_in_resp'; +import { InnerTransferResp } from './model_inner_transfer_resp'; +import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; +import { InnerTransferReq } from './model_inner_transfer_req'; +import { FlexTransferResp } from './model_flex_transfer_resp'; +import { SubAccountTransferReq } from './model_sub_account_transfer_req'; +import { GetTransferQuotasResp } from './model_get_transfer_quotas_resp'; +import { GetTransferQuotasReq } from './model_get_transfer_quotas_req'; +import { FuturesAccountTransferOutResp } from './model_futures_account_transfer_out_resp'; +import { FuturesAccountTransferOutReq } from './model_futures_account_transfer_out_req'; +import { FlexTransferReq } from './model_flex_transfer_req'; +import { FuturesAccountTransferInReq } from './model_futures_account_transfer_in_req'; +import { GetFuturesAccountTransferOutLedgerReq } from './model_get_futures_account_transfer_out_ledger_req'; + +export interface TransferAPI { + /** + * getTransferQuotas Get Transfer Quotas + * Description: This endpoint returns the transferable balance of a specified account. + * Documentation: https://www.kucoin.com/docs-new/api-3470148 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getTransferQuotas(req: GetTransferQuotasReq): Promise; + + /** + * @deprecated + * futuresAccountTransferIn Futures Account Transfer In + * Description: The amount to be transferred will be deducted from the payAccount. Please ensure that you have sufficient funds in your payAccount Account, or the transfer will fail. + * Documentation: https://www.kucoin.com/docs-new/api-3470304 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + futuresAccountTransferIn( + req: FuturesAccountTransferInReq, + ): Promise; + + /** + * @deprecated + * getFuturesAccountTransferOutLedger Get Futures Account Transfer Out Ledger + * Description: This endpoint can get futures account transfer out ledger + * Documentation: https://www.kucoin.com/docs-new/api-3470307 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getFuturesAccountTransferOutLedger( + req: GetFuturesAccountTransferOutLedgerReq, + ): Promise; + + /** + * @deprecated + * innerTransfer Inner Transfer + * Description: This API endpoint can be used to transfer funds between accounts internally. Users can transfer funds between their account free of charge. + * Documentation: https://www.kucoin.com/docs-new/api-3470302 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 10 | + * +---------------------+------------+ + */ + innerTransfer(req: InnerTransferReq): Promise; + + /** + * @deprecated + * subAccountTransfer SubAccount Transfer + * Description: Funds in the main account, trading account and margin account of a Master Account can be transferred to the main account, trading account, futures account and margin account of its Sub-Account. The futures account of both the Master Account and Sub-Account can only accept funds transferred in from the main account, trading account and margin account and cannot transfer out to these accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470301 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 30 | + * +---------------------+------------+ + */ + subAccountTransfer(req: SubAccountTransferReq): Promise; + + /** + * flexTransfer Flex Transfer + * Description: This interface can be used for transfers between master and sub accounts and inner transfers + * Documentation: https://www.kucoin.com/docs-new/api-3470147 + * +---------------------+---------------+ + * | Extra API Info | Value | + * +---------------------+---------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FLEXTRANSFERS | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------------+ + */ + flexTransfer(req: FlexTransferReq): Promise; + + /** + * @deprecated + * futuresAccountTransferOut Futures Account Transfer Out + * Description: The amount to be transferred will be deducted from the KuCoin Futures Account. Please ensure that you have sufficient funds in your KuCoin Futures Account, or the transfer will fail. + * Documentation: https://www.kucoin.com/docs-new/api-3470303 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + futuresAccountTransferOut( + req: FuturesAccountTransferOutReq, + ): Promise; +} + +export class TransferAPIImpl implements TransferAPI { + constructor(private transport: Transport) {} + + getTransferQuotas(req: GetTransferQuotasReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/accounts/transferable', + req, + new GetTransferQuotasResp(), + false, + ); + } + + futuresAccountTransferIn( + req: FuturesAccountTransferInReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/transfer-in', + req, + new FuturesAccountTransferInResp(), + false, + ); + } + + getFuturesAccountTransferOutLedger( + req: GetFuturesAccountTransferOutLedgerReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/transfer-list', + req, + new GetFuturesAccountTransferOutLedgerResp(), + false, + ); + } + + innerTransfer(req: InnerTransferReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v2/accounts/inner-transfer', + req, + new InnerTransferResp(), + false, + ); + } + + subAccountTransfer(req: SubAccountTransferReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v2/accounts/sub-transfer', + req, + new SubAccountTransferResp(), + false, + ); + } + + flexTransfer(req: FlexTransferReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/accounts/universal-transfer', + req, + new FlexTransferResp(), + false, + ); + } + + futuresAccountTransferOut( + req: FuturesAccountTransferOutReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v3/transfer-out', + req, + new FuturesAccountTransferOutResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts new file mode 100644 index 00000000..911cb3e5 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts @@ -0,0 +1,298 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class FlexTransferReq implements Serializable { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * Transfer out UserId, This is required when transferring sub-account to master-account. It is optional for internal transfers. + */ + fromUserId?: string; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + fromAccountType?: FlexTransferReq.FromAccountTypeEnum; + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + fromAccountTag?: string; + /** + * Transfer type:INTERNAL(Transfer within account)、PARENT_TO_SUB(Transfer from master-account to sub-account),SUB_TO_PARENT(Transfer from sub-account to master-account) + */ + type?: FlexTransferReq.TypeEnum; + /** + * Transfer in UserId, This is required when transferring master-account to sub-account. It is optional for internal transfers. + */ + toUserId?: string; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + toAccountType?: FlexTransferReq.ToAccountTypeEnum; + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + toAccountTag?: string; + + /** + * Creates a new instance of the `FlexTransferReq` class. + * The builder pattern allows step-by-step construction of a `FlexTransferReq` object. + */ + static builder(): FlexTransferReqBuilder { + return new FlexTransferReqBuilder(); + } + + /** + * Creates a new instance of the `FlexTransferReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * Transfer out UserId, This is required when transferring sub-account to master-account. It is optional for internal transfers. + */ + fromUserId?: string; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + fromAccountType?: FlexTransferReq.FromAccountTypeEnum; + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + fromAccountTag?: string; + /** + * Transfer type:INTERNAL(Transfer within account)、PARENT_TO_SUB(Transfer from master-account to sub-account),SUB_TO_PARENT(Transfer from sub-account to master-account) + */ + type?: FlexTransferReq.TypeEnum; + /** + * Transfer in UserId, This is required when transferring master-account to sub-account. It is optional for internal transfers. + */ + toUserId?: string; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + toAccountType?: FlexTransferReq.ToAccountTypeEnum; + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + toAccountTag?: string; + }): FlexTransferReq { + let obj = new FlexTransferReq(); + obj.clientOid = data.clientOid; + obj.currency = data.currency; + obj.amount = data.amount; + obj.fromUserId = data.fromUserId; + obj.fromAccountType = data.fromAccountType; + obj.fromAccountTag = data.fromAccountTag; + obj.type = data.type; + obj.toUserId = data.toUserId; + obj.toAccountType = data.toAccountType; + obj.toAccountTag = data.toAccountTag; + return obj; + } + + fromJson(input: string): FlexTransferReq { + const jsonObject = JSON.parse(input); + return plainToInstance(FlexTransferReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): FlexTransferReq { + return plainToInstance(FlexTransferReq, jsonObject); + } +} + +export namespace FlexTransferReq { + export enum FromAccountTypeEnum { + /** + * Funding account + */ + MAIN = 'MAIN', + /** + * Spot account + */ + TRADE = 'TRADE', + /** + * Futures account + */ + CONTRACT = 'CONTRACT', + /** + * Cross margin account + */ + MARGIN = 'MARGIN', + /** + * Isolated margin account + */ + ISOLATED = 'ISOLATED', + /** + * Cross margin account + */ + MARGIN_V2 = 'MARGIN_V2', + /** + * Isolated margin account + */ + ISOLATED_V2 = 'ISOLATED_V2', + /** + * Option account + */ + OPTION = 'OPTION', + } + export enum TypeEnum { + /** + * + */ + INTERNAL = 'INTERNAL', + /** + * + */ + PARENT_TO_SUB = 'PARENT_TO_SUB', + /** + * + */ + SUB_TO_PARENT = 'SUB_TO_PARENT', + } + export enum ToAccountTypeEnum { + /** + * Funding account + */ + MAIN = 'MAIN', + /** + * Spot account + */ + TRADE = 'TRADE', + /** + * Futures account + */ + CONTRACT = 'CONTRACT', + /** + * Cross margin account + */ + MARGIN = 'MARGIN', + /** + * Isolated margin account + */ + ISOLATED = 'ISOLATED', + /** + * Cross margin account + */ + MARGIN_V2 = 'MARGIN_V2', + /** + * Isolated margin account + */ + ISOLATED_V2 = 'ISOLATED_V2', + /** + * Option account + */ + OPTION = 'OPTION', + } +} + +export class FlexTransferReqBuilder { + obj: FlexTransferReq = new FlexTransferReq(); + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + setClientOid(value: string): FlexTransferReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * currency + */ + setCurrency(value: string): FlexTransferReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + setAmount(value: string): FlexTransferReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Transfer out UserId, This is required when transferring sub-account to master-account. It is optional for internal transfers. + */ + setFromUserId(value: string): FlexTransferReqBuilder { + this.obj.fromUserId = value; + return this; + } + + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + setFromAccountType(value: FlexTransferReq.FromAccountTypeEnum): FlexTransferReqBuilder { + this.obj.fromAccountType = value; + return this; + } + + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + setFromAccountTag(value: string): FlexTransferReqBuilder { + this.obj.fromAccountTag = value; + return this; + } + + /** + * Transfer type:INTERNAL(Transfer within account)、PARENT_TO_SUB(Transfer from master-account to sub-account),SUB_TO_PARENT(Transfer from sub-account to master-account) + */ + setType(value: FlexTransferReq.TypeEnum): FlexTransferReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Transfer in UserId, This is required when transferring master-account to sub-account. It is optional for internal transfers. + */ + setToUserId(value: string): FlexTransferReqBuilder { + this.obj.toUserId = value; + return this; + } + + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 + */ + setToAccountType(value: FlexTransferReq.ToAccountTypeEnum): FlexTransferReqBuilder { + this.obj.toAccountType = value; + return this; + } + + /** + * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT + */ + setToAccountTag(value: string): FlexTransferReqBuilder { + this.obj.toAccountTag = value; + return this; + } + + build(): FlexTransferReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts new file mode 100644 index 00000000..a071cebc --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class FlexTransferResp implements Response { + /** + * Transfer order ID + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): FlexTransferResp { + const jsonObject = JSON.parse(input); + return plainToInstance(FlexTransferResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): FlexTransferResp { + return plainToInstance(FlexTransferResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts new file mode 100644 index 00000000..0e2f5dfe --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts @@ -0,0 +1,109 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class FuturesAccountTransferInReq implements Serializable { + /** + * Currency, including XBT,USDT... + */ + currency?: string; + /** + * Amount to be transfered in + */ + amount?: number; + /** + * Payment account type, including MAIN,TRADE + */ + payAccountType?: FuturesAccountTransferInReq.PayAccountTypeEnum; + + /** + * Creates a new instance of the `FuturesAccountTransferInReq` class. + * The builder pattern allows step-by-step construction of a `FuturesAccountTransferInReq` object. + */ + static builder(): FuturesAccountTransferInReqBuilder { + return new FuturesAccountTransferInReqBuilder(); + } + + /** + * Creates a new instance of the `FuturesAccountTransferInReq` class with the given data. + */ + static create(data: { + /** + * Currency, including XBT,USDT... + */ + currency?: string; + /** + * Amount to be transfered in + */ + amount?: number; + /** + * Payment account type, including MAIN,TRADE + */ + payAccountType?: FuturesAccountTransferInReq.PayAccountTypeEnum; + }): FuturesAccountTransferInReq { + let obj = new FuturesAccountTransferInReq(); + obj.currency = data.currency; + obj.amount = data.amount; + obj.payAccountType = data.payAccountType; + return obj; + } + + fromJson(input: string): FuturesAccountTransferInReq { + const jsonObject = JSON.parse(input); + return plainToInstance(FuturesAccountTransferInReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): FuturesAccountTransferInReq { + return plainToInstance(FuturesAccountTransferInReq, jsonObject); + } +} + +export namespace FuturesAccountTransferInReq { + export enum PayAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class FuturesAccountTransferInReqBuilder { + obj: FuturesAccountTransferInReq = new FuturesAccountTransferInReq(); + /** + * Currency, including XBT,USDT... + */ + setCurrency(value: string): FuturesAccountTransferInReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Amount to be transfered in + */ + setAmount(value: number): FuturesAccountTransferInReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Payment account type, including MAIN,TRADE + */ + setPayAccountType( + value: FuturesAccountTransferInReq.PayAccountTypeEnum, + ): FuturesAccountTransferInReqBuilder { + this.obj.payAccountType = value; + return this; + } + + build(): FuturesAccountTransferInReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts new file mode 100644 index 00000000..d247c89c --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class FuturesAccountTransferInResp + implements Response +{ + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): FuturesAccountTransferInResp { + const jsonObject = JSON.parse(input); + return plainToInstance(FuturesAccountTransferInResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): FuturesAccountTransferInResp { + return plainToInstance(FuturesAccountTransferInResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts new file mode 100644 index 00000000..77275035 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts @@ -0,0 +1,109 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class FuturesAccountTransferOutReq implements Serializable { + /** + * Currency, including XBT,USDT... + */ + currency?: string; + /** + * Amount to be transfered out, the maximum cannot exceed 1000000000 + */ + amount?: number; + /** + * Receive account type, including MAIN,TRADE + */ + recAccountType?: FuturesAccountTransferOutReq.RecAccountTypeEnum; + + /** + * Creates a new instance of the `FuturesAccountTransferOutReq` class. + * The builder pattern allows step-by-step construction of a `FuturesAccountTransferOutReq` object. + */ + static builder(): FuturesAccountTransferOutReqBuilder { + return new FuturesAccountTransferOutReqBuilder(); + } + + /** + * Creates a new instance of the `FuturesAccountTransferOutReq` class with the given data. + */ + static create(data: { + /** + * Currency, including XBT,USDT... + */ + currency?: string; + /** + * Amount to be transfered out, the maximum cannot exceed 1000000000 + */ + amount?: number; + /** + * Receive account type, including MAIN,TRADE + */ + recAccountType?: FuturesAccountTransferOutReq.RecAccountTypeEnum; + }): FuturesAccountTransferOutReq { + let obj = new FuturesAccountTransferOutReq(); + obj.currency = data.currency; + obj.amount = data.amount; + obj.recAccountType = data.recAccountType; + return obj; + } + + fromJson(input: string): FuturesAccountTransferOutReq { + const jsonObject = JSON.parse(input); + return plainToInstance(FuturesAccountTransferOutReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): FuturesAccountTransferOutReq { + return plainToInstance(FuturesAccountTransferOutReq, jsonObject); + } +} + +export namespace FuturesAccountTransferOutReq { + export enum RecAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class FuturesAccountTransferOutReqBuilder { + obj: FuturesAccountTransferOutReq = new FuturesAccountTransferOutReq(); + /** + * Currency, including XBT,USDT... + */ + setCurrency(value: string): FuturesAccountTransferOutReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Amount to be transfered out, the maximum cannot exceed 1000000000 + */ + setAmount(value: number): FuturesAccountTransferOutReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Receive account type, including MAIN,TRADE + */ + setRecAccountType( + value: FuturesAccountTransferOutReq.RecAccountTypeEnum, + ): FuturesAccountTransferOutReqBuilder { + this.obj.recAccountType = value; + return this; + } + + build(): FuturesAccountTransferOutReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts new file mode 100644 index 00000000..aac12e5b --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts @@ -0,0 +1,99 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class FuturesAccountTransferOutResp + implements Response +{ + /** + * Transfer order ID + */ + applyId?: string; + /** + * Business number + */ + bizNo?: string; + /** + * Pay account type + */ + payAccountType?: string; + /** + * Pay account sub type + */ + payTag?: string; + /** + * User remark + */ + remark?: string; + /** + * Receive account type + */ + recAccountType?: string; + /** + * Receive account sub type + */ + recTag?: string; + /** + * Receive account tx remark + */ + recRemark?: string; + /** + * Receive system + */ + recSystem?: string; + /** + * Status:APPLY, PROCESSING, PENDING_APPROVAL, APPROVED, REJECTED, PENDING_CANCEL, CANCEL, SUCCESS + */ + status?: string; + /** + * Currency + */ + currency?: string; + /** + * Transfer amout + */ + amount?: string; + /** + * Transfer fee + */ + fee?: string; + /** + * Serial number + */ + sn?: number; + /** + * Fail Reason + */ + reason?: string; + /** + * Create time + */ + createdAt?: number; + /** + * Update time + */ + updatedAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): FuturesAccountTransferOutResp { + const jsonObject = JSON.parse(input); + return plainToInstance(FuturesAccountTransferOutResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): FuturesAccountTransferOutResp { + return plainToInstance(FuturesAccountTransferOutResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts new file mode 100644 index 00000000..5ad5a26c --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesAccountTransferOutLedgerItems + implements Serializable +{ + /** + * Transfer order ID + */ + applyId?: string; + /** + * Currency + */ + currency?: string; + /** + * Receive account tx remark + */ + recRemark?: string; + /** + * Receive system + */ + recSystem?: string; + /** + * Status PROCESSING, SUCCESS, FAILURE + */ + status?: GetFuturesAccountTransferOutLedgerItems.StatusEnum; + /** + * Transaction amount + */ + amount?: string; + /** + * Reason caused the failure + */ + reason?: string; + /** + * Offset + */ + offset?: number; + /** + * Request application time + */ + createdAt?: number; + /** + * User remark + */ + remark?: string; + fromJson(input: string): GetFuturesAccountTransferOutLedgerItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesAccountTransferOutLedgerItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerItems { + return plainToInstance(GetFuturesAccountTransferOutLedgerItems, jsonObject); + } +} + +export namespace GetFuturesAccountTransferOutLedgerItems { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts new file mode 100644 index 00000000..a5fad696 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts @@ -0,0 +1,187 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFuturesAccountTransferOutLedgerReq + implements Serializable +{ + /** + * currency + */ + currency?: string; + /** + * Status PROCESSING, SUCCESS, FAILURE + */ + type?: GetFuturesAccountTransferOutLedgerReq.TypeEnum; + /** + * Status List PROCESSING, SUCCESS, FAILURE + */ + tag?: Array; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number = 1; + /** + * pageSize, The default pageSize is 50 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetFuturesAccountTransferOutLedgerReq` class. + * The builder pattern allows step-by-step construction of a `GetFuturesAccountTransferOutLedgerReq` object. + */ + static builder(): GetFuturesAccountTransferOutLedgerReqBuilder { + return new GetFuturesAccountTransferOutLedgerReqBuilder(); + } + + /** + * Creates a new instance of the `GetFuturesAccountTransferOutLedgerReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status PROCESSING, SUCCESS, FAILURE + */ + type?: GetFuturesAccountTransferOutLedgerReq.TypeEnum; + /** + * Status List PROCESSING, SUCCESS, FAILURE + */ + tag?: Array; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50 + */ + pageSize?: number; + }): GetFuturesAccountTransferOutLedgerReq { + let obj = new GetFuturesAccountTransferOutLedgerReq(); + obj.currency = data.currency; + obj.type = data.type; + obj.tag = data.tag; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetFuturesAccountTransferOutLedgerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesAccountTransferOutLedgerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerReq { + return plainToInstance(GetFuturesAccountTransferOutLedgerReq, jsonObject); + } +} + +export namespace GetFuturesAccountTransferOutLedgerReq { + export enum TypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + /** + * + */ + MARGIN = 'MARGIN', + /** + * + */ + ISOLATED = 'ISOLATED', + } +} + +export class GetFuturesAccountTransferOutLedgerReqBuilder { + obj: GetFuturesAccountTransferOutLedgerReq = new GetFuturesAccountTransferOutLedgerReq(); + /** + * currency + */ + setCurrency(value: string): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status PROCESSING, SUCCESS, FAILURE + */ + setType( + value: GetFuturesAccountTransferOutLedgerReq.TypeEnum, + ): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Status List PROCESSING, SUCCESS, FAILURE + */ + setTag(value: Array): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.tag = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page, The default currentPage is 1 + */ + setCurrentPage(value: number): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * pageSize, The default pageSize is 50 + */ + setPageSize(value: number): GetFuturesAccountTransferOutLedgerReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetFuturesAccountTransferOutLedgerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts new file mode 100644 index 00000000..31a6aabd --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts @@ -0,0 +1,53 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetFuturesAccountTransferOutLedgerItems } from './model_get_futures_account_transfer_out_ledger_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFuturesAccountTransferOutLedgerResp + implements Response +{ + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetFuturesAccountTransferOutLedgerItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFuturesAccountTransferOutLedgerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFuturesAccountTransferOutLedgerResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerResp { + return plainToInstance(GetFuturesAccountTransferOutLedgerResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts new file mode 100644 index 00000000..492539ab --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts @@ -0,0 +1,119 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTransferQuotasReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The account type:MAIN、TRADE、MARGIN、ISOLATED + */ + type?: GetTransferQuotasReq.TypeEnum; + /** + * Trading pair, required when the account type is ISOLATED; other types are not passed, e.g.: BTC-USDT + */ + tag?: string = 'BTC-USDT'; + + /** + * Creates a new instance of the `GetTransferQuotasReq` class. + * The builder pattern allows step-by-step construction of a `GetTransferQuotasReq` object. + */ + static builder(): GetTransferQuotasReqBuilder { + return new GetTransferQuotasReqBuilder(); + } + + /** + * Creates a new instance of the `GetTransferQuotasReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The account type:MAIN、TRADE、MARGIN、ISOLATED + */ + type?: GetTransferQuotasReq.TypeEnum; + /** + * Trading pair, required when the account type is ISOLATED; other types are not passed, e.g.: BTC-USDT + */ + tag?: string; + }): GetTransferQuotasReq { + let obj = new GetTransferQuotasReq(); + obj.currency = data.currency; + obj.type = data.type; + obj.tag = data.tag; + return obj; + } + + fromJson(input: string): GetTransferQuotasReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTransferQuotasReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTransferQuotasReq { + return plainToInstance(GetTransferQuotasReq, jsonObject); + } +} + +export namespace GetTransferQuotasReq { + export enum TypeEnum { + /** + * Funding account + */ + MAIN = 'MAIN', + /** + * Spot account + */ + TRADE = 'TRADE', + /** + * Cross margin account + */ + MARGIN = 'MARGIN', + /** + * Isolated margin account + */ + ISOLATED = 'ISOLATED', + /** + * Option account + */ + OPTION = 'OPTION', + } +} + +export class GetTransferQuotasReqBuilder { + obj: GetTransferQuotasReq = new GetTransferQuotasReq(); + /** + * currency + */ + setCurrency(value: string): GetTransferQuotasReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The account type:MAIN、TRADE、MARGIN、ISOLATED + */ + setType(value: GetTransferQuotasReq.TypeEnum): GetTransferQuotasReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Trading pair, required when the account type is ISOLATED; other types are not passed, e.g.: BTC-USDT + */ + setTag(value: string): GetTransferQuotasReqBuilder { + this.obj.tag = value; + return this; + } + + build(): GetTransferQuotasReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts new file mode 100644 index 00000000..72ef60da --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTransferQuotasResp implements Response { + /** + * Currency + */ + currency?: string; + /** + * Total funds in an account. + */ + balance?: string; + /** + * Funds available to withdraw or trade. + */ + available?: string; + /** + * Funds on hold (not available for use). + */ + holds?: string; + /** + * Funds available to transfer. + */ + transferable?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTransferQuotasResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTransferQuotasResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTransferQuotasResp { + return plainToInstance(GetTransferQuotasResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts new file mode 100644 index 00000000..592c3341 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts @@ -0,0 +1,225 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class InnerTransferReq implements Serializable { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * Receiving Account Type: main, trade, margin, isolated, margin_v2, isolated_v2, contract + */ + to?: InnerTransferReq.ToEnum; + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + fromTag?: string; + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + toTag?: string; + /** + * Payment Account Type: main, trade, margin, isolated, margin_v2, isolated_v2 + */ + from?: InnerTransferReq.FromEnum; + + /** + * Creates a new instance of the `InnerTransferReq` class. + * The builder pattern allows step-by-step construction of a `InnerTransferReq` object. + */ + static builder(): InnerTransferReqBuilder { + return new InnerTransferReqBuilder(); + } + + /** + * Creates a new instance of the `InnerTransferReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * Receiving Account Type: main, trade, margin, isolated, margin_v2, isolated_v2, contract + */ + to?: InnerTransferReq.ToEnum; + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + fromTag?: string; + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + toTag?: string; + /** + * Payment Account Type: main, trade, margin, isolated, margin_v2, isolated_v2 + */ + from?: InnerTransferReq.FromEnum; + }): InnerTransferReq { + let obj = new InnerTransferReq(); + obj.clientOid = data.clientOid; + obj.currency = data.currency; + obj.amount = data.amount; + obj.to = data.to; + obj.fromTag = data.fromTag; + obj.toTag = data.toTag; + obj.from = data.from; + return obj; + } + + fromJson(input: string): InnerTransferReq { + const jsonObject = JSON.parse(input); + return plainToInstance(InnerTransferReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): InnerTransferReq { + return plainToInstance(InnerTransferReq, jsonObject); + } +} + +export namespace InnerTransferReq { + export enum ToEnum { + /** + * Funding account + */ + MAIN = 'main', + /** + * Spot account + */ + TRADE = 'trade', + /** + * Cross margin account + */ + MARGIN = 'margin', + /** + * Isolated margin account + */ + ISOLATED = 'isolated', + /** + * Cross margin account + */ + MARGIN_V2 = 'margin_v2', + /** + * Isolated margin account + */ + ISOLATED_V2 = 'isolated_v2', + /** + * Option account + */ + OPTION = 'option', + } + export enum FromEnum { + /** + * Funding account + */ + MAIN = 'main', + /** + * Spot account + */ + TRADE = 'trade', + /** + * Cross margin account + */ + MARGIN = 'margin', + /** + * Isolated margin account + */ + ISOLATED = 'isolated', + /** + * Cross margin account + */ + MARGIN_V2 = 'margin_v2', + /** + * Isolated margin account + */ + ISOLATED_V2 = 'isolated_v2', + /** + * Option account + */ + OPTION = 'option', + } +} + +export class InnerTransferReqBuilder { + obj: InnerTransferReq = new InnerTransferReq(); + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + setClientOid(value: string): InnerTransferReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * currency + */ + setCurrency(value: string): InnerTransferReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + setAmount(value: string): InnerTransferReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Receiving Account Type: main, trade, margin, isolated, margin_v2, isolated_v2, contract + */ + setTo(value: InnerTransferReq.ToEnum): InnerTransferReqBuilder { + this.obj.to = value; + return this; + } + + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + setFromTag(value: string): InnerTransferReqBuilder { + this.obj.fromTag = value; + return this; + } + + /** + * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT + */ + setToTag(value: string): InnerTransferReqBuilder { + this.obj.toTag = value; + return this; + } + + /** + * Payment Account Type: main, trade, margin, isolated, margin_v2, isolated_v2 + */ + setFrom(value: InnerTransferReq.FromEnum): InnerTransferReqBuilder { + this.obj.from = value; + return this; + } + + build(): InnerTransferReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts new file mode 100644 index 00000000..272dfff0 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class InnerTransferResp implements Response { + /** + * Transfer order ID + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): InnerTransferResp { + const jsonObject = JSON.parse(input); + return plainToInstance(InnerTransferResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): InnerTransferResp { + return plainToInstance(InnerTransferResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts new file mode 100644 index 00000000..b6493dcd --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts @@ -0,0 +1,219 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SubAccountTransferReq implements Serializable { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * OUT — the master user to sub user IN — the sub user to the master user. + */ + direction?: SubAccountTransferReq.DirectionEnum; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + accountType?: SubAccountTransferReq.AccountTypeEnum = + SubAccountTransferReq.AccountTypeEnum.MAIN; + /** + * Sub Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + subAccountType?: SubAccountTransferReq.SubAccountTypeEnum = + SubAccountTransferReq.SubAccountTypeEnum.MAIN; + /** + * the user ID of a sub-account. + */ + subUserId?: string; + + /** + * Creates a new instance of the `SubAccountTransferReq` class. + * The builder pattern allows step-by-step construction of a `SubAccountTransferReq` object. + */ + static builder(): SubAccountTransferReqBuilder { + return new SubAccountTransferReqBuilder(); + } + + /** + * Creates a new instance of the `SubAccountTransferReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + clientOid?: string; + /** + * currency + */ + currency?: string; + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + amount?: string; + /** + * OUT — the master user to sub user IN — the sub user to the master user. + */ + direction?: SubAccountTransferReq.DirectionEnum; + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + accountType?: SubAccountTransferReq.AccountTypeEnum; + /** + * Sub Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + subAccountType?: SubAccountTransferReq.SubAccountTypeEnum; + /** + * the user ID of a sub-account. + */ + subUserId?: string; + }): SubAccountTransferReq { + let obj = new SubAccountTransferReq(); + obj.clientOid = data.clientOid; + obj.currency = data.currency; + obj.amount = data.amount; + obj.direction = data.direction; + obj.accountType = data.accountType; + obj.subAccountType = data.subAccountType; + obj.subUserId = data.subUserId; + return obj; + } + + fromJson(input: string): SubAccountTransferReq { + const jsonObject = JSON.parse(input); + return plainToInstance(SubAccountTransferReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SubAccountTransferReq { + return plainToInstance(SubAccountTransferReq, jsonObject); + } +} + +export namespace SubAccountTransferReq { + export enum DirectionEnum { + /** + * + */ + IN = 'IN', + /** + * + */ + OUT = 'OUT', + } + export enum AccountTypeEnum { + /** + * Funding account + */ + MAIN = 'MAIN', + /** + * Spot account + */ + TRADE = 'TRADE', + /** + * Margin account + */ + MARGIN = 'MARGIN', + /** + * Futures account + */ + CONTRACT = 'CONTRACT', + /** + * Option account + */ + OPTION = 'OPTION', + } + export enum SubAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + /** + * + */ + MARGIN = 'MARGIN', + /** + * + */ + CONTRACT = 'CONTRACT', + } +} + +export class SubAccountTransferReqBuilder { + obj: SubAccountTransferReq = new SubAccountTransferReq(); + /** + * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits + */ + setClientOid(value: string): SubAccountTransferReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * currency + */ + setCurrency(value: string): SubAccountTransferReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Transfer amount, the amount is a positive integer multiple of the currency precision. + */ + setAmount(value: string): SubAccountTransferReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * OUT — the master user to sub user IN — the sub user to the master user. + */ + setDirection(value: SubAccountTransferReq.DirectionEnum): SubAccountTransferReqBuilder { + this.obj.direction = value; + return this; + } + + /** + * Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + setAccountType(value: SubAccountTransferReq.AccountTypeEnum): SubAccountTransferReqBuilder { + this.obj.accountType = value; + return this; + } + + /** + * Sub Account type:MAIN、TRADE、CONTRACT、MARGIN + */ + setSubAccountType( + value: SubAccountTransferReq.SubAccountTypeEnum, + ): SubAccountTransferReqBuilder { + this.obj.subAccountType = value; + return this; + } + + /** + * the user ID of a sub-account. + */ + setSubUserId(value: string): SubAccountTransferReqBuilder { + this.obj.subUserId = value; + return this; + } + + build(): SubAccountTransferReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts new file mode 100644 index 00000000..e9ed3f5f --- /dev/null +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class SubAccountTransferResp implements Response { + /** + * Transfer order ID + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): SubAccountTransferResp { + const jsonObject = JSON.parse(input); + return plainToInstance(SubAccountTransferResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SubAccountTransferResp { + return plainToInstance(SubAccountTransferResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.template b/sdk/node/src/generate/account/withdrawal/api_withdrawal.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts new file mode 100644 index 00000000..1e926a45 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts @@ -0,0 +1,203 @@ +import { WithdrawalV1Req } from './model_withdrawal_v1_req'; +import { GetWithdrawalHistoryOldResp } from './model_get_withdrawal_history_old_resp'; +import { GetWithdrawalQuotasResp } from './model_get_withdrawal_quotas_resp'; +import { WithdrawalV3Req } from './model_withdrawal_v3_req'; +import { CancelWithdrawalResp } from './model_cancel_withdrawal_resp'; +import { GetWithdrawalHistoryOldReq } from './model_get_withdrawal_history_old_req'; +import { WithdrawalV3Resp } from './model_withdrawal_v3_resp'; +import { CancelWithdrawalReq } from './model_cancel_withdrawal_req'; +import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; +import { GetWithdrawalHistoryReq } from './model_get_withdrawal_history_req'; +import { WithdrawalV1Resp } from './model_withdrawal_v1_resp'; +import { GetWithdrawalHistoryResp } from './model_get_withdrawal_history_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getWithdrawalHistoryOld request test', () => { + /** + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals + */ + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetWithdrawalHistoryOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getWithdrawalHistoryOld response test', () => { + /** + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1526723468,\n "amount": "0.534",\n "address": "33xW37ZSW4tQvg443Pc7NLCAs167Yc2XUV",\n "walletTxId": "aeacea864c020acf58e51606169240e96774838dcd4f7ce48acf38e3651323f4",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetWithdrawalHistoryOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getWithdrawalHistory request test', () => { + /** + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals + */ + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetWithdrawalHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getWithdrawalHistory response test', () => { + /** + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetWithdrawalHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('withdrawalV1 request test', () => { + /** + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals + */ + let data = + '{"currency": "USDT", "address": "TKFRQXSDc****16GmLrjJggwX8", "amount": 3, "chain": "trx", "isInner": true}'; + let req = new WithdrawalV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('withdrawalV1 response test', () => { + /** + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals + */ + let data = '{"code":"200000","data":{"withdrawalId":"670a973cf07b3800070e216c"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new WithdrawalV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getWithdrawalQuotas request test', () => { + /** + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas + */ + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetWithdrawalQuotasReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getWithdrawalQuotas response test', () => { + /** + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas + */ + let data = + '{"code":"200000","data":{"currency":"BTC","limitBTCAmount":"15.79590095","usedBTCAmount":"0.00000000","quotaCurrency":"USDT","limitQuotaCurrencyAmount":"999999.00000000","usedQuotaCurrencyAmount":"0","remainAmount":"15.79590095","availableAmount":"0","withdrawMinFee":"0.0005","innerWithdrawMinFee":"0","withdrawMinSize":"0.001","isWithdrawEnabled":true,"precision":8,"chain":"BTC","reason":null,"lockedAmount":"0"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetWithdrawalQuotasResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelWithdrawal request test', () => { + /** + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} + */ + let data = '{"withdrawalId": "670b891f7e0f440007730692"}'; + let req = new CancelWithdrawalReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelWithdrawal response test', () => { + /** + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} + */ + let data = '{"code":"200000","data":null}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelWithdrawalResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('withdrawalV3 request test', () => { + /** + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals + */ + let data = + '{"currency": "USDT", "toAddress": "TKFRQXSDcY****GmLrjJggwX8", "amount": 3, "withdrawType": "ADDRESS", "chain": "trx", "isInner": true, "remark": "this is Remark"}'; + let req = new WithdrawalV3Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('withdrawalV3 response test', () => { + /** + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals + */ + let data = '{"code":"200000","data":{"withdrawalId":"670deec84d64da0007d7c946"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new WithdrawalV3Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts new file mode 100644 index 00000000..8b57dd4c --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts @@ -0,0 +1,191 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { WithdrawalV1Req } from './model_withdrawal_v1_req'; +import { GetWithdrawalHistoryOldResp } from './model_get_withdrawal_history_old_resp'; +import { GetWithdrawalQuotasResp } from './model_get_withdrawal_quotas_resp'; +import { WithdrawalV3Req } from './model_withdrawal_v3_req'; +import { CancelWithdrawalResp } from './model_cancel_withdrawal_resp'; +import { GetWithdrawalHistoryOldReq } from './model_get_withdrawal_history_old_req'; +import { WithdrawalV3Resp } from './model_withdrawal_v3_resp'; +import { CancelWithdrawalReq } from './model_cancel_withdrawal_req'; +import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; +import { GetWithdrawalHistoryReq } from './model_get_withdrawal_history_req'; +import { WithdrawalV1Resp } from './model_withdrawal_v1_resp'; +import { GetWithdrawalHistoryResp } from './model_get_withdrawal_history_resp'; + +export interface WithdrawalAPI { + /** + * @deprecated + * getWithdrawalHistoryOld Get Withdrawal History - Old + * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470308 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise; + + /** + * getWithdrawalHistory Get Withdrawal History + * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470145 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise; + + /** + * @deprecated + * withdrawalV1 Withdraw - V1 + * Description: Use this interface to withdraw the specified currency + * Documentation: https://www.kucoin.com/docs-new/api-3470310 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | WITHDRAWAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + withdrawalV1(req: WithdrawalV1Req): Promise; + + /** + * getWithdrawalQuotas Get Withdrawal Quotas + * Description: This interface can obtain the withdrawal quotas information of this currency. + * Documentation: https://www.kucoin.com/docs-new/api-3470143 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise; + + /** + * cancelWithdrawal Cancel Withdrawal + * Description: This interface can cancel the withdrawal, Only withdrawals requests of PROCESSING status could be canceled. + * Documentation: https://www.kucoin.com/docs-new/api-3470144 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | WITHDRAWAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ + */ + cancelWithdrawal(req: CancelWithdrawalReq): Promise; + + /** + * withdrawalV3 Withdraw(V3) + * Description: Use this interface to withdraw the specified currency + * Documentation: https://www.kucoin.com/docs-new/api-3470146 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | WITHDRAWAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 5 | + * +---------------------+------------+ + */ + withdrawalV3(req: WithdrawalV3Req): Promise; +} + +export class WithdrawalAPIImpl implements WithdrawalAPI { + constructor(private transport: Transport) {} + + getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hist-withdrawals', + req, + new GetWithdrawalHistoryOldResp(), + false, + ); + } + + getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/withdrawals', + req, + new GetWithdrawalHistoryResp(), + false, + ); + } + + withdrawalV1(req: WithdrawalV1Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/withdrawals', + req, + new WithdrawalV1Resp(), + false, + ); + } + + getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/withdrawals/quotas', + req, + new GetWithdrawalQuotasResp(), + false, + ); + } + + cancelWithdrawal(req: CancelWithdrawalReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/withdrawals/{withdrawalId}', + req, + new CancelWithdrawalResp(), + false, + ); + } + + withdrawalV3(req: WithdrawalV3Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/withdrawals', + req, + new WithdrawalV3Resp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts new file mode 100644 index 00000000..5cd8e74d --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelWithdrawalReq implements Serializable { + /** + * Path parameter, a unique ID for a withdrawalId + */ + @Reflect.metadata('path', 'withdrawalId') + withdrawalId?: string; + + /** + * Creates a new instance of the `CancelWithdrawalReq` class. + * The builder pattern allows step-by-step construction of a `CancelWithdrawalReq` object. + */ + static builder(): CancelWithdrawalReqBuilder { + return new CancelWithdrawalReqBuilder(); + } + + /** + * Creates a new instance of the `CancelWithdrawalReq` class with the given data. + */ + static create(data: { + /** + * Path parameter, a unique ID for a withdrawalId + */ + withdrawalId?: string; + }): CancelWithdrawalReq { + let obj = new CancelWithdrawalReq(); + obj.withdrawalId = data.withdrawalId; + return obj; + } + + fromJson(input: string): CancelWithdrawalReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelWithdrawalReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelWithdrawalReq { + return plainToInstance(CancelWithdrawalReq, jsonObject); + } +} + +export class CancelWithdrawalReqBuilder { + obj: CancelWithdrawalReq = new CancelWithdrawalReq(); + /** + * Path parameter, a unique ID for a withdrawalId + */ + setWithdrawalId(value: string): CancelWithdrawalReqBuilder { + this.obj.withdrawalId = value; + return this; + } + + build(): CancelWithdrawalReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts new file mode 100644 index 00000000..ecd861eb --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelWithdrawalResp implements Response { + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelWithdrawalResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelWithdrawalResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): CancelWithdrawalResp { + return plainToInstance(CancelWithdrawalResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts new file mode 100644 index 00000000..1dbfd2cf --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts @@ -0,0 +1,91 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawalHistoryItems implements Serializable { + /** + * Unique id + */ + id?: string; + /** + * Currency + */ + currency?: string; + /** + * The id of currency + */ + chain?: string; + /** + * Status + */ + status?: GetWithdrawalHistoryItems.StatusEnum; + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. + */ + memo?: string; + /** + * Internal deposit or not + */ + isInner?: boolean; + /** + * Deposit amount + */ + amount?: string; + /** + * Fees charged for deposit + */ + fee?: string; + /** + * Wallet Txid + */ + walletTxId?: string; + /** + * Creation time of the database record + */ + createdAt?: number; + /** + * Update time of the database record + */ + updatedAt?: number; + /** + * remark + */ + remark?: string; + fromJson(input: string): GetWithdrawalHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryItems { + return plainToInstance(GetWithdrawalHistoryItems, jsonObject); + } +} + +export namespace GetWithdrawalHistoryItems { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + WALLET_PROCESSING = 'WALLET_PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts new file mode 100644 index 00000000..c5050787 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts @@ -0,0 +1,63 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawalHistoryOldItems implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Creation time of the database record + */ + createAt?: number; + /** + * Withdrawal amount + */ + amount?: string; + /** + * Withdrawal address + */ + address?: string; + /** + * Wallet Txid + */ + walletTxId?: string; + /** + * Internal deposit or not + */ + isInner?: boolean; + /** + * Status + */ + status?: GetWithdrawalHistoryOldItems.StatusEnum; + fromJson(input: string): GetWithdrawalHistoryOldItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryOldItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryOldItems { + return plainToInstance(GetWithdrawalHistoryOldItems, jsonObject); + } +} + +export namespace GetWithdrawalHistoryOldItems { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts new file mode 100644 index 00000000..3b99889d --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawalHistoryOldReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetWithdrawalHistoryOldReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetWithdrawalHistoryOldReq` class. + * The builder pattern allows step-by-step construction of a `GetWithdrawalHistoryOldReq` object. + */ + static builder(): GetWithdrawalHistoryOldReqBuilder { + return new GetWithdrawalHistoryOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetWithdrawalHistoryOldReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + status?: GetWithdrawalHistoryOldReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetWithdrawalHistoryOldReq { + let obj = new GetWithdrawalHistoryOldReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetWithdrawalHistoryOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryOldReq { + return plainToInstance(GetWithdrawalHistoryOldReq, jsonObject); + } +} + +export namespace GetWithdrawalHistoryOldReq { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} + +export class GetWithdrawalHistoryOldReqBuilder { + obj: GetWithdrawalHistoryOldReq = new GetWithdrawalHistoryOldReq(); + /** + * currency + */ + setCurrency(value: string): GetWithdrawalHistoryOldReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status. Available value: PROCESSING, SUCCESS, and FAILURE + */ + setStatus(value: GetWithdrawalHistoryOldReq.StatusEnum): GetWithdrawalHistoryOldReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetWithdrawalHistoryOldReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetWithdrawalHistoryOldReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetWithdrawalHistoryOldReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetWithdrawalHistoryOldReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetWithdrawalHistoryOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts new file mode 100644 index 00000000..2465c331 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts @@ -0,0 +1,53 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetWithdrawalHistoryOldItems } from './model_get_withdrawal_history_old_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetWithdrawalHistoryOldResp + implements Response +{ + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetWithdrawalHistoryOldItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetWithdrawalHistoryOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryOldResp { + return plainToInstance(GetWithdrawalHistoryOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts new file mode 100644 index 00000000..0fe505a3 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts @@ -0,0 +1,166 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawalHistoryReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE + */ + status?: GetWithdrawalHistoryReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetWithdrawalHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetWithdrawalHistoryReq` object. + */ + static builder(): GetWithdrawalHistoryReqBuilder { + return new GetWithdrawalHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetWithdrawalHistoryReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE + */ + status?: GetWithdrawalHistoryReq.StatusEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetWithdrawalHistoryReq { + let obj = new GetWithdrawalHistoryReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetWithdrawalHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryReq { + return plainToInstance(GetWithdrawalHistoryReq, jsonObject); + } +} + +export namespace GetWithdrawalHistoryReq { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + WALLET_PROCESSING = 'WALLET_PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} + +export class GetWithdrawalHistoryReqBuilder { + obj: GetWithdrawalHistoryReq = new GetWithdrawalHistoryReq(); + /** + * currency + */ + setCurrency(value: string): GetWithdrawalHistoryReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE + */ + setStatus(value: GetWithdrawalHistoryReq.StatusEnum): GetWithdrawalHistoryReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetWithdrawalHistoryReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetWithdrawalHistoryReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetWithdrawalHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetWithdrawalHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetWithdrawalHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts new file mode 100644 index 00000000..2115a93e --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetWithdrawalHistoryItems } from './model_get_withdrawal_history_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetWithdrawalHistoryResp implements Response { + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetWithdrawalHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetWithdrawalHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalHistoryResp { + return plainToInstance(GetWithdrawalHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts new file mode 100644 index 00000000..f39266e4 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawalQuotasReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string = 'eth'; + + /** + * Creates a new instance of the `GetWithdrawalQuotasReq` class. + * The builder pattern allows step-by-step construction of a `GetWithdrawalQuotasReq` object. + */ + static builder(): GetWithdrawalQuotasReqBuilder { + return new GetWithdrawalQuotasReqBuilder(); + } + + /** + * Creates a new instance of the `GetWithdrawalQuotasReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + }): GetWithdrawalQuotasReq { + let obj = new GetWithdrawalQuotasReq(); + obj.currency = data.currency; + obj.chain = data.chain; + return obj; + } + + fromJson(input: string): GetWithdrawalQuotasReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalQuotasReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalQuotasReq { + return plainToInstance(GetWithdrawalQuotasReq, jsonObject); + } +} + +export class GetWithdrawalQuotasReqBuilder { + obj: GetWithdrawalQuotasReq = new GetWithdrawalQuotasReq(); + /** + * currency + */ + setCurrency(value: string): GetWithdrawalQuotasReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + setChain(value: string): GetWithdrawalQuotasReqBuilder { + this.obj.chain = value; + return this; + } + + build(): GetWithdrawalQuotasReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts new file mode 100644 index 00000000..fa20d858 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts @@ -0,0 +1,93 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetWithdrawalQuotasResp implements Response { + /** + * + */ + currency?: string; + /** + * + */ + limitBTCAmount?: string; + /** + * + */ + usedBTCAmount?: string; + /** + * withdrawal limit currency + */ + quotaCurrency?: string; + /** + * The intraday available withdrawal amount(withdrawal limit currency) + */ + limitQuotaCurrencyAmount?: string; + /** + * The intraday cumulative withdrawal amount(withdrawal limit currency) + */ + usedQuotaCurrencyAmount?: string; + /** + * Remaining amount available to withdraw the current day + */ + remainAmount?: string; + /** + * Current available withdrawal amount + */ + availableAmount?: string; + /** + * Minimum withdrawal fee + */ + withdrawMinFee?: string; + /** + * Fees for internal withdrawal + */ + innerWithdrawMinFee?: string; + /** + * Minimum withdrawal amount + */ + withdrawMinSize?: string; + /** + * Is the withdraw function enabled or not + */ + isWithdrawEnabled?: boolean; + /** + * Floating point precision. + */ + precision?: number; + /** + * The chainName of currency + */ + chain?: string; + /** + * Reasons for restriction, Usually empty + */ + reason?: string; + /** + * Total locked amount (including the amount locked into USDT for each currency) + */ + lockedAmount?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetWithdrawalQuotasResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawalQuotasResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawalQuotasResp { + return plainToInstance(GetWithdrawalQuotasResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts new file mode 100644 index 00000000..1d859a43 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts @@ -0,0 +1,179 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class WithdrawalV1Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + chain?: string = 'eth'; + /** + * Withdrawal address + */ + address?: string; + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + amount?: number; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * Internal withdrawal or not. Default : false + */ + isInner?: boolean = false; + /** + * remark + */ + remark?: string; + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + feeDeductType?: string; + + /** + * Creates a new instance of the `WithdrawalV1Req` class. + * The builder pattern allows step-by-step construction of a `WithdrawalV1Req` object. + */ + static builder(): WithdrawalV1ReqBuilder { + return new WithdrawalV1ReqBuilder(); + } + + /** + * Creates a new instance of the `WithdrawalV1Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + chain?: string; + /** + * Withdrawal address + */ + address?: string; + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + amount?: number; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * Internal withdrawal or not. Default : false + */ + isInner?: boolean; + /** + * remark + */ + remark?: string; + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + feeDeductType?: string; + }): WithdrawalV1Req { + let obj = new WithdrawalV1Req(); + obj.currency = data.currency; + obj.chain = data.chain; + obj.address = data.address; + obj.amount = data.amount; + obj.memo = data.memo; + obj.isInner = data.isInner; + obj.remark = data.remark; + obj.feeDeductType = data.feeDeductType; + return obj; + } + + fromJson(input: string): WithdrawalV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(WithdrawalV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): WithdrawalV1Req { + return plainToInstance(WithdrawalV1Req, jsonObject); + } +} + +export class WithdrawalV1ReqBuilder { + obj: WithdrawalV1Req = new WithdrawalV1Req(); + /** + * currency + */ + setCurrency(value: string): WithdrawalV1ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + setChain(value: string): WithdrawalV1ReqBuilder { + this.obj.chain = value; + return this; + } + + /** + * Withdrawal address + */ + setAddress(value: string): WithdrawalV1ReqBuilder { + this.obj.address = value; + return this; + } + + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + setAmount(value: number): WithdrawalV1ReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + setMemo(value: string): WithdrawalV1ReqBuilder { + this.obj.memo = value; + return this; + } + + /** + * Internal withdrawal or not. Default : false + */ + setIsInner(value: boolean): WithdrawalV1ReqBuilder { + this.obj.isInner = value; + return this; + } + + /** + * remark + */ + setRemark(value: string): WithdrawalV1ReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + setFeeDeductType(value: string): WithdrawalV1ReqBuilder { + this.obj.feeDeductType = value; + return this; + } + + build(): WithdrawalV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts new file mode 100644 index 00000000..e892577e --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class WithdrawalV1Resp implements Response { + /** + * Withdrawal id, a unique ID for a withdrawal + */ + withdrawalId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): WithdrawalV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(WithdrawalV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): WithdrawalV1Resp { + return plainToInstance(WithdrawalV1Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts new file mode 100644 index 00000000..8f278411 --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts @@ -0,0 +1,217 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class WithdrawalV3Req implements Serializable { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + chain?: string = 'eth'; + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + amount?: number; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * Internal withdrawal or not. Default : false + */ + isInner?: boolean = false; + /** + * remark + */ + remark?: string; + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + feeDeductType?: string; + /** + * Withdrawal address + */ + toAddress?: string; + /** + * Withdrawal type, ADDRESS (withdrawal address), UID, MAIL (email), PHONE (mobile phone number). Note: If you withdraw by uid/mail/phone, there will have rate limited: 3 times/10 seconds, 50 times/24 hours (calculated on a rolling basis based on the first request time) + */ + withdrawType?: WithdrawalV3Req.WithdrawTypeEnum; + + /** + * Creates a new instance of the `WithdrawalV3Req` class. + * The builder pattern allows step-by-step construction of a `WithdrawalV3Req` object. + */ + static builder(): WithdrawalV3ReqBuilder { + return new WithdrawalV3ReqBuilder(); + } + + /** + * Creates a new instance of the `WithdrawalV3Req` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + chain?: string; + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + amount?: number; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * Internal withdrawal or not. Default : false + */ + isInner?: boolean; + /** + * remark + */ + remark?: string; + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + feeDeductType?: string; + /** + * Withdrawal address + */ + toAddress?: string; + /** + * Withdrawal type, ADDRESS (withdrawal address), UID, MAIL (email), PHONE (mobile phone number). Note: If you withdraw by uid/mail/phone, there will have rate limited: 3 times/10 seconds, 50 times/24 hours (calculated on a rolling basis based on the first request time) + */ + withdrawType?: WithdrawalV3Req.WithdrawTypeEnum; + }): WithdrawalV3Req { + let obj = new WithdrawalV3Req(); + obj.currency = data.currency; + obj.chain = data.chain; + obj.amount = data.amount; + obj.memo = data.memo; + obj.isInner = data.isInner; + obj.remark = data.remark; + obj.feeDeductType = data.feeDeductType; + obj.toAddress = data.toAddress; + obj.withdrawType = data.withdrawType; + return obj; + } + + fromJson(input: string): WithdrawalV3Req { + const jsonObject = JSON.parse(input); + return plainToInstance(WithdrawalV3Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): WithdrawalV3Req { + return plainToInstance(WithdrawalV3Req, jsonObject); + } +} + +export namespace WithdrawalV3Req { + export enum WithdrawTypeEnum { + /** + * + */ + ADDRESS = 'ADDRESS', + /** + * + */ + UID = 'UID', + /** + * + */ + MAIL = 'MAIL', + /** + * + */ + PHONE = 'PHONE', + } +} + +export class WithdrawalV3ReqBuilder { + obj: WithdrawalV3Req = new WithdrawalV3Req(); + /** + * currency + */ + setCurrency(value: string): WithdrawalV3ReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. + */ + setChain(value: string): WithdrawalV3ReqBuilder { + this.obj.chain = value; + return this; + } + + /** + * Withdrawal amount, a positive number which is a multiple of the amount precision + */ + setAmount(value: number): WithdrawalV3ReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + setMemo(value: string): WithdrawalV3ReqBuilder { + this.obj.memo = value; + return this; + } + + /** + * Internal withdrawal or not. Default : false + */ + setIsInner(value: boolean): WithdrawalV3ReqBuilder { + this.obj.isInner = value; + return this; + } + + /** + * remark + */ + setRemark(value: string): WithdrawalV3ReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. + */ + setFeeDeductType(value: string): WithdrawalV3ReqBuilder { + this.obj.feeDeductType = value; + return this; + } + + /** + * Withdrawal address + */ + setToAddress(value: string): WithdrawalV3ReqBuilder { + this.obj.toAddress = value; + return this; + } + + /** + * Withdrawal type, ADDRESS (withdrawal address), UID, MAIL (email), PHONE (mobile phone number). Note: If you withdraw by uid/mail/phone, there will have rate limited: 3 times/10 seconds, 50 times/24 hours (calculated on a rolling basis based on the first request time) + */ + setWithdrawType(value: WithdrawalV3Req.WithdrawTypeEnum): WithdrawalV3ReqBuilder { + this.obj.withdrawType = value; + return this; + } + + build(): WithdrawalV3Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts new file mode 100644 index 00000000..e55a678d --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class WithdrawalV3Resp implements Response { + /** + * Withdrawal id, a unique ID for a withdrawal + */ + withdrawalId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): WithdrawalV3Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(WithdrawalV3Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): WithdrawalV3Resp { + return plainToInstance(WithdrawalV3Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.test.ts b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.test.ts new file mode 100644 index 00000000..9b124ecb --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.test.ts @@ -0,0 +1,20 @@ +import { GetAccountResp } from './model_get_account_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getAccount request test', () => { + /** + * getAccount + * Get Account + * /api/v2/affiliate/inviter/statistics + */ + }); + + test('getAccount response test', () => { + /** + * getAccount + * Get Account + * /api/v2/affiliate/inviter/statistics + */ + }); +}); diff --git a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.ts b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.ts new file mode 100644 index 00000000..72917985 --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.ts @@ -0,0 +1,38 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetAccountResp } from './model_get_account_resp'; + +export interface AffiliateAPI { + /** + * getAccount Get Account + * Description: This endpoint allows getting affiliate user rebate information. + * Documentation: https://www.kucoin.com/docs-new/api-3470279 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 30 | + * +---------------------+------------+ + */ + getAccount(): Promise; +} + +export class AffiliateAPIImpl implements AffiliateAPI { + constructor(private transport: Transport) {} + + getAccount(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/affiliate/inviter/statistics', + null, + new GetAccountResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts new file mode 100644 index 00000000..6f4fe2d3 --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts @@ -0,0 +1,38 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountLtv implements Serializable { + /** + * LTV of Restricted Transfers to Funding Account + */ + transferLtv?: string; + /** + * LTV of Reduce Only (Restricted Open Positions) + */ + onlyClosePosLtv?: string; + /** + * LTV of Delayed Liquidation + */ + delayedLiquidationLtv?: string; + /** + * LTV of Instant Liquidation + */ + instantLiquidationLtv?: string; + /** + * Current LTV + */ + currentLtv?: string; + fromJson(input: string): GetAccountLtv { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountLtv, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountLtv { + return plainToInstance(GetAccountLtv, jsonObject); + } +} diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts new file mode 100644 index 00000000..b160193b --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts @@ -0,0 +1,30 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountMargins implements Serializable { + /** + * Margin Currency + */ + marginCcy?: string; + /** + * Maintenance Quantity (Calculated with Margin Coefficient) + */ + marginQty?: string; + /** + * Margin Coefficient return real time margin discount rate to USDT + */ + marginFactor?: string; + fromJson(input: string): GetAccountMargins { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountMargins, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountMargins { + return plainToInstance(GetAccountMargins, jsonObject); + } +} diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts new file mode 100644 index 00000000..bb752937 --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountOrders implements Serializable { + /** + * Loan Orders ID + */ + orderId?: string; + /** + * Loan Currency + */ + currency?: string; + /** + * Principal to Be Repaid + */ + principal?: string; + /** + * Interest to Be Repaid + */ + interest?: string; + fromJson(input: string): GetAccountOrders { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountOrders, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountOrders { + return plainToInstance(GetAccountOrders, jsonObject); + } +} diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts new file mode 100644 index 00000000..e90e2063 --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAccountMargins } from './model_get_account_margins'; +import { GetAccountLtv } from './model_get_account_ltv'; +import { GetAccountOrders } from './model_get_account_orders'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAccountResp implements Response { + /** + * Master account UID + */ + parentUid?: string; + /** + * Loan Orders + */ + @Type(() => GetAccountOrders) + orders?: Array; + /** + * + */ + @Type(() => GetAccountLtv) + ltv?: GetAccountLtv; + /** + * Total Margin Amount (USDT) + */ + totalMarginAmount?: string; + /** + * Total Maintenance Margin for Restricted Transfers (USDT) + */ + transferMarginAmount?: string; + /** + * Margins + */ + @Type(() => GetAccountMargins) + margins?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountResp { + return plainToInstance(GetAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.template b/sdk/node/src/generate/broker/apibroker/api_api_broker.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts new file mode 100644 index 00000000..d870c4d5 --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts @@ -0,0 +1,37 @@ +import { GetRebaseResp } from './model_get_rebase_resp'; +import { GetRebaseReq } from './model_get_rebase_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getRebase request test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/api/rebase/download + */ + let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; + let req = new GetRebaseReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRebase response test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/api/rebase/download + */ + let data = + '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRebaseResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.ts b/sdk/node/src/generate/broker/apibroker/api_api_broker.ts new file mode 100644 index 00000000..7e36a634 --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetRebaseResp } from './model_get_rebase_resp'; +import { GetRebaseReq } from './model_get_rebase_req'; + +export interface APIBrokerAPI { + /** + * getRebase Get Broker Rebate + * Description: This interface supports downloading Broker rebate orders + * Documentation: https://www.kucoin.com/docs-new/api-3470280 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 3 | + * +---------------------+------------+ + */ + getRebase(req: GetRebaseReq): Promise; +} + +export class APIBrokerAPIImpl implements APIBrokerAPI { + constructor(private transport: Transport) {} + + getRebase(req: GetRebaseReq): Promise { + return this.transport.call( + 'spot', + true, + 'GET', + '/api/v1/broker/api/rebase/download', + req, + new GetRebaseResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts new file mode 100644 index 00000000..eebeae51 --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts @@ -0,0 +1,107 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRebaseReq implements Serializable { + /** + * Start time, for example: 20240610 + */ + begin?: string; + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetRebaseReq.TradeTypeEnum; + + /** + * Creates a new instance of the `GetRebaseReq` class. + * The builder pattern allows step-by-step construction of a `GetRebaseReq` object. + */ + static builder(): GetRebaseReqBuilder { + return new GetRebaseReqBuilder(); + } + + /** + * Creates a new instance of the `GetRebaseReq` class with the given data. + */ + static create(data: { + /** + * Start time, for example: 20240610 + */ + begin?: string; + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetRebaseReq.TradeTypeEnum; + }): GetRebaseReq { + let obj = new GetRebaseReq(); + obj.begin = data.begin; + obj.end = data.end; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): GetRebaseReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRebaseReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRebaseReq { + return plainToInstance(GetRebaseReq, jsonObject); + } +} + +export namespace GetRebaseReq { + export enum TradeTypeEnum { + /** + * spot + */ + _1 = '1', + /** + * futures + */ + _2 = '2', + } +} + +export class GetRebaseReqBuilder { + obj: GetRebaseReq = new GetRebaseReq(); + /** + * Start time, for example: 20240610 + */ + setBegin(value: string): GetRebaseReqBuilder { + this.obj.begin = value; + return this; + } + + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + setEnd(value: string): GetRebaseReqBuilder { + this.obj.end = value; + return this; + } + + /** + * Transaction type, 1: spot 2: futures + */ + setTradeType(value: GetRebaseReq.TradeTypeEnum): GetRebaseReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): GetRebaseReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts new file mode 100644 index 00000000..cf09f43f --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRebaseResp implements Response { + /** + * Rebate order file (link is valid for 1 day) + */ + url?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRebaseResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRebaseResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRebaseResp { + return plainToInstance(GetRebaseResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts new file mode 100644 index 00000000..ff4be5e4 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts @@ -0,0 +1,436 @@ +import { GetSubAccountResp } from './model_get_sub_account_resp'; +import { GetRebaseResp } from './model_get_rebase_resp'; +import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; +import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; +import { GetSubAccountAPIReq } from './model_get_sub_account_api_req'; +import { GetRebaseReq } from './model_get_rebase_req'; +import { DeleteSubAccountAPIReq } from './model_delete_sub_account_api_req'; +import { GetWithdrawDetailReq } from './model_get_withdraw_detail_req'; +import { GetDepositDetailResp } from './model_get_deposit_detail_resp'; +import { GetDepositDetailReq } from './model_get_deposit_detail_req'; +import { TransferResp } from './model_transfer_resp'; +import { GetWithdrawDetailResp } from './model_get_withdraw_detail_resp'; +import { DeleteSubAccountAPIResp } from './model_delete_sub_account_api_resp'; +import { GetTransferHistoryResp } from './model_get_transfer_history_resp'; +import { GetDepositListResp } from './model_get_deposit_list_resp'; +import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; +import { AddSubAccountReq } from './model_add_sub_account_req'; +import { GetSubAccountReq } from './model_get_sub_account_req'; +import { GetSubAccountAPIResp } from './model_get_sub_account_api_resp'; +import { GetBrokerInfoResp } from './model_get_broker_info_resp'; +import { GetTransferHistoryReq } from './model_get_transfer_history_req'; +import { AddSubAccountResp } from './model_add_sub_account_resp'; +import { GetBrokerInfoReq } from './model_get_broker_info_req'; +import { GetDepositListReq } from './model_get_deposit_list_req'; +import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; +import { TransferReq } from './model_transfer_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getDepositList request test', () => { + /** + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list + */ + let data = + '{"currency": "USDT", "status": "SUCCESS", "hash": "example_string_default_value", "startTimestamp": 123456, "endTimestamp": 123456, "limit": 100}'; + let req = new GetDepositListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositList response test', () => { + /** + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "uid": 165111215,\n "hash": "6724e363a492800007ec602b",\n "address": "xxxxxxx@gmail.com",\n "memo": "",\n "amount": "3.0",\n "fee": "0.0",\n "currency": "USDT",\n "isInner": true,\n "walletTxId": "bbbbbbbbb",\n "status": "SUCCESS",\n "chain": "",\n "remark": "",\n "createdAt": 1730470760000,\n "updatedAt": 1730470760000\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('deleteSubAccountAPI request test', () => { + /** + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; + let req = new DeleteSubAccountAPIReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('deleteSubAccountAPI response test', () => { + /** + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new DeleteSubAccountAPIResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSubAccountAPI request test', () => { + /** + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; + let req = new GetSubAccountAPIReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSubAccountAPI response test', () => { + /** + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "203.**.154"\n ],\n "createdAt": 1729821494000\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSubAccountAPIResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccountApi request test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = + '{"uid": "226383154", "passphrase": "11223344", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; + let req = new AddSubAccountApiReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccountApi response test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let data = + '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "secretKey": "d694df2******5bae05b96",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.0.0.1",\n "123.123.123.123"\n ],\n "createdAt": 1729821494000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountApiResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSubAccount request test', () => { + /** + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account + */ + let data = '{"uid": "226383154", "currentPage": 1, "pageSize": 20}'; + let req = new GetSubAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSubAccount response test', () => { + /** + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 20,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819382000,\n "level": 0\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSubAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addSubAccount request test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account + */ + let data = '{"accountName": "Account1"}'; + let req = new AddSubAccountReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addSubAccount response test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account + */ + let data = + '{\n "code": "200000",\n "data": {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819381908,\n "level": 0\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddSubAccountResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifySubAccountApi request test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey + */ + let data = + '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; + let req = new ModifySubAccountApiReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifySubAccountApi response test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey + */ + let data = + '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "123.**.123"\n ],\n "createdAt": 1729821494000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifySubAccountApiResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getBrokerInfo request test', () => { + /** + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info + */ + let data = '{"begin": "20240510", "end": "20241010", "tradeType": "1"}'; + let req = new GetBrokerInfoReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getBrokerInfo response test', () => { + /** + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info + */ + let data = + '{\n "code": "200000",\n "data": {\n "accountSize": 0,\n "maxAccountSize": null,\n "level": 0\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetBrokerInfoResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRebase request test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download + */ + let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; + let req = new GetRebaseReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRebase response test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download + */ + let data = + '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRebaseResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('transfer request test', () => { + /** + * transfer + * Transfer + * /api/v1/broker/nd/transfer + */ + let data = + '{"currency": "USDT", "amount": "1", "clientOid": "e6c24d23-6bc2-401b-bf9e-55e2daddfbc1", "direction": "OUT", "accountType": "MAIN", "specialUid": "226383154", "specialAccountType": "MAIN"}'; + let req = new TransferReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('transfer response test', () => { + /** + * transfer + * Transfer + * /api/v1/broker/nd/transfer + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new TransferResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDepositDetail request test', () => { + /** + * getDepositDetail + * Get Deposit Detail + * /api/v3/broker/nd/deposit/detail + */ + let data = '{"currency": "USDT", "hash": "30bb0e0b***4156c5188"}'; + let req = new GetDepositDetailReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getDepositDetail response test', () => { + /** + * getDepositDetail + * Get Deposit Detail + * /api/v3/broker/nd/deposit/detail + */ + let data = + '{\n "data" : {\n "chain" : "trx",\n "hash" : "30bb0e0b***4156c5188",\n "walletTxId" : "30bb0***610d1030f",\n "uid" : 201496341,\n "updatedAt" : 1713429174000,\n "amount" : "8.5",\n "memo" : "",\n "fee" : "0.0",\n "address" : "THLPzUrbd1o***vP7d",\n "remark" : "Deposit",\n "isInner" : false,\n "currency" : "USDT",\n "status" : "SUCCESS",\n "createdAt" : 1713429173000\n },\n "code" : "200000"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetDepositDetailResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getTransferHistory request test', () => { + /** + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail + */ + let data = '{"orderId": "671b4600c1e3dd000726866d"}'; + let req = new GetTransferHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTransferHistory response test', () => { + /** + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d",\n "currency": "USDT",\n "amount": "1",\n "fromUid": 165111215,\n "fromAccountType": "MAIN",\n "fromAccountTag": "DEFAULT",\n "toUid": 226383154,\n "toAccountType": "MAIN",\n "toAccountTag": "DEFAULT",\n "status": "SUCCESS",\n "reason": null,\n "createdAt": 1729840640000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTransferHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getWithdrawDetail request test', () => { + /** + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail + */ + let data = '{"withdrawalId": "66617a2***3c9a"}'; + let req = new GetWithdrawDetailReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getWithdrawDetail response test', () => { + /** + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail + */ + let data = + '{\n "data": {\n "id": "66617a2***3c9a",\n "chain": "ton",\n "walletTxId": "AJ***eRI=",\n "uid": 157267400,\n "amount": "1.00000000",\n "memo": "7025734",\n "fee": "0.00000000",\n "address": "EQDn***dKbGzr",\n "remark": "",\n "isInner": false,\n "currency": "USDT",\n "status": "SUCCESS",\n "createdAt": 1717664288000,\n "updatedAt": 1717664375000\n },\n "code": "200000"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetWithdrawDetailResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts new file mode 100644 index 00000000..b1327f95 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts @@ -0,0 +1,399 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetSubAccountResp } from './model_get_sub_account_resp'; +import { GetRebaseResp } from './model_get_rebase_resp'; +import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; +import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; +import { GetSubAccountAPIReq } from './model_get_sub_account_api_req'; +import { GetRebaseReq } from './model_get_rebase_req'; +import { DeleteSubAccountAPIReq } from './model_delete_sub_account_api_req'; +import { GetWithdrawDetailReq } from './model_get_withdraw_detail_req'; +import { GetDepositDetailResp } from './model_get_deposit_detail_resp'; +import { GetDepositDetailReq } from './model_get_deposit_detail_req'; +import { TransferResp } from './model_transfer_resp'; +import { GetWithdrawDetailResp } from './model_get_withdraw_detail_resp'; +import { DeleteSubAccountAPIResp } from './model_delete_sub_account_api_resp'; +import { GetTransferHistoryResp } from './model_get_transfer_history_resp'; +import { GetDepositListResp } from './model_get_deposit_list_resp'; +import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; +import { AddSubAccountReq } from './model_add_sub_account_req'; +import { GetSubAccountReq } from './model_get_sub_account_req'; +import { GetSubAccountAPIResp } from './model_get_sub_account_api_resp'; +import { GetBrokerInfoResp } from './model_get_broker_info_resp'; +import { GetTransferHistoryReq } from './model_get_transfer_history_req'; +import { AddSubAccountResp } from './model_add_sub_account_resp'; +import { GetBrokerInfoReq } from './model_get_broker_info_req'; +import { GetDepositListReq } from './model_get_deposit_list_req'; +import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; +import { TransferReq } from './model_transfer_req'; + +export interface NDBrokerAPI { + /** + * getDepositList Get Deposit List + * Description: This endpoint can obtain the deposit records of each sub-account under the ND Broker. + * Documentation: https://www.kucoin.com/docs-new/api-3470285 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getDepositList(req: GetDepositListReq): Promise; + + /** + * deleteSubAccountAPI Delete SubAccount API + * Description: This interface supports deleting Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470289 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise; + + /** + * getSubAccountAPI Get SubAccount API + * Description: This interface supports querying the Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470284 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSubAccountAPI(req: GetSubAccountAPIReq): Promise; + + /** + * addSubAccountApi Add SubAccount API + * Description: This interface supports the creation of Broker sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470291 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + addSubAccountApi(req: AddSubAccountApiReq): Promise; + + /** + * getSubAccount Get SubAccount + * Description: This interface supports querying sub-accounts created by Broker + * Documentation: https://www.kucoin.com/docs-new/api-3470283 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSubAccount(req: GetSubAccountReq): Promise; + + /** + * addSubAccount Add SubAccount + * Description: This endpoint supports Broker users to create sub-accounts + * Documentation: https://www.kucoin.com/docs-new/api-3470290 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + addSubAccount(req: AddSubAccountReq): Promise; + + /** + * modifySubAccountApi Modify SubAccount API + * Description: This interface supports modify the Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470292 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + modifySubAccountApi(req: ModifySubAccountApiReq): Promise; + + /** + * getBrokerInfo Get Broker Info + * Description: This endpoint supports querying the basic information of the current Broker + * Documentation: https://www.kucoin.com/docs-new/api-3470282 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getBrokerInfo(req: GetBrokerInfoReq): Promise; + + /** + * getRebase Get Broker Rebate + * Description: This interface supports downloading Broker rebate orders + * Documentation: https://www.kucoin.com/docs-new/api-3470281 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getRebase(req: GetRebaseReq): Promise; + + /** + * transfer Transfer + * Description: This endpoint supports fund transfer between Broker account and Broker sub-accounts. Please be aware that withdrawal from sub-account is not directly supported. Broker has to transfer funds from broker sub-account to broker account to initiate the withdrawals. + * Documentation: https://www.kucoin.com/docs-new/api-3470293 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + transfer(req: TransferReq): Promise; + + /** + * getDepositDetail Get Deposit Detail + * Description: This endpoint supports querying the deposit record of sub-accounts created by a Broker (excluding main account of nd broker) + * Documentation: https://www.kucoin.com/docs-new/api-3470288 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + getDepositDetail(req: GetDepositDetailReq): Promise; + + /** + * getTransferHistory Get Transfer History + * Description: This endpoint supports querying transfer records of the broker itself and its created sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470286 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + getTransferHistory(req: GetTransferHistoryReq): Promise; + + /** + * getWithdrawDetail Get Withdraw Detail + * Description: This endpoint supports querying the withdrawal records of sub-accounts created by a Broker (excluding main account of nd broker). + * Documentation: https://www.kucoin.com/docs-new/api-3470287 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | BROKER | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | BROKER | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + getWithdrawDetail(req: GetWithdrawDetailReq): Promise; +} + +export class NDBrokerAPIImpl implements NDBrokerAPI { + constructor(private transport: Transport) {} + + getDepositList(req: GetDepositListReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v1/asset/ndbroker/deposit/list', + req, + new GetDepositListResp(), + false, + ); + } + + deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise { + return this.transport.call( + 'broker', + true, + 'DELETE', + '/api/v1/broker/nd/account/apikey', + req, + new DeleteSubAccountAPIResp(), + false, + ); + } + + getSubAccountAPI(req: GetSubAccountAPIReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v1/broker/nd/account/apikey', + req, + new GetSubAccountAPIResp(), + false, + ); + } + + addSubAccountApi(req: AddSubAccountApiReq): Promise { + return this.transport.call( + 'broker', + true, + 'POST', + '/api/v1/broker/nd/account/apikey', + req, + new AddSubAccountApiResp(), + false, + ); + } + + getSubAccount(req: GetSubAccountReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v1/broker/nd/account', + req, + new GetSubAccountResp(), + false, + ); + } + + addSubAccount(req: AddSubAccountReq): Promise { + return this.transport.call( + 'broker', + true, + 'POST', + '/api/v1/broker/nd/account', + req, + new AddSubAccountResp(), + false, + ); + } + + modifySubAccountApi(req: ModifySubAccountApiReq): Promise { + return this.transport.call( + 'broker', + true, + 'POST', + '/api/v1/broker/nd/account/update-apikey', + req, + new ModifySubAccountApiResp(), + false, + ); + } + + getBrokerInfo(req: GetBrokerInfoReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v1/broker/nd/info', + req, + new GetBrokerInfoResp(), + false, + ); + } + + getRebase(req: GetRebaseReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v1/broker/nd/rebase/download', + req, + new GetRebaseResp(), + false, + ); + } + + transfer(req: TransferReq): Promise { + return this.transport.call( + 'broker', + true, + 'POST', + '/api/v1/broker/nd/transfer', + req, + new TransferResp(), + false, + ); + } + + getDepositDetail(req: GetDepositDetailReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v3/broker/nd/deposit/detail', + req, + new GetDepositDetailResp(), + false, + ); + } + + getTransferHistory(req: GetTransferHistoryReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v3/broker/nd/transfer/detail', + req, + new GetTransferHistoryResp(), + false, + ); + } + + getWithdrawDetail(req: GetWithdrawDetailReq): Promise { + return this.transport.call( + 'broker', + true, + 'GET', + '/api/v3/broker/nd/withdraw/detail', + req, + new GetWithdrawDetailResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts new file mode 100644 index 00000000..ca4992d6 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts @@ -0,0 +1,145 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountApiReq implements Serializable { + /** + * Subaccount UID + */ + uid?: string; + /** + * API passphrase + */ + passphrase?: string; + /** + * IP whitelist list, supports up to 20 IPs + */ + ipWhitelist?: Array; + /** + * Permission group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + permissions?: Array; + /** + * apikey remarks (length 4~32) + */ + label?: string; + + /** + * Creates a new instance of the `AddSubAccountApiReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountApiReq` object. + */ + static builder(): AddSubAccountApiReqBuilder { + return new AddSubAccountApiReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountApiReq` class with the given data. + */ + static create(data: { + /** + * Subaccount UID + */ + uid?: string; + /** + * API passphrase + */ + passphrase?: string; + /** + * IP whitelist list, supports up to 20 IPs + */ + ipWhitelist?: Array; + /** + * Permission group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + permissions?: Array; + /** + * apikey remarks (length 4~32) + */ + label?: string; + }): AddSubAccountApiReq { + let obj = new AddSubAccountApiReq(); + obj.uid = data.uid; + obj.passphrase = data.passphrase; + obj.ipWhitelist = data.ipWhitelist; + obj.permissions = data.permissions; + obj.label = data.label; + return obj; + } + + fromJson(input: string): AddSubAccountApiReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountApiReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountApiReq { + return plainToInstance(AddSubAccountApiReq, jsonObject); + } +} + +export namespace AddSubAccountApiReq { + export enum PermissionsEnum { + /** + * + */ + GENERAL = 'general', + /** + * + */ + SPOT = 'spot', + /** + * + */ + FUTURES = 'futures', + } +} + +export class AddSubAccountApiReqBuilder { + obj: AddSubAccountApiReq = new AddSubAccountApiReq(); + /** + * Subaccount UID + */ + setUid(value: string): AddSubAccountApiReqBuilder { + this.obj.uid = value; + return this; + } + + /** + * API passphrase + */ + setPassphrase(value: string): AddSubAccountApiReqBuilder { + this.obj.passphrase = value; + return this; + } + + /** + * IP whitelist list, supports up to 20 IPs + */ + setIpWhitelist(value: Array): AddSubAccountApiReqBuilder { + this.obj.ipWhitelist = value; + return this; + } + + /** + * Permission group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + setPermissions(value: Array): AddSubAccountApiReqBuilder { + this.obj.permissions = value; + return this; + } + + /** + * apikey remarks (length 4~32) + */ + setLabel(value: string): AddSubAccountApiReqBuilder { + this.obj.label = value; + return this; + } + + build(): AddSubAccountApiReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts new file mode 100644 index 00000000..53d8119a --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountApiResp implements Response { + /** + * Sub-Account UID + */ + uid?: string; + /** + * apikey remarks + */ + label?: string; + /** + * apiKey + */ + apiKey?: string; + /** + * secretKey + */ + secretKey?: string; + /** + * apiVersion + */ + apiVersion?: number; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list + */ + permissions?: Array; + /** + * IP whitelist list + */ + ipWhitelist?: Array; + /** + * Creation time, unix timestamp (milliseconds) + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountApiResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountApiResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountApiResp { + return plainToInstance(AddSubAccountApiResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts new file mode 100644 index 00000000..a640976d --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddSubAccountReq implements Serializable { + /** + * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. + */ + accountName?: string; + + /** + * Creates a new instance of the `AddSubAccountReq` class. + * The builder pattern allows step-by-step construction of a `AddSubAccountReq` object. + */ + static builder(): AddSubAccountReqBuilder { + return new AddSubAccountReqBuilder(); + } + + /** + * Creates a new instance of the `AddSubAccountReq` class with the given data. + */ + static create(data: { + /** + * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. + */ + accountName?: string; + }): AddSubAccountReq { + let obj = new AddSubAccountReq(); + obj.accountName = data.accountName; + return obj; + } + + fromJson(input: string): AddSubAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountReq { + return plainToInstance(AddSubAccountReq, jsonObject); + } +} + +export class AddSubAccountReqBuilder { + obj: AddSubAccountReq = new AddSubAccountReq(); + /** + * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. + */ + setAccountName(value: string): AddSubAccountReqBuilder { + this.obj.accountName = value; + return this; + } + + build(): AddSubAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts new file mode 100644 index 00000000..0b48121d --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddSubAccountResp implements Response { + /** + * Sub-Account name + */ + accountName?: string; + /** + * Sub-Account UID + */ + uid?: string; + /** + * Creation time, unix timestamp (milliseconds) + */ + createdAt?: number; + /** + * Subaccount VIP level + */ + level?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddSubAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddSubAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddSubAccountResp { + return plainToInstance(AddSubAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts new file mode 100644 index 00000000..dd4958da --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class DeleteSubAccountAPIReq implements Serializable { + /** + * Sub-account UID + */ + uid?: string; + /** + * Sub-account apiKey + */ + apiKey?: string; + + /** + * Creates a new instance of the `DeleteSubAccountAPIReq` class. + * The builder pattern allows step-by-step construction of a `DeleteSubAccountAPIReq` object. + */ + static builder(): DeleteSubAccountAPIReqBuilder { + return new DeleteSubAccountAPIReqBuilder(); + } + + /** + * Creates a new instance of the `DeleteSubAccountAPIReq` class with the given data. + */ + static create(data: { + /** + * Sub-account UID + */ + uid?: string; + /** + * Sub-account apiKey + */ + apiKey?: string; + }): DeleteSubAccountAPIReq { + let obj = new DeleteSubAccountAPIReq(); + obj.uid = data.uid; + obj.apiKey = data.apiKey; + return obj; + } + + fromJson(input: string): DeleteSubAccountAPIReq { + const jsonObject = JSON.parse(input); + return plainToInstance(DeleteSubAccountAPIReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): DeleteSubAccountAPIReq { + return plainToInstance(DeleteSubAccountAPIReq, jsonObject); + } +} + +export class DeleteSubAccountAPIReqBuilder { + obj: DeleteSubAccountAPIReq = new DeleteSubAccountAPIReq(); + /** + * Sub-account UID + */ + setUid(value: string): DeleteSubAccountAPIReqBuilder { + this.obj.uid = value; + return this; + } + + /** + * Sub-account apiKey + */ + setApiKey(value: string): DeleteSubAccountAPIReqBuilder { + this.obj.apiKey = value; + return this; + } + + build(): DeleteSubAccountAPIReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts new file mode 100644 index 00000000..8c8f0bf7 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class DeleteSubAccountAPIResp implements Response { + /** + * + */ + data?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): DeleteSubAccountAPIResp { + const jsonObject = JSON.parse(input); + return plainToInstance(DeleteSubAccountAPIResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): DeleteSubAccountAPIResp { + return plainToInstance(DeleteSubAccountAPIResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts new file mode 100644 index 00000000..59868ab5 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts @@ -0,0 +1,107 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetBrokerInfoReq implements Serializable { + /** + * Start time, for example: 20230110 + */ + begin?: string; + /** + * End time, for example: 20230210 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetBrokerInfoReq.TradeTypeEnum; + + /** + * Creates a new instance of the `GetBrokerInfoReq` class. + * The builder pattern allows step-by-step construction of a `GetBrokerInfoReq` object. + */ + static builder(): GetBrokerInfoReqBuilder { + return new GetBrokerInfoReqBuilder(); + } + + /** + * Creates a new instance of the `GetBrokerInfoReq` class with the given data. + */ + static create(data: { + /** + * Start time, for example: 20230110 + */ + begin?: string; + /** + * End time, for example: 20230210 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetBrokerInfoReq.TradeTypeEnum; + }): GetBrokerInfoReq { + let obj = new GetBrokerInfoReq(); + obj.begin = data.begin; + obj.end = data.end; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): GetBrokerInfoReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBrokerInfoReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBrokerInfoReq { + return plainToInstance(GetBrokerInfoReq, jsonObject); + } +} + +export namespace GetBrokerInfoReq { + export enum TradeTypeEnum { + /** + * spot + */ + _1 = '1', + /** + * futures + */ + _2 = '2', + } +} + +export class GetBrokerInfoReqBuilder { + obj: GetBrokerInfoReq = new GetBrokerInfoReq(); + /** + * Start time, for example: 20230110 + */ + setBegin(value: string): GetBrokerInfoReqBuilder { + this.obj.begin = value; + return this; + } + + /** + * End time, for example: 20230210 (query data with a maximum interval of 6 months) + */ + setEnd(value: string): GetBrokerInfoReqBuilder { + this.obj.end = value; + return this; + } + + /** + * Transaction type, 1: spot 2: futures + */ + setTradeType(value: GetBrokerInfoReq.TradeTypeEnum): GetBrokerInfoReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): GetBrokerInfoReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts new file mode 100644 index 00000000..aec66d99 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetBrokerInfoResp implements Response { + /** + * Number of sub-accounts created + */ + accountSize?: number; + /** + * The maximum number of sub-accounts allowed to be created, null means no limit + */ + maxAccountSize?: number; + /** + * Broker level + */ + level?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetBrokerInfoResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBrokerInfoResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBrokerInfoResp { + return plainToInstance(GetBrokerInfoResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts new file mode 100644 index 00000000..65e8dea8 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositDetailReq implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Hash Value + */ + hash?: string; + + /** + * Creates a new instance of the `GetDepositDetailReq` class. + * The builder pattern allows step-by-step construction of a `GetDepositDetailReq` object. + */ + static builder(): GetDepositDetailReqBuilder { + return new GetDepositDetailReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositDetailReq` class with the given data. + */ + static create(data: { + /** + * Currency + */ + currency?: string; + /** + * Hash Value + */ + hash?: string; + }): GetDepositDetailReq { + let obj = new GetDepositDetailReq(); + obj.currency = data.currency; + obj.hash = data.hash; + return obj; + } + + fromJson(input: string): GetDepositDetailReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositDetailReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositDetailReq { + return plainToInstance(GetDepositDetailReq, jsonObject); + } +} + +export class GetDepositDetailReqBuilder { + obj: GetDepositDetailReq = new GetDepositDetailReq(); + /** + * Currency + */ + setCurrency(value: string): GetDepositDetailReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Hash Value + */ + setHash(value: string): GetDepositDetailReqBuilder { + this.obj.hash = value; + return this; + } + + build(): GetDepositDetailReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts new file mode 100644 index 00000000..9a7f43da --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts @@ -0,0 +1,102 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositDetailResp implements Response { + /** + * chain id of currency + */ + chain?: string; + /** + * Hash + */ + hash?: string; + /** + * Wallet Transaction ID + */ + walletTxId?: string; + /** + * UID + */ + uid?: number; + /** + * Update Time (milliseconds) + */ + updatedAt?: number; + /** + * Amount + */ + amount?: string; + /** + * Memo + */ + memo?: string; + /** + * Fee + */ + fee?: string; + /** + * Address + */ + address?: string; + /** + * Remark + */ + remark?: string; + /** + * Is Internal (true or false) + */ + isInner?: boolean; + /** + * Currency + */ + currency?: string; + /** + * Status (PROCESSING, SUCCESS, FAILURE) + */ + status?: GetDepositDetailResp.StatusEnum; + /** + * Creation Time (milliseconds) + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositDetailResp { + return plainToInstance(GetDepositDetailResp, jsonObject); + } +} + +export namespace GetDepositDetailResp { + export enum StatusEnum { + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + /** + * + */ + PROCESSING = 'PROCESSING', + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts new file mode 100644 index 00000000..fb466f65 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts @@ -0,0 +1,91 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositListData implements Serializable { + /** + * deposit uid + */ + uid?: number; + /** + * hash + */ + hash?: string; + /** + * Deposit address + */ + address?: string; + /** + * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. + */ + memo?: string; + /** + * Deposit amount + */ + amount?: string; + /** + * Fees charged for deposit + */ + fee?: string; + /** + * currency + */ + currency?: string; + /** + * Internal deposit or not + */ + isInner?: boolean; + /** + * Wallet Txid + */ + walletTxId?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, FAILURE + */ + status?: GetDepositListData.StatusEnum; + /** + * remark + */ + remark?: string; + /** + * chain name of currency + */ + chain?: string; + /** + * Creation time of the database record + */ + createdAt?: number; + /** + * Update time of the database record + */ + updatedAt?: number; + fromJson(input: string): GetDepositListData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositListData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositListData { + return plainToInstance(GetDepositListData, jsonObject); + } +} + +export namespace GetDepositListData { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts new file mode 100644 index 00000000..94f118a9 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts @@ -0,0 +1,145 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetDepositListReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, FAILURE + */ + status?: string; + /** + * hash + */ + hash?: string; + /** + * Start time (milisecond) + */ + startTimestamp?: number; + /** + * End time (milisecond),Default sorting in descending order + */ + endTimestamp?: number; + /** + * Maximum number of returned items, maximum 1000, default 1000 + */ + limit?: number = 1000; + + /** + * Creates a new instance of the `GetDepositListReq` class. + * The builder pattern allows step-by-step construction of a `GetDepositListReq` object. + */ + static builder(): GetDepositListReqBuilder { + return new GetDepositListReqBuilder(); + } + + /** + * Creates a new instance of the `GetDepositListReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Status. Available value: PROCESSING, SUCCESS, FAILURE + */ + status?: string; + /** + * hash + */ + hash?: string; + /** + * Start time (milisecond) + */ + startTimestamp?: number; + /** + * End time (milisecond),Default sorting in descending order + */ + endTimestamp?: number; + /** + * Maximum number of returned items, maximum 1000, default 1000 + */ + limit?: number; + }): GetDepositListReq { + let obj = new GetDepositListReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.hash = data.hash; + obj.startTimestamp = data.startTimestamp; + obj.endTimestamp = data.endTimestamp; + obj.limit = data.limit; + return obj; + } + + fromJson(input: string): GetDepositListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDepositListReq { + return plainToInstance(GetDepositListReq, jsonObject); + } +} + +export class GetDepositListReqBuilder { + obj: GetDepositListReq = new GetDepositListReq(); + /** + * currency + */ + setCurrency(value: string): GetDepositListReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Status. Available value: PROCESSING, SUCCESS, FAILURE + */ + setStatus(value: string): GetDepositListReqBuilder { + this.obj.status = value; + return this; + } + + /** + * hash + */ + setHash(value: string): GetDepositListReqBuilder { + this.obj.hash = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartTimestamp(value: number): GetDepositListReqBuilder { + this.obj.startTimestamp = value; + return this; + } + + /** + * End time (milisecond),Default sorting in descending order + */ + setEndTimestamp(value: number): GetDepositListReqBuilder { + this.obj.endTimestamp = value; + return this; + } + + /** + * Maximum number of returned items, maximum 1000, default 1000 + */ + setLimit(value: number): GetDepositListReqBuilder { + this.obj.limit = value; + return this; + } + + build(): GetDepositListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts new file mode 100644 index 00000000..8346827c --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetDepositListData } from './model_get_deposit_list_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDepositListResp implements Response { + /** + * + */ + @Type(() => GetDepositListData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDepositListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDepositListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetDepositListResp { + return plainToInstance(GetDepositListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts new file mode 100644 index 00000000..eebeae51 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts @@ -0,0 +1,107 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRebaseReq implements Serializable { + /** + * Start time, for example: 20240610 + */ + begin?: string; + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetRebaseReq.TradeTypeEnum; + + /** + * Creates a new instance of the `GetRebaseReq` class. + * The builder pattern allows step-by-step construction of a `GetRebaseReq` object. + */ + static builder(): GetRebaseReqBuilder { + return new GetRebaseReqBuilder(); + } + + /** + * Creates a new instance of the `GetRebaseReq` class with the given data. + */ + static create(data: { + /** + * Start time, for example: 20240610 + */ + begin?: string; + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + end?: string; + /** + * Transaction type, 1: spot 2: futures + */ + tradeType?: GetRebaseReq.TradeTypeEnum; + }): GetRebaseReq { + let obj = new GetRebaseReq(); + obj.begin = data.begin; + obj.end = data.end; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): GetRebaseReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRebaseReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRebaseReq { + return plainToInstance(GetRebaseReq, jsonObject); + } +} + +export namespace GetRebaseReq { + export enum TradeTypeEnum { + /** + * spot + */ + _1 = '1', + /** + * futures + */ + _2 = '2', + } +} + +export class GetRebaseReqBuilder { + obj: GetRebaseReq = new GetRebaseReq(); + /** + * Start time, for example: 20240610 + */ + setBegin(value: string): GetRebaseReqBuilder { + this.obj.begin = value; + return this; + } + + /** + * End time, for example: 20241010 (query data with a maximum interval of 6 months) + */ + setEnd(value: string): GetRebaseReqBuilder { + this.obj.end = value; + return this; + } + + /** + * Transaction type, 1: spot 2: futures + */ + setTradeType(value: GetRebaseReq.TradeTypeEnum): GetRebaseReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): GetRebaseReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts new file mode 100644 index 00000000..cf09f43f --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRebaseResp implements Response { + /** + * Rebate order file (link is valid for 1 day) + */ + url?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRebaseResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRebaseResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRebaseResp { + return plainToInstance(GetRebaseResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts new file mode 100644 index 00000000..3acc2682 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts @@ -0,0 +1,63 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountAPIData implements Serializable { + /** + * Sub-Account UID + */ + uid?: string; + /** + * apikey remarks + */ + label?: string; + /** + * apiKey + */ + apiKey?: string; + /** + * apiVersion + */ + apiVersion?: number; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list + */ + permissions?: Array; + /** + * IP whitelist list + */ + ipWhitelist?: Array; + /** + * Creation time, unix timestamp (milliseconds) + */ + createdAt?: number; + fromJson(input: string): GetSubAccountAPIData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountAPIData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountAPIData { + return plainToInstance(GetSubAccountAPIData, jsonObject); + } +} + +export namespace GetSubAccountAPIData { + export enum PermissionsEnum { + /** + * + */ + GENERAL = 'General', + /** + * + */ + SPOT = 'Spot', + /** + * + */ + FUTURES = 'Futures', + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts new file mode 100644 index 00000000..fb21278f --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountAPIReq implements Serializable { + /** + * Sub-account UID + */ + uid?: string; + /** + * Sub-account apiKey + */ + apiKey?: string; + + /** + * Creates a new instance of the `GetSubAccountAPIReq` class. + * The builder pattern allows step-by-step construction of a `GetSubAccountAPIReq` object. + */ + static builder(): GetSubAccountAPIReqBuilder { + return new GetSubAccountAPIReqBuilder(); + } + + /** + * Creates a new instance of the `GetSubAccountAPIReq` class with the given data. + */ + static create(data: { + /** + * Sub-account UID + */ + uid?: string; + /** + * Sub-account apiKey + */ + apiKey?: string; + }): GetSubAccountAPIReq { + let obj = new GetSubAccountAPIReq(); + obj.uid = data.uid; + obj.apiKey = data.apiKey; + return obj; + } + + fromJson(input: string): GetSubAccountAPIReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountAPIReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountAPIReq { + return plainToInstance(GetSubAccountAPIReq, jsonObject); + } +} + +export class GetSubAccountAPIReqBuilder { + obj: GetSubAccountAPIReq = new GetSubAccountAPIReq(); + /** + * Sub-account UID + */ + setUid(value: string): GetSubAccountAPIReqBuilder { + this.obj.uid = value; + return this; + } + + /** + * Sub-account apiKey + */ + setApiKey(value: string): GetSubAccountAPIReqBuilder { + this.obj.apiKey = value; + return this; + } + + build(): GetSubAccountAPIReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts new file mode 100644 index 00000000..1cd23774 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSubAccountAPIData } from './model_get_sub_account_api_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSubAccountAPIResp implements Response { + /** + * + */ + @Type(() => GetSubAccountAPIData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSubAccountAPIResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountAPIResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSubAccountAPIResp { + return plainToInstance(GetSubAccountAPIResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts new file mode 100644 index 00000000..623fa7fd --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountItems implements Serializable { + /** + * Sub-account name + */ + accountName?: string; + /** + * Sub-account UID + */ + uid?: string; + /** + * Creation time, unix timestamp (milliseconds) + */ + createdAt?: number; + /** + * Sub-account VIP level + */ + level?: number; + fromJson(input: string): GetSubAccountItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountItems { + return plainToInstance(GetSubAccountItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts new file mode 100644 index 00000000..4311ced1 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSubAccountReq implements Serializable { + /** + * Sub-account UID + */ + uid?: string; + /** + * Current page, default is 1 + */ + currentPage?: number = 1; + /** + * The number returned per page, the default is 20, the maximum is 100 + */ + pageSize?: number = 20; + + /** + * Creates a new instance of the `GetSubAccountReq` class. + * The builder pattern allows step-by-step construction of a `GetSubAccountReq` object. + */ + static builder(): GetSubAccountReqBuilder { + return new GetSubAccountReqBuilder(); + } + + /** + * Creates a new instance of the `GetSubAccountReq` class with the given data. + */ + static create(data: { + /** + * Sub-account UID + */ + uid?: string; + /** + * Current page, default is 1 + */ + currentPage?: number; + /** + * The number returned per page, the default is 20, the maximum is 100 + */ + pageSize?: number; + }): GetSubAccountReq { + let obj = new GetSubAccountReq(); + obj.uid = data.uid; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetSubAccountReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountReq { + return plainToInstance(GetSubAccountReq, jsonObject); + } +} + +export class GetSubAccountReqBuilder { + obj: GetSubAccountReq = new GetSubAccountReq(); + /** + * Sub-account UID + */ + setUid(value: string): GetSubAccountReqBuilder { + this.obj.uid = value; + return this; + } + + /** + * Current page, default is 1 + */ + setCurrentPage(value: number): GetSubAccountReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * The number returned per page, the default is 20, the maximum is 100 + */ + setPageSize(value: number): GetSubAccountReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetSubAccountReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts new file mode 100644 index 00000000..13dd291d --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSubAccountItems } from './model_get_sub_account_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSubAccountResp implements Response { + /** + * Current page + */ + currentPage?: number; + /** + * Page Size + */ + pageSize?: number; + /** + * Total Number + */ + totalNum?: number; + /** + * Total Page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetSubAccountItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSubAccountResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSubAccountResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSubAccountResp { + return plainToInstance(GetSubAccountResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts new file mode 100644 index 00000000..e7547425 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTransferHistoryReq implements Serializable { + /** + * Transfer Order ID + */ + orderId?: string; + + /** + * Creates a new instance of the `GetTransferHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTransferHistoryReq` object. + */ + static builder(): GetTransferHistoryReqBuilder { + return new GetTransferHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTransferHistoryReq` class with the given data. + */ + static create(data: { + /** + * Transfer Order ID + */ + orderId?: string; + }): GetTransferHistoryReq { + let obj = new GetTransferHistoryReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetTransferHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTransferHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTransferHistoryReq { + return plainToInstance(GetTransferHistoryReq, jsonObject); + } +} + +export class GetTransferHistoryReqBuilder { + obj: GetTransferHistoryReq = new GetTransferHistoryReq(); + /** + * Transfer Order ID + */ + setOrderId(value: string): GetTransferHistoryReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetTransferHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts new file mode 100644 index 00000000..bcf688fc --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts @@ -0,0 +1,138 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTransferHistoryResp implements Response { + /** + * Transfer Order ID + */ + orderId?: string; + /** + * Currency + */ + currency?: string; + /** + * Transfer Amount + */ + amount?: string; + /** + * UID of the user transferring out + */ + fromUid?: number; + /** + * From Account Type:Account Type: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED + */ + fromAccountType?: GetTransferHistoryResp.FromAccountTypeEnum; + /** + * Trading pair, required if the account type is ISOLATED, e.g., BTC-USDT + */ + fromAccountTag?: string; + /** + * UID of the user transferring in + */ + toUid?: number; + /** + * Account Type:Account Type: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED + */ + toAccountType?: GetTransferHistoryResp.ToAccountTypeEnum; + /** + * To Trading pair, required if the account type is ISOLATED, e.g., BTC-USDT + */ + toAccountTag?: string; + /** + * Status: PROCESSING (processing), SUCCESS (successful), FAILURE (failed) + */ + status?: GetTransferHistoryResp.StatusEnum; + /** + * Failure Reason + */ + reason?: string; + /** + * Creation Time (Unix timestamp in milliseconds) + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTransferHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTransferHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTransferHistoryResp { + return plainToInstance(GetTransferHistoryResp, jsonObject); + } +} + +export namespace GetTransferHistoryResp { + export enum FromAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + /** + * + */ + CONTRACT = 'CONTRACT', + /** + * + */ + MARGIN = 'MARGIN', + /** + * + */ + ISOLATED = 'ISOLATED', + } + export enum ToAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + /** + * + */ + CONTRACT = 'CONTRACT', + /** + * + */ + MARGIN = 'MARGIN', + /** + * + */ + ISOLATED = 'ISOLATED', + } + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts new file mode 100644 index 00000000..57a9d841 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetWithdrawDetailReq implements Serializable { + /** + * Withdrawal ID + */ + withdrawalId?: string; + + /** + * Creates a new instance of the `GetWithdrawDetailReq` class. + * The builder pattern allows step-by-step construction of a `GetWithdrawDetailReq` object. + */ + static builder(): GetWithdrawDetailReqBuilder { + return new GetWithdrawDetailReqBuilder(); + } + + /** + * Creates a new instance of the `GetWithdrawDetailReq` class with the given data. + */ + static create(data: { + /** + * Withdrawal ID + */ + withdrawalId?: string; + }): GetWithdrawDetailReq { + let obj = new GetWithdrawDetailReq(); + obj.withdrawalId = data.withdrawalId; + return obj; + } + + fromJson(input: string): GetWithdrawDetailReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawDetailReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawDetailReq { + return plainToInstance(GetWithdrawDetailReq, jsonObject); + } +} + +export class GetWithdrawDetailReqBuilder { + obj: GetWithdrawDetailReq = new GetWithdrawDetailReq(); + /** + * Withdrawal ID + */ + setWithdrawalId(value: string): GetWithdrawDetailReqBuilder { + this.obj.withdrawalId = value; + return this; + } + + build(): GetWithdrawDetailReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts new file mode 100644 index 00000000..671c34b8 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts @@ -0,0 +1,110 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetWithdrawDetailResp implements Response { + /** + * Withdrawal ID + */ + id?: string; + /** + * chain id of currency + */ + chain?: string; + /** + * Wallet Transaction ID + */ + walletTxId?: string; + /** + * UID + */ + uid?: number; + /** + * Update Time (milliseconds) + */ + updatedAt?: number; + /** + * Amount + */ + amount?: string; + /** + * Memo + */ + memo?: string; + /** + * Fee + */ + fee?: string; + /** + * Address + */ + address?: string; + /** + * Remark + */ + remark?: string; + /** + * Is Internal (true or false) + */ + isInner?: boolean; + /** + * Currency + */ + currency?: string; + /** + * Status (PROCESSING, WALLET_PROCESSING, REVIEW, SUCCESS, FAILURE) + */ + status?: GetWithdrawDetailResp.StatusEnum; + /** + * Creation Time (milliseconds) + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetWithdrawDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetWithdrawDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetWithdrawDetailResp { + return plainToInstance(GetWithdrawDetailResp, jsonObject); + } +} + +export namespace GetWithdrawDetailResp { + export enum StatusEnum { + /** + * + */ + PROCESSING = 'PROCESSING', + /** + * + */ + WALLET_PROCESSING = 'WALLET_PROCESSING', + /** + * + */ + REVIEW = 'REVIEW', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILURE = 'FAILURE', + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts new file mode 100644 index 00000000..ed5743cb --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts @@ -0,0 +1,147 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifySubAccountApiReq implements Serializable { + /** + * Subaccount UID + */ + uid?: string; + /** + * IP whitelist list, supports up to 20 IPs + */ + ipWhitelist?: Array; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + permissions?: Array; + /** + * apikey remarks (length 4~32) + */ + label?: string; + /** + * Subaccount apiKey + */ + apiKey?: string; + + /** + * Creates a new instance of the `ModifySubAccountApiReq` class. + * The builder pattern allows step-by-step construction of a `ModifySubAccountApiReq` object. + */ + static builder(): ModifySubAccountApiReqBuilder { + return new ModifySubAccountApiReqBuilder(); + } + + /** + * Creates a new instance of the `ModifySubAccountApiReq` class with the given data. + */ + static create(data: { + /** + * Subaccount UID + */ + uid?: string; + /** + * IP whitelist list, supports up to 20 IPs + */ + ipWhitelist?: Array; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + permissions?: Array; + /** + * apikey remarks (length 4~32) + */ + label?: string; + /** + * Subaccount apiKey + */ + apiKey?: string; + }): ModifySubAccountApiReq { + let obj = new ModifySubAccountApiReq(); + obj.uid = data.uid; + obj.ipWhitelist = data.ipWhitelist; + obj.permissions = data.permissions; + obj.label = data.label; + obj.apiKey = data.apiKey; + return obj; + } + + fromJson(input: string): ModifySubAccountApiReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifySubAccountApiReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifySubAccountApiReq { + return plainToInstance(ModifySubAccountApiReq, jsonObject); + } +} + +export namespace ModifySubAccountApiReq { + export enum PermissionsEnum { + /** + * + */ + GENERAL = 'general', + /** + * + */ + SPOT = 'spot', + /** + * + */ + FUTURES = 'futures', + } +} + +export class ModifySubAccountApiReqBuilder { + obj: ModifySubAccountApiReq = new ModifySubAccountApiReq(); + /** + * Subaccount UID + */ + setUid(value: string): ModifySubAccountApiReqBuilder { + this.obj.uid = value; + return this; + } + + /** + * IP whitelist list, supports up to 20 IPs + */ + setIpWhitelist(value: Array): ModifySubAccountApiReqBuilder { + this.obj.ipWhitelist = value; + return this; + } + + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) + */ + setPermissions( + value: Array, + ): ModifySubAccountApiReqBuilder { + this.obj.permissions = value; + return this; + } + + /** + * apikey remarks (length 4~32) + */ + setLabel(value: string): ModifySubAccountApiReqBuilder { + this.obj.label = value; + return this; + } + + /** + * Subaccount apiKey + */ + setApiKey(value: string): ModifySubAccountApiReqBuilder { + this.obj.apiKey = value; + return this; + } + + build(): ModifySubAccountApiReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts new file mode 100644 index 00000000..e81fc2ed --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifySubAccountApiResp implements Response { + /** + * Sub-Account UID + */ + uid?: string; + /** + * apikey remarks + */ + label?: string; + /** + * apiKey + */ + apiKey?: string; + /** + * apiVersion + */ + apiVersion?: number; + /** + * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list + */ + permissions?: Array; + /** + * IP whitelist list + */ + ipWhitelist?: Array; + /** + * Creation time, unix timestamp (milliseconds) + */ + createdAt?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifySubAccountApiResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifySubAccountApiResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifySubAccountApiResp { + return plainToInstance(ModifySubAccountApiResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts new file mode 100644 index 00000000..4e514467 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts @@ -0,0 +1,195 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class TransferReq implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Transfer Amount (must be a positive integer in the currency\'s precision) + */ + amount?: string; + /** + * Fund transfer direction: OUT (Broker account is transferred to Broker sub-account), IN (Broker sub-account is transferred to Broker account) + */ + direction?: TransferReq.DirectionEnum; + /** + * Broker account types: MAIN (Funding account), TRADE (Spot trading account) + */ + accountType?: TransferReq.AccountTypeEnum; + /** + * Broker subaccount uid, must be the Broker subaccount created by the current Broker user. + */ + specialUid?: string; + /** + * Broker sub-account types: MAIN (Funding account), TRADE (Spot trading account) + */ + specialAccountType?: TransferReq.SpecialAccountTypeEnum; + /** + * Client Order Id, The unique identifier created by the client. It is recommended to use UUID. The maximum length is 128 bits. + */ + clientOid?: string; + + /** + * Creates a new instance of the `TransferReq` class. + * The builder pattern allows step-by-step construction of a `TransferReq` object. + */ + static builder(): TransferReqBuilder { + return new TransferReqBuilder(); + } + + /** + * Creates a new instance of the `TransferReq` class with the given data. + */ + static create(data: { + /** + * Currency + */ + currency?: string; + /** + * Transfer Amount (must be a positive integer in the currency\'s precision) + */ + amount?: string; + /** + * Fund transfer direction: OUT (Broker account is transferred to Broker sub-account), IN (Broker sub-account is transferred to Broker account) + */ + direction?: TransferReq.DirectionEnum; + /** + * Broker account types: MAIN (Funding account), TRADE (Spot trading account) + */ + accountType?: TransferReq.AccountTypeEnum; + /** + * Broker subaccount uid, must be the Broker subaccount created by the current Broker user. + */ + specialUid?: string; + /** + * Broker sub-account types: MAIN (Funding account), TRADE (Spot trading account) + */ + specialAccountType?: TransferReq.SpecialAccountTypeEnum; + /** + * Client Order Id, The unique identifier created by the client. It is recommended to use UUID. The maximum length is 128 bits. + */ + clientOid?: string; + }): TransferReq { + let obj = new TransferReq(); + obj.currency = data.currency; + obj.amount = data.amount; + obj.direction = data.direction; + obj.accountType = data.accountType; + obj.specialUid = data.specialUid; + obj.specialAccountType = data.specialAccountType; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): TransferReq { + const jsonObject = JSON.parse(input); + return plainToInstance(TransferReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): TransferReq { + return plainToInstance(TransferReq, jsonObject); + } +} + +export namespace TransferReq { + export enum DirectionEnum { + /** + * + */ + OUT = 'OUT', + /** + * + */ + IN = 'IN', + } + export enum AccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } + export enum SpecialAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class TransferReqBuilder { + obj: TransferReq = new TransferReq(); + /** + * Currency + */ + setCurrency(value: string): TransferReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Transfer Amount (must be a positive integer in the currency\'s precision) + */ + setAmount(value: string): TransferReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Fund transfer direction: OUT (Broker account is transferred to Broker sub-account), IN (Broker sub-account is transferred to Broker account) + */ + setDirection(value: TransferReq.DirectionEnum): TransferReqBuilder { + this.obj.direction = value; + return this; + } + + /** + * Broker account types: MAIN (Funding account), TRADE (Spot trading account) + */ + setAccountType(value: TransferReq.AccountTypeEnum): TransferReqBuilder { + this.obj.accountType = value; + return this; + } + + /** + * Broker subaccount uid, must be the Broker subaccount created by the current Broker user. + */ + setSpecialUid(value: string): TransferReqBuilder { + this.obj.specialUid = value; + return this; + } + + /** + * Broker sub-account types: MAIN (Funding account), TRADE (Spot trading account) + */ + setSpecialAccountType(value: TransferReq.SpecialAccountTypeEnum): TransferReqBuilder { + this.obj.specialAccountType = value; + return this; + } + + /** + * Client Order Id, The unique identifier created by the client. It is recommended to use UUID. The maximum length is 128 bits. + */ + setClientOid(value: string): TransferReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): TransferReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts new file mode 100644 index 00000000..e9a29c9b --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class TransferResp implements Response { + /** + * + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): TransferResp { + const jsonObject = JSON.parse(input); + return plainToInstance(TransferResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): TransferResp { + return plainToInstance(TransferResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/earn/earn/api_earn.template b/sdk/node/src/generate/earn/earn/api_earn.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/earn/earn/api_earn.test.ts b/sdk/node/src/generate/earn/earn/api_earn.test.ts new file mode 100644 index 00000000..10c8ee79 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/api_earn.test.ts @@ -0,0 +1,303 @@ +import { GetStakingProductsReq } from './model_get_staking_products_req'; +import { GetSavingsProductsReq } from './model_get_savings_products_req'; +import { GetPromotionProductsReq } from './model_get_promotion_products_req'; +import { GetPromotionProductsResp } from './model_get_promotion_products_resp'; +import { PurchaseReq } from './model_purchase_req'; +import { GetAccountHoldingResp } from './model_get_account_holding_resp'; +import { GetETHStakingProductsResp } from './model_get_eth_staking_products_resp'; +import { GetAccountHoldingReq } from './model_get_account_holding_req'; +import { PurchaseResp } from './model_purchase_resp'; +import { GetStakingProductsResp } from './model_get_staking_products_resp'; +import { GetETHStakingProductsReq } from './model_get_eth_staking_products_req'; +import { GetRedeemPreviewResp } from './model_get_redeem_preview_resp'; +import { GetKcsStakingProductsReq } from './model_get_kcs_staking_products_req'; +import { RedeemResp } from './model_redeem_resp'; +import { GetRedeemPreviewReq } from './model_get_redeem_preview_req'; +import { GetSavingsProductsResp } from './model_get_savings_products_resp'; +import { RedeemReq } from './model_redeem_req'; +import { GetKcsStakingProductsResp } from './model_get_kcs_staking_products_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getETHStakingProducts request test', () => { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetETHStakingProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getETHStakingProducts response test', () => { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "ETH2",\n "category": "ETH2",\n "type": "DEMAND",\n "precision": 8,\n "currency": "ETH",\n "incomeCurrency": "ETH2",\n "returnRate": "0.028",\n "userLowerLimit": "0.01",\n "userUpperLimit": "8557.3597075",\n "productUpperLimit": "8557.3597075",\n "productRemainAmount": "8557.3597075",\n "redeemPeriod": 5,\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "applyStartTime": 1729255485000,\n "applyEndTime": null,\n "lockStartTime": 1729255485000,\n "lockEndTime": null,\n "interestDate": 1729267200000,\n "newUserOnly": 0,\n "earlyRedeemSupported": 0,\n "duration": 0,\n "status": "ONGOING"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetETHStakingProductsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getAccountHolding request test', () => { + /** + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets + */ + let data = + '{"currency": "KCS", "productId": "example_string_default_value", "productCategory": "DEMAND", "currentPage": 1, "pageSize": 10}'; + let req = new GetAccountHoldingReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getAccountHolding response test', () => { + /** + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets + */ + let data = + '{\n "code": "200000",\n "data": {\n "totalNum": 1,\n "totalPage": 1,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "orderId": "2767291",\n "productId": "2611",\n "productCategory": "KCS_STAKING",\n "productType": "DEMAND",\n "currency": "KCS",\n "incomeCurrency": "KCS",\n "returnRate": "0.03471727",\n "holdAmount": "1",\n "redeemedAmount": "0",\n "redeemingAmount": "1",\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "purchaseTime": 1729257513000,\n "redeemPeriod": 3,\n "status": "REDEEMING",\n "earlyRedeemSupported": 0\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetAccountHoldingResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getKcsStakingProducts request test', () => { + /** + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetKcsStakingProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getKcsStakingProducts response test', () => { + /** + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "2611",\n "currency": "KCS",\n "category": "KCS_STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "100000000",\n "userUpperLimit": "100000000",\n "userLowerLimit": "1",\n "redeemPeriod": 3,\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "applyStartTime": 1701252000000,\n "applyEndTime": null,\n "returnRate": "0.03471727",\n "incomeCurrency": "KCS",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "58065850.54998251",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetKcsStakingProductsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('redeem request test', () => { + /** + * redeem + * Redeem + * /api/v1/earn/orders + */ + let data = + '{"orderId": "2767291", "amount": "example_string_default_value", "fromAccountType": "MAIN", "confirmPunishRedeem": "1"}'; + let req = new RedeemReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('redeem response test', () => { + /** + * redeem + * Redeem + * /api/v1/earn/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderTxId": "6603700",\n "deliverTime": 1729517805000,\n "status": "PENDING",\n "amount": "1"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new RedeemResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('purchase request test', () => { + /** + * purchase + * purchase + * /api/v1/earn/orders + */ + let data = '{"productId": "2611", "amount": "1", "accountType": "TRADE"}'; + let req = new PurchaseReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('purchase response test', () => { + /** + * purchase + * purchase + * /api/v1/earn/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "2767291",\n "orderTxId": "6603694"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new PurchaseResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPromotionProducts request test', () => { + /** + * getPromotionProducts + * Get Promotion Products + * /api/v1/earn/promotion/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetPromotionProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPromotionProducts response test', () => { + /** + * getPromotionProducts + * Get Promotion Products + * /api/v1/earn/promotion/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "2685",\n "currency": "BTC",\n "category": "ACTIVITY",\n "type": "TIME",\n "precision": 8,\n "productUpperLimit": "50",\n "userUpperLimit": "1",\n "userLowerLimit": "0.001",\n "redeemPeriod": 0,\n "lockStartTime": 1702371601000,\n "lockEndTime": 1729858405000,\n "applyStartTime": 1702371600000,\n "applyEndTime": null,\n "returnRate": "0.03",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "49.78203998",\n "status": "ONGOING",\n "redeemType": "TRANS_DEMAND",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729253605000,\n "duration": 7,\n "newUserOnly": 1\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPromotionProductsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRedeemPreview request test', () => { + /** + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview + */ + let data = '{"orderId": "2767291", "fromAccountType": "MAIN"}'; + let req = new GetRedeemPreviewReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRedeemPreview response test', () => { + /** + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview + */ + let data = + '{\n "code": "200000",\n "data": {\n "currency": "KCS",\n "redeemAmount": "1",\n "penaltyInterestAmount": "0",\n "redeemPeriod": 3,\n "deliverTime": 1729518951000,\n "manualRedeemable": true,\n "redeemAll": false\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRedeemPreviewResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSavingsProducts request test', () => { + /** + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetSavingsProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSavingsProducts response test', () => { + /** + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "2172",\n "currency": "BTC",\n "category": "DEMAND",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "480",\n "productRemainAmount": "132.36153083",\n "userUpperLimit": "20",\n "userLowerLimit": "0.01",\n "redeemPeriod": 0,\n "lockStartTime": 1644807600000,\n "lockEndTime": null,\n "applyStartTime": 1644807600000,\n "applyEndTime": null,\n "returnRate": "0.00047208",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSavingsProductsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getStakingProducts request test', () => { + /** + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetStakingProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getStakingProducts response test', () => { + /** + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "2535",\n "currency": "STX",\n "category": "STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "1000000",\n "userUpperLimit": "10000",\n "userLowerLimit": "1",\n "redeemPeriod": 14,\n "lockStartTime": 1688614514000,\n "lockEndTime": null,\n "applyStartTime": 1688614512000,\n "applyEndTime": null,\n "returnRate": "0.045",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "254032.90178701",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetStakingProductsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/earn/earn/api_earn.ts b/sdk/node/src/generate/earn/earn/api_earn.ts new file mode 100644 index 00000000..02345bcb --- /dev/null +++ b/sdk/node/src/generate/earn/earn/api_earn.ts @@ -0,0 +1,279 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetStakingProductsReq } from './model_get_staking_products_req'; +import { GetSavingsProductsReq } from './model_get_savings_products_req'; +import { GetPromotionProductsReq } from './model_get_promotion_products_req'; +import { GetPromotionProductsResp } from './model_get_promotion_products_resp'; +import { PurchaseReq } from './model_purchase_req'; +import { GetAccountHoldingResp } from './model_get_account_holding_resp'; +import { GetETHStakingProductsResp } from './model_get_eth_staking_products_resp'; +import { GetAccountHoldingReq } from './model_get_account_holding_req'; +import { PurchaseResp } from './model_purchase_resp'; +import { GetStakingProductsResp } from './model_get_staking_products_resp'; +import { GetETHStakingProductsReq } from './model_get_eth_staking_products_req'; +import { GetRedeemPreviewResp } from './model_get_redeem_preview_resp'; +import { GetKcsStakingProductsReq } from './model_get_kcs_staking_products_req'; +import { RedeemResp } from './model_redeem_resp'; +import { GetRedeemPreviewReq } from './model_get_redeem_preview_req'; +import { GetSavingsProductsResp } from './model_get_savings_products_resp'; +import { RedeemReq } from './model_redeem_req'; +import { GetKcsStakingProductsResp } from './model_get_kcs_staking_products_resp'; + +export interface EarnAPI { + /** + * getETHStakingProducts Get ETH Staking Products + * Description: This endpoint can get available ETH staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470276 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getETHStakingProducts(req: GetETHStakingProductsReq): Promise; + + /** + * getAccountHolding Get Account Holding + * Description: This endpoint can get current holding assets information. If no current holding assets are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470273 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getAccountHolding(req: GetAccountHoldingReq): Promise; + + /** + * getKcsStakingProducts Get KCS Staking Products + * Description: This endpoint can get available KCS staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470275 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise; + + /** + * redeem Redeem + * Description: This endpoint allows initiating redemption by holding ID. If the current holding is fully redeemed or in the process of being redeemed, it indicates that the holding does not exist. + * Documentation: https://www.kucoin.com/docs-new/api-3470270 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | EARN | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + redeem(req: RedeemReq): Promise; + + /** + * purchase purchase + * Description: This endpoint allows subscribing earn product + * Documentation: https://www.kucoin.com/docs-new/api-3470268 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | EARN | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + purchase(req: PurchaseReq): Promise; + + /** + * getPromotionProducts Get Promotion Products + * Description: This endpoint can get available limited-time promotion products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470272 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getPromotionProducts(req: GetPromotionProductsReq): Promise; + + /** + * getRedeemPreview Get Redeem Preview + * Description: This endpoint allows subscribing earn products + * Documentation: https://www.kucoin.com/docs-new/api-3470269 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | EARN | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getRedeemPreview(req: GetRedeemPreviewReq): Promise; + + /** + * getSavingsProducts Get Savings Products + * Description: This endpoint can get available savings products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470271 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getSavingsProducts(req: GetSavingsProductsReq): Promise; + + /** + * getStakingProducts Get Staking Products + * Description: This endpoint can get available staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470274 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | EARN | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getStakingProducts(req: GetStakingProductsReq): Promise; +} + +export class EarnAPIImpl implements EarnAPI { + constructor(private transport: Transport) {} + + getETHStakingProducts(req: GetETHStakingProductsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/eth-staking/products', + req, + new GetETHStakingProductsResp(), + false, + ); + } + + getAccountHolding(req: GetAccountHoldingReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/hold-assets', + req, + new GetAccountHoldingResp(), + false, + ); + } + + getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/kcs-staking/products', + req, + new GetKcsStakingProductsResp(), + false, + ); + } + + redeem(req: RedeemReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/earn/orders', + req, + new RedeemResp(), + false, + ); + } + + purchase(req: PurchaseReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/earn/orders', + req, + new PurchaseResp(), + false, + ); + } + + getPromotionProducts(req: GetPromotionProductsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/promotion/products', + req, + new GetPromotionProductsResp(), + false, + ); + } + + getRedeemPreview(req: GetRedeemPreviewReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/redeem-preview', + req, + new GetRedeemPreviewResp(), + false, + ); + } + + getSavingsProducts(req: GetSavingsProductsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/saving/products', + req, + new GetSavingsProductsResp(), + false, + ); + } + + getStakingProducts(req: GetStakingProductsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/earn/staking/products', + req, + new GetStakingProductsResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts new file mode 100644 index 00000000..06652ba3 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts @@ -0,0 +1,105 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountHoldingItems implements Serializable { + /** + * Holding ID + */ + orderId?: string; + /** + * Product ID + */ + productId?: string; + /** + * Product category + */ + productCategory?: string; + /** + * Product sub-type + */ + productType?: string; + /** + * currency + */ + currency?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Holding amount + */ + holdAmount?: string; + /** + * Redeemed amount + */ + redeemedAmount?: string; + /** + * Redeeming amount + */ + redeemingAmount?: string; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product maturity time, in milliseconds + */ + lockEndTime?: number; + /** + * Most recent subscription time, in milliseconds + */ + purchaseTime?: number; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Status: LOCKED (holding), REDEEMING (redeeming) + */ + status?: GetAccountHoldingItems.StatusEnum; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetAccountHoldingItems.EarlyRedeemSupportedEnum; + fromJson(input: string): GetAccountHoldingItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountHoldingItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountHoldingItems { + return plainToInstance(GetAccountHoldingItems, jsonObject); + } +} + +export namespace GetAccountHoldingItems { + export enum StatusEnum { + /** + * + */ + LOCKED = 'LOCKED', + /** + * + */ + REDEEMING = 'REDEEMING', + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts new file mode 100644 index 00000000..605179dd --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts @@ -0,0 +1,155 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountHoldingReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Product ID + */ + productId?: string; + /** + * Product category + */ + productCategory?: GetAccountHoldingReq.ProductCategoryEnum; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 15; + + /** + * Creates a new instance of the `GetAccountHoldingReq` class. + * The builder pattern allows step-by-step construction of a `GetAccountHoldingReq` object. + */ + static builder(): GetAccountHoldingReqBuilder { + return new GetAccountHoldingReqBuilder(); + } + + /** + * Creates a new instance of the `GetAccountHoldingReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Product ID + */ + productId?: string; + /** + * Product category + */ + productCategory?: GetAccountHoldingReq.ProductCategoryEnum; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetAccountHoldingReq { + let obj = new GetAccountHoldingReq(); + obj.currency = data.currency; + obj.productId = data.productId; + obj.productCategory = data.productCategory; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetAccountHoldingReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountHoldingReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountHoldingReq { + return plainToInstance(GetAccountHoldingReq, jsonObject); + } +} + +export namespace GetAccountHoldingReq { + export enum ProductCategoryEnum { + /** + * Savings + */ + DEMAND = 'DEMAND', + /** + * Activity + */ + ACTIVITY = 'ACTIVITY', + /** + * Staking + */ + STAKING = 'STAKING', + /** + * KCS Staking + */ + KCS_STAKING = 'KCS_STAKING', + /** + * ETHStaking + */ + ETH2 = 'ETH2', + } +} + +export class GetAccountHoldingReqBuilder { + obj: GetAccountHoldingReq = new GetAccountHoldingReq(); + /** + * currency + */ + setCurrency(value: string): GetAccountHoldingReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Product ID + */ + setProductId(value: string): GetAccountHoldingReqBuilder { + this.obj.productId = value; + return this; + } + + /** + * Product category + */ + setProductCategory( + value: GetAccountHoldingReq.ProductCategoryEnum, + ): GetAccountHoldingReqBuilder { + this.obj.productCategory = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetAccountHoldingReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetAccountHoldingReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetAccountHoldingReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts new file mode 100644 index 00000000..6fae942c --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAccountHoldingItems } from './model_get_account_holding_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAccountHoldingResp implements Response { + /** + * total number + */ + totalNum?: number; + /** + * + */ + @Type(() => GetAccountHoldingItems) + items?: Array; + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total page + */ + totalPage?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAccountHoldingResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountHoldingResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountHoldingResp { + return plainToInstance(GetAccountHoldingResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts new file mode 100644 index 00000000..cfc73135 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts @@ -0,0 +1,187 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetETHStakingProductsData implements Serializable { + /** + * Product ID + */ + id?: string; + /** + * Product category: ETH2 (ETH Staking) + */ + category?: GetETHStakingProductsData.CategoryEnum; + /** + * Product subtype: DEMAND (demand) + */ + type?: GetETHStakingProductsData.TypeEnum; + /** + * Maximum precision supported + */ + precision?: number; + /** + * currency + */ + currency?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Min user subscribe amount + */ + userLowerLimit?: string; + /** + * Max user subscribe amount + */ + userUpperLimit?: string; + /** + * Products total subscribe amount + */ + productUpperLimit?: string; + /** + * Products remain subscribe amount + */ + productRemainAmount?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) + */ + redeemType?: GetETHStakingProductsData.RedeemTypeEnum; + /** + * Income release type: DAILY (daily release), AFTER (release after product ends) + */ + incomeReleaseType?: GetETHStakingProductsData.IncomeReleaseTypeEnum; + /** + * Subscription start time, in milliseconds + */ + applyStartTime?: number; + /** + * Subscription end time, in milliseconds + */ + applyEndTime?: number; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product maturity time, in milliseconds + */ + lockEndTime?: number; + /** + * Most recent interest date(millisecond) + */ + interestDate?: number; + /** + * Whether the product is exclusive for new users: 0 (no), 1 (yes) + */ + newUserOnly?: GetETHStakingProductsData.NewUserOnlyEnum; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetETHStakingProductsData.EarlyRedeemSupportedEnum; + /** + * Product duration (days) + */ + duration?: number; + /** + * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) + */ + status?: GetETHStakingProductsData.StatusEnum; + fromJson(input: string): GetETHStakingProductsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETHStakingProductsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetETHStakingProductsData { + return plainToInstance(GetETHStakingProductsData, jsonObject); + } +} + +export namespace GetETHStakingProductsData { + export enum CategoryEnum { + /** + * + */ + ETH2 = 'ETH2', + } + export enum TypeEnum { + /** + * demand + */ + DEMAND = 'DEMAND', + } + export enum RedeemTypeEnum { + /** + * + */ + MANUAL = 'MANUAL', + /** + * + */ + TRANS_DEMAND = 'TRANS_DEMAND', + /** + * + */ + AUTO = 'AUTO', + } + export enum IncomeReleaseTypeEnum { + /** + * + */ + DAILY = 'DAILY', + /** + * + */ + AFTER = 'AFTER', + } + export enum NewUserOnlyEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum StatusEnum { + /** + * + */ + ONGOING = 'ONGOING', + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + FULL = 'FULL', + /** + * + */ + INTERESTING = 'INTERESTING', + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts new file mode 100644 index 00000000..680c49f9 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetETHStakingProductsReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetETHStakingProductsReq` class. + * The builder pattern allows step-by-step construction of a `GetETHStakingProductsReq` object. + */ + static builder(): GetETHStakingProductsReqBuilder { + return new GetETHStakingProductsReqBuilder(); + } + + /** + * Creates a new instance of the `GetETHStakingProductsReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetETHStakingProductsReq { + let obj = new GetETHStakingProductsReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetETHStakingProductsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETHStakingProductsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetETHStakingProductsReq { + return plainToInstance(GetETHStakingProductsReq, jsonObject); + } +} + +export class GetETHStakingProductsReqBuilder { + obj: GetETHStakingProductsReq = new GetETHStakingProductsReq(); + /** + * currency + */ + setCurrency(value: string): GetETHStakingProductsReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetETHStakingProductsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts new file mode 100644 index 00000000..e9abf6ca --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetETHStakingProductsData } from './model_get_eth_staking_products_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetETHStakingProductsResp + implements Response +{ + /** + * + */ + @Type(() => GetETHStakingProductsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetETHStakingProductsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETHStakingProductsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetETHStakingProductsResp { + return plainToInstance(GetETHStakingProductsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts new file mode 100644 index 00000000..38aec228 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts @@ -0,0 +1,191 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetKcsStakingProductsData implements Serializable { + /** + * Product ID + */ + id?: string; + /** + * currency + */ + currency?: string; + /** + * Product category: KCS_STAKING + */ + category?: GetKcsStakingProductsData.CategoryEnum; + /** + * Product subtype: TIME (fixed), DEMAND (demand) + */ + type?: GetKcsStakingProductsData.TypeEnum; + /** + * Maximum precision supported + */ + precision?: number; + /** + * Products total subscribe amount + */ + productUpperLimit?: string; + /** + * Max user subscribe amount + */ + userUpperLimit?: string; + /** + * Min user subscribe amount + */ + userLowerLimit?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product maturity time, in milliseconds + */ + lockEndTime?: number; + /** + * Subscription start time, in milliseconds + */ + applyStartTime?: number; + /** + * Subscription end time, in milliseconds + */ + applyEndTime?: number; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetKcsStakingProductsData.EarlyRedeemSupportedEnum; + /** + * Products remain subscribe amount + */ + productRemainAmount?: string; + /** + * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) + */ + status?: GetKcsStakingProductsData.StatusEnum; + /** + * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) + */ + redeemType?: GetKcsStakingProductsData.RedeemTypeEnum; + /** + * Income release type: DAILY (daily release), AFTER (release after product ends) + */ + incomeReleaseType?: GetKcsStakingProductsData.IncomeReleaseTypeEnum; + /** + * Most recent interest date(millisecond) + */ + interestDate?: number; + /** + * Product duration (days) + */ + duration?: number; + /** + * Whether the product is exclusive for new users: 0 (no), 1 (yes) + */ + newUserOnly?: GetKcsStakingProductsData.NewUserOnlyEnum; + fromJson(input: string): GetKcsStakingProductsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKcsStakingProductsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetKcsStakingProductsData { + return plainToInstance(GetKcsStakingProductsData, jsonObject); + } +} + +export namespace GetKcsStakingProductsData { + export enum CategoryEnum { + /** + * + */ + KCS_STAKING = 'KCS_STAKING', + } + export enum TypeEnum { + /** + * fixed + */ + TIME = 'TIME', + /** + * demand + */ + DEMAND = 'DEMAND', + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum StatusEnum { + /** + * + */ + ONGOING = 'ONGOING', + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + FULL = 'FULL', + /** + * + */ + INTERESTING = 'INTERESTING', + } + export enum RedeemTypeEnum { + /** + * + */ + MANUAL = 'MANUAL', + /** + * + */ + TRANS_DEMAND = 'TRANS_DEMAND', + /** + * + */ + AUTO = 'AUTO', + } + export enum IncomeReleaseTypeEnum { + /** + * + */ + DAILY = 'DAILY', + /** + * + */ + AFTER = 'AFTER', + } + export enum NewUserOnlyEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts new file mode 100644 index 00000000..551933e8 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetKcsStakingProductsReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetKcsStakingProductsReq` class. + * The builder pattern allows step-by-step construction of a `GetKcsStakingProductsReq` object. + */ + static builder(): GetKcsStakingProductsReqBuilder { + return new GetKcsStakingProductsReqBuilder(); + } + + /** + * Creates a new instance of the `GetKcsStakingProductsReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetKcsStakingProductsReq { + let obj = new GetKcsStakingProductsReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetKcsStakingProductsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKcsStakingProductsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetKcsStakingProductsReq { + return plainToInstance(GetKcsStakingProductsReq, jsonObject); + } +} + +export class GetKcsStakingProductsReqBuilder { + obj: GetKcsStakingProductsReq = new GetKcsStakingProductsReq(); + /** + * currency + */ + setCurrency(value: string): GetKcsStakingProductsReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetKcsStakingProductsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts new file mode 100644 index 00000000..19657db4 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetKcsStakingProductsData } from './model_get_kcs_staking_products_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetKcsStakingProductsResp + implements Response +{ + /** + * + */ + @Type(() => GetKcsStakingProductsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetKcsStakingProductsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKcsStakingProductsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetKcsStakingProductsResp { + return plainToInstance(GetKcsStakingProductsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts new file mode 100644 index 00000000..3882e829 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts @@ -0,0 +1,191 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPromotionProductsData implements Serializable { + /** + * Product ID + */ + id?: string; + /** + * currency + */ + currency?: string; + /** + * Product category: ACTIVITY + */ + category?: GetPromotionProductsData.CategoryEnum; + /** + * Product subtype: TIME (fixed), DEMAND (demand) + */ + type?: GetPromotionProductsData.TypeEnum; + /** + * Maximum precision supported + */ + precision?: number; + /** + * Products total subscribe amount + */ + productUpperLimit?: string; + /** + * Max user subscribe amount + */ + userUpperLimit?: string; + /** + * Min user subscribe amount + */ + userLowerLimit?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product earliest interest end time, in milliseconds + */ + lockEndTime?: number; + /** + * Subscription start time, in milliseconds + */ + applyStartTime?: number; + /** + * Subscription end time, in milliseconds + */ + applyEndTime?: number; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetPromotionProductsData.EarlyRedeemSupportedEnum; + /** + * Products remain subscribe amount + */ + productRemainAmount?: string; + /** + * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) + */ + status?: GetPromotionProductsData.StatusEnum; + /** + * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) + */ + redeemType?: GetPromotionProductsData.RedeemTypeEnum; + /** + * Income release type: DAILY (daily release), AFTER (release after product ends) + */ + incomeReleaseType?: GetPromotionProductsData.IncomeReleaseTypeEnum; + /** + * Most recent interest date(millisecond) + */ + interestDate?: number; + /** + * Product duration (days) + */ + duration?: number; + /** + * Whether the product is exclusive for new users: 0 (no), 1 (yes) + */ + newUserOnly?: GetPromotionProductsData.NewUserOnlyEnum; + fromJson(input: string): GetPromotionProductsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPromotionProductsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPromotionProductsData { + return plainToInstance(GetPromotionProductsData, jsonObject); + } +} + +export namespace GetPromotionProductsData { + export enum CategoryEnum { + /** + * + */ + ACTIVITY = 'ACTIVITY', + } + export enum TypeEnum { + /** + * fixed + */ + TIME = 'TIME', + /** + * demand + */ + DEMAND = 'DEMAND', + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum StatusEnum { + /** + * + */ + ONGOING = 'ONGOING', + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + FULL = 'FULL', + /** + * + */ + INTERESTING = 'INTERESTING', + } + export enum RedeemTypeEnum { + /** + * + */ + MANUAL = 'MANUAL', + /** + * + */ + TRANS_DEMAND = 'TRANS_DEMAND', + /** + * + */ + AUTO = 'AUTO', + } + export enum IncomeReleaseTypeEnum { + /** + * + */ + DAILY = 'DAILY', + /** + * + */ + AFTER = 'AFTER', + } + export enum NewUserOnlyEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts new file mode 100644 index 00000000..95775acf --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPromotionProductsReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetPromotionProductsReq` class. + * The builder pattern allows step-by-step construction of a `GetPromotionProductsReq` object. + */ + static builder(): GetPromotionProductsReqBuilder { + return new GetPromotionProductsReqBuilder(); + } + + /** + * Creates a new instance of the `GetPromotionProductsReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetPromotionProductsReq { + let obj = new GetPromotionProductsReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetPromotionProductsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPromotionProductsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPromotionProductsReq { + return plainToInstance(GetPromotionProductsReq, jsonObject); + } +} + +export class GetPromotionProductsReqBuilder { + obj: GetPromotionProductsReq = new GetPromotionProductsReq(); + /** + * currency + */ + setCurrency(value: string): GetPromotionProductsReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetPromotionProductsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts new file mode 100644 index 00000000..ff63c6c3 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetPromotionProductsData } from './model_get_promotion_products_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPromotionProductsResp implements Response { + /** + * + */ + @Type(() => GetPromotionProductsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPromotionProductsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPromotionProductsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetPromotionProductsResp { + return plainToInstance(GetPromotionProductsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts new file mode 100644 index 00000000..f58b612b --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRedeemPreviewReq implements Serializable { + /** + * Holding ID + */ + orderId?: string; + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + fromAccountType?: GetRedeemPreviewReq.FromAccountTypeEnum; + + /** + * Creates a new instance of the `GetRedeemPreviewReq` class. + * The builder pattern allows step-by-step construction of a `GetRedeemPreviewReq` object. + */ + static builder(): GetRedeemPreviewReqBuilder { + return new GetRedeemPreviewReqBuilder(); + } + + /** + * Creates a new instance of the `GetRedeemPreviewReq` class with the given data. + */ + static create(data: { + /** + * Holding ID + */ + orderId?: string; + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + fromAccountType?: GetRedeemPreviewReq.FromAccountTypeEnum; + }): GetRedeemPreviewReq { + let obj = new GetRedeemPreviewReq(); + obj.orderId = data.orderId; + obj.fromAccountType = data.fromAccountType; + return obj; + } + + fromJson(input: string): GetRedeemPreviewReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRedeemPreviewReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRedeemPreviewReq { + return plainToInstance(GetRedeemPreviewReq, jsonObject); + } +} + +export namespace GetRedeemPreviewReq { + export enum FromAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class GetRedeemPreviewReqBuilder { + obj: GetRedeemPreviewReq = new GetRedeemPreviewReq(); + /** + * Holding ID + */ + setOrderId(value: string): GetRedeemPreviewReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + setFromAccountType(value: GetRedeemPreviewReq.FromAccountTypeEnum): GetRedeemPreviewReqBuilder { + this.obj.fromAccountType = value; + return this; + } + + build(): GetRedeemPreviewReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts new file mode 100644 index 00000000..9069b706 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRedeemPreviewResp implements Response { + /** + * currency + */ + currency?: string; + /** + * Expected redemption amount + */ + redeemAmount?: string; + /** + * Penalty interest amount, incurred for early redemption of fixed-term products + */ + penaltyInterestAmount?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Expected deliver time (milliseconds) + */ + deliverTime?: number; + /** + * Whether manual redemption is possible + */ + manualRedeemable?: boolean; + /** + * Whether the entire holding must be redeemed, required for early redemption of fixed-term products + */ + redeemAll?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRedeemPreviewResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRedeemPreviewResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRedeemPreviewResp { + return plainToInstance(GetRedeemPreviewResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts new file mode 100644 index 00000000..52610bd6 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts @@ -0,0 +1,191 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSavingsProductsData implements Serializable { + /** + * Product ID + */ + id?: string; + /** + * currency + */ + currency?: string; + /** + * Product category: DEMAND (savings) + */ + category?: GetSavingsProductsData.CategoryEnum; + /** + * Product subtype: TIME (fixed), DEMAND (demand) + */ + type?: GetSavingsProductsData.TypeEnum; + /** + * Maximum precision supported + */ + precision?: number; + /** + * Products total subscribe amount + */ + productUpperLimit?: string; + /** + * Max user subscribe amount + */ + userUpperLimit?: string; + /** + * Min user subscribe amount + */ + userLowerLimit?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product maturity time, in milliseconds + */ + lockEndTime?: number; + /** + * Subscription start time, in milliseconds + */ + applyStartTime?: number; + /** + * Subscription end time, in milliseconds + */ + applyEndTime?: number; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetSavingsProductsData.EarlyRedeemSupportedEnum; + /** + * Products remain subscribe amount + */ + productRemainAmount?: string; + /** + * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) + */ + status?: GetSavingsProductsData.StatusEnum; + /** + * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) + */ + redeemType?: GetSavingsProductsData.RedeemTypeEnum; + /** + * Income release type: DAILY (daily release), AFTER (release after product ends) + */ + incomeReleaseType?: GetSavingsProductsData.IncomeReleaseTypeEnum; + /** + * Most recent interest date(millisecond) + */ + interestDate?: number; + /** + * Product duration (days) + */ + duration?: number; + /** + * Whether the product is exclusive for new users: 0 (no), 1 (yes) + */ + newUserOnly?: GetSavingsProductsData.NewUserOnlyEnum; + fromJson(input: string): GetSavingsProductsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSavingsProductsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSavingsProductsData { + return plainToInstance(GetSavingsProductsData, jsonObject); + } +} + +export namespace GetSavingsProductsData { + export enum CategoryEnum { + /** + * savings + */ + DEMAND = 'DEMAND', + } + export enum TypeEnum { + /** + * fixed + */ + TIME = 'TIME', + /** + * demand + */ + DEMAND = 'DEMAND', + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum StatusEnum { + /** + * + */ + ONGOING = 'ONGOING', + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + FULL = 'FULL', + /** + * + */ + INTERESTING = 'INTERESTING', + } + export enum RedeemTypeEnum { + /** + * + */ + MANUAL = 'MANUAL', + /** + * + */ + TRANS_DEMAND = 'TRANS_DEMAND', + /** + * + */ + AUTO = 'AUTO', + } + export enum IncomeReleaseTypeEnum { + /** + * + */ + DAILY = 'DAILY', + /** + * + */ + AFTER = 'AFTER', + } + export enum NewUserOnlyEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts new file mode 100644 index 00000000..96903a37 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSavingsProductsReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetSavingsProductsReq` class. + * The builder pattern allows step-by-step construction of a `GetSavingsProductsReq` object. + */ + static builder(): GetSavingsProductsReqBuilder { + return new GetSavingsProductsReqBuilder(); + } + + /** + * Creates a new instance of the `GetSavingsProductsReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetSavingsProductsReq { + let obj = new GetSavingsProductsReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetSavingsProductsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSavingsProductsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSavingsProductsReq { + return plainToInstance(GetSavingsProductsReq, jsonObject); + } +} + +export class GetSavingsProductsReqBuilder { + obj: GetSavingsProductsReq = new GetSavingsProductsReq(); + /** + * currency + */ + setCurrency(value: string): GetSavingsProductsReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetSavingsProductsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts new file mode 100644 index 00000000..cf2d5000 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSavingsProductsData } from './model_get_savings_products_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSavingsProductsResp implements Response { + /** + * + */ + @Type(() => GetSavingsProductsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSavingsProductsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSavingsProductsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetSavingsProductsResp { + return plainToInstance(GetSavingsProductsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts new file mode 100644 index 00000000..dc81adb0 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts @@ -0,0 +1,191 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStakingProductsData implements Serializable { + /** + * Product ID + */ + id?: string; + /** + * currency + */ + currency?: string; + /** + * Product category: STAKING + */ + category?: GetStakingProductsData.CategoryEnum; + /** + * Product subtype: TIME (fixed), DEMAND (demand) + */ + type?: GetStakingProductsData.TypeEnum; + /** + * Maximum precision supported + */ + precision?: number; + /** + * Products total subscribe amount + */ + productUpperLimit?: string; + /** + * Max user subscribe amount + */ + userUpperLimit?: string; + /** + * Min user subscribe amount + */ + userLowerLimit?: string; + /** + * Redemption waiting period (days) + */ + redeemPeriod?: number; + /** + * Product earliest interest start time, in milliseconds + */ + lockStartTime?: number; + /** + * Product maturity time, in milliseconds + */ + lockEndTime?: number; + /** + * Subscription start time, in milliseconds + */ + applyStartTime?: number; + /** + * Subscription end time, in milliseconds + */ + applyEndTime?: number; + /** + * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return + */ + returnRate?: string; + /** + * Income currency + */ + incomeCurrency?: string; + /** + * Whether the fixed product supports early redemption: 0 (no), 1 (yes) + */ + earlyRedeemSupported?: GetStakingProductsData.EarlyRedeemSupportedEnum; + /** + * Products remain subscribe amount + */ + productRemainAmount?: string; + /** + * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) + */ + status?: GetStakingProductsData.StatusEnum; + /** + * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) + */ + redeemType?: GetStakingProductsData.RedeemTypeEnum; + /** + * Income release type: DAILY (daily release), AFTER (release after product ends) + */ + incomeReleaseType?: GetStakingProductsData.IncomeReleaseTypeEnum; + /** + * Most recent interest date(millisecond) + */ + interestDate?: number; + /** + * Product duration (days) + */ + duration?: number; + /** + * Whether the product is exclusive for new users: 0 (no), 1 (yes) + */ + newUserOnly?: GetStakingProductsData.NewUserOnlyEnum; + fromJson(input: string): GetStakingProductsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStakingProductsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStakingProductsData { + return plainToInstance(GetStakingProductsData, jsonObject); + } +} + +export namespace GetStakingProductsData { + export enum CategoryEnum { + /** + * + */ + STAKING = 'STAKING', + } + export enum TypeEnum { + /** + * fixed + */ + TIME = 'TIME', + /** + * demand + */ + DEMAND = 'DEMAND', + } + export enum EarlyRedeemSupportedEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } + export enum StatusEnum { + /** + * + */ + ONGOING = 'ONGOING', + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + FULL = 'FULL', + /** + * + */ + INTERESTING = 'INTERESTING', + } + export enum RedeemTypeEnum { + /** + * + */ + MANUAL = 'MANUAL', + /** + * + */ + TRANS_DEMAND = 'TRANS_DEMAND', + /** + * + */ + AUTO = 'AUTO', + } + export enum IncomeReleaseTypeEnum { + /** + * + */ + DAILY = 'DAILY', + /** + * + */ + AFTER = 'AFTER', + } + export enum NewUserOnlyEnum { + /** + * + */ + _0 = 0, + /** + * + */ + _1 = 1, + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts new file mode 100644 index 00000000..9cdf0586 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStakingProductsReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetStakingProductsReq` class. + * The builder pattern allows step-by-step construction of a `GetStakingProductsReq` object. + */ + static builder(): GetStakingProductsReqBuilder { + return new GetStakingProductsReqBuilder(); + } + + /** + * Creates a new instance of the `GetStakingProductsReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetStakingProductsReq { + let obj = new GetStakingProductsReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetStakingProductsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStakingProductsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStakingProductsReq { + return plainToInstance(GetStakingProductsReq, jsonObject); + } +} + +export class GetStakingProductsReqBuilder { + obj: GetStakingProductsReq = new GetStakingProductsReq(); + /** + * currency + */ + setCurrency(value: string): GetStakingProductsReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetStakingProductsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts new file mode 100644 index 00000000..5b0191bc --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetStakingProductsData } from './model_get_staking_products_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetStakingProductsResp implements Response { + /** + * + */ + @Type(() => GetStakingProductsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetStakingProductsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStakingProductsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetStakingProductsResp { + return plainToInstance(GetStakingProductsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_purchase_req.ts b/sdk/node/src/generate/earn/earn/model_purchase_req.ts new file mode 100644 index 00000000..30fb7c37 --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_purchase_req.ts @@ -0,0 +1,107 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class PurchaseReq implements Serializable { + /** + * Product Id + */ + productId?: string; + /** + * Subscription amount + */ + amount?: string; + /** + * MAIN (funding account), TRADE (spot trading account) + */ + accountType?: PurchaseReq.AccountTypeEnum; + + /** + * Creates a new instance of the `PurchaseReq` class. + * The builder pattern allows step-by-step construction of a `PurchaseReq` object. + */ + static builder(): PurchaseReqBuilder { + return new PurchaseReqBuilder(); + } + + /** + * Creates a new instance of the `PurchaseReq` class with the given data. + */ + static create(data: { + /** + * Product Id + */ + productId?: string; + /** + * Subscription amount + */ + amount?: string; + /** + * MAIN (funding account), TRADE (spot trading account) + */ + accountType?: PurchaseReq.AccountTypeEnum; + }): PurchaseReq { + let obj = new PurchaseReq(); + obj.productId = data.productId; + obj.amount = data.amount; + obj.accountType = data.accountType; + return obj; + } + + fromJson(input: string): PurchaseReq { + const jsonObject = JSON.parse(input); + return plainToInstance(PurchaseReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): PurchaseReq { + return plainToInstance(PurchaseReq, jsonObject); + } +} + +export namespace PurchaseReq { + export enum AccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class PurchaseReqBuilder { + obj: PurchaseReq = new PurchaseReq(); + /** + * Product Id + */ + setProductId(value: string): PurchaseReqBuilder { + this.obj.productId = value; + return this; + } + + /** + * Subscription amount + */ + setAmount(value: string): PurchaseReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * MAIN (funding account), TRADE (spot trading account) + */ + setAccountType(value: PurchaseReq.AccountTypeEnum): PurchaseReqBuilder { + this.obj.accountType = value; + return this; + } + + build(): PurchaseReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts new file mode 100644 index 00000000..3dac2b7e --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class PurchaseResp implements Response { + /** + * Holding ID + */ + orderId?: string; + /** + * Subscription order ID + */ + orderTxId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): PurchaseResp { + const jsonObject = JSON.parse(input); + return plainToInstance(PurchaseResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): PurchaseResp { + return plainToInstance(PurchaseResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/earn/earn/model_redeem_req.ts b/sdk/node/src/generate/earn/earn/model_redeem_req.ts new file mode 100644 index 00000000..99c4bbdd --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_redeem_req.ts @@ -0,0 +1,124 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class RedeemReq implements Serializable { + /** + * Holding ID + */ + orderId?: string; + /** + * Redemption amount + */ + amount?: string; + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + fromAccountType?: RedeemReq.FromAccountTypeEnum; + /** + * Confirmation field for early redemption penalty: 1 (confirm early redemption, and the current holding will be fully redeemed). This parameter is valid only for fixed-term products + */ + confirmPunishRedeem?: string; + + /** + * Creates a new instance of the `RedeemReq` class. + * The builder pattern allows step-by-step construction of a `RedeemReq` object. + */ + static builder(): RedeemReqBuilder { + return new RedeemReqBuilder(); + } + + /** + * Creates a new instance of the `RedeemReq` class with the given data. + */ + static create(data: { + /** + * Holding ID + */ + orderId?: string; + /** + * Redemption amount + */ + amount?: string; + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + fromAccountType?: RedeemReq.FromAccountTypeEnum; + /** + * Confirmation field for early redemption penalty: 1 (confirm early redemption, and the current holding will be fully redeemed). This parameter is valid only for fixed-term products + */ + confirmPunishRedeem?: string; + }): RedeemReq { + let obj = new RedeemReq(); + obj.orderId = data.orderId; + obj.amount = data.amount; + obj.fromAccountType = data.fromAccountType; + obj.confirmPunishRedeem = data.confirmPunishRedeem; + return obj; + } + + fromJson(input: string): RedeemReq { + const jsonObject = JSON.parse(input); + return plainToInstance(RedeemReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RedeemReq { + return plainToInstance(RedeemReq, jsonObject); + } +} + +export namespace RedeemReq { + export enum FromAccountTypeEnum { + /** + * + */ + MAIN = 'MAIN', + /** + * + */ + TRADE = 'TRADE', + } +} + +export class RedeemReqBuilder { + obj: RedeemReq = new RedeemReq(); + /** + * Holding ID + */ + setOrderId(value: string): RedeemReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * Redemption amount + */ + setAmount(value: string): RedeemReqBuilder { + this.obj.amount = value; + return this; + } + + /** + * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 + */ + setFromAccountType(value: RedeemReq.FromAccountTypeEnum): RedeemReqBuilder { + this.obj.fromAccountType = value; + return this; + } + + /** + * Confirmation field for early redemption penalty: 1 (confirm early redemption, and the current holding will be fully redeemed). This parameter is valid only for fixed-term products + */ + setConfirmPunishRedeem(value: string): RedeemReqBuilder { + this.obj.confirmPunishRedeem = value; + return this; + } + + build(): RedeemReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts new file mode 100644 index 00000000..cb8dfeac --- /dev/null +++ b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts @@ -0,0 +1,58 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class RedeemResp implements Response { + /** + * Redemption order ID + */ + orderTxId?: string; + /** + * Expected deliver time (milliseconds) + */ + deliverTime?: number; + /** + * Redemption status: SUCCESS (successful), PENDING (redemption pending) + */ + status?: RedeemResp.StatusEnum; + /** + * Redemption amount + */ + amount?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): RedeemResp { + const jsonObject = JSON.parse(input); + return plainToInstance(RedeemResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RedeemResp { + return plainToInstance(RedeemResp, jsonObject); + } +} + +export namespace RedeemResp { + export enum StatusEnum { + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + PENDING = 'PENDING', + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts new file mode 100644 index 00000000..05aa8c65 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -0,0 +1,104 @@ +import { GetPublicFundingHistoryReq } from './model_get_public_funding_history_req'; +import { GetPrivateFundingHistoryResp } from './model_get_private_funding_history_resp'; +import { GetPublicFundingHistoryResp } from './model_get_public_funding_history_resp'; +import { GetCurrentFundingRateResp } from './model_get_current_funding_rate_resp'; +import { GetPrivateFundingHistoryReq } from './model_get_private_funding_history_req'; +import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getPublicFundingHistory request test', () => { + /** + * getPublicFundingHistory + * Get Public Funding History + * /api/v1/contract/funding-rates + */ + let data = '{"symbol": "XBTUSDTM", "from": 1700310700000, "to": 1702310700000}'; + let req = new GetPublicFundingHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPublicFundingHistory response test', () => { + /** + * getPublicFundingHistory + * Get Public Funding History + * /api/v1/contract/funding-rates + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.1E-4,\n "timepoint": 1702296000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.47E-4,\n "timepoint": 1702267200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.52E-4,\n "timepoint": 1702238400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.13E-4,\n "timepoint": 1702209600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.21E-4,\n "timepoint": 1702180800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.06E-4,\n "timepoint": 1702152000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.68E-4,\n "timepoint": 1702123200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.82E-4,\n "timepoint": 1702094400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.0E-4,\n "timepoint": 1702065600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.46E-4,\n "timepoint": 1702036800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.97E-4,\n "timepoint": 1702008000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.76E-4,\n "timepoint": 1701979200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.22E-4,\n "timepoint": 1701950400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.92E-4,\n "timepoint": 1701921600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.1E-4,\n "timepoint": 1701892800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.48E-4,\n "timepoint": 1701864000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.68E-4,\n "timepoint": 1701835200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.51E-4,\n "timepoint": 1701806400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.44E-4,\n "timepoint": 1701777600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.25E-4,\n "timepoint": 1701748800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": -8.2E-5,\n "timepoint": 1701720000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.64E-4,\n "timepoint": 1701691200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.14E-4,\n "timepoint": 1701662400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.44E-4,\n "timepoint": 1701633600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.99E-4,\n "timepoint": 1701604800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.79E-4,\n "timepoint": 1701576000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 8.7E-5,\n "timepoint": 1701547200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.6E-5,\n "timepoint": 1701518400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": -3.7E-5,\n "timepoint": 1701489600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.5E-5,\n "timepoint": 1701460800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.8E-5,\n "timepoint": 1701432000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.2E-5,\n "timepoint": 1701403200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.45E-4,\n "timepoint": 1701374400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.41E-4,\n "timepoint": 1701345600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 9.4E-5,\n "timepoint": 1701316800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.08E-4,\n "timepoint": 1701288000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.6E-5,\n "timepoint": 1701259200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.0E-5,\n "timepoint": 1701230400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.0E-5,\n "timepoint": 1701201600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.16E-4,\n "timepoint": 1701172800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.04E-4,\n "timepoint": 1701144000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.3E-4,\n "timepoint": 1701115200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.2E-5,\n "timepoint": 1701086400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.33E-4,\n "timepoint": 1701057600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 8.0E-5,\n "timepoint": 1701028800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.11E-4,\n "timepoint": 1701000000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.4E-5,\n "timepoint": 1700971200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.01E-4,\n "timepoint": 1700942400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.9E-5,\n "timepoint": 1700913600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.1E-5,\n "timepoint": 1700884800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.0E-6,\n "timepoint": 1700856000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.03E-4,\n "timepoint": 1700827200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.0E-6,\n "timepoint": 1700798400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.7E-5,\n "timepoint": 1700769600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.47E-4,\n "timepoint": 1700740800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.8E-5,\n "timepoint": 1700712000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.39E-4,\n "timepoint": 1700683200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.5E-5,\n "timepoint": 1700654400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.11E-4,\n "timepoint": 1700625600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 9.8E-5,\n "timepoint": 1700596800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.18E-4,\n "timepoint": 1700568000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.16E-4,\n "timepoint": 1700539200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.6E-4,\n "timepoint": 1700510400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.92E-4,\n "timepoint": 1700481600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.13E-4,\n "timepoint": 1700452800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.47E-4,\n "timepoint": 1700424000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.3E-4,\n "timepoint": 1700395200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.63E-4,\n "timepoint": 1700366400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.32E-4,\n "timepoint": 1700337600000\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPublicFundingHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPrivateFundingHistory request test', () => { + /** + * getPrivateFundingHistory + * Get Private Funding History + * /api/v1/funding-history + */ + let data = + '{"symbol": "XBTUSDTM", "from": 1700310700000, "to": 1702310700000, "reverse": true, "offset": 123456, "forward": true, "maxCount": 123456}'; + let req = new GetPrivateFundingHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPrivateFundingHistory response test', () => { + /** + * getPrivateFundingHistory + * Get Private Funding History + * /api/v1/funding-history + */ + let data = + '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "id": 1472387374042586,\n "symbol": "XBTUSDTM",\n "timePoint": 1731470400000,\n "fundingRate": 6.41E-4,\n "markPrice": 87139.92,\n "positionQty": 1,\n "positionCost": 87.13992,\n "funding": -0.05585669,\n "settleCurrency": "USDT",\n "context": "{\\"marginMode\\": \\"ISOLATED\\", \\"positionSide\\": \\"BOTH\\"}",\n "marginMode": "ISOLATED"\n }\n ],\n "hasMore": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPrivateFundingHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getCurrentFundingRate request test', () => { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetCurrentFundingRateReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCurrentFundingRate response test', () => { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": ".XBTUSDTMFPI8H",\n "granularity": 28800000,\n "timePoint": 1731441600000,\n "value": 6.41E-4,\n "predictedValue": 5.2E-5,\n "fundingRateCap": 0.003,\n "fundingRateFloor": -0.003\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCurrentFundingRateResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts new file mode 100644 index 00000000..206d0455 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts @@ -0,0 +1,103 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetPublicFundingHistoryReq } from './model_get_public_funding_history_req'; +import { GetPrivateFundingHistoryResp } from './model_get_private_funding_history_resp'; +import { GetPublicFundingHistoryResp } from './model_get_public_funding_history_resp'; +import { GetCurrentFundingRateResp } from './model_get_current_funding_rate_resp'; +import { GetPrivateFundingHistoryReq } from './model_get_private_funding_history_req'; +import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; + +export interface FundingFeesAPI { + /** + * getPublicFundingHistory Get Public Funding History + * Description: Query the funding rate at each settlement time point within a certain time range of the corresponding contract + * Documentation: https://www.kucoin.com/docs-new/api-3470266 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise; + + /** + * getPrivateFundingHistory Get Private Funding History + * Description: Submit request to get the funding history. + * Documentation: https://www.kucoin.com/docs-new/api-3470267 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getPrivateFundingHistory( + req: GetPrivateFundingHistoryReq, + ): Promise; + + /** + * getCurrentFundingRate Get Current Funding Rate + * Description: get Current Funding Rate + * Documentation: https://www.kucoin.com/docs-new/api-3470265 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; +} + +export class FundingFeesAPIImpl implements FundingFeesAPI { + constructor(private transport: Transport) {} + + getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/contract/funding-rates', + req, + new GetPublicFundingHistoryResp(), + false, + ); + } + + getPrivateFundingHistory( + req: GetPrivateFundingHistoryReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/funding-history', + req, + new GetPrivateFundingHistoryResp(), + false, + ); + } + + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/funding-rate/{symbol}/current', + req, + new GetCurrentFundingRateResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts new file mode 100644 index 00000000..0684a869 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCurrentFundingRateReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetCurrentFundingRateReq` class. + * The builder pattern allows step-by-step construction of a `GetCurrentFundingRateReq` object. + */ + static builder(): GetCurrentFundingRateReqBuilder { + return new GetCurrentFundingRateReqBuilder(); + } + + /** + * Creates a new instance of the `GetCurrentFundingRateReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetCurrentFundingRateReq { + let obj = new GetCurrentFundingRateReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetCurrentFundingRateReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCurrentFundingRateReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCurrentFundingRateReq { + return plainToInstance(GetCurrentFundingRateReq, jsonObject); + } +} + +export class GetCurrentFundingRateReqBuilder { + obj: GetCurrentFundingRateReq = new GetCurrentFundingRateReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetCurrentFundingRateReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetCurrentFundingRateReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts new file mode 100644 index 00000000..87180a2a --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetCurrentFundingRateResp + implements Response +{ + /** + * Funding Rate Symbol + */ + symbol?: string; + /** + * Granularity (milisecond) + */ + granularity?: number; + /** + * The funding rate settlement time point of the previous cycle (milisecond) + */ + timePoint?: number; + /** + * Current cycle funding rate + */ + value?: number; + /** + * Predicted funding rate + */ + predictedValue?: number; + /** + * Maximum Funding Rate + */ + fundingRateCap?: number; + /** + * Minimum Funding Rate + */ + fundingRateFloor?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetCurrentFundingRateResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCurrentFundingRateResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCurrentFundingRateResp { + return plainToInstance(GetCurrentFundingRateResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts new file mode 100644 index 00000000..b0811281 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPrivateFundingHistoryDataList + implements Serializable +{ + /** + * id + */ + id?: number; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Time point (milisecond) + */ + timePoint?: number; + /** + * Funding rate + */ + fundingRate?: number; + /** + * Mark price + */ + markPrice?: number; + /** + * Position size + */ + positionQty?: number; + /** + * Position value at settlement period + */ + positionCost?: number; + /** + * Settled funding fees. A positive number means that the user received the funding fee, and vice versa. + */ + funding?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * context + */ + context?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetPrivateFundingHistoryDataList.MarginModeEnum; + fromJson(input: string): GetPrivateFundingHistoryDataList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateFundingHistoryDataList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateFundingHistoryDataList { + return plainToInstance(GetPrivateFundingHistoryDataList, jsonObject); + } +} + +export namespace GetPrivateFundingHistoryDataList { + export enum MarginModeEnum { + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + /** + * cross margin + */ + CROSS = 'CROSS', + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts new file mode 100644 index 00000000..1d12ef13 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPrivateFundingHistoryReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Begin time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + reverse?: boolean; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Max record count. The default record count is 10 + */ + maxCount?: number; + + /** + * Creates a new instance of the `GetPrivateFundingHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetPrivateFundingHistoryReq` object. + */ + static builder(): GetPrivateFundingHistoryReqBuilder { + return new GetPrivateFundingHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetPrivateFundingHistoryReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Begin time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + reverse?: boolean; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Max record count. The default record count is 10 + */ + maxCount?: number; + }): GetPrivateFundingHistoryReq { + let obj = new GetPrivateFundingHistoryReq(); + obj.symbol = data.symbol; + obj.from = data.from; + obj.to = data.to; + obj.reverse = data.reverse; + obj.offset = data.offset; + obj.forward = data.forward; + obj.maxCount = data.maxCount; + return obj; + } + + fromJson(input: string): GetPrivateFundingHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateFundingHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateFundingHistoryReq { + return plainToInstance(GetPrivateFundingHistoryReq, jsonObject); + } +} + +export class GetPrivateFundingHistoryReqBuilder { + obj: GetPrivateFundingHistoryReq = new GetPrivateFundingHistoryReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPrivateFundingHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Begin time (milisecond) + */ + setFrom(value: number): GetPrivateFundingHistoryReqBuilder { + this.obj.from = value; + return this; + } + + /** + * End time (milisecond) + */ + setTo(value: number): GetPrivateFundingHistoryReqBuilder { + this.obj.to = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setReverse(value: boolean): GetPrivateFundingHistoryReqBuilder { + this.obj.reverse = value; + return this; + } + + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + setOffset(value: number): GetPrivateFundingHistoryReqBuilder { + this.obj.offset = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setForward(value: boolean): GetPrivateFundingHistoryReqBuilder { + this.obj.forward = value; + return this; + } + + /** + * Max record count. The default record count is 10 + */ + setMaxCount(value: number): GetPrivateFundingHistoryReqBuilder { + this.obj.maxCount = value; + return this; + } + + build(): GetPrivateFundingHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts new file mode 100644 index 00000000..cdf61bbd --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPrivateFundingHistoryDataList } from './model_get_private_funding_history_data_list'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPrivateFundingHistoryResp + implements Response +{ + /** + * + */ + @Type(() => GetPrivateFundingHistoryDataList) + dataList?: Array; + /** + * Whether there are more pages + */ + hasMore?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPrivateFundingHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateFundingHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateFundingHistoryResp { + return plainToInstance(GetPrivateFundingHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts new file mode 100644 index 00000000..fe179d1d --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts @@ -0,0 +1,30 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPublicFundingHistoryData implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Funding rate + */ + fundingRate?: number; + /** + * Time point (milisecond) + */ + timepoint?: number; + fromJson(input: string): GetPublicFundingHistoryData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicFundingHistoryData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicFundingHistoryData { + return plainToInstance(GetPublicFundingHistoryData, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts new file mode 100644 index 00000000..6fe2eac2 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPublicFundingHistoryReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Begin time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + + /** + * Creates a new instance of the `GetPublicFundingHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetPublicFundingHistoryReq` object. + */ + static builder(): GetPublicFundingHistoryReqBuilder { + return new GetPublicFundingHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetPublicFundingHistoryReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Begin time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + }): GetPublicFundingHistoryReq { + let obj = new GetPublicFundingHistoryReq(); + obj.symbol = data.symbol; + obj.from = data.from; + obj.to = data.to; + return obj; + } + + fromJson(input: string): GetPublicFundingHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicFundingHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicFundingHistoryReq { + return plainToInstance(GetPublicFundingHistoryReq, jsonObject); + } +} + +export class GetPublicFundingHistoryReqBuilder { + obj: GetPublicFundingHistoryReq = new GetPublicFundingHistoryReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPublicFundingHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Begin time (milisecond) + */ + setFrom(value: number): GetPublicFundingHistoryReqBuilder { + this.obj.from = value; + return this; + } + + /** + * End time (milisecond) + */ + setTo(value: number): GetPublicFundingHistoryReqBuilder { + this.obj.to = value; + return this; + } + + build(): GetPublicFundingHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts new file mode 100644 index 00000000..d8c2909b --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetPublicFundingHistoryData } from './model_get_public_funding_history_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPublicFundingHistoryResp + implements Response +{ + /** + * + */ + @Type(() => GetPublicFundingHistoryData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPublicFundingHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicFundingHistoryResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetPublicFundingHistoryResp { + return plainToInstance(GetPublicFundingHistoryResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts b/sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts b/sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts new file mode 100644 index 00000000..818f28f0 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts @@ -0,0 +1,202 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { MarginModeEventCallbackWrapper, MarginModeEventCallback } from './model_margin_mode_event'; +import { BalanceEventCallbackWrapper, BalanceEventCallback } from './model_balance_event'; +import { PositionEventCallbackWrapper, PositionEventCallback } from './model_position_event'; +import { StopOrdersEventCallback, StopOrdersEventCallbackWrapper } from './model_stop_orders_event'; +import { + CrossLeverageEventCallback, + CrossLeverageEventCallbackWrapper, +} from './model_cross_leverage_event'; +import { + AllPositionEventCallback, + AllPositionEventCallbackWrapper, +} from './model_all_position_event'; +import { OrderEventCallbackWrapper, OrderEventCallback } from './model_order_event'; +import { AllOrderEventCallback, AllOrderEventCallbackWrapper } from './model_all_order_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface FuturesPrivateWS { + /** + * allOrder All Order change pushes. + * Push order changes for all symbol + * push frequency: realtime + */ + allOrder(callback: AllOrderEventCallback): Promise; + + /** + * allPosition All symbol position change events push + * Subscribe this topic to get the realtime push of position change event of all symbol + * push frequency: realtime + */ + allPosition(callback: AllPositionEventCallback): Promise; + + /** + * balance the balance change push + * Subscribe this topic to get the realtime push of balance change + * push frequency: realtime + */ + balance(callback: BalanceEventCallback): Promise; + + /** + * crossLeverage the leverage change push + * Subscribe this topic to get the realtime push of leverage change of contracts that are in cross margin mode + * push frequency: realtime + */ + crossLeverage(callback: CrossLeverageEventCallback): Promise; + + /** + * marginMode the margin mode change + * Subscribe this topic to get the realtime push of margin mode change event of a symbol + * push frequency: realtime + */ + marginMode(callback: MarginModeEventCallback): Promise; + + /** + * order Order change pushes. + * Push order changes for the specified symbol + * push frequency: realtime + */ + order(symbol: string, callback: OrderEventCallback): Promise; + + /** + * position the position change events push + * Subscribe this topic to get the realtime push of position change event of a symbol + * push frequency: realtime + */ + position(symbol: string, callback: PositionEventCallback): Promise; + + /** + * stopOrders stop order change pushes. + * Subscribe this topic to get the realtime push of stop order changes. + * push frequency: realtime + */ + stopOrders(callback: StopOrdersEventCallback): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class FuturesPrivateWSImpl implements FuturesPrivateWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + allOrder(callback: AllOrderEventCallback): Promise { + let topicPrefix = '/contractMarket/tradeOrders'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new AllOrderEventCallbackWrapper(callback), + ); + } + + allPosition(callback: AllPositionEventCallback): Promise { + let topicPrefix = '/contract/positionAll'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new AllPositionEventCallbackWrapper(callback), + ); + } + + balance(callback: BalanceEventCallback): Promise { + let topicPrefix = '/contractAccount/wallet'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new BalanceEventCallbackWrapper(callback), + ); + } + + crossLeverage(callback: CrossLeverageEventCallback): Promise { + let topicPrefix = '/contract/crossLeverage'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new CrossLeverageEventCallbackWrapper(callback), + ); + } + + marginMode(callback: MarginModeEventCallback): Promise { + let topicPrefix = '/contract/marginMode'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new MarginModeEventCallbackWrapper(callback), + ); + } + + order(symbol: string, callback: OrderEventCallback): Promise { + let topicPrefix = '/contractMarket/tradeOrders'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe(topicPrefix, args, new OrderEventCallbackWrapper(callback)); + } + + position(symbol: string, callback: PositionEventCallback): Promise { + let topicPrefix = '/contract/position'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new PositionEventCallbackWrapper(callback), + ); + } + + stopOrders(callback: StopOrdersEventCallback): Promise { + let topicPrefix = '/contractMarket/advancedOrders'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new StopOrdersEventCallbackWrapper(callback), + ); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts new file mode 100644 index 00000000..604e4aa0 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -0,0 +1,232 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class AllOrderEvent implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * User-specified order type + */ + orderType?: AllOrderEvent.OrderTypeEnum; + /** + * buy or sell + */ + side?: AllOrderEvent.SideEnum; + /** + * Cumulative number of cancellations + */ + canceledSize?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Margin Mode + */ + marginMode?: AllOrderEvent.MarginModeEnum; + /** + * Order Type + */ + type?: AllOrderEvent.TypeEnum; + /** + * Order time(Nanosecond) + */ + orderTime?: number; + /** + * User-specified order size + */ + size?: string; + /** + * Cumulative number of filled + */ + filledSize?: string; + /** + * Price + */ + price?: string; + /** + * Remain size + */ + remainSize?: string; + /** + * Order Status + */ + status?: AllOrderEvent.StatusEnum; + /** + * Push time(Nanosecond) + */ + ts?: number; + /** + * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** + */ + liquidity?: AllOrderEvent.LiquidityEnum; + /** + * Actual Fee Type + */ + feeType?: AllOrderEvent.FeeTypeEnum; + /** + * Match Price(when the type is \"match\") + */ + matchPrice?: string; + /** + * Match Size (when the type is \"match\") + */ + matchSize?: string; + /** + * Trade id, it is generated by Matching engine. + */ + tradeId?: string; + /** + * The size before order update + */ + oldSize?: string; + /** + * Client Order Id,The ClientOid field is a unique ID created by the user + */ + clientOid?: string; + /** + * normal order or liquid order + */ + tradeType?: AllOrderEvent.TradeTypeEnum; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): AllOrderEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(AllOrderEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AllOrderEvent { + return plainToInstance(AllOrderEvent, jsonObject); + } +} + +export namespace AllOrderEvent { + export enum OrderTypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum TypeEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * the message sent when the order is match, 1. When the status is open and the type is match, it is a maker match. 2. When the status is match and the type is match, it is a taker match. + */ + MATCH = 'match', + /** + * The message sent due to the order being modified: STP triggering, partial cancellation of the order. Includes these three situations: 1. When the status is open and the type is update: partial amounts of the order have been canceled, or STP triggers 2. When the status is match and the type is update: STP triggers 3. When the status is done and the type is update: partial amounts of the order have been filled and the unfilled part got canceled, or STP is triggered. + */ + UPDATE = 'update', + /** + * The message sent when the status of the order changes to DONE after the transaction + */ + FILLED = 'filled', + /** + * The message sent when the status of the order changes to DONE due to being canceled + */ + CANCELED = 'canceled', + } + export enum StatusEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * when taker order executes with orders in the order book, the taker order status is “match” + */ + MATCH = 'match', + /** + * the order is fully executed successfully + */ + DONE = 'done', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } + export enum FeeTypeEnum { + /** + * takerFee + */ + TAKERFEE = 'takerFee', + /** + * makerFee + */ + MAKERFEE = 'makerFee', + } + export enum TradeTypeEnum { + /** + * Normal trade order + */ + TRADE = 'trade', + /** + * Liquid order, except type=update, all other types will be pushed + */ + LIQUID = 'liquid', + } +} + +export type AllOrderEventCallback = (topic: string, subject: string, data: AllOrderEvent) => void; + +export class AllOrderEventCallbackWrapper implements WebSocketMessageCallback { + callback: AllOrderEventCallback; + + constructor(callback: AllOrderEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new AllOrderEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts new file mode 100644 index 00000000..55ea31a4 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -0,0 +1,252 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class AllPositionEvent implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * Whether it is cross margin. + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: number; + /** + * Current commission + */ + currentComm?: number; + /** + * Unrealised value + */ + unrealisedCost?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: number; + /** + * Current realised position value + */ + realisedCost?: number; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: number; + /** + * Mark Value + */ + markValue?: number; + /** + * Position value + */ + posCost?: number; + /** + * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction + */ + posInit?: number; + /** + * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) + */ + posMargin?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: number; + /** + * Realised profit and loss + */ + realisedPnl?: number; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: number; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: number; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: number; + /** + * Average entry price + */ + avgEntryPrice?: number; + /** + * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. + */ + liquidationPrice?: number; + /** + * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. + */ + bankruptPrice?: number; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Margin Mode: CROSS,ISOLATED + */ + marginMode?: AllPositionEvent.MarginModeEnum; + /** + * Position Side + */ + positionSide?: AllPositionEvent.PositionSideEnum; + /** + * Leverage + */ + leverage?: number; + /** + * Auto deposit margin or not **Only applicable to Isolated Margin** + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement **Only applicable to Isolated Margin** + */ + maintMarginReq?: number; + /** + * Risk limit **Only applicable to Isolated Margin** + */ + riskLimit?: number; + /** + * Leverage of the order **Only applicable to Isolated Margin** + */ + realLeverage?: number; + /** + * added margin **Only applicable to Isolated Margin** + */ + posCross?: number; + /** + * Bankruptcy cost **Only applicable to Isolated Margin** + */ + posComm?: number; + /** + * Funding fees paid out **Only applicable to Isolated Margin** + */ + posLoss?: number; + /** + * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** + */ + posFunding?: number; + /** + * Maintenance margin **Only applicable to Isolated Margin** + */ + posMaint?: number; + /** + * Position margin **Only applicable to Isolated Margin** + */ + maintMargin?: number; + /** + * Funding time + */ + fundingTime?: number; + /** + * Position size + */ + qty?: number; + /** + * Funding rate + */ + fundingRate?: number; + /** + * Funding fees + */ + fundingFee?: number; + /** + * Funding Fee Settlement Time (nanosecond) + */ + ts?: number; + /** + * Adjustment isolated margin risk limit level successful or not + */ + success?: boolean; + /** + * Adjustment isolated margin risk limit level failure reason + */ + msg?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): AllPositionEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(AllPositionEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AllPositionEvent { + return plainToInstance(AllPositionEvent, jsonObject); + } +} + +export namespace AllPositionEvent { + export enum MarginModeEnum { + /** + * cross margin + */ + CROSS = 'CROSS', + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum PositionSideEnum { + /** + * One-way position + */ + BOTH = 'BOTH', + } +} + +export type AllPositionEventCallback = ( + topic: string, + subject: string, + data: AllPositionEvent, +) => void; + +export class AllPositionEventCallbackWrapper implements WebSocketMessageCallback { + callback: AllPositionEventCallback; + + constructor(callback: AllPositionEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new AllPositionEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts new file mode 100644 index 00000000..0ce90a78 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -0,0 +1,105 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class BalanceEvent implements Response { + /** + * Margin of the cross margin position + */ + crossPosMargin?: string; + /** + * Margin of the isolated margin order + */ + isolatedOrderMargin?: string; + /** + * Frozen Balance + */ + holdBalance?: string; + /** + * Equity + */ + equity?: string; + /** + * Version. When holding a cross margin position, the available balance may change with fluctuations in the mark price, leading to discrepancies in the available balance for the same version number. + */ + version?: string; + /** + * Available Balance + */ + availableBalance?: string; + /** + * Margin of the isolated margin position, including isolated margin funding fees + */ + isolatedPosMargin?: string; + /** + * Wallet Balance + */ + walletBalance?: string; + /** + * Isolated margin funding fee + */ + isolatedFundingFeeMargin?: string; + /** + * Unrealized PNL in cross margin mode + */ + crossUnPnl?: string; + /** + * Total margin under cross margin mode + */ + totalCrossMargin?: string; + /** + * Currency Symbol + */ + currency?: string; + /** + * Unrealized PNL in isolated margin mode + */ + isolatedUnPnl?: string; + /** + * Margin of the cross margin order + */ + crossOrderMargin?: string; + /** + * Last modified time + */ + timestamp?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): BalanceEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(BalanceEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): BalanceEvent { + return plainToInstance(BalanceEvent, jsonObject); + } +} + +export type BalanceEventCallback = (topic: string, subject: string, data: BalanceEvent) => void; + +export class BalanceEventCallbackWrapper implements WebSocketMessageCallback { + callback: BalanceEventCallback; + + constructor(callback: BalanceEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new BalanceEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts new file mode 100644 index 00000000..c51e3135 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -0,0 +1,24 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CrossLeverageDataValue implements Serializable { + /** + * + */ + leverage?: string; + + fromJson(input: string): CrossLeverageDataValue { + const jsonObject = JSON.parse(input); + return plainToInstance(CrossLeverageDataValue, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): CrossLeverageDataValue { + return plainToInstance(CrossLeverageDataValue, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts new file mode 100644 index 00000000..361603ad --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -0,0 +1,55 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { CrossLeverageDataValue } from './model_cross_leverage_data_value'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class CrossLeverageEvent implements Response { + /** + * + */ + data?: { [key: string]: CrossLeverageDataValue }; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): CrossLeverageEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(CrossLeverageEvent, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): CrossLeverageEvent { + return plainToInstance(CrossLeverageEvent, { data: jsonObject }); + } +} + +export type CrossLeverageEventCallback = ( + topic: string, + subject: string, + data: CrossLeverageEvent, +) => void; + +export class CrossLeverageEventCallbackWrapper implements WebSocketMessageCallback { + callback: CrossLeverageEventCallback; + + constructor(callback: CrossLeverageEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new CrossLeverageEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts new file mode 100644 index 00000000..de22f36d --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -0,0 +1,53 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class MarginModeEvent implements Response { + /** + * The SYMBOL is the key with value \"CROSS\" or \"ISOLATED\" + */ + SYMBOL?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): MarginModeEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(MarginModeEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarginModeEvent { + return plainToInstance(MarginModeEvent, jsonObject); + } +} + +export type MarginModeEventCallback = ( + topic: string, + subject: string, + data: MarginModeEvent, +) => void; + +export class MarginModeEventCallbackWrapper implements WebSocketMessageCallback { + callback: MarginModeEventCallback; + + constructor(callback: MarginModeEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new MarginModeEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts new file mode 100644 index 00000000..d4def339 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -0,0 +1,232 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderEvent implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * User-specified order type + */ + orderType?: OrderEvent.OrderTypeEnum; + /** + * buy or sell + */ + side?: OrderEvent.SideEnum; + /** + * Cumulative number of cancellations + */ + canceledSize?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Margin Mode + */ + marginMode?: OrderEvent.MarginModeEnum; + /** + * Order Type + */ + type?: OrderEvent.TypeEnum; + /** + * Order time(Nanosecond) + */ + orderTime?: number; + /** + * User-specified order size + */ + size?: string; + /** + * Cumulative number of filled + */ + filledSize?: string; + /** + * Price + */ + price?: string; + /** + * Remain size + */ + remainSize?: string; + /** + * Order Status + */ + status?: OrderEvent.StatusEnum; + /** + * Push time(Nanosecond) + */ + ts?: number; + /** + * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** + */ + liquidity?: OrderEvent.LiquidityEnum; + /** + * Actual Fee Type + */ + feeType?: OrderEvent.FeeTypeEnum; + /** + * Match Price(when the type is \"match\") + */ + matchPrice?: string; + /** + * Match Size (when the type is \"match\") + */ + matchSize?: string; + /** + * Trade id, it is generated by Matching engine. + */ + tradeId?: string; + /** + * The size before order update + */ + oldSize?: string; + /** + * Client Order Id,The ClientOid field is a unique ID created by the user + */ + clientOid?: string; + /** + * normal order or liquid order + */ + tradeType?: OrderEvent.TradeTypeEnum; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderEvent { + return plainToInstance(OrderEvent, jsonObject); + } +} + +export namespace OrderEvent { + export enum OrderTypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum TypeEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * the message sent when the order is match, 1. When the status is open and the type is match, it is a maker match. 2. When the status is match and the type is match, it is a taker match. + */ + MATCH = 'match', + /** + * The message sent due to the order being modified: STP triggering, partial cancellation of the order. Includes these three situations: 1. When the status is open and the type is update: partial amounts of the order have been canceled, or STP triggers 2. When the status is match and the type is update: STP triggers 3. When the status is done and the type is update: partial amounts of the order have been filled and the unfilled part got canceled, or STP is triggered. + */ + UPDATE = 'update', + /** + * The message sent when the status of the order changes to DONE after the transaction + */ + FILLED = 'filled', + /** + * The message sent when the status of the order changes to DONE due to being canceled + */ + CANCELED = 'canceled', + } + export enum StatusEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * when taker order executes with orders in the order book, the taker order status is “match” + */ + MATCH = 'match', + /** + * the order is fully executed successfully + */ + DONE = 'done', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } + export enum FeeTypeEnum { + /** + * takerFee + */ + TAKERFEE = 'takerFee', + /** + * makerFee + */ + MAKERFEE = 'makerFee', + } + export enum TradeTypeEnum { + /** + * Normal trade order + */ + TRADE = 'trade', + /** + * Liquid order, except type=update, all other types will be pushed + */ + LIQUID = 'liquid', + } +} + +export type OrderEventCallback = (topic: string, subject: string, data: OrderEvent) => void; + +export class OrderEventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderEventCallback; + + constructor(callback: OrderEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts new file mode 100644 index 00000000..4abf6624 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -0,0 +1,248 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class PositionEvent implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * Whether it is cross margin. + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: number; + /** + * Current commission + */ + currentComm?: number; + /** + * Unrealised value + */ + unrealisedCost?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: number; + /** + * Current realised position value + */ + realisedCost?: number; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: number; + /** + * Mark Value + */ + markValue?: number; + /** + * Position value + */ + posCost?: number; + /** + * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction + */ + posInit?: number; + /** + * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) + */ + posMargin?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: number; + /** + * Realised profit and loss + */ + realisedPnl?: number; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: number; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: number; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: number; + /** + * Average entry price + */ + avgEntryPrice?: number; + /** + * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. + */ + liquidationPrice?: number; + /** + * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. + */ + bankruptPrice?: number; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Margin Mode: CROSS,ISOLATED + */ + marginMode?: PositionEvent.MarginModeEnum; + /** + * Position Side + */ + positionSide?: PositionEvent.PositionSideEnum; + /** + * Leverage + */ + leverage?: number; + /** + * Auto deposit margin or not **Only applicable to Isolated Margin** + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement **Only applicable to Isolated Margin** + */ + maintMarginReq?: number; + /** + * Risk limit **Only applicable to Isolated Margin** + */ + riskLimit?: number; + /** + * Leverage of the order **Only applicable to Isolated Margin** + */ + realLeverage?: number; + /** + * added margin **Only applicable to Isolated Margin** + */ + posCross?: number; + /** + * Bankruptcy cost **Only applicable to Isolated Margin** + */ + posComm?: number; + /** + * Funding fees paid out **Only applicable to Isolated Margin** + */ + posLoss?: number; + /** + * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** + */ + posFunding?: number; + /** + * Maintenance margin **Only applicable to Isolated Margin** + */ + posMaint?: number; + /** + * Position margin **Only applicable to Isolated Margin** + */ + maintMargin?: number; + /** + * Funding time + */ + fundingTime?: number; + /** + * Position size + */ + qty?: number; + /** + * Funding rate + */ + fundingRate?: number; + /** + * Funding fees + */ + fundingFee?: number; + /** + * Funding Fee Settlement Time (nanosecond) + */ + ts?: number; + /** + * Adjustment isolated margin risk limit level successful or not + */ + success?: boolean; + /** + * Adjustment isolated margin risk limit level failure reason + */ + msg?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): PositionEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(PositionEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): PositionEvent { + return plainToInstance(PositionEvent, jsonObject); + } +} + +export namespace PositionEvent { + export enum MarginModeEnum { + /** + * cross margin + */ + CROSS = 'CROSS', + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum PositionSideEnum { + /** + * One-way position + */ + BOTH = 'BOTH', + } +} + +export type PositionEventCallback = (topic: string, subject: string, data: PositionEvent) => void; + +export class PositionEventCallbackWrapper implements WebSocketMessageCallback { + callback: PositionEventCallback; + + constructor(callback: PositionEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new PositionEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts new file mode 100644 index 00000000..baac0d2d --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -0,0 +1,154 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class StopOrdersEvent implements Response { + /** + * + */ + createdAt?: number; + /** + * Margin Mode + */ + marginMode?: StopOrdersEvent.MarginModeEnum; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Order price + */ + orderPrice?: string; + /** + * User-specified order type + */ + orderType?: StopOrdersEvent.OrderTypeEnum; + /** + * buy or sell + */ + side?: StopOrdersEvent.SideEnum; + /** + * User-specified order size + */ + size?: number; + /** + * Either \'down\' or \'up\' + */ + stop?: StopOrdersEvent.StopEnum; + /** + * Stop Price + */ + stopPrice?: string; + /** + * + */ + stopPriceType?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * + */ + ts?: number; + /** + * Order Type + */ + type?: StopOrdersEvent.TypeEnum; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): StopOrdersEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(StopOrdersEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): StopOrdersEvent { + return plainToInstance(StopOrdersEvent, jsonObject); + } +} + +export namespace StopOrdersEvent { + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum OrderTypeEnum { + /** + * Stop order + */ + STOP = 'stop', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum TypeEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * when the stop order has been triggered + */ + TRIGGERED = 'triggered', + /** + * when the order has been canceled + */ + CANCEL = 'cancel', + } +} + +export type StopOrdersEventCallback = ( + topic: string, + subject: string, + data: StopOrdersEvent, +) => void; + +export class StopOrdersEventCallbackWrapper implements WebSocketMessageCallback { + callback: StopOrdersEventCallback; + + constructor(callback: StopOrdersEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new StopOrdersEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts b/sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/futurespublic/api_futures_public.ts b/sdk/node/src/generate/futures/futurespublic/api_futures_public.ts new file mode 100644 index 00000000..58ac1b66 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/api_futures_public.ts @@ -0,0 +1,255 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { + OrderbookLevel5EventCallbackWrapper, + OrderbookLevel5EventCallback, +} from './model_orderbook_level5_event'; +import { KlinesEventCallbackWrapper, KlinesEventCallback } from './model_klines_event'; +import { TickerV2EventCallbackWrapper, TickerV2EventCallback } from './model_ticker_v2_event'; +import { + SymbolSnapshotEventCallback, + SymbolSnapshotEventCallbackWrapper, +} from './model_symbol_snapshot_event'; +import { + OrderbookIncrementEventCallback, + OrderbookIncrementEventCallbackWrapper, +} from './model_orderbook_increment_event'; +import { TickerV1EventCallbackWrapper, TickerV1EventCallback } from './model_ticker_v1_event'; +import { + OrderbookLevel50EventCallback, + OrderbookLevel50EventCallbackWrapper, +} from './model_orderbook_level50_event'; +import { ExecutionEventCallbackWrapper, ExecutionEventCallback } from './model_execution_event'; +import { InstrumentEventCallbackWrapper, InstrumentEventCallback } from './model_instrument_event'; +import { + AnnouncementEventCallback, + AnnouncementEventCallbackWrapper, +} from './model_announcement_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface FuturesPublicWS { + /** + * announcement announcement + * Subscribe this topic to get Funding Fee Settlement. + * push frequency: Settlement is made every 8 hours, real-time push + */ + announcement(symbol: string, callback: AnnouncementEventCallback): Promise; + + /** + * execution Match execution data. + * For each order executed, the system will send you the match messages in the format as following. + * push frequency: realtime + */ + execution(symbol: string, callback: ExecutionEventCallback): Promise; + + /** + * instrument instrument + * Subscribe this topic to get the mark Price, index Price or funding fee Rate + * push frequency: mark.index.price 1s, funding.rate 1min + */ + instrument(symbol: string, callback: InstrumentEventCallback): Promise; + + /** + * klines Klines + * Subscribe to this topic to get K-Line data. + * push frequency: 1s + */ + klines(symbol: string, type: string, callback: KlinesEventCallback): Promise; + + /** + * orderbookIncrement Orderbook - Increment + * The system will return the increment change orderbook data(All depth), If there is no change in the market, data will not be pushed + * push frequency: realtime + */ + orderbookIncrement(symbol: string, callback: OrderbookIncrementEventCallback): Promise; + + /** + * orderbookLevel50 Orderbook - Level50 + * The depth50 market data. + * push frequency: 100ms + */ + orderbookLevel50(symbol: string, callback: OrderbookLevel50EventCallback): Promise; + + /** + * orderbookLevel5 Orderbook - Level5 + * The system will return the 5 best ask/bid orders data, If there is no change in the market, data will not be pushed + * push frequency: 100ms + */ + orderbookLevel5(symbol: string, callback: OrderbookLevel5EventCallback): Promise; + + /** + * symbolSnapshot Symbol Snapshot + * Get symbol\'s snapshot. + * push frequency: 5000ms + */ + symbolSnapshot(symbol: string, callback: SymbolSnapshotEventCallback): Promise; + + /** + * tickerV1 Get Ticker(not recommended) + * Subscribe this topic to get the realtime push of BBO changes.It is not recommended to use this topic any more. For real-time ticker information, please subscribe /contractMarket/tickerV2:{symbol}. + * push frequency: realtime + */ + tickerV1(symbol: string, callback: TickerV1EventCallback): Promise; + + /** + * tickerV2 Get Ticker V2 + * Subscribe this topic to get the realtime push of BBO changes. After subscription, when there are changes in the order book(Not necessarily ask1/bid1 changes), the system will push the real-time ticker symbol information to you. + * push frequency: realtime + */ + tickerV2(symbol: string, callback: TickerV2EventCallback): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class FuturesPublicWSImpl implements FuturesPublicWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + announcement(symbol: string, callback: AnnouncementEventCallback): Promise { + let topicPrefix = '/contract/announcement'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new AnnouncementEventCallbackWrapper(callback), + ); + } + + execution(symbol: string, callback: ExecutionEventCallback): Promise { + let topicPrefix = '/contractMarket/execution'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new ExecutionEventCallbackWrapper(callback), + ); + } + + instrument(symbol: string, callback: InstrumentEventCallback): Promise { + let topicPrefix = '/contract/instrument'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new InstrumentEventCallbackWrapper(callback), + ); + } + + klines(symbol: string, type: string, callback: KlinesEventCallback): Promise { + let topicPrefix = '/contractMarket/limitCandle'; + + let args: string[] = [[symbol, type].join('_')]; + + return this.wsService.subscribe( + topicPrefix, + args, + new KlinesEventCallbackWrapper(callback), + ); + } + + orderbookIncrement(symbol: string, callback: OrderbookIncrementEventCallback): Promise { + let topicPrefix = '/contractMarket/level2'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookIncrementEventCallbackWrapper(callback), + ); + } + + orderbookLevel50(symbol: string, callback: OrderbookLevel50EventCallback): Promise { + let topicPrefix = '/contractMarket/level2Depth50'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookLevel50EventCallbackWrapper(callback), + ); + } + + orderbookLevel5(symbol: string, callback: OrderbookLevel5EventCallback): Promise { + let topicPrefix = '/contractMarket/level2Depth5'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookLevel5EventCallbackWrapper(callback), + ); + } + + symbolSnapshot(symbol: string, callback: SymbolSnapshotEventCallback): Promise { + let topicPrefix = '/contractMarket/snapshot'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new SymbolSnapshotEventCallbackWrapper(callback), + ); + } + + tickerV1(symbol: string, callback: TickerV1EventCallback): Promise { + let topicPrefix = '/contractMarket/ticker'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new TickerV1EventCallbackWrapper(callback), + ); + } + + tickerV2(symbol: string, callback: TickerV2EventCallback): Promise { + let topicPrefix = '/contractMarket/tickerV2'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new TickerV2EventCallbackWrapper(callback), + ); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts new file mode 100644 index 00000000..a6474a61 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -0,0 +1,65 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class AnnouncementEvent implements Response { + /** + * Symbol + */ + symbol?: string; + /** + * Funding time + */ + fundingTime?: number; + /** + * Funding rate + */ + fundingRate?: number; + /** + * + */ + timestamp?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): AnnouncementEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(AnnouncementEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AnnouncementEvent { + return plainToInstance(AnnouncementEvent, jsonObject); + } +} + +export type AnnouncementEventCallback = ( + topic: string, + subject: string, + data: AnnouncementEvent, +) => void; + +export class AnnouncementEventCallbackWrapper implements WebSocketMessageCallback { + callback: AnnouncementEventCallback; + + constructor(callback: AnnouncementEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new AnnouncementEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts new file mode 100644 index 00000000..35116dd9 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -0,0 +1,81 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class ExecutionEvent implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + sequence?: number; + /** + * + */ + side?: string; + /** + * + */ + size?: number; + /** + * + */ + price?: string; + /** + * + */ + takerOrderId?: string; + /** + * + */ + makerOrderId?: string; + /** + * + */ + tradeId?: string; + /** + * + */ + ts?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): ExecutionEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(ExecutionEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): ExecutionEvent { + return plainToInstance(ExecutionEvent, jsonObject); + } +} + +export type ExecutionEventCallback = (topic: string, subject: string, data: ExecutionEvent) => void; + +export class ExecutionEventCallbackWrapper implements WebSocketMessageCallback { + callback: ExecutionEventCallback; + + constructor(callback: ExecutionEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new ExecutionEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts new file mode 100644 index 00000000..aff82160 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -0,0 +1,69 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class InstrumentEvent implements Response { + /** + * Granularity (predicted funding rate: 1-min granularity: 60000; Funding rate: 8-hours granularity: 28800000. ) + */ + granularity?: number; + /** + * + */ + fundingRate?: number; + /** + * + */ + timestamp?: number; + /** + * + */ + markPrice?: number; + /** + * + */ + indexPrice?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): InstrumentEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(InstrumentEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): InstrumentEvent { + return plainToInstance(InstrumentEvent, jsonObject); + } +} + +export type InstrumentEventCallback = ( + topic: string, + subject: string, + data: InstrumentEvent, +) => void; + +export class InstrumentEventCallbackWrapper implements WebSocketMessageCallback { + callback: InstrumentEventCallback; + + constructor(callback: InstrumentEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new InstrumentEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts new file mode 100644 index 00000000..2bc0b27d --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class KlinesEvent implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time, open price, close price, high price, low price, Transaction volume(This value is incorrect, please do not use it, we will fix it in subsequent versions), Transaction amount + */ + candles?: Array; + /** + * timestamp(ms) + */ + time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): KlinesEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(KlinesEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): KlinesEvent { + return plainToInstance(KlinesEvent, jsonObject); + } +} + +export type KlinesEventCallback = (topic: string, subject: string, data: KlinesEvent) => void; + +export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { + callback: KlinesEventCallback; + + constructor(callback: KlinesEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new KlinesEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts new file mode 100644 index 00000000..e5b6ade4 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookIncrementEvent implements Response { + /** + * + */ + sequence?: number; + /** + * + */ + change?: string; + /** + * + */ + timestamp?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookIncrementEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookIncrementEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookIncrementEvent { + return plainToInstance(OrderbookIncrementEvent, jsonObject); + } +} + +export type OrderbookIncrementEventCallback = ( + topic: string, + subject: string, + data: OrderbookIncrementEvent, +) => void; + +export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookIncrementEventCallback; + + constructor(callback: OrderbookIncrementEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookIncrementEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts new file mode 100644 index 00000000..d9a09d6d --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -0,0 +1,69 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookLevel50Event implements Response { + /** + * + */ + bids?: Array>; + /** + * + */ + sequence?: number; + /** + * + */ + timestamp?: number; + /** + * + */ + ts?: number; + /** + * + */ + asks?: Array>; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookLevel50Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel50Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel50Event { + return plainToInstance(OrderbookLevel50Event, jsonObject); + } +} + +export type OrderbookLevel50EventCallback = ( + topic: string, + subject: string, + data: OrderbookLevel50Event, +) => void; + +export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookLevel50EventCallback; + + constructor(callback: OrderbookLevel50EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookLevel50Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts new file mode 100644 index 00000000..44be6af1 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -0,0 +1,69 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookLevel5Event implements Response { + /** + * + */ + bids?: Array>; + /** + * + */ + sequence?: number; + /** + * + */ + timestamp?: number; + /** + * + */ + ts?: number; + /** + * + */ + asks?: Array>; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookLevel5Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel5Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel5Event { + return plainToInstance(OrderbookLevel5Event, jsonObject); + } +} + +export type OrderbookLevel5EventCallback = ( + topic: string, + subject: string, + data: OrderbookLevel5Event, +) => void; + +export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookLevel5EventCallback; + + constructor(callback: OrderbookLevel5EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookLevel5Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts new file mode 100644 index 00000000..ef51d99b --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -0,0 +1,89 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class SymbolSnapshotEvent implements Response { + /** + * + */ + highPrice?: number; + /** + * + */ + lastPrice?: number; + /** + * + */ + lowPrice?: number; + /** + * + */ + price24HoursBefore?: number; + /** + * + */ + priceChg?: number; + /** + * + */ + priceChgPct?: number; + /** + * + */ + symbol?: string; + /** + * + */ + ts?: number; + /** + * + */ + turnover?: number; + /** + * + */ + volume?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): SymbolSnapshotEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotEvent { + return plainToInstance(SymbolSnapshotEvent, jsonObject); + } +} + +export type SymbolSnapshotEventCallback = ( + topic: string, + subject: string, + data: SymbolSnapshotEvent, +) => void; + +export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallback { + callback: SymbolSnapshotEventCallback; + + constructor(callback: SymbolSnapshotEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new SymbolSnapshotEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts new file mode 100644 index 00000000..4fa620be --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -0,0 +1,89 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class TickerV1Event implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + sequence?: number; + /** + * + */ + side?: string; + /** + * + */ + size?: number; + /** + * + */ + price?: string; + /** + * + */ + bestBidSize?: number; + /** + * + */ + bestBidPrice?: string; + /** + * + */ + bestAskPrice?: string; + /** + * + */ + tradeId?: string; + /** + * + */ + bestAskSize?: number; + /** + * + */ + ts?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): TickerV1Event { + const jsonObject = JSON.parse(input); + return plainToInstance(TickerV1Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): TickerV1Event { + return plainToInstance(TickerV1Event, jsonObject); + } +} + +export type TickerV1EventCallback = (topic: string, subject: string, data: TickerV1Event) => void; + +export class TickerV1EventCallbackWrapper implements WebSocketMessageCallback { + callback: TickerV1EventCallback; + + constructor(callback: TickerV1EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new TickerV1Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts new file mode 100644 index 00000000..fd518f2b --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -0,0 +1,73 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class TickerV2Event implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + sequence?: number; + /** + * + */ + bestBidSize?: number; + /** + * + */ + bestBidPrice?: string; + /** + * + */ + bestAskPrice?: string; + /** + * + */ + bestAskSize?: number; + /** + * + */ + ts?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): TickerV2Event { + const jsonObject = JSON.parse(input); + return plainToInstance(TickerV2Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): TickerV2Event { + return plainToInstance(TickerV2Event, jsonObject); + } +} + +export type TickerV2EventCallback = (topic: string, subject: string, data: TickerV2Event) => void; + +export class TickerV2EventCallbackWrapper implements WebSocketMessageCallback { + callback: TickerV2EventCallback; + + constructor(callback: TickerV2EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new TickerV2Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/futures/market/api_market.template b/sdk/node/src/generate/futures/market/api_market.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts new file mode 100644 index 00000000..4b479b39 --- /dev/null +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -0,0 +1,450 @@ +import { GetPremiumIndexResp } from './model_get_premium_index_resp'; +import { GetMarkPriceResp } from './model_get_mark_price_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetTickerReq } from './model_get_ticker_req'; +import { GetInterestRateIndexReq } from './model_get_interest_rate_index_req'; +import { GetSpotIndexPriceReq } from './model_get_spot_index_price_req'; +import { GetMarkPriceReq } from './model_get_mark_price_req'; +import { GetPrivateTokenResp } from './model_get_private_token_resp'; +import { GetPartOrderBookReq } from './model_get_part_order_book_req'; +import { GetPremiumIndexReq } from './model_get_premium_index_req'; +import { GetSymbolReq } from './model_get_symbol_req'; +import { GetSymbolResp } from './model_get_symbol_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; +import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetFullOrderBookReq } from './model_get_full_order_book_req'; +import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetInterestRateIndexResp } from './model_get_interest_rate_index_resp'; +import { Get24hrStatsResp } from './model_get24hr_stats_resp'; +import { GetKlinesReq } from './model_get_klines_req'; +import { GetPartOrderBookResp } from './model_get_part_order_book_resp'; +import { GetAllTickersResp } from './model_get_all_tickers_resp'; +import { GetServerTimeResp } from './model_get_server_time_resp'; +import { GetSpotIndexPriceResp } from './model_get_spot_index_price_resp'; +import { GetKlinesResp } from './model_get_klines_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getAllTickers request test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/allTickers + */ + }); + + test('getAllTickers response test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/allTickers + */ + }); + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + }); + + test('getPrivateToken response test', () => { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + }); + test('getPublicToken request test', () => { + /** + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public + */ + }); + + test('getPublicToken response test', () => { + /** + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public + */ + }); + test('getAllSymbols request test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active + */ + }); + + test('getAllSymbols response test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active + */ + }); + test('getSymbol request test', () => { + /** + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetSymbolReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSymbol response test', () => { + /** + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDM",\n "rootSymbol": "XBT",\n "type": "FFWCSX",\n "firstOpenDate": 1552638575000,\n "expireDate": null,\n "settleDate": null,\n "baseCurrency": "XBT",\n "quoteCurrency": "USD",\n "settleCurrency": "XBT",\n "maxOrderQty": 10000000,\n "maxPrice": 1000000.0,\n "lotSize": 1,\n "tickSize": 0.1,\n "indexPriceTickSize": 0.1,\n "multiplier": -1.0,\n "initialMargin": 0.014,\n "maintainMargin": 0.007,\n "maxRiskLimit": 1,\n "minRiskLimit": 1,\n "riskStep": 0,\n "makerFeeRate": 2.0E-4,\n "takerFeeRate": 6.0E-4,\n "takerFixFee": 0.0,\n "makerFixFee": 0.0,\n "settlementFee": null,\n "isDeleverage": true,\n "isQuanto": false,\n "isInverse": true,\n "markMethod": "FairPrice",\n "fairMethod": "FundingRate",\n "fundingBaseSymbol": ".XBTINT8H",\n "fundingQuoteSymbol": ".USDINT8H",\n "fundingRateSymbol": ".XBTUSDMFPI8H",\n "indexSymbol": ".BXBT",\n "settlementSymbol": null,\n "status": "Open",\n "fundingFeeRate": 1.75E-4,\n "predictedFundingFeeRate": 1.76E-4,\n "fundingRateGranularity": 28800000,\n "openInterest": "61725904",\n "turnoverOf24h": 209.56303473,\n "volumeOf24h": 1.4354731E7,\n "markPrice": 68336.7,\n "indexPrice": 68335.29,\n "lastTradePrice": 68349.3,\n "nextFundingRateTime": 17402942,\n "maxLeverage": 75,\n "sourceExchanges": [\n "kraken",\n "bitstamp",\n "crypto"\n ],\n "premiumsSymbol1M": ".XBTUSDMPI",\n "premiumsSymbol8H": ".XBTUSDMPI8H",\n "fundingBaseSymbol1M": ".XBTINT",\n "fundingQuoteSymbol1M": ".USDINT",\n "lowPrice": 67436.7,\n "highPrice": 69471.8,\n "priceChgPct": 0.0097,\n "priceChg": 658.7,\n "k": 2645000.0,\n "m": 1640000.0,\n "f": 1.3,\n "mmrLimit": 0.3,\n "mmrLevConstant": 75.0,\n "supportCross": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSymbolResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSpotIndexPrice request test', () => { + /** + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query + */ + let data = + '{"symbol": ".KXBTUSDT", "startAt": 123456, "endAt": 123456, "reverse": true, "offset": 123456, "forward": true, "maxCount": 10}'; + let req = new GetSpotIndexPriceReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSpotIndexPrice response test', () => { + /** + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query + */ + let data = + '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557515000,\n "value": 69202.94,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69209.27,\n "weight": 0.0533\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0128\n },\n {\n "exchange": "okex",\n "price": 69195.34,\n "weight": 0.11\n },\n {\n "exchange": "bybit",\n "price": 69190.33,\n "weight": 0.0676\n },\n {\n "exchange": "binance",\n "price": 69204.55,\n "weight": 0.6195\n },\n {\n "exchange": "kucoin",\n "price": 69202.91,\n "weight": 0.1368\n }\n ]\n },\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557514000,\n "value": 69204.98,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69212.71,\n "weight": 0.0808\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0134\n },\n {\n "exchange": "okex",\n "price": 69195.49,\n "weight": 0.0536\n },\n {\n "exchange": "bybit",\n "price": 69195.97,\n "weight": 0.0921\n },\n {\n "exchange": "binance",\n "price": 69204.56,\n "weight": 0.5476\n },\n {\n "exchange": "kucoin",\n "price": 69207.8,\n "weight": 0.2125\n }\n ]\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSpotIndexPriceResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getInterestRateIndex request test', () => { + /** + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query + */ + let data = + '{"symbol": ".XBTINT8H", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; + let req = new GetInterestRateIndexReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getInterestRateIndex response test', () => { + /** + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query + */ + let data = + '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692100000,\n "value": 3.0E-4\n },\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692040000,\n "value": 3.0E-4\n }\n ],\n "hasMore": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetInterestRateIndexResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getKlines request test', () => { + /** + * getKlines + * Get Klines + * /api/v1/kline/query + */ + let data = + '{"symbol": "XBTUSDTM", "granularity": 1, "from": 1728552342000, "to": 1729243542000}'; + let req = new GetKlinesReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getKlines response test', () => { + /** + * getKlines + * Get Klines + * /api/v1/kline/query + */ + let data = + '{\n "code": "200000",\n "data": [\n [\n 1728576000000,\n 60791.1,\n 61035,\n 58940,\n 60300,\n 5501167\n ],\n [\n 1728604800000,\n 60299.9,\n 60924.1,\n 60077.4,\n 60666.1,\n 1220980\n ],\n [\n 1728633600000,\n 60665.7,\n 62436.8,\n 60650.1,\n 62255.1,\n 3386359\n ]\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetKlinesResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPartOrderBook request test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} + */ + let data = '{"symbol": "XBTUSDM", "size": "20"}'; + let req = new GetPartOrderBookReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPartOrderBook response test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} + */ + let data = + '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPartOrderBookResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getFullOrderBook request test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot + */ + let data = '{"symbol": "XBTUSDM"}'; + let req = new GetFullOrderBookReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFullOrderBook response test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot + */ + let data = + '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFullOrderBookResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMarkPrice request test', () => { + /** + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetMarkPriceReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMarkPrice response test', () => { + /** + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current + */ + let data = + '{"code":"200000","data":{"symbol":"XBTUSDTM","granularity":1000,"timePoint":1729254307000,"value":67687.08,"indexPrice":67683.58}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarkPriceResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPremiumIndex request test', () => { + /** + * getPremiumIndex + * Get Premium Index + * /api/v1/premium/query + */ + let data = + '{"symbol": ".XBTUSDTMPI", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; + let req = new GetPremiumIndexReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPremiumIndex response test', () => { + /** + * getPremiumIndex + * Get Premium Index + * /api/v1/premium/query + */ + let data = + '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".XBTUSDTMPI",\n "granularity": 60000,\n "timePoint": 1730558040000,\n "value": 0.00006\n },\n {\n "symbol": ".XBTUSDTMPI",\n "granularity": 60000,\n "timePoint": 1730557980000,\n "value": -0.000025\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPremiumIndexResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getServiceStatus request test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + + test('getServiceStatus response test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + test('getTicker request test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/ticker + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetTickerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTicker response test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/ticker + */ + let data = + '{"code":"200000","data":{"sequence":1697895100310,"symbol":"XBTUSDM","side":"sell","size":2936,"tradeId":"1697901180000","price":"67158.4","bestBidPrice":"67169.6","bestBidSize":32345,"bestAskPrice":"67169.7","bestAskSize":7251,"ts":1729163001780000000}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTickerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getServerTime request test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + }); + + test('getServerTime response test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + }); + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/trade/history + */ + let data = '{"symbol": "XBTUSDM"}'; + let req = new GetTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistory response test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/trade/history + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "sequence": 1697915257909,\n "contractId": 1,\n "tradeId": "1697915257909",\n "makerOrderId": "236679665752801280",\n "takerOrderId": "236679667975745536",\n "ts": 1729242032152000000,\n "size": 1,\n "price": "67878",\n "side": "sell"\n },\n {\n "sequence": 1697915257749,\n "contractId": 1,\n "tradeId": "1697915257749",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679665400492032",\n "ts": 1729242031535000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n },\n {\n "sequence": 1697915257701,\n "contractId": 1,\n "tradeId": "1697915257701",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679661919211521",\n "ts": 1729242030932000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('get24hrStats request test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics + */ + }); + + test('get24hrStats response test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics + */ + }); +}); diff --git a/sdk/node/src/generate/futures/market/api_market.ts b/sdk/node/src/generate/futures/market/api_market.ts new file mode 100644 index 00000000..198c6d9d --- /dev/null +++ b/sdk/node/src/generate/futures/market/api_market.ts @@ -0,0 +1,512 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetPremiumIndexResp } from './model_get_premium_index_resp'; +import { GetMarkPriceResp } from './model_get_mark_price_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetTickerReq } from './model_get_ticker_req'; +import { GetInterestRateIndexReq } from './model_get_interest_rate_index_req'; +import { GetSpotIndexPriceReq } from './model_get_spot_index_price_req'; +import { GetMarkPriceReq } from './model_get_mark_price_req'; +import { GetPrivateTokenResp } from './model_get_private_token_resp'; +import { GetPartOrderBookReq } from './model_get_part_order_book_req'; +import { GetPremiumIndexReq } from './model_get_premium_index_req'; +import { GetSymbolReq } from './model_get_symbol_req'; +import { GetSymbolResp } from './model_get_symbol_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; +import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetFullOrderBookReq } from './model_get_full_order_book_req'; +import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetInterestRateIndexResp } from './model_get_interest_rate_index_resp'; +import { Get24hrStatsResp } from './model_get24hr_stats_resp'; +import { GetKlinesReq } from './model_get_klines_req'; +import { GetPartOrderBookResp } from './model_get_part_order_book_resp'; +import { GetAllTickersResp } from './model_get_all_tickers_resp'; +import { GetServerTimeResp } from './model_get_server_time_resp'; +import { GetSpotIndexPriceResp } from './model_get_spot_index_price_resp'; +import { GetKlinesResp } from './model_get_klines_resp'; + +export interface MarketAPI { + /** + * getAllTickers Get All Tickers + * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470223 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getAllTickers(): Promise; + + /** + * getPrivateToken Get Private Token - Futures + * Description: This interface can obtain the token required for websocket to establish a Futures private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token + * Documentation: https://www.kucoin.com/docs-new/api-3470296 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getPrivateToken(): Promise; + + /** + * getPublicToken Get Public Token - Futures + * Description: This interface can obtain the token required for websocket to establish a Futures connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token + * Documentation: https://www.kucoin.com/docs-new/api-3470297 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getPublicToken(): Promise; + + /** + * getAllSymbols Get All Symbols + * Description: Get detailed information of all contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. + * Documentation: https://www.kucoin.com/docs-new/api-3470220 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getAllSymbols(): Promise; + + /** + * getSymbol Get Symbol + * Description: Get information of specified contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. + * Documentation: https://www.kucoin.com/docs-new/api-3470221 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getSymbol(req: GetSymbolReq): Promise; + + /** + * getSpotIndexPrice Get Spot Index Price + * Description: Get Spot Index Price + * Documentation: https://www.kucoin.com/docs-new/api-3470231 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise; + + /** + * getInterestRateIndex Get Interest Rate Index + * Description: Get interest rate Index. + * Documentation: https://www.kucoin.com/docs-new/api-3470226 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getInterestRateIndex(req: GetInterestRateIndexReq): Promise; + + /** + * getKlines Get Klines + * Description: Get the Kline of the symbol. Data are returned in grouped buckets based on requested type. For each query, the system would return at most 500 pieces of data. To obtain more data, please page the data by time. + * Documentation: https://www.kucoin.com/docs-new/api-3470234 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getKlines(req: GetKlinesReq): Promise; + + /** + * getPartOrderBook Get Part OrderBook + * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. + * Documentation: https://www.kucoin.com/docs-new/api-3470225 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getPartOrderBook(req: GetPartOrderBookReq): Promise; + + /** + * getFullOrderBook Get Full OrderBook + * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. + * Documentation: https://www.kucoin.com/docs-new/api-3470224 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getFullOrderBook(req: GetFullOrderBookReq): Promise; + + /** + * getMarkPrice Get Mark Price + * Description: Get current mark price + * Documentation: https://www.kucoin.com/docs-new/api-3470233 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getMarkPrice(req: GetMarkPriceReq): Promise; + + /** + * getPremiumIndex Get Premium Index + * Description: Submit request to get premium index. + * Documentation: https://www.kucoin.com/docs-new/api-3470227 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getPremiumIndex(req: GetPremiumIndexReq): Promise; + + /** + * getServiceStatus Get Service Status + * Description: Get the service status. + * Documentation: https://www.kucoin.com/docs-new/api-3470230 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------+ + */ + getServiceStatus(): Promise; + + /** + * getTicker Get Ticker + * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470222 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getTicker(req: GetTickerReq): Promise; + + /** + * getServerTime Get Server Time + * Description: Get the API server time. This is the Unix timestamp. + * Documentation: https://www.kucoin.com/docs-new/api-3470229 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getServerTime(): Promise; + + /** + * getTradeHistory Get Trade History + * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. + * Documentation: https://www.kucoin.com/docs-new/api-3470232 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getTradeHistory(req: GetTradeHistoryReq): Promise; + + /** + * get24hrStats Get 24hr Stats + * Description: Get the statistics of the platform futures trading volume in the last 24 hours. + * Documentation: https://www.kucoin.com/docs-new/api-3470228 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + get24hrStats(): Promise; +} + +export class MarketAPIImpl implements MarketAPI { + constructor(private transport: Transport) {} + + getAllTickers(): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/allTickers', + null, + new GetAllTickersResp(), + false, + ); + } + + getPrivateToken(): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/bullet-private', + null, + new GetPrivateTokenResp(), + false, + ); + } + + getPublicToken(): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/bullet-public', + null, + new GetPublicTokenResp(), + false, + ); + } + + getAllSymbols(): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/contracts/active', + null, + new GetAllSymbolsResp(), + false, + ); + } + + getSymbol(req: GetSymbolReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/contracts/{symbol}', + req, + new GetSymbolResp(), + false, + ); + } + + getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/index/query', + req, + new GetSpotIndexPriceResp(), + false, + ); + } + + getInterestRateIndex(req: GetInterestRateIndexReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/interest/query', + req, + new GetInterestRateIndexResp(), + false, + ); + } + + getKlines(req: GetKlinesReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/kline/query', + req, + new GetKlinesResp(), + false, + ); + } + + getPartOrderBook(req: GetPartOrderBookReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/level2/depth{size}', + req, + new GetPartOrderBookResp(), + false, + ); + } + + getFullOrderBook(req: GetFullOrderBookReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/level2/snapshot', + req, + new GetFullOrderBookResp(), + false, + ); + } + + getMarkPrice(req: GetMarkPriceReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/mark-price/{symbol}/current', + req, + new GetMarkPriceResp(), + false, + ); + } + + getPremiumIndex(req: GetPremiumIndexReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/premium/query', + req, + new GetPremiumIndexResp(), + false, + ); + } + + getServiceStatus(): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/status', + null, + new GetServiceStatusResp(), + false, + ); + } + + getTicker(req: GetTickerReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/ticker', + req, + new GetTickerResp(), + false, + ); + } + + getServerTime(): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/timestamp', + null, + new GetServerTimeResp(), + false, + ); + } + + getTradeHistory(req: GetTradeHistoryReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/trade/history', + req, + new GetTradeHistoryResp(), + false, + ); + } + + get24hrStats(): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/trade-statistics', + null, + new Get24hrStatsResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts new file mode 100644 index 00000000..75a71327 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class Get24hrStatsResp implements Response { + /** + * 24-hour platform Futures trading volume. Unit is USD + */ + turnoverOf24h?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): Get24hrStatsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(Get24hrStatsResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): Get24hrStatsResp { + return plainToInstance(Get24hrStatsResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts new file mode 100644 index 00000000..3a3ad0c6 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts @@ -0,0 +1,321 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllSymbolsData implements Serializable { + /** + * Symbol + */ + symbol?: string; + /** + * Contract group + */ + rootSymbol?: string; + /** + * Type of the contract + */ + type?: GetAllSymbolsData.TypeEnum; + /** + * First Open Date(millisecond) + */ + firstOpenDate?: number; + /** + * Expiration date(millisecond). Null means it will never expire + */ + expireDate?: number; + /** + * Settlement date(millisecond). Null indicates that automatic settlement is not supported + */ + settleDate?: number; + /** + * Base currency + */ + baseCurrency?: string; + /** + * Quote currency + */ + quoteCurrency?: string; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Maximum order quantity + */ + maxOrderQty?: number; + /** + * Maximum order price + */ + maxPrice?: number; + /** + * Minimum lot size + */ + lotSize?: number; + /** + * Minimum price changes + */ + tickSize?: number; + /** + * Index price of tick size + */ + indexPriceTickSize?: number; + /** + * The basic unit of the contract API is lots. For the number of coins in each lot, please refer to the param multiplier. For example, for XBTUSDTM, multiplier=0.001, which corresponds to the value of each XBTUSDTM contract being 0.001 BTC. There is also a special case. All coin-swap contracts, such as each XBTUSDM contract, correspond to 1 USD. + */ + multiplier?: number; + /** + * Initial margin requirement + */ + initialMargin?: number; + /** + * Maintenance margin requirement + */ + maintainMargin?: number; + /** + * Maximum risk limit (unit: XBT) + */ + maxRiskLimit?: number; + /** + * Minimum risk limit (unit: XBT) + */ + minRiskLimit?: number; + /** + * Risk limit increment value (unit: XBT) + */ + riskStep?: number; + /** + * Maker fee rate + */ + makerFeeRate?: number; + /** + * Taker fee rate + */ + takerFeeRate?: number; + /** + * Deprecated param + */ + takerFixFee?: number; + /** + * Deprecated param + */ + makerFixFee?: number; + /** + * Settlement fee + */ + settlementFee?: number; + /** + * Enabled ADL or not + */ + isDeleverage?: boolean; + /** + * Deprecated param + */ + isQuanto?: boolean; + /** + * Whether it is a reverse contract + */ + isInverse?: boolean; + /** + * Marking method + */ + markMethod?: GetAllSymbolsData.MarkMethodEnum; + /** + * Fair price marking method, The Futures contract is null + */ + fairMethod?: GetAllSymbolsData.FairMethodEnum; + /** + * Ticker symbol of the based currency + */ + fundingBaseSymbol?: string; + /** + * Ticker symbol of the quote currency + */ + fundingQuoteSymbol?: string; + /** + * Funding rate symbol + */ + fundingRateSymbol?: string; + /** + * Index symbol + */ + indexSymbol?: string; + /** + * Settlement Symbol + */ + settlementSymbol?: string; + /** + * Contract status + */ + status?: GetAllSymbolsData.StatusEnum; + /** + * Funding fee rate + */ + fundingFeeRate?: number; + /** + * Predicted funding fee rate + */ + predictedFundingFeeRate?: number; + /** + * Funding interval(millisecond) + */ + fundingRateGranularity?: number; + /** + * Open interest + */ + openInterest?: string; + /** + * 24-hour turnover + */ + turnoverOf24h?: number; + /** + * 24-hour volume + */ + volumeOf24h?: number; + /** + * Mark price + */ + markPrice?: number; + /** + * Index price + */ + indexPrice?: number; + /** + * Last trade price + */ + lastTradePrice?: number; + /** + * Next funding rate time(millisecond) + */ + nextFundingRateTime?: number; + /** + * Maximum leverage + */ + maxLeverage?: number; + /** + * The contract index price source exchange + */ + sourceExchanges?: Array; + /** + * Premium index symbol(1 minute) + */ + premiumsSymbol1M?: string; + /** + * Premium index symbol(8 hours) + */ + premiumsSymbol8H?: string; + /** + * Base currency interest rate symbol(1 minute) + */ + fundingBaseSymbol1M?: string; + /** + * Quote currency interest rate symbol(1 minute) + */ + fundingQuoteSymbol1M?: string; + /** + * 24-hour lowest price + */ + lowPrice?: number; + /** + * 24-hour highest price + */ + highPrice?: number; + /** + * 24-hour price change% + */ + priceChgPct?: number; + /** + * 24-hour price change + */ + priceChg?: number; + /** + * + */ + k?: number; + /** + * + */ + m?: number; + /** + * + */ + f?: number; + /** + * + */ + mmrLimit?: number; + /** + * + */ + mmrLevConstant?: number; + /** + * Whether support Cross Margin + */ + supportCross?: boolean; + fromJson(input: string): GetAllSymbolsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllSymbolsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllSymbolsData { + return plainToInstance(GetAllSymbolsData, jsonObject); + } +} + +export namespace GetAllSymbolsData { + export enum TypeEnum { + /** + * Standardized swap contracts standard financial futures on swap, expiration swap funding rate + */ + FFWCSX = 'FFWCSX', + /** + * Futures Contract + */ + FFICSX = 'FFICSX', + } + export enum MarkMethodEnum { + /** + * Fair Price + */ + FAIRPRICE = 'FairPrice', + } + export enum FairMethodEnum { + /** + * FundingRate + */ + FUNDINGRATE = 'FundingRate', + } + export enum StatusEnum { + /** + * Initial + */ + INIT = 'Init', + /** + * Online + */ + OPEN = 'Open', + /** + * Setting + */ + BEINGSETTLED = 'BeingSettled', + /** + * Settled + */ + SETTLED = 'Settled', + /** + * Suspended + */ + PAUSED = 'Paused', + /** + * Offline + */ + CLOSED = 'Closed', + /** + * Orders can only be canceled + */ + CANCELONLY = 'CancelOnly', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts new file mode 100644 index 00000000..d0b410ad --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetAllSymbolsData } from './model_get_all_symbols_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAllSymbolsResp implements Response { + /** + * the list of all contracts + */ + @Type(() => GetAllSymbolsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAllSymbolsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllSymbolsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetAllSymbolsResp { + return plainToInstance(GetAllSymbolsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts new file mode 100644 index 00000000..b5b94094 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts @@ -0,0 +1,75 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllTickersData implements Serializable { + /** + * Sequence number, used to judge whether the messages pushed by Websocket is continuous. + */ + sequence?: number; + /** + * Symbol + */ + symbol?: string; + /** + * Trade direction + */ + side?: GetAllTickersData.SideEnum; + /** + * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. + */ + size?: number; + /** + * Transaction ID + */ + tradeId?: string; + /** + * Filled price + */ + price?: string; + /** + * Best bid price + */ + bestBidPrice?: string; + /** + * Best bid size + */ + bestBidSize?: number; + /** + * Best ask price + */ + bestAskPrice?: string; + /** + * Best ask size + */ + bestAskSize?: number; + /** + * Filled time(nanosecond) + */ + ts?: number; + fromJson(input: string): GetAllTickersData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllTickersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllTickersData { + return plainToInstance(GetAllTickersData, jsonObject); + } +} + +export namespace GetAllTickersData { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts new file mode 100644 index 00000000..dfb0136d --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAllTickersData } from './model_get_all_tickers_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAllTickersResp implements Response { + /** + * + */ + @Type(() => GetAllTickersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAllTickersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllTickersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetAllTickersResp { + return plainToInstance(GetAllTickersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts new file mode 100644 index 00000000..484bc5b3 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFullOrderBookReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetFullOrderBookReq` class. + * The builder pattern allows step-by-step construction of a `GetFullOrderBookReq` object. + */ + static builder(): GetFullOrderBookReqBuilder { + return new GetFullOrderBookReqBuilder(); + } + + /** + * Creates a new instance of the `GetFullOrderBookReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetFullOrderBookReq { + let obj = new GetFullOrderBookReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetFullOrderBookReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFullOrderBookReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFullOrderBookReq { + return plainToInstance(GetFullOrderBookReq, jsonObject); + } +} + +export class GetFullOrderBookReqBuilder { + obj: GetFullOrderBookReq = new GetFullOrderBookReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetFullOrderBookReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetFullOrderBookReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts new file mode 100644 index 00000000..fb1529d8 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFullOrderBookResp implements Response { + /** + * Sequence number + */ + sequence?: number; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * bids, from high to low + */ + bids?: Array>; + /** + * asks, from low to high + */ + asks?: Array>; + /** + * Timestamp(nanosecond) + */ + ts?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFullOrderBookResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFullOrderBookResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFullOrderBookResp { + return plainToInstance(GetFullOrderBookResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts new file mode 100644 index 00000000..bd4e466e --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetInterestRateIndexDataList implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Granularity (milisecond) + */ + granularity?: number; + /** + * Timestamp(milisecond) + */ + timePoint?: number; + /** + * Interest rate value + */ + value?: number; + fromJson(input: string): GetInterestRateIndexDataList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestRateIndexDataList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestRateIndexDataList { + return plainToInstance(GetInterestRateIndexDataList, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts new file mode 100644 index 00000000..3368ceac --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetInterestRateIndexReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean = true; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean = true; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number = 10; + + /** + * Creates a new instance of the `GetInterestRateIndexReq` class. + * The builder pattern allows step-by-step construction of a `GetInterestRateIndexReq` object. + */ + static builder(): GetInterestRateIndexReqBuilder { + return new GetInterestRateIndexReqBuilder(); + } + + /** + * Creates a new instance of the `GetInterestRateIndexReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number; + }): GetInterestRateIndexReq { + let obj = new GetInterestRateIndexReq(); + obj.symbol = data.symbol; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.reverse = data.reverse; + obj.offset = data.offset; + obj.forward = data.forward; + obj.maxCount = data.maxCount; + return obj; + } + + fromJson(input: string): GetInterestRateIndexReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestRateIndexReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestRateIndexReq { + return plainToInstance(GetInterestRateIndexReq, jsonObject); + } +} + +export class GetInterestRateIndexReqBuilder { + obj: GetInterestRateIndexReq = new GetInterestRateIndexReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetInterestRateIndexReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetInterestRateIndexReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetInterestRateIndexReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + setReverse(value: boolean): GetInterestRateIndexReqBuilder { + this.obj.reverse = value; + return this; + } + + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + setOffset(value: number): GetInterestRateIndexReqBuilder { + this.obj.offset = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setForward(value: boolean): GetInterestRateIndexReqBuilder { + this.obj.forward = value; + return this; + } + + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + setMaxCount(value: number): GetInterestRateIndexReqBuilder { + this.obj.maxCount = value; + return this; + } + + build(): GetInterestRateIndexReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts new file mode 100644 index 00000000..8c4ff22c --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetInterestRateIndexDataList } from './model_get_interest_rate_index_data_list'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetInterestRateIndexResp implements Response { + /** + * + */ + @Type(() => GetInterestRateIndexDataList) + dataList?: Array; + /** + * Whether there are more pages + */ + hasMore?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetInterestRateIndexResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestRateIndexResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestRateIndexResp { + return plainToInstance(GetInterestRateIndexResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_klines_req.ts b/sdk/node/src/generate/futures/market/model_get_klines_req.ts new file mode 100644 index 00000000..c97dc321 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_klines_req.ts @@ -0,0 +1,160 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetKlinesReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Type of candlestick patterns(minute) + */ + granularity?: GetKlinesReq.GranularityEnum; + /** + * Start time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + + /** + * Creates a new instance of the `GetKlinesReq` class. + * The builder pattern allows step-by-step construction of a `GetKlinesReq` object. + */ + static builder(): GetKlinesReqBuilder { + return new GetKlinesReqBuilder(); + } + + /** + * Creates a new instance of the `GetKlinesReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Type of candlestick patterns(minute) + */ + granularity?: GetKlinesReq.GranularityEnum; + /** + * Start time (milisecond) + */ + from?: number; + /** + * End time (milisecond) + */ + to?: number; + }): GetKlinesReq { + let obj = new GetKlinesReq(); + obj.symbol = data.symbol; + obj.granularity = data.granularity; + obj.from = data.from; + obj.to = data.to; + return obj; + } + + fromJson(input: string): GetKlinesReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKlinesReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetKlinesReq { + return plainToInstance(GetKlinesReq, jsonObject); + } +} + +export namespace GetKlinesReq { + export enum GranularityEnum { + /** + * 1min + */ + _1 = 1, + /** + * 5min + */ + _5 = 5, + /** + * 15min + */ + _15 = 15, + /** + * 30min + */ + _30 = 30, + /** + * 1hour + */ + _60 = 60, + /** + * 2hour + */ + _120 = 120, + /** + * 4hour + */ + _240 = 240, + /** + * 8hour + */ + _480 = 480, + /** + * 12hour + */ + _720 = 720, + /** + * 1day + */ + _1440 = 1440, + /** + * 1week + */ + _10080 = 10080, + } +} + +export class GetKlinesReqBuilder { + obj: GetKlinesReq = new GetKlinesReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetKlinesReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Type of candlestick patterns(minute) + */ + setGranularity(value: GetKlinesReq.GranularityEnum): GetKlinesReqBuilder { + this.obj.granularity = value; + return this; + } + + /** + * Start time (milisecond) + */ + setFrom(value: number): GetKlinesReqBuilder { + this.obj.from = value; + return this; + } + + /** + * End time (milisecond) + */ + setTo(value: number): GetKlinesReqBuilder { + this.obj.to = value; + return this; + } + + build(): GetKlinesReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts new file mode 100644 index 00000000..68c156a0 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetKlinesResp implements Response { + /** + * + */ + data?: Array>; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetKlinesResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKlinesResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetKlinesResp { + return plainToInstance(GetKlinesResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts new file mode 100644 index 00000000..515e18f0 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarkPriceReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetMarkPriceReq` class. + * The builder pattern allows step-by-step construction of a `GetMarkPriceReq` object. + */ + static builder(): GetMarkPriceReqBuilder { + return new GetMarkPriceReqBuilder(); + } + + /** + * Creates a new instance of the `GetMarkPriceReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetMarkPriceReq { + let obj = new GetMarkPriceReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMarkPriceReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarkPriceReq { + return plainToInstance(GetMarkPriceReq, jsonObject); + } +} + +export class GetMarkPriceReqBuilder { + obj: GetMarkPriceReq = new GetMarkPriceReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMarkPriceReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMarkPriceReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts new file mode 100644 index 00000000..c0c88857 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarkPriceResp implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Granularity (milisecond) + */ + granularity?: number; + /** + * Time point (milisecond) + */ + timePoint?: number; + /** + * Mark price + */ + value?: number; + /** + * Index price + */ + indexPrice?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarkPriceResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarkPriceResp { + return plainToInstance(GetMarkPriceResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts new file mode 100644 index 00000000..df50e6dd --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPartOrderBookReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Get the depth layer, optional value: 20, 100 + */ + @Reflect.metadata('path', 'size') + size?: string; + + /** + * Creates a new instance of the `GetPartOrderBookReq` class. + * The builder pattern allows step-by-step construction of a `GetPartOrderBookReq` object. + */ + static builder(): GetPartOrderBookReqBuilder { + return new GetPartOrderBookReqBuilder(); + } + + /** + * Creates a new instance of the `GetPartOrderBookReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Get the depth layer, optional value: 20, 100 + */ + size?: string; + }): GetPartOrderBookReq { + let obj = new GetPartOrderBookReq(); + obj.symbol = data.symbol; + obj.size = data.size; + return obj; + } + + fromJson(input: string): GetPartOrderBookReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPartOrderBookReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPartOrderBookReq { + return plainToInstance(GetPartOrderBookReq, jsonObject); + } +} + +export class GetPartOrderBookReqBuilder { + obj: GetPartOrderBookReq = new GetPartOrderBookReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPartOrderBookReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Get the depth layer, optional value: 20, 100 + */ + setSize(value: string): GetPartOrderBookReqBuilder { + this.obj.size = value; + return this; + } + + build(): GetPartOrderBookReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts new file mode 100644 index 00000000..dbba6de5 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPartOrderBookResp implements Response { + /** + * Sequence number + */ + sequence?: number; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * bids, from high to low + */ + bids?: Array>; + /** + * asks, from low to high + */ + asks?: Array>; + /** + * Timestamp(nanosecond) + */ + ts?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPartOrderBookResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPartOrderBookResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPartOrderBookResp { + return plainToInstance(GetPartOrderBookResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts new file mode 100644 index 00000000..95b9bdaa --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPremiumIndexDataList implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Granularity(milisecond) + */ + granularity?: number; + /** + * Timestamp(milisecond) + */ + timePoint?: number; + /** + * Premium index + */ + value?: number; + fromJson(input: string): GetPremiumIndexDataList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPremiumIndexDataList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPremiumIndexDataList { + return plainToInstance(GetPremiumIndexDataList, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts new file mode 100644 index 00000000..d64a7ce2 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPremiumIndexReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean = true; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean = true; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number = 10; + + /** + * Creates a new instance of the `GetPremiumIndexReq` class. + * The builder pattern allows step-by-step construction of a `GetPremiumIndexReq` object. + */ + static builder(): GetPremiumIndexReqBuilder { + return new GetPremiumIndexReqBuilder(); + } + + /** + * Creates a new instance of the `GetPremiumIndexReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number; + }): GetPremiumIndexReq { + let obj = new GetPremiumIndexReq(); + obj.symbol = data.symbol; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.reverse = data.reverse; + obj.offset = data.offset; + obj.forward = data.forward; + obj.maxCount = data.maxCount; + return obj; + } + + fromJson(input: string): GetPremiumIndexReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPremiumIndexReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPremiumIndexReq { + return plainToInstance(GetPremiumIndexReq, jsonObject); + } +} + +export class GetPremiumIndexReqBuilder { + obj: GetPremiumIndexReq = new GetPremiumIndexReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPremiumIndexReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetPremiumIndexReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetPremiumIndexReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + setReverse(value: boolean): GetPremiumIndexReqBuilder { + this.obj.reverse = value; + return this; + } + + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + setOffset(value: number): GetPremiumIndexReqBuilder { + this.obj.offset = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setForward(value: boolean): GetPremiumIndexReqBuilder { + this.obj.forward = value; + return this; + } + + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + setMaxCount(value: number): GetPremiumIndexReqBuilder { + this.obj.maxCount = value; + return this; + } + + build(): GetPremiumIndexReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts new file mode 100644 index 00000000..7429044a --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetPremiumIndexDataList } from './model_get_premium_index_data_list'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPremiumIndexResp implements Response { + /** + * + */ + @Type(() => GetPremiumIndexDataList) + dataList?: Array; + /** + * Whether there are more pages + */ + hasMore?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPremiumIndexResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPremiumIndexResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPremiumIndexResp { + return plainToInstance(GetPremiumIndexResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts new file mode 100644 index 00000000..40190529 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPrivateTokenInstanceServers + implements Serializable +{ + /** + * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change + */ + endpoint?: string; + /** + * Whether to encrypt. Currently only supports wss, not ws + */ + encrypt?: boolean; + /** + * Network Protocol + */ + protocol?: GetPrivateTokenInstanceServers.ProtocolEnum; + /** + * Recommended ping interval(millisecond) + */ + pingInterval?: number; + /** + * Heartbeat timeout(millisecond) + */ + pingTimeout?: number; + fromJson(input: string): GetPrivateTokenInstanceServers { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { + return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + } +} + +export namespace GetPrivateTokenInstanceServers { + export enum ProtocolEnum { + /** + * websocket + */ + WEBSOCKET = 'websocket', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts new file mode 100644 index 00000000..66c91797 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPrivateTokenResp implements Response { + /** + * The token required to establish a websocket connection + */ + token?: string; + /** + * + */ + @Type(() => GetPrivateTokenInstanceServers) + instanceServers?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPrivateTokenResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateTokenResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateTokenResp { + return plainToInstance(GetPrivateTokenResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts new file mode 100644 index 00000000..c8671c1c --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts @@ -0,0 +1,47 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPublicTokenInstanceServers implements Serializable { + /** + * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change + */ + endpoint?: string; + /** + * Whether to encrypt. Currently only supports wss, not ws + */ + encrypt?: boolean; + /** + * Network Protocol + */ + protocol?: GetPublicTokenInstanceServers.ProtocolEnum; + /** + * Recommended ping interval(millisecond) + */ + pingInterval?: number; + /** + * Heartbeat timeout(millisecond) + */ + pingTimeout?: number; + fromJson(input: string): GetPublicTokenInstanceServers { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicTokenInstanceServers { + return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + } +} + +export namespace GetPublicTokenInstanceServers { + export enum ProtocolEnum { + /** + * websocket + */ + WEBSOCKET = 'websocket', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts new file mode 100644 index 00000000..557b3e34 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPublicTokenResp implements Response { + /** + * The token required to establish a websocket connection + */ + token?: string; + /** + * + */ + @Type(() => GetPublicTokenInstanceServers) + instanceServers?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPublicTokenResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicTokenResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicTokenResp { + return plainToInstance(GetPublicTokenResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts new file mode 100644 index 00000000..65ad2ca0 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetServerTimeResp implements Response { + /** + * ServerTime(millisecond) + */ + data?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetServerTimeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetServerTimeResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetServerTimeResp { + return plainToInstance(GetServerTimeResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts new file mode 100644 index 00000000..5eec6fbe --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts @@ -0,0 +1,54 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetServiceStatusResp implements Response { + /** + * + */ + msg?: string; + /** + * Status of service: open:normal transaction, close:Stop Trading/Maintenance, cancelonly:can only cancel the order but not place order + */ + status?: GetServiceStatusResp.StatusEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetServiceStatusResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetServiceStatusResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetServiceStatusResp { + return plainToInstance(GetServiceStatusResp, jsonObject); + } +} + +export namespace GetServiceStatusResp { + export enum StatusEnum { + /** + * normal transaction + */ + OPEN = 'open', + /** + * Stop Trading/Maintenance + */ + CLOSE = 'close', + /** + * can only cancel the order but not place order + */ + CANCELONLY = 'cancelonly', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts new file mode 100644 index 00000000..4d279130 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts @@ -0,0 +1,40 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetSpotIndexPriceDataListDecomposionList } from './model_get_spot_index_price_data_list_decomposion_list'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotIndexPriceDataList implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Granularity (milisecond) + */ + granularity?: number; + /** + * Timestamp (milisecond) + */ + timePoint?: number; + /** + * Index Value + */ + value?: number; + /** + * Component List + */ + @Type(() => GetSpotIndexPriceDataListDecomposionList) + decomposionList?: Array; + fromJson(input: string): GetSpotIndexPriceDataList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotIndexPriceDataList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotIndexPriceDataList { + return plainToInstance(GetSpotIndexPriceDataList, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts new file mode 100644 index 00000000..20147fef --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts @@ -0,0 +1,32 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotIndexPriceDataListDecomposionList + implements Serializable +{ + /** + * Exchange + */ + exchange?: string; + /** + * Price + */ + price?: number; + /** + * Weight + */ + weight?: number; + fromJson(input: string): GetSpotIndexPriceDataListDecomposionList { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotIndexPriceDataListDecomposionList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotIndexPriceDataListDecomposionList { + return plainToInstance(GetSpotIndexPriceDataListDecomposionList, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts new file mode 100644 index 00000000..47d52fcb --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSpotIndexPriceReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean = true; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean = true; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number = 10; + + /** + * Creates a new instance of the `GetSpotIndexPriceReq` class. + * The builder pattern allows step-by-step construction of a `GetSpotIndexPriceReq` object. + */ + static builder(): GetSpotIndexPriceReqBuilder { + return new GetSpotIndexPriceReqBuilder(); + } + + /** + * Creates a new instance of the `GetSpotIndexPriceReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + reverse?: boolean; + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + offset?: number; + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + forward?: boolean; + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + maxCount?: number; + }): GetSpotIndexPriceReq { + let obj = new GetSpotIndexPriceReq(); + obj.symbol = data.symbol; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.reverse = data.reverse; + obj.offset = data.offset; + obj.forward = data.forward; + obj.maxCount = data.maxCount; + return obj; + } + + fromJson(input: string): GetSpotIndexPriceReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotIndexPriceReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotIndexPriceReq { + return plainToInstance(GetSpotIndexPriceReq, jsonObject); + } +} + +export class GetSpotIndexPriceReqBuilder { + obj: GetSpotIndexPriceReq = new GetSpotIndexPriceReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetSpotIndexPriceReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetSpotIndexPriceReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetSpotIndexPriceReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. + */ + setReverse(value: boolean): GetSpotIndexPriceReqBuilder { + this.obj.reverse = value; + return this; + } + + /** + * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. + */ + setOffset(value: number): GetSpotIndexPriceReqBuilder { + this.obj.offset = value; + return this; + } + + /** + * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default + */ + setForward(value: boolean): GetSpotIndexPriceReqBuilder { + this.obj.forward = value; + return this; + } + + /** + * Max record count. The default record count is 10, The maximum length cannot exceed 100 + */ + setMaxCount(value: number): GetSpotIndexPriceReqBuilder { + this.obj.maxCount = value; + return this; + } + + build(): GetSpotIndexPriceReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts new file mode 100644 index 00000000..3e47cb01 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetSpotIndexPriceDataList } from './model_get_spot_index_price_data_list'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSpotIndexPriceResp implements Response { + /** + * + */ + @Type(() => GetSpotIndexPriceDataList) + dataList?: Array; + /** + * Whether there are more pages + */ + hasMore?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSpotIndexPriceResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSpotIndexPriceResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSpotIndexPriceResp { + return plainToInstance(GetSpotIndexPriceResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_req.ts b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts new file mode 100644 index 00000000..3560f7dc --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSymbolReq implements Serializable { + /** + * Path Parameter. Symbol of the contract + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetSymbolReq` class. + * The builder pattern allows step-by-step construction of a `GetSymbolReq` object. + */ + static builder(): GetSymbolReqBuilder { + return new GetSymbolReqBuilder(); + } + + /** + * Creates a new instance of the `GetSymbolReq` class with the given data. + */ + static create(data: { + /** + * Path Parameter. Symbol of the contract + */ + symbol?: string; + }): GetSymbolReq { + let obj = new GetSymbolReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetSymbolReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolReq { + return plainToInstance(GetSymbolReq, jsonObject); + } +} + +export class GetSymbolReqBuilder { + obj: GetSymbolReq = new GetSymbolReq(); + /** + * Path Parameter. Symbol of the contract + */ + setSymbol(value: string): GetSymbolReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetSymbolReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts new file mode 100644 index 00000000..ad5c48fc --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts @@ -0,0 +1,332 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSymbolResp implements Response { + /** + * Symbol + */ + symbol?: string; + /** + * Contract group + */ + rootSymbol?: string; + /** + * Type of the contract + */ + type?: GetSymbolResp.TypeEnum; + /** + * First Open Date(millisecond) + */ + firstOpenDate?: number; + /** + * Expiration date(millisecond). Null means it will never expire + */ + expireDate?: number; + /** + * Settlement date(millisecond). Null indicates that automatic settlement is not supported + */ + settleDate?: number; + /** + * Base currency + */ + baseCurrency?: string; + /** + * Quote currency + */ + quoteCurrency?: string; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Maximum order quantity + */ + maxOrderQty?: number; + /** + * Maximum order price + */ + maxPrice?: number; + /** + * Minimum lot size + */ + lotSize?: number; + /** + * Minimum price changes + */ + tickSize?: number; + /** + * Index price of tick size + */ + indexPriceTickSize?: number; + /** + * The basic unit of the contract API is lots. For the number of coins in each lot, please refer to the param multiplier. For example, for XBTUSDTM, multiplier=0.001, which corresponds to the value of each XBTUSDTM contract being 0.001 BTC. There is also a special case. All coin-swap contracts, such as each XBTUSDM contract, correspond to 1 USD. + */ + multiplier?: number; + /** + * Initial margin requirement + */ + initialMargin?: number; + /** + * Maintenance margin requirement + */ + maintainMargin?: number; + /** + * Maximum risk limit (unit: XBT) + */ + maxRiskLimit?: number; + /** + * Minimum risk limit (unit: XBT) + */ + minRiskLimit?: number; + /** + * Risk limit increment value (unit: XBT) + */ + riskStep?: number; + /** + * Maker fee rate + */ + makerFeeRate?: number; + /** + * Taker fee rate + */ + takerFeeRate?: number; + /** + * Deprecated param + */ + takerFixFee?: number; + /** + * Deprecated param + */ + makerFixFee?: number; + /** + * Settlement fee + */ + settlementFee?: number; + /** + * Enabled ADL or not + */ + isDeleverage?: boolean; + /** + * Deprecated param + */ + isQuanto?: boolean; + /** + * Whether it is a reverse contract + */ + isInverse?: boolean; + /** + * Marking method + */ + markMethod?: GetSymbolResp.MarkMethodEnum; + /** + * Fair price marking method, The Futures contract is null + */ + fairMethod?: GetSymbolResp.FairMethodEnum; + /** + * Ticker symbol of the based currency + */ + fundingBaseSymbol?: string; + /** + * Ticker symbol of the quote currency + */ + fundingQuoteSymbol?: string; + /** + * Funding rate symbol + */ + fundingRateSymbol?: string; + /** + * Index symbol + */ + indexSymbol?: string; + /** + * Settlement Symbol + */ + settlementSymbol?: string; + /** + * Contract status + */ + status?: GetSymbolResp.StatusEnum; + /** + * Funding fee rate + */ + fundingFeeRate?: number; + /** + * Predicted funding fee rate + */ + predictedFundingFeeRate?: number; + /** + * Funding interval(millisecond) + */ + fundingRateGranularity?: number; + /** + * Open interest + */ + openInterest?: string; + /** + * 24-hour turnover + */ + turnoverOf24h?: number; + /** + * 24-hour volume + */ + volumeOf24h?: number; + /** + * Mark price + */ + markPrice?: number; + /** + * Index price + */ + indexPrice?: number; + /** + * Last trade price + */ + lastTradePrice?: number; + /** + * Next funding rate time(millisecond) + */ + nextFundingRateTime?: number; + /** + * Maximum leverage + */ + maxLeverage?: number; + /** + * The contract index price source exchange + */ + sourceExchanges?: Array; + /** + * Premium index symbol(1 minute) + */ + premiumsSymbol1M?: string; + /** + * Premium index symbol(8 hours) + */ + premiumsSymbol8H?: string; + /** + * Base currency interest rate symbol(1 minute) + */ + fundingBaseSymbol1M?: string; + /** + * Quote currency interest rate symbol(1 minute) + */ + fundingQuoteSymbol1M?: string; + /** + * 24-hour lowest price + */ + lowPrice?: number; + /** + * 24-hour highest price + */ + highPrice?: number; + /** + * 24-hour price change% + */ + priceChgPct?: number; + /** + * 24-hour price change + */ + priceChg?: number; + /** + * + */ + k?: number; + /** + * + */ + m?: number; + /** + * + */ + f?: number; + /** + * + */ + mmrLimit?: number; + /** + * + */ + mmrLevConstant?: number; + /** + * Whether support Cross Margin + */ + supportCross?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSymbolResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolResp { + return plainToInstance(GetSymbolResp, jsonObject); + } +} + +export namespace GetSymbolResp { + export enum TypeEnum { + /** + * Standardized swap contracts standard financial futures on swap, expiration swap funding rate + */ + FFWCSX = 'FFWCSX', + /** + * Futures Contract + */ + FFICSX = 'FFICSX', + } + export enum MarkMethodEnum { + /** + * Fair Price + */ + FAIRPRICE = 'FairPrice', + } + export enum FairMethodEnum { + /** + * FundingRate + */ + FUNDINGRATE = 'FundingRate', + } + export enum StatusEnum { + /** + * Initial + */ + INIT = 'Init', + /** + * Online + */ + OPEN = 'Open', + /** + * Setting + */ + BEINGSETTLED = 'BeingSettled', + /** + * Settled + */ + SETTLED = 'Settled', + /** + * Suspended + */ + PAUSED = 'Paused', + /** + * Offline + */ + CLOSED = 'Closed', + /** + * Orders can only be canceled + */ + CANCELONLY = 'CancelOnly', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts new file mode 100644 index 00000000..0ce82707 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTickerReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetTickerReq` class. + * The builder pattern allows step-by-step construction of a `GetTickerReq` object. + */ + static builder(): GetTickerReqBuilder { + return new GetTickerReqBuilder(); + } + + /** + * Creates a new instance of the `GetTickerReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetTickerReq { + let obj = new GetTickerReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetTickerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTickerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTickerReq { + return plainToInstance(GetTickerReq, jsonObject); + } +} + +export class GetTickerReqBuilder { + obj: GetTickerReq = new GetTickerReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetTickerReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetTickerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts new file mode 100644 index 00000000..a4db9ea7 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts @@ -0,0 +1,86 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTickerResp implements Response { + /** + * Sequence number, used to judge whether the messages pushed by Websocket is continuous. + */ + sequence?: number; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. + */ + side?: GetTickerResp.SideEnum; + /** + * Filled quantity + */ + size?: number; + /** + * Transaction ID + */ + tradeId?: string; + /** + * Filled price + */ + price?: string; + /** + * Best bid price + */ + bestBidPrice?: string; + /** + * Best bid size + */ + bestBidSize?: number; + /** + * Best ask price + */ + bestAskPrice?: string; + /** + * Best ask size + */ + bestAskSize?: number; + /** + * Filled time(nanosecond) + */ + ts?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTickerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTickerResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTickerResp { + return plainToInstance(GetTickerResp, jsonObject); + } +} + +export namespace GetTickerResp { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts new file mode 100644 index 00000000..757bd4c1 --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts @@ -0,0 +1,67 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryData implements Serializable { + /** + * Sequence number + */ + sequence?: number; + /** + * Deprecated param + */ + contractId?: number; + /** + * Transaction ID + */ + tradeId?: string; + /** + * Maker order ID + */ + makerOrderId?: string; + /** + * Taker order ID + */ + takerOrderId?: string; + /** + * Filled timestamp(nanosecond) + */ + ts?: number; + /** + * Filled amount + */ + size?: number; + /** + * Filled price + */ + price?: string; + /** + * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. + */ + side?: GetTradeHistoryData.SideEnum; + fromJson(input: string): GetTradeHistoryData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryData { + return plainToInstance(GetTradeHistoryData, jsonObject); + } +} + +export namespace GetTradeHistoryData { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts new file mode 100644 index 00000000..8b9dc8ef --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. + */ + static builder(): GetTradeHistoryReqBuilder { + return new GetTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetTradeHistoryReq { + let obj = new GetTradeHistoryReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToInstance(GetTradeHistoryReq, jsonObject); + } +} + +export class GetTradeHistoryReqBuilder { + obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts new file mode 100644 index 00000000..2e10640a --- /dev/null +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetTradeHistoryData } from './model_get_trade_history_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryResp implements Response { + /** + * + */ + @Type(() => GetTradeHistoryData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetTradeHistoryResp { + return plainToInstance(GetTradeHistoryResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/order/api_order.template b/sdk/node/src/generate/futures/order/api_order.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts new file mode 100644 index 00000000..72af28c7 --- /dev/null +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -0,0 +1,605 @@ +import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { GetRecentClosedOrdersReq } from './model_get_recent_closed_orders_req'; +import { GetStopOrderListResp } from './model_get_stop_order_list_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; +import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { CancelAllStopOrdersResp } from './model_cancel_all_stop_orders_resp'; +import { CancelAllOrdersV1Req } from './model_cancel_all_orders_v1_req'; +import { GetStopOrderListReq } from './model_get_stop_order_list_req'; +import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { CancelAllOrdersV3Resp } from './model_cancel_all_orders_v3_resp'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; +import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; +import { GetOrderListResp } from './model_get_order_list_resp'; +import { GetOrderListReq } from './model_get_order_list_req'; +import { CancelAllOrdersV3Req } from './model_cancel_all_orders_v3_req'; +import { BatchCancelOrdersResp } from './model_batch_cancel_orders_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelAllOrdersV1Resp } from './model_cancel_all_orders_v1_resp'; +import { AddOrderResp } from './model_add_order_resp'; +import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; +import { BatchAddOrdersReq } from './model_batch_add_orders_req'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { GetRecentTradeHistoryReq } from './model_get_recent_trade_history_req'; +import { GetRecentTradeHistoryResp } from './model_get_recent_trade_history_resp'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { CancelOrderByIdReq } from './model_cancel_order_by_id_req'; +import { GetRecentClosedOrdersResp } from './model_get_recent_closed_orders_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/fills + */ + let data = + '{"orderId": "236655147005071361", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "tradeTypes": "trade", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistory response test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/fills + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.04045854",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.040467",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOpenOrderValue request test', () => { + /** + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetOpenOrderValueReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOpenOrderValue response test', () => { + /** + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics + */ + let data = + '{\n "code": "200000",\n "data": {\n "openOrderBuySize": 1,\n "openOrderSellSize": 0,\n "openOrderBuyCost": "0.0001",\n "openOrderSellCost": "0",\n "settleCurrency": "USDT"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOpenOrderValueResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid + */ + let data = '{"clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByClientOid response test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "250444645610336256",\n "symbol": "XRPUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "1",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1732523858568,\n "updatedAt": 1732523858568,\n "endAt": null,\n "orderTime": 1732523858550892322,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} + */ + let data = '{"symbol": "XBTUSDTM", "clientOid": "example_string_default_value"}'; + let req = new CancelOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOid response test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "clientOid": "017485b0-2957-4681-8a14-5d46b35aee0d"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelAllOrdersV1 request test', () => { + /** + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new CancelAllOrdersV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelAllOrdersV1 response test', () => { + /** + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelAllOrdersV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderList request test', () => { + /** + * getOrderList + * Get Order List + * /api/v1/orders + */ + let data = + '{"status": "done", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 123456}'; + let req = new GetOrderListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderList response test', () => { + /** + * getOrderList + * Get Order List + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchCancelOrders request test', () => { + /** + * batchCancelOrders + * Batch Cancel Orders + * /api/v1/orders/multi-cancel + */ + let data = '{"orderIdsList": ["250445104152670209", "250445181751463936"]}'; + let req = new BatchCancelOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchCancelOrders response test', () => { + /** + * batchCancelOrders + * Batch Cancel Orders + * /api/v1/orders/multi-cancel + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "orderId": "250445104152670209",\n "clientOid": null,\n "code": "200",\n "msg": "success"\n },\n {\n "orderId": "250445181751463936",\n "clientOid": null,\n "code": "200",\n "msg": "success"\n }\n ]\n}\n'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchCancelOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchAddOrders request test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi + */ + let data = + '[{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}, {"clientOid": "5c52e11203aa677f33e493fc", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}]'; + let req = new BatchAddOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchAddOrders response test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "orderId": "235919387779985408",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n },\n {\n "orderId": "235919387855482880",\n "clientOid": "5c52e11203aa677f33e493fc",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchAddOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderById request test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} + */ + let data = '{"orderId": "example_string_default_value"}'; + let req = new CancelOrderByIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderById response test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235303670076489728"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/orders/{order-id} + */ + let data = '{"order-id": "236655147005071361"}'; + let req = new GetOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByOrderId response test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/orders/{order-id} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "236655147005071361",\n "symbol": "XBTUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "0.0001",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1729236185949,\n "updatedAt": 1729236185949,\n "endAt": null,\n "orderTime": 1729236185885647952,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/orders + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrder response test', () => { + /** + * addOrder + * Add Order + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/orders/test + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderTestReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTest response test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/orders/test + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRecentClosedOrders request test', () => { + /** + * getRecentClosedOrders + * Get Recent Closed Orders + * /api/v1/recentDoneOrders + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetRecentClosedOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRecentClosedOrders response test', () => { + /** + * getRecentClosedOrders + * Get Recent Closed Orders + * /api/v1/recentDoneOrders + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "236387137732231168",\n "symbol": "XRPUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "5.51",\n "dealValue": "5.511",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "10.0",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "16698fe6-2746-4aeb-a7fa-61f633ab6090",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729172287496,\n "updatedAt": 1729172287568,\n "endAt": 1729172287568,\n "orderTime": 1729172287496950800,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0.5511",\n "filledSize": 1,\n "filledValue": "5.511",\n "status": "done",\n "reduceOnly": false\n },\n {\n "id": "236317213710184449",\n "symbol": "XBTUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "67.4309",\n "dealValue": "67.4309",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729155616310,\n "updatedAt": 1729155616324,\n "endAt": 1729155616324,\n "orderTime": 1729155616310180400,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "67430.9",\n "filledSize": 1,\n "filledValue": "67.4309",\n "status": "done",\n "reduceOnly": false\n },\n {\n "id": "236317094436728832",\n "symbol": "XBTUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "67.445",\n "dealValue": "67.445",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729155587873,\n "updatedAt": 1729155587946,\n "endAt": 1729155587946,\n "orderTime": 1729155587873332000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "67445.0",\n "filledSize": 1,\n "filledValue": "67.445",\n "status": "done",\n "reduceOnly": false\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRecentClosedOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRecentTradeHistory request test', () => { + /** + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetRecentTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRecentTradeHistory response test', () => { + /** + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.04045854",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.040467",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRecentTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addTPSLOrder request test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; + let req = new AddTPSLOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addTPSLOrder response test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddTPSLOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelAllStopOrders request test', () => { + /** + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new CancelAllStopOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelAllStopOrders response test', () => { + /** + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelAllStopOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getStopOrderList request test', () => { + /** + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders + */ + let data = + '{"symbol": "XBTUSDTM", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 50}'; + let req = new GetStopOrderListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getStopOrderList response test', () => { + /** + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetStopOrderListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelAllOrdersV3 request test', () => { + /** + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new CancelAllOrdersV3Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelAllOrdersV3 response test', () => { + /** + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelAllOrdersV3Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/futures/order/api_order.ts b/sdk/node/src/generate/futures/order/api_order.ts new file mode 100644 index 00000000..8f5dd44b --- /dev/null +++ b/sdk/node/src/generate/futures/order/api_order.ts @@ -0,0 +1,550 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { GetRecentClosedOrdersReq } from './model_get_recent_closed_orders_req'; +import { GetStopOrderListResp } from './model_get_stop_order_list_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; +import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { CancelAllStopOrdersResp } from './model_cancel_all_stop_orders_resp'; +import { CancelAllOrdersV1Req } from './model_cancel_all_orders_v1_req'; +import { GetStopOrderListReq } from './model_get_stop_order_list_req'; +import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { CancelAllOrdersV3Resp } from './model_cancel_all_orders_v3_resp'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; +import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; +import { GetOrderListResp } from './model_get_order_list_resp'; +import { GetOrderListReq } from './model_get_order_list_req'; +import { CancelAllOrdersV3Req } from './model_cancel_all_orders_v3_req'; +import { BatchCancelOrdersResp } from './model_batch_cancel_orders_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelAllOrdersV1Resp } from './model_cancel_all_orders_v1_resp'; +import { AddOrderResp } from './model_add_order_resp'; +import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; +import { BatchAddOrdersReq } from './model_batch_add_orders_req'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { GetRecentTradeHistoryReq } from './model_get_recent_trade_history_req'; +import { GetRecentTradeHistoryResp } from './model_get_recent_trade_history_resp'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { CancelOrderByIdReq } from './model_cancel_order_by_id_req'; +import { GetRecentClosedOrdersResp } from './model_get_recent_closed_orders_resp'; + +export interface OrderAPI { + /** + * getTradeHistory Get Trade History + * Description: Get a list of recent fills. If you need to get your recent trade history with low latency, please query endpoint Get List of Orders Completed in 24h. The requested data is not real-time. + * Documentation: https://www.kucoin.com/docs-new/api-3470248 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getTradeHistory(req: GetTradeHistoryReq): Promise; + + /** + * getOpenOrderValue Get Open Order Value + * Description: You can query this endpoint to get the the total number and value of the all your active orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470250 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getOpenOrderValue(req: GetOpenOrderValueReq): Promise; + + /** + * getOrderByClientOid Get Order By ClientOid + * Description: Get a single order by client order id (including a stop order). + * Documentation: https://www.kucoin.com/docs-new/api-3470352 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + + /** + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: Cancel order by client defined orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470240 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + + /** + * @deprecated + * cancelAllOrdersV1 Cancel All Orders - V1 + * Description: Cancel all open orders (excluding stop orders). The response is a list of orderIDs of the canceled orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470362 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 200 | + * +---------------------+---------+ + */ + cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise; + + /** + * getOrderList Get Order List + * Description: List your current orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470244 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOrderList(req: GetOrderListReq): Promise; + + /** + * batchCancelOrders Batch Cancel Orders + * Description: Cancel a bach of orders by client defined orderId or system generated orderId + * Documentation: https://www.kucoin.com/docs-new/api-3470241 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + batchCancelOrders(req: BatchCancelOrdersReq): Promise; + + /** + * batchAddOrders Batch Add Orders + * Description: Place multiple order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. You can place up to 20 orders at one time, including limit orders, market orders, and stop orders Please be noted that the system would hold the fees from the orders entered the orderbook in advance. + * Documentation: https://www.kucoin.com/docs-new/api-3470236 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + batchAddOrders(req: BatchAddOrdersReq): Promise; + + /** + * cancelOrderById Cancel Order By OrderId + * Description: Cancel order by system generated orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470239 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderById(req: CancelOrderByIdReq): Promise; + + /** + * getOrderByOrderId Get Order By OrderId + * Description: Get a single order by order id (including a stop order). + * Documentation: https://www.kucoin.com/docs-new/api-3470245 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; + + /** + * addOrder Add Order + * Description: Place order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470235 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addOrder(req: AddOrderReq): Promise; + + /** + * addOrderTest Add Order Test + * Description: Place order to the futures trading system just for validation + * Documentation: https://www.kucoin.com/docs-new/api-3470238 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addOrderTest(req: AddOrderTestReq): Promise; + + /** + * getRecentClosedOrders Get Recent Closed Orders + * Description: Get a list of recent 1000 closed orders in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. + * Documentation: https://www.kucoin.com/docs-new/api-3470246 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; + + /** + * getRecentTradeHistory Get Recent Trade History + * Description: Get a list of recent 1000 fills in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. + * Documentation: https://www.kucoin.com/docs-new/api-3470249 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise; + + /** + * addTPSLOrder Add Take Profit And Stop Loss Order + * Description: Place take profit and stop loss order supports both take-profit and stop-loss functions, and other functions are exactly the same as the place order interface. + * Documentation: https://www.kucoin.com/docs-new/api-3470237 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addTPSLOrder(req: AddTPSLOrderReq): Promise; + + /** + * cancelAllStopOrders Cancel All Stop orders + * Description: Cancel all untriggered stop orders. The response is a list of orderIDs of the canceled stop orders. To cancel triggered stop orders, please use \'Cancel Multiple Futures Limit orders\'. + * Documentation: https://www.kucoin.com/docs-new/api-3470243 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise; + + /** + * getStopOrderList Get Stop Order List + * Description: Get the un-triggered stop orders list. Stop orders that have been triggered can be queried through the general order interface + * Documentation: https://www.kucoin.com/docs-new/api-3470247 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 6 | + * +---------------------+---------+ + */ + getStopOrderList(req: GetStopOrderListReq): Promise; + + /** + * cancelAllOrdersV3 Cancel All Orders + * Description: Cancel all open orders (excluding stop orders). The response is a list of orderIDs of the canceled orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470242 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 30 | + * +---------------------+---------+ + */ + cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise; +} + +export class OrderAPIImpl implements OrderAPI { + constructor(private transport: Transport) {} + + getTradeHistory(req: GetTradeHistoryReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/fills', + req, + new GetTradeHistoryResp(), + false, + ); + } + + getOpenOrderValue(req: GetOpenOrderValueReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/openOrderStatistics', + req, + new GetOpenOrderValueResp(), + false, + ); + } + + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/orders/byClientOid', + req, + new GetOrderByClientOidResp(), + false, + ); + } + + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/orders/client-order/{clientOid}', + req, + new CancelOrderByClientOidResp(), + false, + ); + } + + cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/orders', + req, + new CancelAllOrdersV1Resp(), + false, + ); + } + + getOrderList(req: GetOrderListReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/orders', + req, + new GetOrderListResp(), + false, + ); + } + + batchCancelOrders(req: BatchCancelOrdersReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/orders/multi-cancel', + req, + new BatchCancelOrdersResp(), + true, + ); + } + + batchAddOrders(req: BatchAddOrdersReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/orders/multi', + req, + new BatchAddOrdersResp(), + false, + ); + } + + cancelOrderById(req: CancelOrderByIdReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/orders/{orderId}', + req, + new CancelOrderByIdResp(), + false, + ); + } + + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/orders/{order-id}', + req, + new GetOrderByOrderIdResp(), + false, + ); + } + + addOrder(req: AddOrderReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/orders', + req, + new AddOrderResp(), + false, + ); + } + + addOrderTest(req: AddOrderTestReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/orders/test', + req, + new AddOrderTestResp(), + false, + ); + } + + getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/recentDoneOrders', + req, + new GetRecentClosedOrdersResp(), + false, + ); + } + + getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/recentFills', + req, + new GetRecentTradeHistoryResp(), + false, + ); + } + + addTPSLOrder(req: AddTPSLOrderReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/st-orders', + req, + new AddTPSLOrderResp(), + false, + ); + } + + cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/stopOrders', + req, + new CancelAllStopOrdersResp(), + false, + ); + } + + getStopOrderList(req: GetStopOrderListReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/stopOrders', + req, + new GetStopOrderListResp(), + false, + ); + } + + cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v3/orders', + req, + new CancelAllOrdersV3Resp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_order_req.ts b/sdk/node/src/generate/futures/order/model_add_order_req.ts new file mode 100644 index 00000000..23fc2d6b --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_order_req.ts @@ -0,0 +1,515 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddOrderReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderReq.MarginModeEnum = AddOrderReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + + /** + * Creates a new instance of the `AddOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderReq` object. + */ + static builder(): AddOrderReqBuilder { + return new AddOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddOrderReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + }): AddOrderReq { + let obj = new AddOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stop = data.stop; + obj.stopPriceType = data.stopPriceType; + obj.stopPrice = data.stopPrice; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.stp = data.stp; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.qty = data.qty; + obj.valueQty = data.valueQty; + return obj; + } + + fromJson(input: string): AddOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderReq { + return plainToInstance(AddOrderReq, jsonObject); + } +} + +export namespace AddOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice. + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum StpEnum { + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddOrderReqBuilder { + obj: AddOrderReq = new AddOrderReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderReq.SideEnum): AddOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddOrderReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + setStop(value: AddOrderReq.StopEnum): AddOrderReqBuilder { + this.obj.stop = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + setStopPriceType(value: AddOrderReq.StopPriceTypeEnum): AddOrderReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * Need to be defined if stop is specified. + */ + setStopPrice(value: string): AddOrderReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddOrderReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddOrderReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddOrderReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + setStp(value: AddOrderReq.StpEnum): AddOrderReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddOrderReq.MarginModeEnum): AddOrderReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddOrderReq.TimeInForceEnum): AddOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setQty(value: string): AddOrderReqBuilder { + this.obj.qty = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setValueQty(value: string): AddOrderReqBuilder { + this.obj.valueQty = value; + return this; + } + + build(): AddOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_resp.ts new file mode 100644 index 00000000..de72a007 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderResp { + return plainToInstance(AddOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts new file mode 100644 index 00000000..b0cd31a6 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts @@ -0,0 +1,516 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderTestReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderTestReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderTestReq.MarginModeEnum = AddOrderTestReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum = + AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + + /** + * Creates a new instance of the `AddOrderTestReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. + */ + static builder(): AddOrderTestReqBuilder { + return new AddOrderTestReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderTestReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderTestReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderTestReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + }): AddOrderTestReq { + let obj = new AddOrderTestReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stop = data.stop; + obj.stopPriceType = data.stopPriceType; + obj.stopPrice = data.stopPrice; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.stp = data.stp; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.qty = data.qty; + obj.valueQty = data.valueQty; + return obj; + } + + fromJson(input: string): AddOrderTestReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestReq { + return plainToInstance(AddOrderTestReq, jsonObject); + } +} + +export namespace AddOrderTestReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice. + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum StpEnum { + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum MarginModeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddOrderTestReqBuilder { + obj: AddOrderTestReq = new AddOrderTestReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddOrderTestReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestReq.SideEnum): AddOrderTestReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddOrderTestReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddOrderTestReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddOrderTestReq.TypeEnum): AddOrderTestReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddOrderTestReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + setStop(value: AddOrderTestReq.StopEnum): AddOrderTestReqBuilder { + this.obj.stop = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + setStopPriceType(value: AddOrderTestReq.StopPriceTypeEnum): AddOrderTestReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * Need to be defined if stop is specified. + */ + setStopPrice(value: string): AddOrderTestReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddOrderTestReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddOrderTestReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + setStp(value: AddOrderTestReq.StpEnum): AddOrderTestReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddOrderTestReq.MarginModeEnum): AddOrderTestReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddOrderTestReqBuilder { + this.obj.price = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddOrderTestReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddOrderTestReq.TimeInForceEnum): AddOrderTestReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddOrderTestReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddOrderTestReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddOrderTestReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setQty(value: string): AddOrderTestReqBuilder { + this.obj.qty = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setValueQty(value: string): AddOrderTestReqBuilder { + this.obj.valueQty = value; + return this; + } + + build(): AddOrderTestReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts new file mode 100644 index 00000000..c6cd3a89 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderTestResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestResp { + return plainToInstance(AddOrderTestResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts new file mode 100644 index 00000000..acbe5cf8 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts @@ -0,0 +1,506 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddTPSLOrderReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddTPSLOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddTPSLOrderReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddTPSLOrderReq.MarginModeEnum = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddTPSLOrderReq.TimeInForceEnum = + AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * Take profit price + */ + triggerStopUpPrice?: string; + /** + * Stop loss price + */ + triggerStopDownPrice?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + + /** + * Creates a new instance of the `AddTPSLOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddTPSLOrderReq` object. + */ + static builder(): AddTPSLOrderReqBuilder { + return new AddTPSLOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddTPSLOrderReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddTPSLOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddTPSLOrderReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: AddTPSLOrderReq.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddTPSLOrderReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddTPSLOrderReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * Take profit price + */ + triggerStopUpPrice?: string; + /** + * Stop loss price + */ + triggerStopDownPrice?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + }): AddTPSLOrderReq { + let obj = new AddTPSLOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stopPriceType = data.stopPriceType; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.stp = data.stp; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.triggerStopUpPrice = data.triggerStopUpPrice; + obj.triggerStopDownPrice = data.triggerStopDownPrice; + obj.qty = data.qty; + obj.valueQty = data.valueQty; + return obj; + } + + fromJson(input: string): AddTPSLOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddTPSLOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddTPSLOrderReq { + return plainToInstance(AddTPSLOrderReq, jsonObject); + } +} + +export namespace AddTPSLOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit order + */ + LIMIT = 'limit', + /** + * market order + */ + MARKET = 'market', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum StpEnum { + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum MarginModeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddTPSLOrderReqBuilder { + obj: AddTPSLOrderReq = new AddTPSLOrderReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddTPSLOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddTPSLOrderReq.SideEnum): AddTPSLOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddTPSLOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddTPSLOrderReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddTPSLOrderReq.TypeEnum): AddTPSLOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddTPSLOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + setStopPriceType(value: AddTPSLOrderReq.StopPriceTypeEnum): AddTPSLOrderReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddTPSLOrderReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddTPSLOrderReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddTPSLOrderReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + setStp(value: AddTPSLOrderReq.StpEnum): AddTPSLOrderReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddTPSLOrderReq.MarginModeEnum): AddTPSLOrderReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddTPSLOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddTPSLOrderReq.TimeInForceEnum): AddTPSLOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddTPSLOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddTPSLOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddTPSLOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddTPSLOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Take profit price + */ + setTriggerStopUpPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.triggerStopUpPrice = value; + return this; + } + + /** + * Stop loss price + */ + setTriggerStopDownPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.triggerStopDownPrice = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setQty(value: string): AddTPSLOrderReqBuilder { + this.obj.qty = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setValueQty(value: string): AddTPSLOrderReqBuilder { + this.obj.valueQty = value; + return this; + } + + build(): AddTPSLOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts new file mode 100644 index 00000000..eb702e85 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddTPSLOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddTPSLOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddTPSLOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddTPSLOrderResp { + return plainToInstance(AddTPSLOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts new file mode 100644 index 00000000..8df4b71f --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts @@ -0,0 +1,38 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersData implements Serializable { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * + */ + code?: string; + /** + * + */ + msg?: string; + fromJson(input: string): BatchAddOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersData { + return plainToInstance(BatchAddOrdersData, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts new file mode 100644 index 00000000..da62a0d4 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts @@ -0,0 +1,516 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersItem implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersItem.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: BatchAddOrdersItem.TypeEnum = BatchAddOrdersItem.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: BatchAddOrdersItem.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: BatchAddOrdersItem.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: BatchAddOrdersItem.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: BatchAddOrdersItem.MarginModeEnum = BatchAddOrdersItem.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: BatchAddOrdersItem.TimeInForceEnum = + BatchAddOrdersItem.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + + /** + * Creates a new instance of the `BatchAddOrdersItem` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersItem` object. + */ + static builder(): BatchAddOrdersItemBuilder { + return new BatchAddOrdersItemBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersItem` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersItem.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: BatchAddOrdersItem.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: BatchAddOrdersItem.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: BatchAddOrdersItem.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: BatchAddOrdersItem.StpEnum; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: BatchAddOrdersItem.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: BatchAddOrdersItem.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + qty?: string; + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + valueQty?: string; + }): BatchAddOrdersItem { + let obj = new BatchAddOrdersItem(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stop = data.stop; + obj.stopPriceType = data.stopPriceType; + obj.stopPrice = data.stopPrice; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.stp = data.stp; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.qty = data.qty; + obj.valueQty = data.valueQty; + return obj; + } + + fromJson(input: string): BatchAddOrdersItem { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersItem, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersItem { + return plainToInstance(BatchAddOrdersItem, jsonObject); + } +} + +export namespace BatchAddOrdersItem { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice. + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum StpEnum { + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum MarginModeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class BatchAddOrdersItemBuilder { + obj: BatchAddOrdersItem = new BatchAddOrdersItem(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): BatchAddOrdersItemBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: BatchAddOrdersItem.SideEnum): BatchAddOrdersItemBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) + */ + setSymbol(value: string): BatchAddOrdersItemBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): BatchAddOrdersItemBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: BatchAddOrdersItem.TypeEnum): BatchAddOrdersItemBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): BatchAddOrdersItemBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + setStop(value: BatchAddOrdersItem.StopEnum): BatchAddOrdersItemBuilder { + this.obj.stop = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + setStopPriceType(value: BatchAddOrdersItem.StopPriceTypeEnum): BatchAddOrdersItemBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * Need to be defined if stop is specified. + */ + setStopPrice(value: string): BatchAddOrdersItemBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): BatchAddOrdersItemBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): BatchAddOrdersItemBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): BatchAddOrdersItemBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + setStp(value: BatchAddOrdersItem.StpEnum): BatchAddOrdersItemBuilder { + this.obj.stp = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: BatchAddOrdersItem.MarginModeEnum): BatchAddOrdersItemBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): BatchAddOrdersItemBuilder { + this.obj.price = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): BatchAddOrdersItemBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: BatchAddOrdersItem.TimeInForceEnum): BatchAddOrdersItemBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): BatchAddOrdersItemBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): BatchAddOrdersItemBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): BatchAddOrdersItemBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): BatchAddOrdersItemBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setQty(value: string): BatchAddOrdersItemBuilder { + this.obj.qty = value; + return this; + } + + /** + * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported + */ + setValueQty(value: string): BatchAddOrdersItemBuilder { + this.obj.valueQty = value; + return this; + } + + build(): BatchAddOrdersItem { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts new file mode 100644 index 00000000..7b939128 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchAddOrdersItem } from './model_batch_add_orders_item'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersReq implements Serializable { + /** + * + */ + @Type(() => BatchAddOrdersItem) + items?: Array; + + /** + * Creates a new instance of the `BatchAddOrdersReq` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersReq` object. + */ + static builder(): BatchAddOrdersReqBuilder { + return new BatchAddOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersReq` class with the given data. + */ + static create(data: { + /** + * + */ + items?: Array; + }): BatchAddOrdersReq { + let obj = new BatchAddOrdersReq(); + obj.items = data.items; + return obj; + } + + fromJson(input: string): BatchAddOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersReq, { items: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.items)); + } + + fromObject(jsonObject: Object): BatchAddOrdersReq { + return plainToInstance(BatchAddOrdersReq, { items: jsonObject }); + } +} + +export class BatchAddOrdersReqBuilder { + obj: BatchAddOrdersReq = new BatchAddOrdersReq(); + /** + * + */ + setItems(value: Array): BatchAddOrdersReqBuilder { + this.obj.items = value; + return this; + } + + build(): BatchAddOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts new file mode 100644 index 00000000..cf7ed011 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { BatchAddOrdersData } from './model_batch_add_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchAddOrdersResp implements Response { + /** + * + */ + @Type(() => BatchAddOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchAddOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): BatchAddOrdersResp { + return plainToInstance(BatchAddOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts new file mode 100644 index 00000000..f32f80b9 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelOrdersClientOidsList + implements Serializable +{ + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * + */ + clientOid?: string; + + /** + * Creates a new instance of the `BatchCancelOrdersClientOidsList` class. + * The builder pattern allows step-by-step construction of a `BatchCancelOrdersClientOidsList` object. + */ + static builder(): BatchCancelOrdersClientOidsListBuilder { + return new BatchCancelOrdersClientOidsListBuilder(); + } + + /** + * Creates a new instance of the `BatchCancelOrdersClientOidsList` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * + */ + clientOid?: string; + }): BatchCancelOrdersClientOidsList { + let obj = new BatchCancelOrdersClientOidsList(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): BatchCancelOrdersClientOidsList { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrdersClientOidsList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOrdersClientOidsList { + return plainToInstance(BatchCancelOrdersClientOidsList, jsonObject); + } +} + +export class BatchCancelOrdersClientOidsListBuilder { + obj: BatchCancelOrdersClientOidsList = new BatchCancelOrdersClientOidsList(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): BatchCancelOrdersClientOidsListBuilder { + this.obj.symbol = value; + return this; + } + + /** + * + */ + setClientOid(value: string): BatchCancelOrdersClientOidsListBuilder { + this.obj.clientOid = value; + return this; + } + + build(): BatchCancelOrdersClientOidsList { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts new file mode 100644 index 00000000..b1be0315 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelOrdersData implements Serializable { + /** + * + */ + orderId?: string; + /** + * + */ + clientOid?: string; + /** + * + */ + code?: string; + /** + * + */ + msg?: string; + fromJson(input: string): BatchCancelOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOrdersData { + return plainToInstance(BatchCancelOrdersData, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts new file mode 100644 index 00000000..7f574978 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchCancelOrdersClientOidsList } from './model_batch_cancel_orders_client_oids_list'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelOrdersReq implements Serializable { + /** + * the list of orderId + */ + orderIdsList?: Array; + /** + * the list of client orderId + */ + @Type(() => BatchCancelOrdersClientOidsList) + clientOidsList?: Array; + + /** + * Creates a new instance of the `BatchCancelOrdersReq` class. + * The builder pattern allows step-by-step construction of a `BatchCancelOrdersReq` object. + */ + static builder(): BatchCancelOrdersReqBuilder { + return new BatchCancelOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `BatchCancelOrdersReq` class with the given data. + */ + static create(data: { + /** + * the list of orderId + */ + orderIdsList?: Array; + /** + * the list of client orderId + */ + clientOidsList?: Array; + }): BatchCancelOrdersReq { + let obj = new BatchCancelOrdersReq(); + obj.orderIdsList = data.orderIdsList; + obj.clientOidsList = data.clientOidsList; + return obj; + } + + fromJson(input: string): BatchCancelOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOrdersReq { + return plainToInstance(BatchCancelOrdersReq, jsonObject); + } +} + +export class BatchCancelOrdersReqBuilder { + obj: BatchCancelOrdersReq = new BatchCancelOrdersReq(); + /** + * the list of orderId + */ + setOrderIdsList(value: Array): BatchCancelOrdersReqBuilder { + this.obj.orderIdsList = value; + return this; + } + + /** + * the list of client orderId + */ + setClientOidsList(value: Array): BatchCancelOrdersReqBuilder { + this.obj.clientOidsList = value; + return this; + } + + build(): BatchCancelOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts new file mode 100644 index 00000000..11b2133c --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { BatchCancelOrdersData } from './model_batch_cancel_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchCancelOrdersResp implements Response { + /** + * + */ + @Type(() => BatchCancelOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchCancelOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): BatchCancelOrdersResp { + return plainToInstance(BatchCancelOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts new file mode 100644 index 00000000..97f93475 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllOrdersV1Req implements Serializable { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelAllOrdersV1Req` class. + * The builder pattern allows step-by-step construction of a `CancelAllOrdersV1Req` object. + */ + static builder(): CancelAllOrdersV1ReqBuilder { + return new CancelAllOrdersV1ReqBuilder(); + } + + /** + * Creates a new instance of the `CancelAllOrdersV1Req` class with the given data. + */ + static create(data: { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): CancelAllOrdersV1Req { + let obj = new CancelAllOrdersV1Req(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelAllOrdersV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersV1Req { + return plainToInstance(CancelAllOrdersV1Req, jsonObject); + } +} + +export class CancelAllOrdersV1ReqBuilder { + obj: CancelAllOrdersV1Req = new CancelAllOrdersV1Req(); + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): CancelAllOrdersV1ReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelAllOrdersV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts new file mode 100644 index 00000000..164ad346 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllOrdersV1Resp implements Response { + /** + * Unique ID of the cancelled order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllOrdersV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersV1Resp { + return plainToInstance(CancelAllOrdersV1Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts new file mode 100644 index 00000000..b9845f1f --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllOrdersV3Req implements Serializable { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelAllOrdersV3Req` class. + * The builder pattern allows step-by-step construction of a `CancelAllOrdersV3Req` object. + */ + static builder(): CancelAllOrdersV3ReqBuilder { + return new CancelAllOrdersV3ReqBuilder(); + } + + /** + * Creates a new instance of the `CancelAllOrdersV3Req` class with the given data. + */ + static create(data: { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): CancelAllOrdersV3Req { + let obj = new CancelAllOrdersV3Req(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelAllOrdersV3Req { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersV3Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersV3Req { + return plainToInstance(CancelAllOrdersV3Req, jsonObject); + } +} + +export class CancelAllOrdersV3ReqBuilder { + obj: CancelAllOrdersV3Req = new CancelAllOrdersV3Req(); + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): CancelAllOrdersV3ReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelAllOrdersV3Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts new file mode 100644 index 00000000..028ff08a --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllOrdersV3Resp implements Response { + /** + * Unique ID of the cancelled order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllOrdersV3Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersV3Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersV3Resp { + return plainToInstance(CancelAllOrdersV3Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts new file mode 100644 index 00000000..53622d2d --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllStopOrdersReq implements Serializable { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelAllStopOrdersReq` class. + * The builder pattern allows step-by-step construction of a `CancelAllStopOrdersReq` object. + */ + static builder(): CancelAllStopOrdersReqBuilder { + return new CancelAllStopOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `CancelAllStopOrdersReq` class with the given data. + */ + static create(data: { + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): CancelAllStopOrdersReq { + let obj = new CancelAllStopOrdersReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelAllStopOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllStopOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllStopOrdersReq { + return plainToInstance(CancelAllStopOrdersReq, jsonObject); + } +} + +export class CancelAllStopOrdersReqBuilder { + obj: CancelAllStopOrdersReq = new CancelAllStopOrdersReq(); + /** + * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): CancelAllStopOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelAllStopOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts new file mode 100644 index 00000000..243d1027 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllStopOrdersResp implements Response { + /** + * Unique ID of the cancelled order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllStopOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllStopOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllStopOrdersResp { + return plainToInstance(CancelAllStopOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts new file mode 100644 index 00000000..0cf42585 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByClientOidReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * client order id + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. + */ + static builder(): CancelOrderByClientOidReqBuilder { + return new CancelOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * client order id + */ + clientOid?: string; + }): CancelOrderByClientOidReq { + let obj = new CancelOrderByClientOidReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidReq { + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } +} + +export class CancelOrderByClientOidReqBuilder { + obj: CancelOrderByClientOidReq = new CancelOrderByClientOidReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): CancelOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * client order id + */ + setClientOid(value: string): CancelOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): CancelOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts new file mode 100644 index 00000000..84e88720 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByClientOidResp + implements Response +{ + /** + * + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts new file mode 100644 index 00000000..cd929f51 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByIdReq implements Serializable { + /** + * + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `CancelOrderByIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByIdReq` object. + */ + static builder(): CancelOrderByIdReqBuilder { + return new CancelOrderByIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByIdReq` class with the given data. + */ + static create(data: { + /** + * + */ + orderId?: string; + }): CancelOrderByIdReq { + let obj = new CancelOrderByIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): CancelOrderByIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByIdReq { + return plainToInstance(CancelOrderByIdReq, jsonObject); + } +} + +export class CancelOrderByIdReqBuilder { + obj: CancelOrderByIdReq = new CancelOrderByIdReq(); + /** + * + */ + setOrderId(value: string): CancelOrderByIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): CancelOrderByIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts new file mode 100644 index 00000000..effa9c9a --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByIdResp implements Response { + /** + * The orderId that is to be canceled + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByIdResp { + return plainToInstance(CancelOrderByIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts new file mode 100644 index 00000000..a1011d29 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOpenOrderValueReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetOpenOrderValueReq` class. + * The builder pattern allows step-by-step construction of a `GetOpenOrderValueReq` object. + */ + static builder(): GetOpenOrderValueReqBuilder { + return new GetOpenOrderValueReqBuilder(); + } + + /** + * Creates a new instance of the `GetOpenOrderValueReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetOpenOrderValueReq { + let obj = new GetOpenOrderValueReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetOpenOrderValueReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrderValueReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrderValueReq { + return plainToInstance(GetOpenOrderValueReq, jsonObject); + } +} + +export class GetOpenOrderValueReqBuilder { + obj: GetOpenOrderValueReq = new GetOpenOrderValueReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetOpenOrderValueReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetOpenOrderValueReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts new file mode 100644 index 00000000..04785883 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOpenOrderValueResp implements Response { + /** + * Total number of the unexecuted buy orders + */ + openOrderBuySize?: number; + /** + * Total number of the unexecuted sell orders + */ + openOrderSellSize?: number; + /** + * Value of all the unexecuted buy orders + */ + openOrderBuyCost?: string; + /** + * Value of all the unexecuted sell orders + */ + openOrderSellCost?: string; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOpenOrderValueResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrderValueResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrderValueResp { + return plainToInstance(GetOpenOrderValueResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts new file mode 100644 index 00000000..42d2baff --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByClientOidReq implements Serializable { + /** + * The user self-defined order id. + */ + clientOid?: string; + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. + */ + static builder(): GetOrderByClientOidReqBuilder { + return new GetOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * The user self-defined order id. + */ + clientOid?: string; + }): GetOrderByClientOidReq { + let obj = new GetOrderByClientOidReq(); + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): GetOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidReq { + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } +} + +export class GetOrderByClientOidReqBuilder { + obj: GetOrderByClientOidReq = new GetOrderByClientOidReq(); + /** + * The user self-defined order id. + */ + setClientOid(value: string): GetOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): GetOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts new file mode 100644 index 00000000..94dd7176 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts @@ -0,0 +1,260 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByClientOidResp implements Response { + /** + * Order ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order type, market order or limit order + */ + type?: GetOrderByClientOidResp.TypeEnum; + /** + * Transaction side + */ + side?: GetOrderByClientOidResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order quantity + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Executed size of funds + */ + dealValue?: string; + /** + * Executed quantity + */ + dealSize?: number; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: GetOrderByClientOidResp.StpEnum; + /** + * Stop order type (stop limit or stop market) + */ + stop?: string; + /** + * Trigger price type of stop orders + */ + stopPriceType?: GetOrderByClientOidResp.StopPriceTypeEnum; + /** + * Mark to show whether the stop order is triggered + */ + stopTriggered?: boolean; + /** + * Trigger price of stop orders + */ + stopPrice?: number; + /** + * Time in force policy type + */ + timeInForce?: string; + /** + * Mark of post only + */ + postOnly?: boolean; + /** + * Mark of the hidden order + */ + hidden?: boolean; + /** + * Mark of the iceberg order + */ + iceberg?: boolean; + /** + * Leverage of the order + */ + leverage?: string; + /** + * A mark to forcely hold the funds for an order + */ + forceHold?: boolean; + /** + * A mark to close the position + */ + closeOrder?: boolean; + /** + * Visible size of the iceberg order + */ + visibleSize?: number; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + /** + * Remark + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Mark of the active orders + */ + isActive?: boolean; + /** + * Mark of the canceled orders + */ + cancelExist?: boolean; + /** + * Time the order created + */ + createdAt?: number; + /** + * last update time + */ + updatedAt?: number; + /** + * Order Endtime + */ + endAt?: number; + /** + * Order create time in nanosecond + */ + orderTime?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetOrderByClientOidResp.MarginModeEnum; + /** + * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier + */ + avgDealPrice?: string; + /** + * Value of the executed orders + */ + filledSize?: number; + /** + * Executed order quantity + */ + filledValue?: string; + /** + * order status: “open” or “done” + */ + status?: GetOrderByClientOidResp.StatusEnum; + /** + * A mark to reduce the position size only + */ + reduceOnly?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidResp { + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } +} + +export namespace GetOrderByClientOidResp { + export enum TypeEnum { + /** + * Market Order + */ + MARKET = 'market', + /** + * Limit Order + */ + LIMIT = 'limit', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * None + */ + NULL = '', + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum StopPriceTypeEnum { + /** + * None + */ + NULL = '', + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum MarginModeEnum { + /** + * Cross margin + */ + CROSS = 'CROSS', + /** + * Isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum StatusEnum { + /** + * open order + */ + OPEN = 'open', + /** + * done order + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts new file mode 100644 index 00000000..d2b44bbc --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts @@ -0,0 +1,63 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance, Expose } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByOrderIdReq implements Serializable { + /** + * + */ + @Expose({ name: 'order-id' }) + @Reflect.metadata('path', 'order-id') + order_id?: string; + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. + */ + static builder(): GetOrderByOrderIdReqBuilder { + return new GetOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * + */ + order_id?: string; + }): GetOrderByOrderIdReq { + let obj = new GetOrderByOrderIdReq(); + obj.order_id = data.order_id; + return obj; + } + + fromJson(input: string): GetOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } +} + +export class GetOrderByOrderIdReqBuilder { + obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + /** + * + */ + setOrderId(value: string): GetOrderByOrderIdReqBuilder { + this.obj.order_id = value; + return this; + } + + build(): GetOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts new file mode 100644 index 00000000..034b132e --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts @@ -0,0 +1,260 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByOrderIdResp implements Response { + /** + * Order ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order type, market order or limit order + */ + type?: GetOrderByOrderIdResp.TypeEnum; + /** + * Transaction side + */ + side?: GetOrderByOrderIdResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order quantity + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Executed size of funds + */ + dealValue?: string; + /** + * Executed quantity + */ + dealSize?: number; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. + */ + stp?: GetOrderByOrderIdResp.StpEnum; + /** + * Stop order type (stop limit or stop market) + */ + stop?: string; + /** + * Trigger price type of stop orders + */ + stopPriceType?: GetOrderByOrderIdResp.StopPriceTypeEnum; + /** + * Mark to show whether the stop order is triggered + */ + stopTriggered?: boolean; + /** + * Trigger price of stop orders + */ + stopPrice?: number; + /** + * Time in force policy type + */ + timeInForce?: string; + /** + * Mark of post only + */ + postOnly?: boolean; + /** + * Mark of the hidden order + */ + hidden?: boolean; + /** + * Mark of the iceberg order + */ + iceberg?: boolean; + /** + * Leverage of the order + */ + leverage?: string; + /** + * A mark to forcely hold the funds for an order + */ + forceHold?: boolean; + /** + * A mark to close the position + */ + closeOrder?: boolean; + /** + * Visible size of the iceberg order + */ + visibleSize?: number; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + /** + * Remark + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Mark of the active orders + */ + isActive?: boolean; + /** + * Mark of the canceled orders + */ + cancelExist?: boolean; + /** + * Time the order created + */ + createdAt?: number; + /** + * last update time + */ + updatedAt?: number; + /** + * Order Endtime + */ + endAt?: number; + /** + * Order create time in nanosecond + */ + orderTime?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetOrderByOrderIdResp.MarginModeEnum; + /** + * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier + */ + avgDealPrice?: string; + /** + * Value of the executed orders + */ + filledSize?: number; + /** + * Executed order quantity + */ + filledValue?: string; + /** + * order status: “open” or “done” + */ + status?: GetOrderByOrderIdResp.StatusEnum; + /** + * A mark to reduce the position size only + */ + reduceOnly?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdResp { + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } +} + +export namespace GetOrderByOrderIdResp { + export enum TypeEnum { + /** + * Market Order + */ + MARKET = 'market', + /** + * Limit Order + */ + LIMIT = 'limit', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * Null means not stp order + */ + NULL = '', + /** + * Cancel new, Cancel the new order + */ + CN = 'CN', + /** + * Cancel old, Cancel the old order + */ + CO = 'CO', + /** + * Cancel both, Cancel both sides + */ + CB = 'CB', + } + export enum StopPriceTypeEnum { + /** + * + */ + NULL = '', + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum MarginModeEnum { + /** + * Cross margin + */ + CROSS = 'CROSS', + /** + * Isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum StatusEnum { + /** + * open order + */ + OPEN = 'open', + /** + * done order + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts new file mode 100644 index 00000000..afb5aa05 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts @@ -0,0 +1,170 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderListItems implements Serializable { + /** + * Order ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order type, market order or limit order + */ + type?: string; + /** + * Transaction side + */ + side?: string; + /** + * Order price + */ + price?: string; + /** + * Order quantity + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Executed size of funds + */ + dealValue?: string; + /** + * Executed quantity + */ + dealSize?: number; + /** + * self trade prevention + */ + stp?: string; + /** + * Stop order type (stop limit or stop market) + */ + stop?: string; + /** + * Trigger price type of stop orders + */ + stopPriceType?: string; + /** + * Mark to show whether the stop order is triggered + */ + stopTriggered?: boolean; + /** + * Trigger price of stop orders + */ + stopPrice?: number; + /** + * Time in force policy type + */ + timeInForce?: string; + /** + * Mark of post only + */ + postOnly?: boolean; + /** + * Mark of the hidden order + */ + hidden?: boolean; + /** + * Mark of the iceberg order + */ + iceberg?: boolean; + /** + * Leverage of the order + */ + leverage?: string; + /** + * A mark to forcely hold the funds for an order + */ + forceHold?: boolean; + /** + * A mark to close the position + */ + closeOrder?: boolean; + /** + * Visible size of the iceberg order + */ + visibleSize?: number; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + /** + * Remark of the order + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Mark of the active orders + */ + isActive?: boolean; + /** + * Mark of the canceled orders + */ + cancelExist?: boolean; + /** + * Time the order created + */ + createdAt?: number; + /** + * last update time + */ + updatedAt?: number; + /** + * End time + */ + endAt?: number; + /** + * Order create time in nanosecond + */ + orderTime?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: string; + /** + * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier + */ + avgDealPrice?: string; + /** + * order status: “open” or “done” + */ + status?: string; + /** + * Value of the executed orders + */ + filledSize?: number; + /** + * Executed order quantity + */ + filledValue?: string; + /** + * A mark to reduce the position size only + */ + reduceOnly?: boolean; + fromJson(input: string): GetOrderListItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderListItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderListItems { + return plainToInstance(GetOrderListItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts new file mode 100644 index 00000000..f72e9eeb --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts @@ -0,0 +1,212 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderListReq implements Serializable { + /** + * active or done, done as default. Only list orders for a specific status + */ + status?: GetOrderListReq.StatusEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetOrderListReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetOrderListReq.TypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + + /** + * Creates a new instance of the `GetOrderListReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderListReq` object. + */ + static builder(): GetOrderListReqBuilder { + return new GetOrderListReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderListReq` class with the given data. + */ + static create(data: { + /** + * active or done, done as default. Only list orders for a specific status + */ + status?: GetOrderListReq.StatusEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetOrderListReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetOrderListReq.TypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + }): GetOrderListReq { + let obj = new GetOrderListReq(); + obj.status = data.status; + obj.symbol = data.symbol; + obj.side = data.side; + obj.type = data.type; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetOrderListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderListReq { + return plainToInstance(GetOrderListReq, jsonObject); + } +} + +export namespace GetOrderListReq { + export enum StatusEnum { + /** + * + */ + ACTIVE = 'active', + /** + * + */ + DONE = 'done', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetOrderListReqBuilder { + obj: GetOrderListReq = new GetOrderListReq(); + /** + * active or done, done as default. Only list orders for a specific status + */ + setStatus(value: GetOrderListReq.StatusEnum): GetOrderListReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetOrderListReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * buy or sell + */ + setSide(value: GetOrderListReq.SideEnum): GetOrderListReqBuilder { + this.obj.side = value; + return this; + } + + /** + * limit, market, limit_stop or market_stop + */ + setType(value: GetOrderListReq.TypeEnum): GetOrderListReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetOrderListReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetOrderListReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page, The default currentPage is 1 + */ + setCurrentPage(value: number): GetOrderListReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + setPageSize(value: number): GetOrderListReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetOrderListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts new file mode 100644 index 00000000..60ca0e22 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetOrderListItems } from './model_get_order_list_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderListResp implements Response { + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetOrderListItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderListResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderListResp { + return plainToInstance(GetOrderListResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts new file mode 100644 index 00000000..43dfc1e3 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts @@ -0,0 +1,170 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentClosedOrdersData implements Serializable { + /** + * Order ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order type, market order or limit order + */ + type?: string; + /** + * Transaction side + */ + side?: string; + /** + * Order price + */ + price?: string; + /** + * Order quantity + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Executed size of funds + */ + dealValue?: string; + /** + * Executed quantity + */ + dealSize?: number; + /** + * self trade prevention + */ + stp?: string; + /** + * Stop order type (stop limit or stop market) + */ + stop?: string; + /** + * Trigger price type of stop orders + */ + stopPriceType?: string; + /** + * Mark to show whether the stop order is triggered + */ + stopTriggered?: boolean; + /** + * Trigger price of stop orders + */ + stopPrice?: number; + /** + * Time in force policy type + */ + timeInForce?: string; + /** + * Mark of post only + */ + postOnly?: boolean; + /** + * Mark of the hidden order + */ + hidden?: boolean; + /** + * Mark of the iceberg order + */ + iceberg?: boolean; + /** + * Leverage of the order + */ + leverage?: string; + /** + * A mark to forcely hold the funds for an order + */ + forceHold?: boolean; + /** + * A mark to close the position + */ + closeOrder?: boolean; + /** + * Visible size of the iceberg order + */ + visibleSize?: number; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + /** + * Remark of the order + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Mark of the active orders + */ + isActive?: boolean; + /** + * Mark of the canceled orders + */ + cancelExist?: boolean; + /** + * Time the order created + */ + createdAt?: number; + /** + * last update time + */ + updatedAt?: number; + /** + * End time + */ + endAt?: number; + /** + * Order create time in nanosecond + */ + orderTime?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: string; + /** + * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier + */ + avgDealPrice?: string; + /** + * Value of the executed orders + */ + filledSize?: number; + /** + * Executed order quantity + */ + filledValue?: string; + /** + * order status: “open” or “done” + */ + status?: string; + /** + * A mark to reduce the position size only + */ + reduceOnly?: boolean; + fromJson(input: string): GetRecentClosedOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentClosedOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentClosedOrdersData { + return plainToInstance(GetRecentClosedOrdersData, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts new file mode 100644 index 00000000..a444f450 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentClosedOrdersReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetRecentClosedOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetRecentClosedOrdersReq` object. + */ + static builder(): GetRecentClosedOrdersReqBuilder { + return new GetRecentClosedOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetRecentClosedOrdersReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetRecentClosedOrdersReq { + let obj = new GetRecentClosedOrdersReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetRecentClosedOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentClosedOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentClosedOrdersReq { + return plainToInstance(GetRecentClosedOrdersReq, jsonObject); + } +} + +export class GetRecentClosedOrdersReqBuilder { + obj: GetRecentClosedOrdersReq = new GetRecentClosedOrdersReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetRecentClosedOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetRecentClosedOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts new file mode 100644 index 00000000..acdbc222 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetRecentClosedOrdersData } from './model_get_recent_closed_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRecentClosedOrdersResp + implements Response +{ + /** + * + */ + @Type(() => GetRecentClosedOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRecentClosedOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentClosedOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetRecentClosedOrdersResp { + return plainToInstance(GetRecentClosedOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts new file mode 100644 index 00000000..5a9c336d --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts @@ -0,0 +1,197 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentTradeHistoryData implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Trade ID + */ + tradeId?: string; + /** + * Order ID + */ + orderId?: string; + /** + * Transaction side + */ + side?: GetRecentTradeHistoryData.SideEnum; + /** + * Liquidity- taker or maker + */ + liquidity?: GetRecentTradeHistoryData.LiquidityEnum; + /** + * Whether to force processing as a taker + */ + forceTaker?: boolean; + /** + * Filled price + */ + price?: string; + /** + * Filled amount + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Opening transaction fee + */ + openFeePay?: string; + /** + * Closing transaction fee + */ + closeFeePay?: string; + /** + * A mark to the stop order type + */ + stop?: string; + /** + * Fee Rate + */ + feeRate?: string; + /** + * Fixed fees(Deprecated field, no actual use of the value field) + */ + fixFee?: string; + /** + * Charging currency + */ + feeCurrency?: string; + /** + * trade time in nanosecond + */ + tradeTime?: number; + /** + * Deprecated field, no actual use of the value field + */ + subTradeType?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetRecentTradeHistoryData.MarginModeEnum; + /** + * Order Type + */ + displayType?: GetRecentTradeHistoryData.DisplayTypeEnum; + /** + * Transaction fee + */ + fee?: string; + /** + * Settle Currency + */ + settleCurrency?: string; + /** + * Order type + */ + orderType?: GetRecentTradeHistoryData.OrderTypeEnum; + /** + * Trade type (trade, liquid, cancel, adl or settlement) + */ + tradeType?: GetRecentTradeHistoryData.TradeTypeEnum; + /** + * Time the order created + */ + createdAt?: number; + fromJson(input: string): GetRecentTradeHistoryData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryData { + return plainToInstance(GetRecentTradeHistoryData, jsonObject); + } +} + +export namespace GetRecentTradeHistoryData { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum DisplayTypeEnum { + /** + * Limit order + */ + LIMIT = 'limit', + /** + * Market order + */ + MARKET = 'market', + /** + * Stop limit order + */ + LIMIT_STOP = 'limit_stop', + /** + * Stop Market order + */ + MARKET_STOP = 'market_stop', + } + export enum OrderTypeEnum { + /** + * market + */ + MARKET = 'market', + /** + * limit + */ + LIMIT = 'limit', + } + export enum TradeTypeEnum { + /** + * trade + */ + TRADE = 'trade', + /** + * Partially filled and cancelled orders + */ + CANCEL = 'cancel', + /** + * liquid + */ + LIQUID = 'liquid', + /** + * adl + */ + ADL = 'adl', + /** + * settlement + */ + SETTLEMENT = 'settlement', + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts new file mode 100644 index 00000000..0e263e7f --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentTradeHistoryReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetRecentTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetRecentTradeHistoryReq` object. + */ + static builder(): GetRecentTradeHistoryReqBuilder { + return new GetRecentTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetRecentTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetRecentTradeHistoryReq { + let obj = new GetRecentTradeHistoryReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetRecentTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryReq { + return plainToInstance(GetRecentTradeHistoryReq, jsonObject); + } +} + +export class GetRecentTradeHistoryReqBuilder { + obj: GetRecentTradeHistoryReq = new GetRecentTradeHistoryReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetRecentTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetRecentTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts new file mode 100644 index 00000000..79d07384 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetRecentTradeHistoryData } from './model_get_recent_trade_history_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRecentTradeHistoryResp + implements Response +{ + /** + * + */ + @Type(() => GetRecentTradeHistoryData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRecentTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryResp { + return plainToInstance(GetRecentTradeHistoryResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts new file mode 100644 index 00000000..a7dcd533 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts @@ -0,0 +1,170 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrderListItems implements Serializable { + /** + * Order ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order type, market order or limit order + */ + type?: string; + /** + * Transaction side + */ + side?: string; + /** + * Order price + */ + price?: string; + /** + * Order quantity + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Executed size of funds + */ + dealValue?: string; + /** + * Executed quantity + */ + dealSize?: number; + /** + * self trade prevention + */ + stp?: string; + /** + * Stop order type (stop limit or stop market) + */ + stop?: string; + /** + * Trigger price type of stop orders + */ + stopPriceType?: string; + /** + * Mark to show whether the stop order is triggered + */ + stopTriggered?: boolean; + /** + * Trigger price of stop orders + */ + stopPrice?: string; + /** + * Time in force policy type + */ + timeInForce?: string; + /** + * Mark of post only + */ + postOnly?: boolean; + /** + * Mark of the hidden order + */ + hidden?: boolean; + /** + * Mark of the iceberg order + */ + iceberg?: boolean; + /** + * Leverage of the order + */ + leverage?: string; + /** + * A mark to forcely hold the funds for an order + */ + forceHold?: boolean; + /** + * A mark to close the position + */ + closeOrder?: boolean; + /** + * Visible size of the iceberg order + */ + visibleSize?: number; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + /** + * Remark of the order + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Mark of the active orders + */ + isActive?: boolean; + /** + * Mark of the canceled orders + */ + cancelExist?: boolean; + /** + * Time the order created + */ + createdAt?: number; + /** + * last update time + */ + updatedAt?: number; + /** + * End time + */ + endAt?: number; + /** + * Order create time in nanosecond + */ + orderTime?: number; + /** + * settlement currency + */ + settleCurrency?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: string; + /** + * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier + */ + avgDealPrice?: string; + /** + * Value of the executed orders + */ + filledSize?: number; + /** + * Executed order quantity + */ + filledValue?: string; + /** + * order status: “open” or “done” + */ + status?: string; + /** + * A mark to reduce the position size only + */ + reduceOnly?: boolean; + fromJson(input: string): GetStopOrderListItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderListItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderListItems { + return plainToInstance(GetStopOrderListItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts new file mode 100644 index 00000000..e7179db1 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts @@ -0,0 +1,185 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrderListReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetStopOrderListReq.SideEnum; + /** + * limit, market + */ + type?: GetStopOrderListReq.TypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetStopOrderListReq` class. + * The builder pattern allows step-by-step construction of a `GetStopOrderListReq` object. + */ + static builder(): GetStopOrderListReqBuilder { + return new GetStopOrderListReqBuilder(); + } + + /** + * Creates a new instance of the `GetStopOrderListReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetStopOrderListReq.SideEnum; + /** + * limit, market + */ + type?: GetStopOrderListReq.TypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + }): GetStopOrderListReq { + let obj = new GetStopOrderListReq(); + obj.symbol = data.symbol; + obj.side = data.side; + obj.type = data.type; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetStopOrderListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderListReq { + return plainToInstance(GetStopOrderListReq, jsonObject); + } +} + +export namespace GetStopOrderListReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetStopOrderListReqBuilder { + obj: GetStopOrderListReq = new GetStopOrderListReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetStopOrderListReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * buy or sell + */ + setSide(value: GetStopOrderListReq.SideEnum): GetStopOrderListReqBuilder { + this.obj.side = value; + return this; + } + + /** + * limit, market + */ + setType(value: GetStopOrderListReq.TypeEnum): GetStopOrderListReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetStopOrderListReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetStopOrderListReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page, The default currentPage is 1 + */ + setCurrentPage(value: number): GetStopOrderListReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + setPageSize(value: number): GetStopOrderListReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetStopOrderListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts new file mode 100644 index 00000000..816fac44 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetStopOrderListItems } from './model_get_stop_order_list_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetStopOrderListResp implements Response { + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetStopOrderListItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetStopOrderListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderListResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderListResp { + return plainToInstance(GetStopOrderListResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts new file mode 100644 index 00000000..6ee167b9 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts @@ -0,0 +1,193 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryItems implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Trade ID + */ + tradeId?: string; + /** + * Order ID + */ + orderId?: string; + /** + * Transaction side + */ + side?: GetTradeHistoryItems.SideEnum; + /** + * Liquidity- taker or maker + */ + liquidity?: GetTradeHistoryItems.LiquidityEnum; + /** + * Whether to force processing as a taker + */ + forceTaker?: boolean; + /** + * Filled price + */ + price?: string; + /** + * Filled amount + */ + size?: number; + /** + * Order value + */ + value?: string; + /** + * Opening transaction fee + */ + openFeePay?: string; + /** + * Closing transaction fee + */ + closeFeePay?: string; + /** + * A mark to the stop order type + */ + stop?: string; + /** + * Fee Rate + */ + feeRate?: string; + /** + * Fixed fees(Deprecated field, no actual use of the value field) + */ + fixFee?: string; + /** + * Charging currency + */ + feeCurrency?: string; + /** + * trade time in nanosecond + */ + tradeTime?: number; + /** + * Deprecated field, no actual use of the value field + */ + subTradeType?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetTradeHistoryItems.MarginModeEnum; + /** + * Settle Currency + */ + settleCurrency?: string; + /** + * Order Type + */ + displayType?: GetTradeHistoryItems.DisplayTypeEnum; + /** + * + */ + fee?: string; + /** + * Order type + */ + orderType?: GetTradeHistoryItems.OrderTypeEnum; + /** + * Trade type (trade, liquid, adl or settlement) + */ + tradeType?: GetTradeHistoryItems.TradeTypeEnum; + /** + * Time the order created + */ + createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToInstance(GetTradeHistoryItems, jsonObject); + } +} + +export namespace GetTradeHistoryItems { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum DisplayTypeEnum { + /** + * Limit order + */ + LIMIT = 'limit', + /** + * Market order + */ + MARKET = 'market', + /** + * Stop limit order + */ + LIMIT_STOP = 'limit_stop', + /** + * Stop Market order + */ + MARKET_STOP = 'market_stop', + } + export enum OrderTypeEnum { + /** + * market + */ + MARKET = 'market', + /** + * limit + */ + LIMIT = 'limit', + } + export enum TradeTypeEnum { + /** + * trade + */ + TRADE = 'trade', + /** + * liquid + */ + LIQUID = 'liquid', + /** + * adl + */ + ADL = 'adl', + /** + * settlement + */ + SETTLEMENT = 'settlement', + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts new file mode 100644 index 00000000..6fcc6e79 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts @@ -0,0 +1,227 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryReq implements Serializable { + /** + * List fills for a specific order only (If you specify orderId, other parameters can be ignored) + */ + orderId?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order side + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * Order Type + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * Transaction type: trade, adl, liquid, settlement. Supports querying multiple types at the same time, separated by commas. Query all type when empty + */ + tradeTypes?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number = 1; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. + */ + static builder(): GetTradeHistoryReqBuilder { + return new GetTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * List fills for a specific order only (If you specify orderId, other parameters can be ignored) + */ + orderId?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order side + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * Order Type + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * Transaction type: trade, adl, liquid, settlement. Supports querying multiple types at the same time, separated by commas. Query all type when empty + */ + tradeTypes?: string; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page, The default currentPage is 1 + */ + currentPage?: number; + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + pageSize?: number; + }): GetTradeHistoryReq { + let obj = new GetTradeHistoryReq(); + obj.orderId = data.orderId; + obj.symbol = data.symbol; + obj.side = data.side; + obj.type = data.type; + obj.tradeTypes = data.tradeTypes; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToInstance(GetTradeHistoryReq, jsonObject); + } +} + +export namespace GetTradeHistoryReq { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * Limit order + */ + LIMIT = 'limit', + /** + * Market order + */ + MARKET = 'market', + /** + * Stop limit order + */ + LIMIT_STOP = 'limit_stop', + /** + * Stop Market order + */ + MARKET_STOP = 'market_stop', + } +} + +export class GetTradeHistoryReqBuilder { + obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + /** + * List fills for a specific order only (If you specify orderId, other parameters can be ignored) + */ + setOrderId(value: string): GetTradeHistoryReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Order side + */ + setSide(value: GetTradeHistoryReq.SideEnum): GetTradeHistoryReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Order Type + */ + setType(value: GetTradeHistoryReq.TypeEnum): GetTradeHistoryReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Transaction type: trade, adl, liquid, settlement. Supports querying multiple types at the same time, separated by commas. Query all type when empty + */ + setTradeTypes(value: string): GetTradeHistoryReqBuilder { + this.obj.tradeTypes = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetTradeHistoryReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetTradeHistoryReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page, The default currentPage is 1 + */ + setCurrentPage(value: number): GetTradeHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 + */ + setPageSize(value: number): GetTradeHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts new file mode 100644 index 00000000..435579f0 --- /dev/null +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetTradeHistoryItems } from './model_get_trade_history_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryResp implements Response { + /** + * + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetTradeHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryResp { + return plainToInstance(GetTradeHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/api_positions.template b/sdk/node/src/generate/futures/positions/api_positions.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts new file mode 100644 index 00000000..857c6191 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -0,0 +1,464 @@ +import { RemoveIsolatedMarginReq } from './model_remove_isolated_margin_req'; +import { AddIsolatedMarginReq } from './model_add_isolated_margin_req'; +import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_req'; +import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; +import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; +import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; +import { GetMarginModeReq } from './model_get_margin_mode_req'; +import { GetCrossMarginLeverageResp } from './model_get_cross_margin_leverage_resp'; +import { SwitchMarginModeResp } from './model_switch_margin_mode_resp'; +import { GetPositionsHistoryResp } from './model_get_positions_history_resp'; +import { GetPositionListReq } from './model_get_position_list_req'; +import { GetIsolatedMarginRiskLimitReq } from './model_get_isolated_margin_risk_limit_req'; +import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; +import { GetIsolatedMarginRiskLimitResp } from './model_get_isolated_margin_risk_limit_resp'; +import { GetMarginModeResp } from './model_get_margin_mode_resp'; +import { ModifyMarginLeverageReq } from './model_modify_margin_leverage_req'; +import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; +import { ModifyMarginLeverageResp } from './model_modify_margin_leverage_resp'; +import { GetPositionDetailsReq } from './model_get_position_details_req'; +import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; +import { SwitchMarginModeReq } from './model_switch_margin_mode_req'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; +import { GetPositionListResp } from './model_get_position_list_resp'; +import { GetPositionDetailsResp } from './model_get_position_details_resp'; +import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; +import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; +import { GetPositionsHistoryReq } from './model_get_positions_history_req'; +import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getIsolatedMarginRiskLimit request test', () => { + /** + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetIsolatedMarginRiskLimitReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getIsolatedMarginRiskLimit response test', () => { + /** + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "level": 1,\n "maxRiskLimit": 100000,\n "minRiskLimit": 0,\n "maxLeverage": 125,\n "initialMargin": 0.008,\n "maintainMargin": 0.004\n },\n {\n "symbol": "XBTUSDTM",\n "level": 2,\n "maxRiskLimit": 500000,\n "minRiskLimit": 100000,\n "maxLeverage": 100,\n "initialMargin": 0.01,\n "maintainMargin": 0.005\n },\n {\n "symbol": "XBTUSDTM",\n "level": 3,\n "maxRiskLimit": 1000000,\n "minRiskLimit": 500000,\n "maxLeverage": 75,\n "initialMargin": 0.014,\n "maintainMargin": 0.007\n },\n {\n "symbol": "XBTUSDTM",\n "level": 4,\n "maxRiskLimit": 2000000,\n "minRiskLimit": 1000000,\n "maxLeverage": 50,\n "initialMargin": 0.02,\n "maintainMargin": 0.01\n },\n {\n "symbol": "XBTUSDTM",\n "level": 5,\n "maxRiskLimit": 3000000,\n "minRiskLimit": 2000000,\n "maxLeverage": 30,\n "initialMargin": 0.034,\n "maintainMargin": 0.017\n },\n {\n "symbol": "XBTUSDTM",\n "level": 6,\n "maxRiskLimit": 5000000,\n "minRiskLimit": 3000000,\n "maxLeverage": 20,\n "initialMargin": 0.05,\n "maintainMargin": 0.025\n },\n {\n "symbol": "XBTUSDTM",\n "level": 7,\n "maxRiskLimit": 8000000,\n "minRiskLimit": 5000000,\n "maxLeverage": 10,\n "initialMargin": 0.1,\n "maintainMargin": 0.05\n },\n {\n "symbol": "XBTUSDTM",\n "level": 8,\n "maxRiskLimit": 12000000,\n "minRiskLimit": 8000000,\n "maxLeverage": 5,\n "initialMargin": 0.2,\n "maintainMargin": 0.1\n },\n {\n "symbol": "XBTUSDTM",\n "level": 9,\n "maxRiskLimit": 20000000,\n "minRiskLimit": 12000000,\n "maxLeverage": 4,\n "initialMargin": 0.25,\n "maintainMargin": 0.125\n },\n {\n "symbol": "XBTUSDTM",\n "level": 10,\n "maxRiskLimit": 30000000,\n "minRiskLimit": 20000000,\n "maxLeverage": 3,\n "initialMargin": 0.334,\n "maintainMargin": 0.167\n },\n {\n "symbol": "XBTUSDTM",\n "level": 11,\n "maxRiskLimit": 40000000,\n "minRiskLimit": 30000000,\n "maxLeverage": 2,\n "initialMargin": 0.5,\n "maintainMargin": 0.25\n },\n {\n "symbol": "XBTUSDTM",\n "level": 12,\n "maxRiskLimit": 50000000,\n "minRiskLimit": 40000000,\n "maxLeverage": 1,\n "initialMargin": 1.0,\n "maintainMargin": 0.5\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetIsolatedMarginRiskLimitResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPositionsHistory request test', () => { + /** + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions + */ + let data = + '{"symbol": "example_string_default_value", "from": 123456, "to": 123456, "limit": 10, "pageId": 1}'; + let req = new GetPositionsHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPositionsHistory response test', () => { + /** + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "closeId": "500000000027312193",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "CLOSE_SHORT",\n "pnl": "-3.79237944",\n "realisedGrossCost": "3.795",\n "withdrawPnl": "0.0",\n "tradeFee": "0.078657",\n "fundingFee": "0.08127756",\n "openTime": 1727073653603,\n "closeTime": 1729155587945,\n "openPrice": "63650.0",\n "closePrice": "67445.0",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026809668",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "SUIUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-1.10919296",\n "realisedGrossCost": "1.11297635",\n "withdrawPnl": "0.0",\n "tradeFee": "0.00200295",\n "fundingFee": "0.00578634",\n "openTime": 1726473389296,\n "closeTime": 1728738683541,\n "openPrice": "1.1072",\n "closePrice": "2.22017635",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026819355",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-5.941896296",\n "realisedGrossCost": "5.86937042",\n "withdrawPnl": "0.0",\n "tradeFee": "0.074020096",\n "fundingFee": "0.00149422",\n "openTime": 1726490775358,\n "closeTime": 1727061049859,\n "openPrice": "58679.6",\n "closePrice": "64548.97042",\n "marginMode": "ISOLATED"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPositionsHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMaxWithdrawMargin request test', () => { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin + */ + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetMaxWithdrawMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMaxWithdrawMargin response test', () => { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin + */ + let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMaxWithdrawMarginResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('removeIsolatedMargin request test', () => { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin + */ + let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; + let req = new RemoveIsolatedMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('removeIsolatedMargin response test', () => { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin + */ + let data = '{\n "code": "200000",\n "data": "0.1"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new RemoveIsolatedMarginResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPositionDetails request test', () => { + /** + * getPositionDetails + * Get Position Details + * /api/v1/position + */ + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetPositionDetailsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPositionDetails response test', () => { + /** + * getPositionDetails + * Get Position Details + * /api/v1/position + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.88,\n "delevPercentage": 0.18,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1729482542135,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": 0.01925174,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": 0.01925174,\n "isOpen": true,\n "markPrice": 68900.7,\n "markValue": 68.9007,\n "posCost": 67.4309,\n "posCross": 0.01645214,\n "posCrossMargin": 0,\n "posInit": 22.4769666644,\n "posComm": 0.0539546299,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.03766885,\n "posMargin": 22.5097045843,\n "posFunding": -0.0212068,\n "posMaint": 0.3931320569,\n "maintMargin": 23.9795045843,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.06166534,\n "unrealisedPnl": 1.4698,\n "unrealisedPnlPcnt": 0.0218,\n "unrealisedRoePcnt": 0.0654,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45314.33,\n "bankruptPrice": 44975.16,\n "settleCurrency": "USDT",\n "maintainMargin": 0.005,\n "riskLimitLevel": 2,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.88\n }\n}\n'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPositionDetailsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifyAutoDepositStatus request test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let data = '{"symbol": "XBTUSDTM", "status": true}'; + let req = new ModifyAutoDepositStatusReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyAutoDepositStatus response test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyAutoDepositStatusResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addIsolatedMargin request test', () => { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin + */ + let data = '{"symbol": "string", "margin": 0, "bizNo": "string"}'; + let req = new AddIsolatedMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addIsolatedMargin response test', () => { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "6200c9b83aecfb000152ddcd",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 18.72,\n "crossMode": false,\n "delevPercentage": 0.66,\n "openingTimestamp": 1646287090131,\n "currentTimestamp": 1646295055021,\n "currentQty": 1,\n "currentCost": 43.388,\n "currentComm": 0.0260328,\n "unrealisedCost": 43.388,\n "realisedGrossCost": 0,\n "realisedCost": 0.0260328,\n "isOpen": true,\n "markPrice": 43536.65,\n "markValue": 43.53665,\n "posCost": 43.388,\n "posCross": 0.000024985,\n "posInit": 2.1694,\n "posComm": 0.02733446,\n "posLoss": 0,\n "posMargin": 2.19675944,\n "posMaint": 0.24861326,\n "maintMargin": 2.34540944,\n "realisedGrossPnl": 0,\n "realisedPnl": -0.0260328,\n "unrealisedPnl": 0.14865,\n "unrealisedPnlPcnt": 0.0034,\n "unrealisedRoePcnt": 0.0685,\n "avgEntryPrice": 43388,\n "liquidationPrice": 41440,\n "bankruptPrice": 41218,\n "userId": 1234321123,\n "settleCurrency": "USDT"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddIsolatedMarginResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifyIsolatedMarginRiskLimt request test', () => { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change + */ + let data = '{"symbol": "XBTUSDTM", "level": 2}'; + let req = new ModifyIsolatedMarginRiskLimtReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyIsolatedMarginRiskLimt response test', () => { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyIsolatedMarginRiskLimtResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPositionList request test', () => { + /** + * getPositionList + * Get Position List + * /api/v1/positions + */ + let data = '{"currency": "USDT"}'; + let req = new GetPositionListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPositionList response test', () => { + /** + * getPositionList + * Get Position List + * /api/v1/positions + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "500000000001046430",\n "symbol": "ETHUSDM",\n "crossMode": true,\n "delevPercentage": 0.71,\n "openingTimestamp": 1730635780702,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": -4.069805E-4,\n "currentComm": 2.441E-7,\n "unrealisedCost": -4.069805E-4,\n "realisedGrossCost": 0.0,\n "realisedCost": 2.441E-7,\n "isOpen": true,\n "markPrice": 2454.12,\n "markValue": -4.07478E-4,\n "posCost": -4.069805E-4,\n "posInit": 4.06981E-5,\n "posMargin": 4.07478E-5,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -2.441E-7,\n "unrealisedPnl": -4.975E-7,\n "unrealisedPnlPcnt": -0.0012,\n "unrealisedRoePcnt": -0.0122,\n "avgEntryPrice": 2457.12,\n "liquidationPrice": 1429.96,\n "bankruptPrice": 1414.96,\n "settleCurrency": "ETH",\n "isInverse": true,\n "marginMode": "CROSS",\n "positionSide": "BOTH",\n "leverage": 10\n },\n {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.97,\n "delevPercentage": 0.5,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": -0.15936162,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": -0.15936162,\n "isOpen": true,\n "markPrice": 68323.06,\n "markValue": 68.32306,\n "posCost": 67.4309,\n "posCross": 0.06225152,\n "posCrossMargin": 0,\n "posInit": 22.2769666644,\n "posComm": 0.0539821899,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.26210915,\n "posMargin": 22.1310912243,\n "posFunding": -0.19982016,\n "posMaint": 0.4046228699,\n "maintMargin": 23.0232512243,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.2402787,\n "unrealisedPnl": 0.89216,\n "unrealisedPnlPcnt": 0.0132,\n "unrealisedRoePcnt": 0.04,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45704.44,\n "bankruptPrice": 45353.8,\n "settleCurrency": "USDT",\n "isInverse": false,\n "maintainMargin": 0.005,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.97\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPositionListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifyMarginLeverage request test', () => { + /** + * modifyMarginLeverage + * Modify Cross Margin Leverage + * /api/v2/changeCrossUserLeverage + */ + let data = '{"symbol": "XBTUSDTM", "leverage": "10"}'; + let req = new ModifyMarginLeverageReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyMarginLeverage response test', () => { + /** + * modifyMarginLeverage + * Modify Cross Margin Leverage + * /api/v2/changeCrossUserLeverage + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyMarginLeverageResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getCrossMarginLeverage request test', () => { + /** + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetCrossMarginLeverageReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCrossMarginLeverage response test', () => { + /** + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCrossMarginLeverageResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMaxOpenSize request test', () => { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize + */ + let data = + '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; + let req = new GetMaxOpenSizeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMaxOpenSize response test', () => { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": 0,\n "maxSellOpenSize": 0\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMaxOpenSizeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('switchMarginMode request test', () => { + /** + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode + */ + let data = '{"symbol": "XBTUSDTM", "marginMode": "ISOLATED"}'; + let req = new SwitchMarginModeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('switchMarginMode response test', () => { + /** + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new SwitchMarginModeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMarginMode request test', () => { + /** + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetMarginModeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMarginMode response test', () => { + /** + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarginModeResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/futures/positions/api_positions.ts b/sdk/node/src/generate/futures/positions/api_positions.ts new file mode 100644 index 00000000..d9c4a311 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/api_positions.ts @@ -0,0 +1,438 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { RemoveIsolatedMarginReq } from './model_remove_isolated_margin_req'; +import { AddIsolatedMarginReq } from './model_add_isolated_margin_req'; +import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_req'; +import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; +import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; +import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; +import { GetMarginModeReq } from './model_get_margin_mode_req'; +import { GetCrossMarginLeverageResp } from './model_get_cross_margin_leverage_resp'; +import { SwitchMarginModeResp } from './model_switch_margin_mode_resp'; +import { GetPositionsHistoryResp } from './model_get_positions_history_resp'; +import { GetPositionListReq } from './model_get_position_list_req'; +import { GetIsolatedMarginRiskLimitReq } from './model_get_isolated_margin_risk_limit_req'; +import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; +import { GetIsolatedMarginRiskLimitResp } from './model_get_isolated_margin_risk_limit_resp'; +import { GetMarginModeResp } from './model_get_margin_mode_resp'; +import { ModifyMarginLeverageReq } from './model_modify_margin_leverage_req'; +import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; +import { ModifyMarginLeverageResp } from './model_modify_margin_leverage_resp'; +import { GetPositionDetailsReq } from './model_get_position_details_req'; +import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; +import { SwitchMarginModeReq } from './model_switch_margin_mode_req'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; +import { GetPositionListResp } from './model_get_position_list_resp'; +import { GetPositionDetailsResp } from './model_get_position_details_resp'; +import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; +import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; +import { GetPositionsHistoryReq } from './model_get_positions_history_req'; +import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; + +export interface PositionsAPI { + /** + * getIsolatedMarginRiskLimit Get Isolated Margin Risk Limit + * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). + * Documentation: https://www.kucoin.com/docs-new/api-3470263 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getIsolatedMarginRiskLimit( + req: GetIsolatedMarginRiskLimitReq, + ): Promise; + + /** + * getPositionsHistory Get Positions History + * Description: This interface can query position history information records. + * Documentation: https://www.kucoin.com/docs-new/api-3470254 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getPositionsHistory(req: GetPositionsHistoryReq): Promise; + + /** + * getMaxWithdrawMargin Get Max Withdraw Margin + * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. + * Documentation: https://www.kucoin.com/docs-new/api-3470258 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; + + /** + * removeIsolatedMargin Remove Isolated Margin + * Description: Remove Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470256 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; + + /** + * getPositionDetails Get Position Details + * Description: Get the position details of a specified position. + * Documentation: https://www.kucoin.com/docs-new/api-3470252 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getPositionDetails(req: GetPositionDetailsReq): Promise; + + /** + * @deprecated + * modifyAutoDepositStatus Modify Isolated Margin Auto-Deposit Status + * Description: This endpoint is only applicable to isolated margin and is no longer recommended. It is recommended to use cross margin instead. + * Documentation: https://www.kucoin.com/docs-new/api-3470255 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------+ + */ + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; + + /** + * addIsolatedMargin Add Isolated Margin + * Description: Add Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470257 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------+ + */ + addIsolatedMargin(req: AddIsolatedMarginReq): Promise; + + /** + * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit + * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). + * Documentation: https://www.kucoin.com/docs-new/api-3470264 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise; + + /** + * getPositionList Get Position List + * Description: Get the position details of a specified position. + * Documentation: https://www.kucoin.com/docs-new/api-3470253 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getPositionList(req: GetPositionListReq): Promise; + + /** + * modifyMarginLeverage Modify Cross Margin Leverage + * Description: This interface can modify the current symbol’s cross-margin leverage multiple. + * Documentation: https://www.kucoin.com/docs-new/api-3470261 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; + + /** + * getCrossMarginLeverage Get Cross Margin Leverage + * Description: This interface can query the current symbol’s cross-margin leverage multiple. + * Documentation: https://www.kucoin.com/docs-new/api-3470260 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise; + + /** + * getMaxOpenSize Get Max Open Size + * Description: Get Maximum Open Position Size. + * Documentation: https://www.kucoin.com/docs-new/api-3470251 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; + + /** + * switchMarginMode Switch Margin Mode + * Description: This interface can modify the margin mode of the current symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470262 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + switchMarginMode(req: SwitchMarginModeReq): Promise; + + /** + * getMarginMode Get Margin Mode + * Description: This interface can query the margin mode of the current symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470259 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getMarginMode(req: GetMarginModeReq): Promise; +} + +export class PositionsAPIImpl implements PositionsAPI { + constructor(private transport: Transport) {} + + getIsolatedMarginRiskLimit( + req: GetIsolatedMarginRiskLimitReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/contracts/risk-limit/{symbol}', + req, + new GetIsolatedMarginRiskLimitResp(), + false, + ); + } + + getPositionsHistory(req: GetPositionsHistoryReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/history-positions', + req, + new GetPositionsHistoryResp(), + false, + ); + } + + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/margin/maxWithdrawMargin', + req, + new GetMaxWithdrawMarginResp(), + false, + ); + } + + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/margin/withdrawMargin', + req, + new RemoveIsolatedMarginResp(), + false, + ); + } + + getPositionDetails(req: GetPositionDetailsReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/position', + req, + new GetPositionDetailsResp(), + false, + ); + } + + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/position/margin/auto-deposit-status', + req, + new ModifyAutoDepositStatusResp(), + false, + ); + } + + addIsolatedMargin(req: AddIsolatedMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/position/margin/deposit-margin', + req, + new AddIsolatedMarginResp(), + false, + ); + } + + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/position/risk-limit-level/change', + req, + new ModifyIsolatedMarginRiskLimtResp(), + false, + ); + } + + getPositionList(req: GetPositionListReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/positions', + req, + new GetPositionListResp(), + false, + ); + } + + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v2/changeCrossUserLeverage', + req, + new ModifyMarginLeverageResp(), + false, + ); + } + + getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v2/getCrossUserLeverage', + req, + new GetCrossMarginLeverageResp(), + false, + ); + } + + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v2/getMaxOpenSize', + req, + new GetMaxOpenSizeResp(), + false, + ); + } + + switchMarginMode(req: SwitchMarginModeReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v2/position/changeMarginMode', + req, + new SwitchMarginModeResp(), + false, + ); + } + + getMarginMode(req: GetMarginModeReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v2/position/getMarginMode', + req, + new GetMarginModeResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts new file mode 100644 index 00000000..b8bb5486 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddIsolatedMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + margin?: number; + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + bizNo?: string; + + /** + * Creates a new instance of the `AddIsolatedMarginReq` class. + * The builder pattern allows step-by-step construction of a `AddIsolatedMarginReq` object. + */ + static builder(): AddIsolatedMarginReqBuilder { + return new AddIsolatedMarginReqBuilder(); + } + + /** + * Creates a new instance of the `AddIsolatedMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + margin?: number; + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + bizNo?: string; + }): AddIsolatedMarginReq { + let obj = new AddIsolatedMarginReq(); + obj.symbol = data.symbol; + obj.margin = data.margin; + obj.bizNo = data.bizNo; + return obj; + } + + fromJson(input: string): AddIsolatedMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddIsolatedMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddIsolatedMarginReq { + return plainToInstance(AddIsolatedMarginReq, jsonObject); + } +} + +export class AddIsolatedMarginReqBuilder { + obj: AddIsolatedMarginReq = new AddIsolatedMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddIsolatedMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + setMargin(value: number): AddIsolatedMarginReqBuilder { + this.obj.margin = value; + return this; + } + + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + setBizNo(value: string): AddIsolatedMarginReqBuilder { + this.obj.bizNo = value; + return this; + } + + build(): AddIsolatedMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts new file mode 100644 index 00000000..eca667f1 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts @@ -0,0 +1,177 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddIsolatedMarginResp implements Response { + /** + * Position ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Auto deposit margin or not + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement + */ + maintMarginReq?: number; + /** + * Risk limit + */ + riskLimit?: number; + /** + * Leverage o the order + */ + realLeverage?: number; + /** + * Cross mode or not + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: number; + /** + * Current commission + */ + currentComm?: number; + /** + * Unrealised value + */ + unrealisedCost?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: number; + /** + * Current realised position value + */ + realisedCost?: number; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: number; + /** + * Mark value + */ + markValue?: number; + /** + * Position value + */ + posCost?: number; + /** + * added margin + */ + posCross?: number; + /** + * Leverage margin + */ + posInit?: number; + /** + * Bankruptcy cost + */ + posComm?: number; + /** + * Funding fees paid out + */ + posLoss?: number; + /** + * Position margin + */ + posMargin?: number; + /** + * Maintenance margin + */ + posMaint?: number; + /** + * Position margin + */ + maintMargin?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: number; + /** + * Realised profit and loss + */ + realisedPnl?: number; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: number; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: number; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: number; + /** + * Average entry price + */ + avgEntryPrice?: number; + /** + * Liquidation price + */ + liquidationPrice?: number; + /** + * Bankruptcy price + */ + bankruptPrice?: number; + /** + * userId + */ + userId?: number; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddIsolatedMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddIsolatedMarginResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddIsolatedMarginResp { + return plainToInstance(AddIsolatedMarginResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts new file mode 100644 index 00000000..8628e8b1 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCrossMarginLeverageReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetCrossMarginLeverageReq` class. + * The builder pattern allows step-by-step construction of a `GetCrossMarginLeverageReq` object. + */ + static builder(): GetCrossMarginLeverageReqBuilder { + return new GetCrossMarginLeverageReqBuilder(); + } + + /** + * Creates a new instance of the `GetCrossMarginLeverageReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetCrossMarginLeverageReq { + let obj = new GetCrossMarginLeverageReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetCrossMarginLeverageReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginLeverageReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginLeverageReq { + return plainToInstance(GetCrossMarginLeverageReq, jsonObject); + } +} + +export class GetCrossMarginLeverageReqBuilder { + obj: GetCrossMarginLeverageReq = new GetCrossMarginLeverageReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetCrossMarginLeverageReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetCrossMarginLeverageReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts new file mode 100644 index 00000000..34637519 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetCrossMarginLeverageResp + implements Response +{ + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Leverage multiple + */ + leverage?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetCrossMarginLeverageResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginLeverageResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginLeverageResp { + return plainToInstance(GetCrossMarginLeverageResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts new file mode 100644 index 00000000..a52faea0 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginRiskLimitData + implements Serializable +{ + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * level + */ + level?: number; + /** + * Upper limit USDT(includes) + */ + maxRiskLimit?: number; + /** + * Lower limit USDT + */ + minRiskLimit?: number; + /** + * Max leverage + */ + maxLeverage?: number; + /** + * Initial margin rate + */ + initialMargin?: number; + /** + * Maintenance margin rate + */ + maintainMargin?: number; + fromJson(input: string): GetIsolatedMarginRiskLimitData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginRiskLimitData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitData { + return plainToInstance(GetIsolatedMarginRiskLimitData, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts new file mode 100644 index 00000000..fe7eb922 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginRiskLimitReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetIsolatedMarginRiskLimitReq` class. + * The builder pattern allows step-by-step construction of a `GetIsolatedMarginRiskLimitReq` object. + */ + static builder(): GetIsolatedMarginRiskLimitReqBuilder { + return new GetIsolatedMarginRiskLimitReqBuilder(); + } + + /** + * Creates a new instance of the `GetIsolatedMarginRiskLimitReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetIsolatedMarginRiskLimitReq { + let obj = new GetIsolatedMarginRiskLimitReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetIsolatedMarginRiskLimitReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginRiskLimitReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitReq { + return plainToInstance(GetIsolatedMarginRiskLimitReq, jsonObject); + } +} + +export class GetIsolatedMarginRiskLimitReqBuilder { + obj: GetIsolatedMarginRiskLimitReq = new GetIsolatedMarginRiskLimitReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetIsolatedMarginRiskLimitReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetIsolatedMarginRiskLimitReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts new file mode 100644 index 00000000..97f7604e --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetIsolatedMarginRiskLimitData } from './model_get_isolated_margin_risk_limit_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetIsolatedMarginRiskLimitResp + implements Response +{ + /** + * + */ + @Type(() => GetIsolatedMarginRiskLimitData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetIsolatedMarginRiskLimitResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginRiskLimitResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitResp { + return plainToInstance(GetIsolatedMarginRiskLimitResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts new file mode 100644 index 00000000..cf6a270f --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginModeReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetMarginModeReq` class. + * The builder pattern allows step-by-step construction of a `GetMarginModeReq` object. + */ + static builder(): GetMarginModeReqBuilder { + return new GetMarginModeReqBuilder(); + } + + /** + * Creates a new instance of the `GetMarginModeReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetMarginModeReq { + let obj = new GetMarginModeReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMarginModeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginModeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginModeReq { + return plainToInstance(GetMarginModeReq, jsonObject); + } +} + +export class GetMarginModeReqBuilder { + obj: GetMarginModeReq = new GetMarginModeReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMarginModeReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMarginModeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts new file mode 100644 index 00000000..d66e976a --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarginModeResp implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: GetMarginModeResp.MarginModeEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarginModeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginModeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginModeResp { + return plainToInstance(GetMarginModeResp, jsonObject); + } +} + +export namespace GetMarginModeResp { + export enum MarginModeEnum { + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + /** + * cross margin + */ + CROSS = 'CROSS', + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts new file mode 100644 index 00000000..36a87645 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMaxOpenSizeReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order price + */ + price?: string; + /** + * Leverage + */ + leverage?: number; + + /** + * Creates a new instance of the `GetMaxOpenSizeReq` class. + * The builder pattern allows step-by-step construction of a `GetMaxOpenSizeReq` object. + */ + static builder(): GetMaxOpenSizeReqBuilder { + return new GetMaxOpenSizeReqBuilder(); + } + + /** + * Creates a new instance of the `GetMaxOpenSizeReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order price + */ + price?: string; + /** + * Leverage + */ + leverage?: number; + }): GetMaxOpenSizeReq { + let obj = new GetMaxOpenSizeReq(); + obj.symbol = data.symbol; + obj.price = data.price; + obj.leverage = data.leverage; + return obj; + } + + fromJson(input: string): GetMaxOpenSizeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxOpenSizeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxOpenSizeReq { + return plainToInstance(GetMaxOpenSizeReq, jsonObject); + } +} + +export class GetMaxOpenSizeReqBuilder { + obj: GetMaxOpenSizeReq = new GetMaxOpenSizeReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMaxOpenSizeReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Order price + */ + setPrice(value: string): GetMaxOpenSizeReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Leverage + */ + setLeverage(value: number): GetMaxOpenSizeReqBuilder { + this.obj.leverage = value; + return this; + } + + build(): GetMaxOpenSizeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts new file mode 100644 index 00000000..545f0265 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMaxOpenSizeResp implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Maximum buy size + */ + maxBuyOpenSize?: number; + /** + * Maximum buy size + */ + maxSellOpenSize?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMaxOpenSizeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxOpenSizeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxOpenSizeResp { + return plainToInstance(GetMaxOpenSizeResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts new file mode 100644 index 00000000..7d2f0f6f --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMaxWithdrawMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetMaxWithdrawMarginReq` class. + * The builder pattern allows step-by-step construction of a `GetMaxWithdrawMarginReq` object. + */ + static builder(): GetMaxWithdrawMarginReqBuilder { + return new GetMaxWithdrawMarginReqBuilder(); + } + + /** + * Creates a new instance of the `GetMaxWithdrawMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetMaxWithdrawMarginReq { + let obj = new GetMaxWithdrawMarginReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMaxWithdrawMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxWithdrawMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxWithdrawMarginReq { + return plainToInstance(GetMaxWithdrawMarginReq, jsonObject); + } +} + +export class GetMaxWithdrawMarginReqBuilder { + obj: GetMaxWithdrawMarginReq = new GetMaxWithdrawMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMaxWithdrawMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMaxWithdrawMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts new file mode 100644 index 00000000..bc8c55bb --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMaxWithdrawMarginResp implements Response { + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMaxWithdrawMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxWithdrawMarginResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMaxWithdrawMarginResp { + return plainToInstance(GetMaxWithdrawMarginResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts new file mode 100644 index 00000000..d44b9bd7 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPositionDetailsReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetPositionDetailsReq` class. + * The builder pattern allows step-by-step construction of a `GetPositionDetailsReq` object. + */ + static builder(): GetPositionDetailsReqBuilder { + return new GetPositionDetailsReqBuilder(); + } + + /** + * Creates a new instance of the `GetPositionDetailsReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetPositionDetailsReq { + let obj = new GetPositionDetailsReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetPositionDetailsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionDetailsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionDetailsReq { + return plainToInstance(GetPositionDetailsReq, jsonObject); + } +} + +export class GetPositionDetailsReqBuilder { + obj: GetPositionDetailsReq = new GetPositionDetailsReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPositionDetailsReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetPositionDetailsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts new file mode 100644 index 00000000..3c64c660 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts @@ -0,0 +1,224 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPositionDetailsResp implements Response { + /** + * Position ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Whether it is cross margin. + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: number; + /** + * Current commission + */ + currentComm?: number; + /** + * Unrealised value + */ + unrealisedCost?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: number; + /** + * Current realised position value + */ + realisedCost?: number; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: number; + /** + * Mark Value + */ + markValue?: number; + /** + * Position value + */ + posCost?: number; + /** + * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction + */ + posInit?: number; + /** + * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) + */ + posMargin?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: number; + /** + * Realised profit and loss + */ + realisedPnl?: number; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: number; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: number; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: number; + /** + * Average entry price + */ + avgEntryPrice?: number; + /** + * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. + */ + liquidationPrice?: number; + /** + * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. + */ + bankruptPrice?: number; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Reverse contract or not + */ + isInverse?: boolean; + /** + * Margin Mode: CROSS,ISOLATED + */ + marginMode?: GetPositionDetailsResp.MarginModeEnum; + /** + * Position Side + */ + positionSide?: GetPositionDetailsResp.PositionSideEnum; + /** + * Leverage + */ + leverage?: number; + /** + * Auto deposit margin or not **Only applicable to Isolated Margin** + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement **Only applicable to Isolated Margin** + */ + maintMarginReq?: number; + /** + * Risk limit **Only applicable to Isolated Margin** + */ + riskLimit?: number; + /** + * Leverage of the order **Only applicable to Isolated Margin** + */ + realLeverage?: number; + /** + * added margin **Only applicable to Isolated Margin** + */ + posCross?: number; + /** + * Additional margin calls (automatic, manual, adjusted risk limits) **Only applicable to Isolated Margin** + */ + posCrossMargin?: number; + /** + * Bankruptcy cost **Only applicable to Isolated Margin** + */ + posComm?: number; + /** + * Part of bankruptcy cost (positioning, add margin) **Only applicable to Isolated Margin** + */ + posCommCommon?: number; + /** + * Funding fees paid out **Only applicable to Isolated Margin** + */ + posLoss?: number; + /** + * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** + */ + posFunding?: number; + /** + * Maintenance margin **Only applicable to Isolated Margin** + */ + posMaint?: number; + /** + * Position margin **Only applicable to Isolated Margin** + */ + maintMargin?: number; + /** + * Maintenance margin rate **Only applicable to Isolated Margin** + */ + maintainMargin?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPositionDetailsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionDetailsResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionDetailsResp { + return plainToInstance(GetPositionDetailsResp, jsonObject); + } +} + +export namespace GetPositionDetailsResp { + export enum MarginModeEnum { + /** + * cross margin + */ + CROSS = 'CROSS', + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum PositionSideEnum { + /** + * One-way position + */ + BOTH = 'BOTH', + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts new file mode 100644 index 00000000..6076c9ef --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts @@ -0,0 +1,213 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPositionListData implements Serializable { + /** + * Position ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Whether it is cross margin. + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: number; + /** + * Current commission + */ + currentComm?: number; + /** + * Unrealised value + */ + unrealisedCost?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: number; + /** + * Current realised position value + */ + realisedCost?: number; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: number; + /** + * Mark Value + */ + markValue?: number; + /** + * Position value + */ + posCost?: number; + /** + * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction + */ + posInit?: number; + /** + * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) + */ + posMargin?: number; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: number; + /** + * Realised profit and loss + */ + realisedPnl?: number; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: number; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: number; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: number; + /** + * Average entry price + */ + avgEntryPrice?: number; + /** + * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. + */ + liquidationPrice?: number; + /** + * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. + */ + bankruptPrice?: number; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + /** + * Reverse contract or not + */ + isInverse?: boolean; + /** + * Margin Mode: CROSS,ISOLATED + */ + marginMode?: GetPositionListData.MarginModeEnum; + /** + * Position Side + */ + positionSide?: GetPositionListData.PositionSideEnum; + /** + * Leverage + */ + leverage?: number; + /** + * Auto deposit margin or not **Only applicable to Isolated Margin** + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement **Only applicable to Isolated Margin** + */ + maintMarginReq?: number; + /** + * Risk limit **Only applicable to Isolated Margin** + */ + riskLimit?: number; + /** + * Leverage of the order **Only applicable to Isolated Margin** + */ + realLeverage?: number; + /** + * added margin **Only applicable to Isolated Margin** + */ + posCross?: number; + /** + * Additional margin calls (automatic, manual, adjusted risk limits) **Only applicable to Isolated Margin** + */ + posCrossMargin?: number; + /** + * Bankruptcy cost **Only applicable to Isolated Margin** + */ + posComm?: number; + /** + * Part of bankruptcy cost (positioning, add margin) **Only applicable to Isolated Margin** + */ + posCommCommon?: number; + /** + * Funding fees paid out **Only applicable to Isolated Margin** + */ + posLoss?: number; + /** + * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** + */ + posFunding?: number; + /** + * Maintenance margin **Only applicable to Isolated Margin** + */ + posMaint?: number; + /** + * Position margin **Only applicable to Isolated Margin** + */ + maintMargin?: number; + /** + * Maintenance margin rate **Only applicable to Isolated Margin** + */ + maintainMargin?: number; + fromJson(input: string): GetPositionListData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionListData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionListData { + return plainToInstance(GetPositionListData, jsonObject); + } +} + +export namespace GetPositionListData { + export enum MarginModeEnum { + /** + * cross margin + */ + CROSS = 'CROSS', + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + } + export enum PositionSideEnum { + /** + * One-way position + */ + BOTH = 'BOTH', + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts new file mode 100644 index 00000000..1a165255 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPositionListReq implements Serializable { + /** + * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty + */ + currency?: string; + + /** + * Creates a new instance of the `GetPositionListReq` class. + * The builder pattern allows step-by-step construction of a `GetPositionListReq` object. + */ + static builder(): GetPositionListReqBuilder { + return new GetPositionListReqBuilder(); + } + + /** + * Creates a new instance of the `GetPositionListReq` class with the given data. + */ + static create(data: { + /** + * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty + */ + currency?: string; + }): GetPositionListReq { + let obj = new GetPositionListReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetPositionListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionListReq { + return plainToInstance(GetPositionListReq, jsonObject); + } +} + +export class GetPositionListReqBuilder { + obj: GetPositionListReq = new GetPositionListReq(); + /** + * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty + */ + setCurrency(value: string): GetPositionListReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetPositionListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts new file mode 100644 index 00000000..fdc8595c --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetPositionListData } from './model_get_position_list_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPositionListResp implements Response { + /** + * + */ + @Type(() => GetPositionListData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPositionListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetPositionListResp { + return plainToInstance(GetPositionListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts new file mode 100644 index 00000000..4c7ff41a --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts @@ -0,0 +1,95 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPositionsHistoryItems implements Serializable { + /** + * Close ID + */ + closeId?: string; + /** + * User ID + */ + userId?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Currency used to settle trades + */ + settleCurrency?: string; + /** + * Leverage applied to the order + */ + leverage?: string; + /** + * Type of closure + */ + type?: string; + /** + * Net profit and loss (after deducting fees and funding costs) + */ + pnl?: string; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: string; + /** + * Accumulated realised profit withdrawn from the position + */ + withdrawPnl?: string; + /** + * Accumulated trading fees + */ + tradeFee?: string; + /** + * Accumulated funding fees + */ + fundingFee?: string; + /** + * Time when the position was opened + */ + openTime?: number; + /** + * Time when the position was closed (default sorted in descending order) + */ + closeTime?: number; + /** + * Opening price of the position + */ + openPrice?: string; + /** + * Closing price of the position + */ + closePrice?: string; + /** + * Margin Mode: CROSS,ISOLATED + */ + marginMode?: GetPositionsHistoryItems.MarginModeEnum; + fromJson(input: string): GetPositionsHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionsHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionsHistoryItems { + return plainToInstance(GetPositionsHistoryItems, jsonObject); + } +} + +export namespace GetPositionsHistoryItems { + export enum MarginModeEnum { + /** + * cross margin + */ + CROSS = 'CROSS', + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts new file mode 100644 index 00000000..10d6b321 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts @@ -0,0 +1,128 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPositionsHistoryReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Closing start time(ms) + */ + from?: number; + /** + * Closing end time(ms) + */ + to?: number; + /** + * Number of requests per page, max 200, default 10 + */ + limit?: number = 10; + /** + * Current page number, default 1 + */ + pageId?: number = 1; + + /** + * Creates a new instance of the `GetPositionsHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetPositionsHistoryReq` object. + */ + static builder(): GetPositionsHistoryReqBuilder { + return new GetPositionsHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetPositionsHistoryReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Closing start time(ms) + */ + from?: number; + /** + * Closing end time(ms) + */ + to?: number; + /** + * Number of requests per page, max 200, default 10 + */ + limit?: number; + /** + * Current page number, default 1 + */ + pageId?: number; + }): GetPositionsHistoryReq { + let obj = new GetPositionsHistoryReq(); + obj.symbol = data.symbol; + obj.from = data.from; + obj.to = data.to; + obj.limit = data.limit; + obj.pageId = data.pageId; + return obj; + } + + fromJson(input: string): GetPositionsHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionsHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionsHistoryReq { + return plainToInstance(GetPositionsHistoryReq, jsonObject); + } +} + +export class GetPositionsHistoryReqBuilder { + obj: GetPositionsHistoryReq = new GetPositionsHistoryReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetPositionsHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Closing start time(ms) + */ + setFrom(value: number): GetPositionsHistoryReqBuilder { + this.obj.from = value; + return this; + } + + /** + * Closing end time(ms) + */ + setTo(value: number): GetPositionsHistoryReqBuilder { + this.obj.to = value; + return this; + } + + /** + * Number of requests per page, max 200, default 10 + */ + setLimit(value: number): GetPositionsHistoryReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Current page number, default 1 + */ + setPageId(value: number): GetPositionsHistoryReqBuilder { + this.obj.pageId = value; + return this; + } + + build(): GetPositionsHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts new file mode 100644 index 00000000..061557e7 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPositionsHistoryItems } from './model_get_positions_history_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPositionsHistoryResp implements Response { + /** + * Current page number + */ + currentPage?: number; + /** + * Number of results per page + */ + pageSize?: number; + /** + * Total number of results + */ + totalNum?: number; + /** + * Total number of pages + */ + totalPage?: number; + /** + * + */ + @Type(() => GetPositionsHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPositionsHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPositionsHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPositionsHistoryResp { + return plainToInstance(GetPositionsHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts new file mode 100644 index 00000000..e67fbe63 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyAutoDepositStatusReq implements Serializable { + /** + * Symbol of the contract + */ + symbol?: string; + /** + * Status + */ + status?: boolean; + + /** + * Creates a new instance of the `ModifyAutoDepositStatusReq` class. + * The builder pattern allows step-by-step construction of a `ModifyAutoDepositStatusReq` object. + */ + static builder(): ModifyAutoDepositStatusReqBuilder { + return new ModifyAutoDepositStatusReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyAutoDepositStatusReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract + */ + symbol?: string; + /** + * Status + */ + status?: boolean; + }): ModifyAutoDepositStatusReq { + let obj = new ModifyAutoDepositStatusReq(); + obj.symbol = data.symbol; + obj.status = data.status; + return obj; + } + + fromJson(input: string): ModifyAutoDepositStatusReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyAutoDepositStatusReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyAutoDepositStatusReq { + return plainToInstance(ModifyAutoDepositStatusReq, jsonObject); + } +} + +export class ModifyAutoDepositStatusReqBuilder { + obj: ModifyAutoDepositStatusReq = new ModifyAutoDepositStatusReq(); + /** + * Symbol of the contract + */ + setSymbol(value: string): ModifyAutoDepositStatusReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Status + */ + setStatus(value: boolean): ModifyAutoDepositStatusReqBuilder { + this.obj.status = value; + return this; + } + + build(): ModifyAutoDepositStatusReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts new file mode 100644 index 00000000..a6709b92 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyAutoDepositStatusResp + implements Response +{ + /** + * + */ + data?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyAutoDepositStatusResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { + return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts new file mode 100644 index 00000000..1d818b97 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyIsolatedMarginRiskLimtReq + implements Serializable +{ + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * level + */ + level?: number; + + /** + * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class. + * The builder pattern allows step-by-step construction of a `ModifyIsolatedMarginRiskLimtReq` object. + */ + static builder(): ModifyIsolatedMarginRiskLimtReqBuilder { + return new ModifyIsolatedMarginRiskLimtReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * level + */ + level?: number; + }): ModifyIsolatedMarginRiskLimtReq { + let obj = new ModifyIsolatedMarginRiskLimtReq(); + obj.symbol = data.symbol; + obj.level = data.level; + return obj; + } + + fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { + return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + } +} + +export class ModifyIsolatedMarginRiskLimtReqBuilder { + obj: ModifyIsolatedMarginRiskLimtReq = new ModifyIsolatedMarginRiskLimtReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): ModifyIsolatedMarginRiskLimtReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * level + */ + setLevel(value: number): ModifyIsolatedMarginRiskLimtReqBuilder { + this.obj.level = value; + return this; + } + + build(): ModifyIsolatedMarginRiskLimtReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts new file mode 100644 index 00000000..2921ae5e --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyIsolatedMarginRiskLimtResp + implements Response +{ + /** + * To adjust the level will cancel the open order, the response can only indicate whether the submit of the adjustment request is successful or not. + */ + data?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { + return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts new file mode 100644 index 00000000..b650c881 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyMarginLeverageReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Leverage multiple + */ + leverage?: string; + + /** + * Creates a new instance of the `ModifyMarginLeverageReq` class. + * The builder pattern allows step-by-step construction of a `ModifyMarginLeverageReq` object. + */ + static builder(): ModifyMarginLeverageReqBuilder { + return new ModifyMarginLeverageReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyMarginLeverageReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Leverage multiple + */ + leverage?: string; + }): ModifyMarginLeverageReq { + let obj = new ModifyMarginLeverageReq(); + obj.symbol = data.symbol; + obj.leverage = data.leverage; + return obj; + } + + fromJson(input: string): ModifyMarginLeverageReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyMarginLeverageReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyMarginLeverageReq { + return plainToInstance(ModifyMarginLeverageReq, jsonObject); + } +} + +export class ModifyMarginLeverageReqBuilder { + obj: ModifyMarginLeverageReq = new ModifyMarginLeverageReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): ModifyMarginLeverageReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Leverage multiple + */ + setLeverage(value: string): ModifyMarginLeverageReqBuilder { + this.obj.leverage = value; + return this; + } + + build(): ModifyMarginLeverageReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts new file mode 100644 index 00000000..a80ef95e --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyMarginLeverageResp implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + leverage?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyMarginLeverageResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyMarginLeverageResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyMarginLeverageResp { + return plainToInstance(ModifyMarginLeverageResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts new file mode 100644 index 00000000..55530a9d --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class RemoveIsolatedMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + withdrawAmount?: string; + + /** + * Creates a new instance of the `RemoveIsolatedMarginReq` class. + * The builder pattern allows step-by-step construction of a `RemoveIsolatedMarginReq` object. + */ + static builder(): RemoveIsolatedMarginReqBuilder { + return new RemoveIsolatedMarginReqBuilder(); + } + + /** + * Creates a new instance of the `RemoveIsolatedMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + withdrawAmount?: string; + }): RemoveIsolatedMarginReq { + let obj = new RemoveIsolatedMarginReq(); + obj.symbol = data.symbol; + obj.withdrawAmount = data.withdrawAmount; + return obj; + } + + fromJson(input: string): RemoveIsolatedMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(RemoveIsolatedMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RemoveIsolatedMarginReq { + return plainToInstance(RemoveIsolatedMarginReq, jsonObject); + } +} + +export class RemoveIsolatedMarginReqBuilder { + obj: RemoveIsolatedMarginReq = new RemoveIsolatedMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): RemoveIsolatedMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + setWithdrawAmount(value: string): RemoveIsolatedMarginReqBuilder { + this.obj.withdrawAmount = value; + return this; + } + + build(): RemoveIsolatedMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts new file mode 100644 index 00000000..6adcfe63 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class RemoveIsolatedMarginResp implements Response { + /** + * The size of the position deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): RemoveIsolatedMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(RemoveIsolatedMarginResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): RemoveIsolatedMarginResp { + return plainToInstance(RemoveIsolatedMarginResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts new file mode 100644 index 00000000..698a50d4 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SwitchMarginModeReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Modified margin model: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: SwitchMarginModeReq.MarginModeEnum; + + /** + * Creates a new instance of the `SwitchMarginModeReq` class. + * The builder pattern allows step-by-step construction of a `SwitchMarginModeReq` object. + */ + static builder(): SwitchMarginModeReqBuilder { + return new SwitchMarginModeReqBuilder(); + } + + /** + * Creates a new instance of the `SwitchMarginModeReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Modified margin model: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: SwitchMarginModeReq.MarginModeEnum; + }): SwitchMarginModeReq { + let obj = new SwitchMarginModeReq(); + obj.symbol = data.symbol; + obj.marginMode = data.marginMode; + return obj; + } + + fromJson(input: string): SwitchMarginModeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(SwitchMarginModeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SwitchMarginModeReq { + return plainToInstance(SwitchMarginModeReq, jsonObject); + } +} + +export namespace SwitchMarginModeReq { + export enum MarginModeEnum { + /** + * Isolated Margin Mode + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin MOde + */ + CROSS = 'CROSS', + } +} + +export class SwitchMarginModeReqBuilder { + obj: SwitchMarginModeReq = new SwitchMarginModeReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): SwitchMarginModeReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Modified margin model: ISOLATED (isolated), CROSS (cross margin). + */ + setMarginMode(value: SwitchMarginModeReq.MarginModeEnum): SwitchMarginModeReqBuilder { + this.obj.marginMode = value; + return this; + } + + build(): SwitchMarginModeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts new file mode 100644 index 00000000..50724ae3 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class SwitchMarginModeResp implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin mode: ISOLATED (isolated), CROSS (cross margin). + */ + marginMode?: SwitchMarginModeResp.MarginModeEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): SwitchMarginModeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(SwitchMarginModeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SwitchMarginModeResp { + return plainToInstance(SwitchMarginModeResp, jsonObject); + } +} + +export namespace SwitchMarginModeResp { + export enum MarginModeEnum { + /** + * isolated margin + */ + ISOLATED = 'ISOLATED', + /** + * cross margin + */ + CROSS = 'CROSS', + } +} diff --git a/sdk/node/src/generate/margin/credit/api_credit.template b/sdk/node/src/generate/margin/credit/api_credit.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/credit/api_credit.test.ts b/sdk/node/src/generate/margin/credit/api_credit.test.ts new file mode 100644 index 00000000..416e12fa --- /dev/null +++ b/sdk/node/src/generate/margin/credit/api_credit.test.ts @@ -0,0 +1,238 @@ +import { PurchaseReq } from './model_purchase_req'; +import { GetPurchaseOrdersReq } from './model_get_purchase_orders_req'; +import { PurchaseResp } from './model_purchase_resp'; +import { ModifyPurchaseReq } from './model_modify_purchase_req'; +import { GetLoanMarketInterestRateReq } from './model_get_loan_market_interest_rate_req'; +import { ModifyPurchaseResp } from './model_modify_purchase_resp'; +import { GetLoanMarketInterestRateResp } from './model_get_loan_market_interest_rate_resp'; +import { GetRedeemOrdersResp } from './model_get_redeem_orders_resp'; +import { GetPurchaseOrdersResp } from './model_get_purchase_orders_resp'; +import { GetLoanMarketResp } from './model_get_loan_market_resp'; +import { RedeemResp } from './model_redeem_resp'; +import { GetRedeemOrdersReq } from './model_get_redeem_orders_req'; +import { RedeemReq } from './model_redeem_req'; +import { GetLoanMarketReq } from './model_get_loan_market_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('modifyPurchase request test', () => { + /** + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update + */ + let data = + '{"currency": "BTC", "purchaseOrderNo": "671bafa804c26d000773c533", "interestRate": "0.09"}'; + let req = new ModifyPurchaseReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyPurchase response test', () => { + /** + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update + */ + let data = '{\n "code": "200000",\n "data": null\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyPurchaseResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getLoanMarket request test', () => { + /** + * getLoanMarket + * Get Loan Market + * /api/v3/project/list + */ + let data = '{"currency": "BTC"}'; + let req = new GetLoanMarketReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getLoanMarket response test', () => { + /** + * getLoanMarket + * Get Loan Market + * /api/v3/project/list + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "currency": "BTC",\n "purchaseEnable": true,\n "redeemEnable": true,\n "increment": "0.00000001",\n "minPurchaseSize": "0.001",\n "maxPurchaseSize": "40",\n "interestIncrement": "0.0001",\n "minInterestRate": "0.005",\n "marketInterestRate": "0.005",\n "maxInterestRate": "0.32",\n "autoPurchaseEnable": false\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetLoanMarketResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getLoanMarketInterestRate request test', () => { + /** + * getLoanMarketInterestRate + * Get Loan Market Interest Rate + * /api/v3/project/marketInterestRate + */ + let data = '{"currency": "BTC"}'; + let req = new GetLoanMarketInterestRateReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getLoanMarketInterestRate response test', () => { + /** + * getLoanMarketInterestRate + * Get Loan Market Interest Rate + * /api/v3/project/marketInterestRate + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "time": "202410170000",\n "marketInterestRate": "0.005"\n },\n {\n "time": "202410170100",\n "marketInterestRate": "0.005"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetLoanMarketInterestRateResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPurchaseOrders request test', () => { + /** + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders + */ + let data = + '{"currency": "BTC", "status": "DONE", "purchaseOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; + let req = new GetPurchaseOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPurchaseOrders response test', () => { + /** + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bb15a3b3f930007880bae",\n "purchaseSize": "0.001",\n "matchSize": "0",\n "interestRate": "0.1",\n "incomeSize": "0",\n "applyTime": 1729868122172,\n "status": "PENDING"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPurchaseOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('purchase request test', () => { + /** + * purchase + * Purchase + * /api/v3/purchase + */ + let data = '{"currency": "BTC", "size": "0.001", "interestRate": "0.1"}'; + let req = new PurchaseReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('purchase response test', () => { + /** + * purchase + * Purchase + * /api/v3/purchase + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new PurchaseResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRedeemOrders request test', () => { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let data = + '{"currency": "BTC", "status": "DONE", "redeemOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; + let req = new GetRedeemOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRedeemOrders response test', () => { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bafa804c26d000773c533",\n "redeemOrderNo": "671bb01004c26d000773c55c",\n "redeemSize": "0.001",\n "receiptSize": "0.001",\n "applyTime": null,\n "status": "DONE"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRedeemOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('redeem request test', () => { + /** + * redeem + * Redeem + * /api/v3/redeem + */ + let data = + '{"currency": "BTC", "size": "0.001", "purchaseOrderNo": "671bafa804c26d000773c533"}'; + let req = new RedeemReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('redeem response test', () => { + /** + * redeem + * Redeem + * /api/v3/redeem + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new RedeemResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/credit/api_credit.ts b/sdk/node/src/generate/margin/credit/api_credit.ts new file mode 100644 index 00000000..eb3efa19 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/api_credit.ts @@ -0,0 +1,223 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { PurchaseReq } from './model_purchase_req'; +import { GetPurchaseOrdersReq } from './model_get_purchase_orders_req'; +import { PurchaseResp } from './model_purchase_resp'; +import { ModifyPurchaseReq } from './model_modify_purchase_req'; +import { GetLoanMarketInterestRateReq } from './model_get_loan_market_interest_rate_req'; +import { ModifyPurchaseResp } from './model_modify_purchase_resp'; +import { GetLoanMarketInterestRateResp } from './model_get_loan_market_interest_rate_resp'; +import { GetRedeemOrdersResp } from './model_get_redeem_orders_resp'; +import { GetPurchaseOrdersResp } from './model_get_purchase_orders_resp'; +import { GetLoanMarketResp } from './model_get_loan_market_resp'; +import { RedeemResp } from './model_redeem_resp'; +import { GetRedeemOrdersReq } from './model_get_redeem_orders_req'; +import { RedeemReq } from './model_redeem_req'; +import { GetLoanMarketReq } from './model_get_loan_market_req'; + +export interface CreditAPI { + /** + * modifyPurchase Modify Purchase + * Description: This API endpoint is used to update the interest rates of subscription orders, which will take effect at the beginning of the next hour.,Please ensure that the funds are in the main(funding) account + * Documentation: https://www.kucoin.com/docs-new/api-3470217 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + modifyPurchase(req: ModifyPurchaseReq): Promise; + + /** + * getLoanMarket Get Loan Market + * Description: This API endpoint is used to get the information about the currencies available for lending. + * Documentation: https://www.kucoin.com/docs-new/api-3470212 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getLoanMarket(req: GetLoanMarketReq): Promise; + + /** + * getLoanMarketInterestRate Get Loan Market Interest Rate + * Description: This API endpoint is used to get the interest rates of the margin lending market over the past 7 days. + * Documentation: https://www.kucoin.com/docs-new/api-3470215 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | + * +---------------------+--------+ + */ + getLoanMarketInterestRate( + req: GetLoanMarketInterestRateReq, + ): Promise; + + /** + * getPurchaseOrders Get Purchase Orders + * Description: This API endpoint provides pagination query for the purchase orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470213 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getPurchaseOrders(req: GetPurchaseOrdersReq): Promise; + + /** + * purchase Purchase + * Description: Invest credit in the market and earn interest + * Documentation: https://www.kucoin.com/docs-new/api-3470216 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + purchase(req: PurchaseReq): Promise; + + /** + * getRedeemOrders Get Redeem Orders + * Description: This API endpoint provides pagination query for the redeem orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470214 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getRedeemOrders(req: GetRedeemOrdersReq): Promise; + + /** + * redeem Redeem + * Description: Redeem your loan order + * Documentation: https://www.kucoin.com/docs-new/api-3470218 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + redeem(req: RedeemReq): Promise; +} + +export class CreditAPIImpl implements CreditAPI { + constructor(private transport: Transport) {} + + modifyPurchase(req: ModifyPurchaseReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/lend/purchase/update', + req, + new ModifyPurchaseResp(), + false, + ); + } + + getLoanMarket(req: GetLoanMarketReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/project/list', + req, + new GetLoanMarketResp(), + false, + ); + } + + getLoanMarketInterestRate( + req: GetLoanMarketInterestRateReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/project/marketInterestRate', + req, + new GetLoanMarketInterestRateResp(), + false, + ); + } + + getPurchaseOrders(req: GetPurchaseOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/purchase/orders', + req, + new GetPurchaseOrdersResp(), + false, + ); + } + + purchase(req: PurchaseReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/purchase', + req, + new PurchaseResp(), + false, + ); + } + + getRedeemOrders(req: GetRedeemOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/redeem/orders', + req, + new GetRedeemOrdersResp(), + false, + ); + } + + redeem(req: RedeemReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/redeem', + req, + new RedeemResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts new file mode 100644 index 00000000..d786ab72 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetLoanMarketData implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Whether purchase is supported. + */ + purchaseEnable?: boolean; + /** + * Whether redeem is supported. + */ + redeemEnable?: boolean; + /** + * Increment precision for purchase and redemption + */ + increment?: string; + /** + * Minimum purchase amount + */ + minPurchaseSize?: string; + /** + * Minimum lending rate + */ + minInterestRate?: string; + /** + * Maximum lending rate + */ + maxInterestRate?: string; + /** + * Increment precision for interest; default is 0.0001 + */ + interestIncrement?: string = '0.0001'; + /** + * Maximum purchase amount + */ + maxPurchaseSize?: string; + /** + * Latest market lending rate + */ + marketInterestRate?: string; + /** + * Whether to allow automatic purchase: true: on, false: off + */ + autoPurchaseEnable?: boolean; + fromJson(input: string): GetLoanMarketData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetLoanMarketData { + return plainToInstance(GetLoanMarketData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts new file mode 100644 index 00000000..ed5161e9 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts @@ -0,0 +1,26 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetLoanMarketInterestRateData implements Serializable { + /** + * Time: YYYYMMDDHH00 + */ + time?: string; + /** + * Market lending rate + */ + marketInterestRate?: string; + fromJson(input: string): GetLoanMarketInterestRateData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketInterestRateData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetLoanMarketInterestRateData { + return plainToInstance(GetLoanMarketInterestRateData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts new file mode 100644 index 00000000..f1a44cc3 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetLoanMarketInterestRateReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetLoanMarketInterestRateReq` class. + * The builder pattern allows step-by-step construction of a `GetLoanMarketInterestRateReq` object. + */ + static builder(): GetLoanMarketInterestRateReqBuilder { + return new GetLoanMarketInterestRateReqBuilder(); + } + + /** + * Creates a new instance of the `GetLoanMarketInterestRateReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetLoanMarketInterestRateReq { + let obj = new GetLoanMarketInterestRateReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetLoanMarketInterestRateReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketInterestRateReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetLoanMarketInterestRateReq { + return plainToInstance(GetLoanMarketInterestRateReq, jsonObject); + } +} + +export class GetLoanMarketInterestRateReqBuilder { + obj: GetLoanMarketInterestRateReq = new GetLoanMarketInterestRateReq(); + /** + * currency + */ + setCurrency(value: string): GetLoanMarketInterestRateReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetLoanMarketInterestRateReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts new file mode 100644 index 00000000..cfe41526 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetLoanMarketInterestRateData } from './model_get_loan_market_interest_rate_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetLoanMarketInterestRateResp + implements Response +{ + /** + * + */ + @Type(() => GetLoanMarketInterestRateData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetLoanMarketInterestRateResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketInterestRateResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetLoanMarketInterestRateResp { + return plainToInstance(GetLoanMarketInterestRateResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts new file mode 100644 index 00000000..835344cb --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetLoanMarketReq implements Serializable { + /** + * currency + */ + currency?: string; + + /** + * Creates a new instance of the `GetLoanMarketReq` class. + * The builder pattern allows step-by-step construction of a `GetLoanMarketReq` object. + */ + static builder(): GetLoanMarketReqBuilder { + return new GetLoanMarketReqBuilder(); + } + + /** + * Creates a new instance of the `GetLoanMarketReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + }): GetLoanMarketReq { + let obj = new GetLoanMarketReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetLoanMarketReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetLoanMarketReq { + return plainToInstance(GetLoanMarketReq, jsonObject); + } +} + +export class GetLoanMarketReqBuilder { + obj: GetLoanMarketReq = new GetLoanMarketReq(); + /** + * currency + */ + setCurrency(value: string): GetLoanMarketReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetLoanMarketReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts new file mode 100644 index 00000000..231f580a --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetLoanMarketData } from './model_get_loan_market_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetLoanMarketResp implements Response { + /** + * + */ + @Type(() => GetLoanMarketData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetLoanMarketResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetLoanMarketResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetLoanMarketResp { + return plainToInstance(GetLoanMarketResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts new file mode 100644 index 00000000..787be66e --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts @@ -0,0 +1,63 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPurchaseOrdersItems implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + /** + * Total purchase size + */ + purchaseSize?: string; + /** + * Executed size + */ + matchSize?: string; + /** + * Target annualized interest rate + */ + interestRate?: string; + /** + * Redeemed amount + */ + incomeSize?: string; + /** + * Time of purchase + */ + applyTime?: number; + /** + * Status: DONE-completed; PENDING-settling + */ + status?: GetPurchaseOrdersItems.StatusEnum; + fromJson(input: string): GetPurchaseOrdersItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPurchaseOrdersItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPurchaseOrdersItems { + return plainToInstance(GetPurchaseOrdersItems, jsonObject); + } +} + +export namespace GetPurchaseOrdersItems { + export enum StatusEnum { + /** + * + */ + DONE = 'DONE', + /** + * + */ + PENDING = 'PENDING', + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts new file mode 100644 index 00000000..fe9a4b38 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts @@ -0,0 +1,141 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPurchaseOrdersReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * DONE-completed; PENDING-settling + */ + status?: GetPurchaseOrdersReq.StatusEnum; + /** + * + */ + purchaseOrderNo?: string; + /** + * Current page; default is 1 + */ + currentPage?: number = 1; + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetPurchaseOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetPurchaseOrdersReq` object. + */ + static builder(): GetPurchaseOrdersReqBuilder { + return new GetPurchaseOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetPurchaseOrdersReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * DONE-completed; PENDING-settling + */ + status?: GetPurchaseOrdersReq.StatusEnum; + /** + * + */ + purchaseOrderNo?: string; + /** + * Current page; default is 1 + */ + currentPage?: number; + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + pageSize?: number; + }): GetPurchaseOrdersReq { + let obj = new GetPurchaseOrdersReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.purchaseOrderNo = data.purchaseOrderNo; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetPurchaseOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPurchaseOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPurchaseOrdersReq { + return plainToInstance(GetPurchaseOrdersReq, jsonObject); + } +} + +export namespace GetPurchaseOrdersReq { + export enum StatusEnum { + /** + * + */ + DONE = 'DONE', + /** + * + */ + PENDING = 'PENDING', + } +} + +export class GetPurchaseOrdersReqBuilder { + obj: GetPurchaseOrdersReq = new GetPurchaseOrdersReq(); + /** + * currency + */ + setCurrency(value: string): GetPurchaseOrdersReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * DONE-completed; PENDING-settling + */ + setStatus(value: GetPurchaseOrdersReq.StatusEnum): GetPurchaseOrdersReqBuilder { + this.obj.status = value; + return this; + } + + /** + * + */ + setPurchaseOrderNo(value: string): GetPurchaseOrdersReqBuilder { + this.obj.purchaseOrderNo = value; + return this; + } + + /** + * Current page; default is 1 + */ + setCurrentPage(value: number): GetPurchaseOrdersReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + setPageSize(value: number): GetPurchaseOrdersReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetPurchaseOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts new file mode 100644 index 00000000..77706f15 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPurchaseOrdersItems } from './model_get_purchase_orders_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPurchaseOrdersResp implements Response { + /** + * Current Page + */ + currentPage?: number; + /** + * Page Size + */ + pageSize?: number; + /** + * Total Number + */ + totalNum?: number; + /** + * Total Page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetPurchaseOrdersItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPurchaseOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPurchaseOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPurchaseOrdersResp { + return plainToInstance(GetPurchaseOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts new file mode 100644 index 00000000..8f7a1c6c --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts @@ -0,0 +1,46 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRedeemOrdersItems implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + /** + * Redeem order id + */ + redeemOrderNo?: string; + /** + * Redemption size + */ + redeemSize?: string; + /** + * Redeemed size + */ + receiptSize?: string; + /** + * Time of redeem + */ + applyTime?: string; + /** + * Status: DONE-completed; PENDING-settling + */ + status?: string; + fromJson(input: string): GetRedeemOrdersItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRedeemOrdersItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRedeemOrdersItems { + return plainToInstance(GetRedeemOrdersItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts new file mode 100644 index 00000000..01da9297 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts @@ -0,0 +1,141 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRedeemOrdersReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * DONE-completed; PENDING-settling + */ + status?: GetRedeemOrdersReq.StatusEnum; + /** + * Redeem order id + */ + redeemOrderNo?: string; + /** + * Current page; default is 1 + */ + currentPage?: number = 1; + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetRedeemOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetRedeemOrdersReq` object. + */ + static builder(): GetRedeemOrdersReqBuilder { + return new GetRedeemOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetRedeemOrdersReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * DONE-completed; PENDING-settling + */ + status?: GetRedeemOrdersReq.StatusEnum; + /** + * Redeem order id + */ + redeemOrderNo?: string; + /** + * Current page; default is 1 + */ + currentPage?: number; + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + pageSize?: number; + }): GetRedeemOrdersReq { + let obj = new GetRedeemOrdersReq(); + obj.currency = data.currency; + obj.status = data.status; + obj.redeemOrderNo = data.redeemOrderNo; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetRedeemOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRedeemOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRedeemOrdersReq { + return plainToInstance(GetRedeemOrdersReq, jsonObject); + } +} + +export namespace GetRedeemOrdersReq { + export enum StatusEnum { + /** + * + */ + DONE = 'DONE', + /** + * + */ + PENDING = 'PENDING', + } +} + +export class GetRedeemOrdersReqBuilder { + obj: GetRedeemOrdersReq = new GetRedeemOrdersReq(); + /** + * currency + */ + setCurrency(value: string): GetRedeemOrdersReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * DONE-completed; PENDING-settling + */ + setStatus(value: GetRedeemOrdersReq.StatusEnum): GetRedeemOrdersReqBuilder { + this.obj.status = value; + return this; + } + + /** + * Redeem order id + */ + setRedeemOrderNo(value: string): GetRedeemOrdersReqBuilder { + this.obj.redeemOrderNo = value; + return this; + } + + /** + * Current page; default is 1 + */ + setCurrentPage(value: number): GetRedeemOrdersReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Page size; 1<=pageSize<=100; default is 50 + */ + setPageSize(value: number): GetRedeemOrdersReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetRedeemOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts new file mode 100644 index 00000000..da457196 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetRedeemOrdersItems } from './model_get_redeem_orders_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRedeemOrdersResp implements Response { + /** + * Current Page + */ + currentPage?: number; + /** + * Page Size + */ + pageSize?: number; + /** + * Total Number + */ + totalNum?: number; + /** + * Total Page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetRedeemOrdersItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRedeemOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRedeemOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRedeemOrdersResp { + return plainToInstance(GetRedeemOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts new file mode 100644 index 00000000..aeedd0b2 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyPurchaseReq implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Modified purchase interest rate + */ + interestRate?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + + /** + * Creates a new instance of the `ModifyPurchaseReq` class. + * The builder pattern allows step-by-step construction of a `ModifyPurchaseReq` object. + */ + static builder(): ModifyPurchaseReqBuilder { + return new ModifyPurchaseReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyPurchaseReq` class with the given data. + */ + static create(data: { + /** + * Currency + */ + currency?: string; + /** + * Modified purchase interest rate + */ + interestRate?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + }): ModifyPurchaseReq { + let obj = new ModifyPurchaseReq(); + obj.currency = data.currency; + obj.interestRate = data.interestRate; + obj.purchaseOrderNo = data.purchaseOrderNo; + return obj; + } + + fromJson(input: string): ModifyPurchaseReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyPurchaseReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyPurchaseReq { + return plainToInstance(ModifyPurchaseReq, jsonObject); + } +} + +export class ModifyPurchaseReqBuilder { + obj: ModifyPurchaseReq = new ModifyPurchaseReq(); + /** + * Currency + */ + setCurrency(value: string): ModifyPurchaseReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Modified purchase interest rate + */ + setInterestRate(value: string): ModifyPurchaseReqBuilder { + this.obj.interestRate = value; + return this; + } + + /** + * Purchase order id + */ + setPurchaseOrderNo(value: string): ModifyPurchaseReqBuilder { + this.obj.purchaseOrderNo = value; + return this; + } + + build(): ModifyPurchaseReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts new file mode 100644 index 00000000..056ee7ec --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyPurchaseResp implements Response { + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyPurchaseResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyPurchaseResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyPurchaseResp { + return plainToInstance(ModifyPurchaseResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_purchase_req.ts new file mode 100644 index 00000000..ca638345 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_purchase_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class PurchaseReq implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * purchase amount + */ + size?: string; + /** + * purchase interest rate + */ + interestRate?: string; + + /** + * Creates a new instance of the `PurchaseReq` class. + * The builder pattern allows step-by-step construction of a `PurchaseReq` object. + */ + static builder(): PurchaseReqBuilder { + return new PurchaseReqBuilder(); + } + + /** + * Creates a new instance of the `PurchaseReq` class with the given data. + */ + static create(data: { + /** + * Currency + */ + currency?: string; + /** + * purchase amount + */ + size?: string; + /** + * purchase interest rate + */ + interestRate?: string; + }): PurchaseReq { + let obj = new PurchaseReq(); + obj.currency = data.currency; + obj.size = data.size; + obj.interestRate = data.interestRate; + return obj; + } + + fromJson(input: string): PurchaseReq { + const jsonObject = JSON.parse(input); + return plainToInstance(PurchaseReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): PurchaseReq { + return plainToInstance(PurchaseReq, jsonObject); + } +} + +export class PurchaseReqBuilder { + obj: PurchaseReq = new PurchaseReq(); + /** + * Currency + */ + setCurrency(value: string): PurchaseReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * purchase amount + */ + setSize(value: string): PurchaseReqBuilder { + this.obj.size = value; + return this; + } + + /** + * purchase interest rate + */ + setInterestRate(value: string): PurchaseReqBuilder { + this.obj.interestRate = value; + return this; + } + + build(): PurchaseReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts new file mode 100644 index 00000000..97817140 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class PurchaseResp implements Response { + /** + * Purchase order id + */ + orderNo?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): PurchaseResp { + const jsonObject = JSON.parse(input); + return plainToInstance(PurchaseResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): PurchaseResp { + return plainToInstance(PurchaseResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/credit/model_redeem_req.ts b/sdk/node/src/generate/margin/credit/model_redeem_req.ts new file mode 100644 index 00000000..ed6892a4 --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_redeem_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class RedeemReq implements Serializable { + /** + * Currency + */ + currency?: string; + /** + * Redemption amount + */ + size?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + + /** + * Creates a new instance of the `RedeemReq` class. + * The builder pattern allows step-by-step construction of a `RedeemReq` object. + */ + static builder(): RedeemReqBuilder { + return new RedeemReqBuilder(); + } + + /** + * Creates a new instance of the `RedeemReq` class with the given data. + */ + static create(data: { + /** + * Currency + */ + currency?: string; + /** + * Redemption amount + */ + size?: string; + /** + * Purchase order id + */ + purchaseOrderNo?: string; + }): RedeemReq { + let obj = new RedeemReq(); + obj.currency = data.currency; + obj.size = data.size; + obj.purchaseOrderNo = data.purchaseOrderNo; + return obj; + } + + fromJson(input: string): RedeemReq { + const jsonObject = JSON.parse(input); + return plainToInstance(RedeemReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RedeemReq { + return plainToInstance(RedeemReq, jsonObject); + } +} + +export class RedeemReqBuilder { + obj: RedeemReq = new RedeemReq(); + /** + * Currency + */ + setCurrency(value: string): RedeemReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Redemption amount + */ + setSize(value: string): RedeemReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Purchase order id + */ + setPurchaseOrderNo(value: string): RedeemReqBuilder { + this.obj.purchaseOrderNo = value; + return this; + } + + build(): RedeemReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts new file mode 100644 index 00000000..b105894a --- /dev/null +++ b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class RedeemResp implements Response { + /** + * Redeem order id + */ + orderNo?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): RedeemResp { + const jsonObject = JSON.parse(input); + return plainToInstance(RedeemResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RedeemResp { + return plainToInstance(RedeemResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/api_debit.template b/sdk/node/src/generate/margin/debit/api_debit.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/debit/api_debit.test.ts b/sdk/node/src/generate/margin/debit/api_debit.test.ts new file mode 100644 index 00000000..2ad643fb --- /dev/null +++ b/sdk/node/src/generate/margin/debit/api_debit.test.ts @@ -0,0 +1,205 @@ +import { ModifyLeverageReq } from './model_modify_leverage_req'; +import { GetBorrowHistoryReq } from './model_get_borrow_history_req'; +import { GetRepayHistoryResp } from './model_get_repay_history_resp'; +import { RepayReq } from './model_repay_req'; +import { GetInterestHistoryReq } from './model_get_interest_history_req'; +import { RepayResp } from './model_repay_resp'; +import { BorrowResp } from './model_borrow_resp'; +import { BorrowReq } from './model_borrow_req'; +import { GetRepayHistoryReq } from './model_get_repay_history_req'; +import { ModifyLeverageResp } from './model_modify_leverage_resp'; +import { GetInterestHistoryResp } from './model_get_interest_history_resp'; +import { GetBorrowHistoryResp } from './model_get_borrow_history_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getBorrowHistory request test', () => { + /** + * getBorrowHistory + * Get Borrow History + * /api/v3/margin/borrow + */ + let data = + '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetBorrowHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getBorrowHistory response test', () => { + /** + * getBorrowHistory + * Get Borrow History + * /api/v3/margin/borrow + */ + let data = + '{\n "code": "200000",\n "data": {\n "timestamp": 1729657580449,\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "orderNo": "67187162c0d6990007717b15",\n "symbol": null,\n "currency": "USDT",\n "size": "10",\n "actualSize": "10",\n "status": "SUCCESS",\n "createdTime": 1729655138000\n },\n {\n "orderNo": "67187155b088e70007149585",\n "symbol": null,\n "currency": "USDT",\n "size": "0.1",\n "actualSize": "0",\n "status": "FAILED",\n "createdTime": 1729655125000\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetBorrowHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('borrow request test', () => { + /** + * borrow + * Borrow + * /api/v3/margin/borrow + */ + let data = + '{"currency": "USDT", "size": 10, "timeInForce": "FOK", "isIsolated": false, "isHf": false}'; + let req = new BorrowReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('borrow response test', () => { + /** + * borrow + * Borrow + * /api/v3/margin/borrow + */ + let data = + '{"code":"200000","data":{"orderNo":"67187162c0d6990007717b15","actualSize":"10"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BorrowResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getInterestHistory request test', () => { + /** + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest + */ + let data = + '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetInterestHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getInterestHistory response test', () => { + /** + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest + */ + let data = + '{"code":"200000","data":{"timestamp":1729665170701,"currentPage":1,"pageSize":50,"totalNum":3,"totalPage":1,"items":[{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729663213375},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729659618802},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729656028077}]}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetInterestHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRepayHistory request test', () => { + /** + * getRepayHistory + * Get Repay History + * /api/v3/margin/repay + */ + let data = + '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetRepayHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRepayHistory response test', () => { + /** + * getRepayHistory + * Get Repay History + * /api/v3/margin/repay + */ + let data = + '{"code":"200000","data":{"timestamp":1729663471891,"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"orderNo":"671873361d5bd400075096ad","symbol":null,"currency":"USDT","size":"10","principal":"9.99986518","interest":"0.00013482","status":"SUCCESS","createdTime":1729655606000}]}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRepayHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('repay request test', () => { + /** + * repay + * Repay + * /api/v3/margin/repay + */ + let data = '{"currency": "USDT", "size": 10}'; + let req = new RepayReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('repay response test', () => { + /** + * repay + * Repay + * /api/v3/margin/repay + */ + let data = + '{"code":"200000","data":{"timestamp":1729655606816,"orderNo":"671873361d5bd400075096ad","actualSize":"10"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new RepayResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('modifyLeverage request test', () => { + /** + * modifyLeverage + * Modify Leverage + * /api/v3/position/update-user-leverage + */ + let data = '{"leverage": "5"}'; + let req = new ModifyLeverageReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyLeverage response test', () => { + /** + * modifyLeverage + * Modify Leverage + * /api/v3/position/update-user-leverage + */ + let data = '{"code":"200000","data":null}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyLeverageResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/debit/api_debit.ts b/sdk/node/src/generate/margin/debit/api_debit.ts new file mode 100644 index 00000000..d2fe9937 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/api_debit.ts @@ -0,0 +1,189 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { ModifyLeverageReq } from './model_modify_leverage_req'; +import { GetBorrowHistoryReq } from './model_get_borrow_history_req'; +import { GetRepayHistoryResp } from './model_get_repay_history_resp'; +import { RepayReq } from './model_repay_req'; +import { GetInterestHistoryReq } from './model_get_interest_history_req'; +import { RepayResp } from './model_repay_resp'; +import { BorrowResp } from './model_borrow_resp'; +import { BorrowReq } from './model_borrow_req'; +import { GetRepayHistoryReq } from './model_get_repay_history_req'; +import { ModifyLeverageResp } from './model_modify_leverage_resp'; +import { GetInterestHistoryResp } from './model_get_interest_history_resp'; +import { GetBorrowHistoryResp } from './model_get_borrow_history_resp'; + +export interface DebitAPI { + /** + * getBorrowHistory Get Borrow History + * Description: This API endpoint is used to get the borrowing orders for cross and isolated margin accounts + * Documentation: https://www.kucoin.com/docs-new/api-3470207 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + getBorrowHistory(req: GetBorrowHistoryReq): Promise; + + /** + * borrow Borrow + * Description: This API endpoint is used to initiate an application for cross or isolated margin borrowing. + * Documentation: https://www.kucoin.com/docs-new/api-3470206 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + borrow(req: BorrowReq): Promise; + + /** + * getInterestHistory Get Interest History + * Description: Request via this endpoint to get the interest records of the cross/isolated margin lending. + * Documentation: https://www.kucoin.com/docs-new/api-3470209 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + getInterestHistory(req: GetInterestHistoryReq): Promise; + + /** + * getRepayHistory Get Repay History + * Description: This API endpoint is used to get the borrowing orders for cross and isolated margin accounts + * Documentation: https://www.kucoin.com/docs-new/api-3470208 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 15 | + * +---------------------+---------+ + */ + getRepayHistory(req: GetRepayHistoryReq): Promise; + + /** + * repay Repay + * Description: This API endpoint is used to initiate an application for cross or isolated margin repayment. + * Documentation: https://www.kucoin.com/docs-new/api-3470210 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + repay(req: RepayReq): Promise; + + /** + * modifyLeverage Modify Leverage + * Description: This endpoint allows modifying the leverage multiplier for cross margin or isolated margin. + * Documentation: https://www.kucoin.com/docs-new/api-3470211 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + modifyLeverage(req: ModifyLeverageReq): Promise; +} + +export class DebitAPIImpl implements DebitAPI { + constructor(private transport: Transport) {} + + getBorrowHistory(req: GetBorrowHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/borrow', + req, + new GetBorrowHistoryResp(), + false, + ); + } + + borrow(req: BorrowReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/margin/borrow', + req, + new BorrowResp(), + false, + ); + } + + getInterestHistory(req: GetInterestHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/interest', + req, + new GetInterestHistoryResp(), + false, + ); + } + + getRepayHistory(req: GetRepayHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/repay', + req, + new GetRepayHistoryResp(), + false, + ); + } + + repay(req: RepayReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/margin/repay', + req, + new RepayResp(), + false, + ); + } + + modifyLeverage(req: ModifyLeverageReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/position/update-user-leverage', + req, + new ModifyLeverageResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_borrow_req.ts b/sdk/node/src/generate/margin/debit/model_borrow_req.ts new file mode 100644 index 00000000..d7701a81 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_borrow_req.ts @@ -0,0 +1,158 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BorrowReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Borrow amount + */ + size?: number; + /** + * timeInForce: IOC, FOK + */ + timeInForce?: BorrowReq.TimeInForceEnum; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + isHf?: boolean = false; + + /** + * Creates a new instance of the `BorrowReq` class. + * The builder pattern allows step-by-step construction of a `BorrowReq` object. + */ + static builder(): BorrowReqBuilder { + return new BorrowReqBuilder(); + } + + /** + * Creates a new instance of the `BorrowReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Borrow amount + */ + size?: number; + /** + * timeInForce: IOC, FOK + */ + timeInForce?: BorrowReq.TimeInForceEnum; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + isHf?: boolean; + }): BorrowReq { + let obj = new BorrowReq(); + obj.currency = data.currency; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.symbol = data.symbol; + obj.isIsolated = data.isIsolated; + obj.isHf = data.isHf; + return obj; + } + + fromJson(input: string): BorrowReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BorrowReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BorrowReq { + return plainToInstance(BorrowReq, jsonObject); + } +} + +export namespace BorrowReq { + export enum TimeInForceEnum { + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class BorrowReqBuilder { + obj: BorrowReq = new BorrowReq(); + /** + * currency + */ + setCurrency(value: string): BorrowReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Borrow amount + */ + setSize(value: number): BorrowReqBuilder { + this.obj.size = value; + return this; + } + + /** + * timeInForce: IOC, FOK + */ + setTimeInForce(value: BorrowReq.TimeInForceEnum): BorrowReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): BorrowReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): BorrowReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + setIsHf(value: boolean): BorrowReqBuilder { + this.obj.isHf = value; + return this; + } + + build(): BorrowReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts new file mode 100644 index 00000000..99a0e3e4 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BorrowResp implements Response { + /** + * Borrow Order Id + */ + orderNo?: string; + /** + * Actual borrowed amount + */ + actualSize?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BorrowResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BorrowResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BorrowResp { + return plainToInstance(BorrowResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts new file mode 100644 index 00000000..472d8cbd --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts @@ -0,0 +1,63 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetBorrowHistoryItems implements Serializable { + /** + * Borrow Order Id + */ + orderNo?: string; + /** + * Isolated Margin symbol; empty for cross margin + */ + symbol?: string; + /** + * currency + */ + currency?: string; + /** + * Initiated borrow amount + */ + size?: string; + /** + * Actual borrow amount + */ + actualSize?: string; + /** + * PENDING: Processing, SUCCESS: Successful, FAILED: Failed + */ + status?: GetBorrowHistoryItems.StatusEnum; + /** + * borrow time + */ + createdTime?: number; + fromJson(input: string): GetBorrowHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBorrowHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBorrowHistoryItems { + return plainToInstance(GetBorrowHistoryItems, jsonObject); + } +} + +export namespace GetBorrowHistoryItems { + export enum StatusEnum { + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILED = 'FAILED', + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts new file mode 100644 index 00000000..bb058abf --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts @@ -0,0 +1,179 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetBorrowHistoryReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * Borrow Order Id + */ + orderNo?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number = 1; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetBorrowHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetBorrowHistoryReq` object. + */ + static builder(): GetBorrowHistoryReqBuilder { + return new GetBorrowHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetBorrowHistoryReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * Borrow Order Id + */ + orderNo?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number; + }): GetBorrowHistoryReq { + let obj = new GetBorrowHistoryReq(); + obj.currency = data.currency; + obj.isIsolated = data.isIsolated; + obj.symbol = data.symbol; + obj.orderNo = data.orderNo; + obj.startTime = data.startTime; + obj.endTime = data.endTime; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetBorrowHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBorrowHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBorrowHistoryReq { + return plainToInstance(GetBorrowHistoryReq, jsonObject); + } +} + +export class GetBorrowHistoryReqBuilder { + obj: GetBorrowHistoryReq = new GetBorrowHistoryReq(); + /** + * currency + */ + setCurrency(value: string): GetBorrowHistoryReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): GetBorrowHistoryReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): GetBorrowHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Borrow Order Id + */ + setOrderNo(value: string): GetBorrowHistoryReqBuilder { + this.obj.orderNo = value; + return this; + } + + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + setStartTime(value: number): GetBorrowHistoryReqBuilder { + this.obj.startTime = value; + return this; + } + + /** + * End time + */ + setEndTime(value: number): GetBorrowHistoryReqBuilder { + this.obj.endTime = value; + return this; + } + + /** + * Current query page, with a starting value of 1. Default:1 + */ + setCurrentPage(value: number): GetBorrowHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + setPageSize(value: number): GetBorrowHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetBorrowHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts new file mode 100644 index 00000000..4ae4eca1 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts @@ -0,0 +1,55 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetBorrowHistoryItems } from './model_get_borrow_history_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetBorrowHistoryResp implements Response { + /** + * + */ + timestamp?: number; + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetBorrowHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetBorrowHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetBorrowHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetBorrowHistoryResp { + return plainToInstance(GetBorrowHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts new file mode 100644 index 00000000..cbefd435 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetInterestHistoryItems implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Daily interest rate + */ + dayRatio?: string; + /** + * Interest amount + */ + interestAmount?: string; + /** + * Interest Timestamp + */ + createdTime?: number; + fromJson(input: string): GetInterestHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestHistoryItems { + return plainToInstance(GetInterestHistoryItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts new file mode 100644 index 00000000..2fb791c5 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts @@ -0,0 +1,162 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetInterestHistoryReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number = 1; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetInterestHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetInterestHistoryReq` object. + */ + static builder(): GetInterestHistoryReqBuilder { + return new GetInterestHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetInterestHistoryReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number; + }): GetInterestHistoryReq { + let obj = new GetInterestHistoryReq(); + obj.currency = data.currency; + obj.isIsolated = data.isIsolated; + obj.symbol = data.symbol; + obj.startTime = data.startTime; + obj.endTime = data.endTime; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetInterestHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestHistoryReq { + return plainToInstance(GetInterestHistoryReq, jsonObject); + } +} + +export class GetInterestHistoryReqBuilder { + obj: GetInterestHistoryReq = new GetInterestHistoryReq(); + /** + * currency + */ + setCurrency(value: string): GetInterestHistoryReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): GetInterestHistoryReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): GetInterestHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + setStartTime(value: number): GetInterestHistoryReqBuilder { + this.obj.startTime = value; + return this; + } + + /** + * End time + */ + setEndTime(value: number): GetInterestHistoryReqBuilder { + this.obj.endTime = value; + return this; + } + + /** + * Current query page, with a starting value of 1. Default:1 + */ + setCurrentPage(value: number): GetInterestHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + setPageSize(value: number): GetInterestHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetInterestHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts new file mode 100644 index 00000000..7f605745 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts @@ -0,0 +1,55 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetInterestHistoryItems } from './model_get_interest_history_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetInterestHistoryResp implements Response { + /** + * + */ + timestamp?: number; + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetInterestHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetInterestHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetInterestHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetInterestHistoryResp { + return plainToInstance(GetInterestHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts new file mode 100644 index 00000000..26b2c0df --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts @@ -0,0 +1,67 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRepayHistoryItems implements Serializable { + /** + * Repay Order Id + */ + orderNo?: string; + /** + * Isolated Margin symbol; empty for cross margin + */ + symbol?: string; + /** + * currency + */ + currency?: string; + /** + * Amount of initiated repay + */ + size?: string; + /** + * Amount of principal paid + */ + principal?: string; + /** + * Amount of interest paid + */ + interest?: string; + /** + * PENDING: Processing, SUCCESS: Successful, FAILED: Failed + */ + status?: GetRepayHistoryItems.StatusEnum; + /** + * Repayment time + */ + createdTime?: number; + fromJson(input: string): GetRepayHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRepayHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRepayHistoryItems { + return plainToInstance(GetRepayHistoryItems, jsonObject); + } +} + +export namespace GetRepayHistoryItems { + export enum StatusEnum { + /** + * + */ + PENDING = 'PENDING', + /** + * + */ + SUCCESS = 'SUCCESS', + /** + * + */ + FAILED = 'FAILED', + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts new file mode 100644 index 00000000..b22e2a26 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts @@ -0,0 +1,179 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRepayHistoryReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * Repay Order Id + */ + orderNo?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number = 1; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetRepayHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetRepayHistoryReq` object. + */ + static builder(): GetRepayHistoryReqBuilder { + return new GetRepayHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetRepayHistoryReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * Repay Order Id + */ + orderNo?: string; + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + startTime?: number; + /** + * End time + */ + endTime?: number; + /** + * Current query page, with a starting value of 1. Default:1 + */ + currentPage?: number; + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + pageSize?: number; + }): GetRepayHistoryReq { + let obj = new GetRepayHistoryReq(); + obj.currency = data.currency; + obj.isIsolated = data.isIsolated; + obj.symbol = data.symbol; + obj.orderNo = data.orderNo; + obj.startTime = data.startTime; + obj.endTime = data.endTime; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetRepayHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRepayHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRepayHistoryReq { + return plainToInstance(GetRepayHistoryReq, jsonObject); + } +} + +export class GetRepayHistoryReqBuilder { + obj: GetRepayHistoryReq = new GetRepayHistoryReq(); + /** + * currency + */ + setCurrency(value: string): GetRepayHistoryReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): GetRepayHistoryReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): GetRepayHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Repay Order Id + */ + setOrderNo(value: string): GetRepayHistoryReqBuilder { + this.obj.orderNo = value; + return this; + } + + /** + * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) + */ + setStartTime(value: number): GetRepayHistoryReqBuilder { + this.obj.startTime = value; + return this; + } + + /** + * End time + */ + setEndTime(value: number): GetRepayHistoryReqBuilder { + this.obj.endTime = value; + return this; + } + + /** + * Current query page, with a starting value of 1. Default:1 + */ + setCurrentPage(value: number): GetRepayHistoryReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per page. Default is 50, minimum is 10, maximum is 500 + */ + setPageSize(value: number): GetRepayHistoryReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetRepayHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts new file mode 100644 index 00000000..382af4cb --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts @@ -0,0 +1,55 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetRepayHistoryItems } from './model_get_repay_history_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRepayHistoryResp implements Response { + /** + * + */ + timestamp?: number; + /** + * current page + */ + currentPage?: number; + /** + * page size + */ + pageSize?: number; + /** + * total number + */ + totalNum?: number; + /** + * total page + */ + totalPage?: number; + /** + * + */ + @Type(() => GetRepayHistoryItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRepayHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRepayHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRepayHistoryResp { + return plainToInstance(GetRepayHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts new file mode 100644 index 00000000..429849b2 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyLeverageReq implements Serializable { + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user\'s current debt leverage or greater than the system\'s maximum leverage + */ + leverage?: string; + + /** + * Creates a new instance of the `ModifyLeverageReq` class. + * The builder pattern allows step-by-step construction of a `ModifyLeverageReq` object. + */ + static builder(): ModifyLeverageReqBuilder { + return new ModifyLeverageReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyLeverageReq` class with the given data. + */ + static create(data: { + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user\'s current debt leverage or greater than the system\'s maximum leverage + */ + leverage?: string; + }): ModifyLeverageReq { + let obj = new ModifyLeverageReq(); + obj.symbol = data.symbol; + obj.isIsolated = data.isIsolated; + obj.leverage = data.leverage; + return obj; + } + + fromJson(input: string): ModifyLeverageReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyLeverageReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyLeverageReq { + return plainToInstance(ModifyLeverageReq, jsonObject); + } +} + +export class ModifyLeverageReqBuilder { + obj: ModifyLeverageReq = new ModifyLeverageReq(); + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): ModifyLeverageReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): ModifyLeverageReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user\'s current debt leverage or greater than the system\'s maximum leverage + */ + setLeverage(value: string): ModifyLeverageReqBuilder { + this.obj.leverage = value; + return this; + } + + build(): ModifyLeverageReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts new file mode 100644 index 00000000..f0f53369 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyLeverageResp implements Response { + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyLeverageResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyLeverageResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyLeverageResp { + return plainToInstance(ModifyLeverageResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/debit/model_repay_req.ts b/sdk/node/src/generate/margin/debit/model_repay_req.ts new file mode 100644 index 00000000..abf812d4 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_repay_req.ts @@ -0,0 +1,128 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class RepayReq implements Serializable { + /** + * currency + */ + currency?: string; + /** + * Borrow amount + */ + size?: number; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean = false; + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + isHf?: boolean = false; + + /** + * Creates a new instance of the `RepayReq` class. + * The builder pattern allows step-by-step construction of a `RepayReq` object. + */ + static builder(): RepayReqBuilder { + return new RepayReqBuilder(); + } + + /** + * Creates a new instance of the `RepayReq` class with the given data. + */ + static create(data: { + /** + * currency + */ + currency?: string; + /** + * Borrow amount + */ + size?: number; + /** + * symbol, mandatory for isolated margin account + */ + symbol?: string; + /** + * true-isolated, false-cross; default is false + */ + isIsolated?: boolean; + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + isHf?: boolean; + }): RepayReq { + let obj = new RepayReq(); + obj.currency = data.currency; + obj.size = data.size; + obj.symbol = data.symbol; + obj.isIsolated = data.isIsolated; + obj.isHf = data.isHf; + return obj; + } + + fromJson(input: string): RepayReq { + const jsonObject = JSON.parse(input); + return plainToInstance(RepayReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RepayReq { + return plainToInstance(RepayReq, jsonObject); + } +} + +export class RepayReqBuilder { + obj: RepayReq = new RepayReq(); + /** + * currency + */ + setCurrency(value: string): RepayReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Borrow amount + */ + setSize(value: number): RepayReqBuilder { + this.obj.size = value; + return this; + } + + /** + * symbol, mandatory for isolated margin account + */ + setSymbol(value: string): RepayReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * true-isolated, false-cross; default is false + */ + setIsIsolated(value: boolean): RepayReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * true: high frequency borrowing, false: low frequency borrowing; default false + */ + setIsHf(value: boolean): RepayReqBuilder { + this.obj.isHf = value; + return this; + } + + build(): RepayReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/debit/model_repay_resp.ts b/sdk/node/src/generate/margin/debit/model_repay_resp.ts new file mode 100644 index 00000000..c4a37a13 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/model_repay_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class RepayResp implements Response { + /** + * + */ + timestamp?: number; + /** + * Repay Order Id + */ + orderNo?: string; + /** + * Actual repay amount + */ + actualSize?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): RepayResp { + const jsonObject = JSON.parse(input); + return plainToInstance(RepayResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RepayResp { + return plainToInstance(RepayResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts b/sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/marginprivate/api_margin_private.ts b/sdk/node/src/generate/margin/marginprivate/api_margin_private.ts new file mode 100644 index 00000000..43311e9d --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/api_margin_private.ts @@ -0,0 +1,92 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { + CrossMarginPositionEventCallbackWrapper, + CrossMarginPositionEventCallback, +} from './model_cross_margin_position_event'; +import { + IsolatedMarginPositionEventCallback, + IsolatedMarginPositionEventCallbackWrapper, +} from './model_isolated_margin_position_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface MarginPrivateWS { + /** + * crossMarginPosition Get Cross Margin Position change + * The system will push the change event when the position status changes, Or push the current debt message periodically when there is a liability. + * push frequency: once every 4s + */ + crossMarginPosition(callback: CrossMarginPositionEventCallback): Promise; + + /** + * isolatedMarginPosition Get Isolated Margin Position change + * The system will push the change event when the position status changes, Or push the current debt message periodically when there is a liability. + * push frequency: real time + */ + isolatedMarginPosition( + symbol: string, + callback: IsolatedMarginPositionEventCallback, + ): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class MarginPrivateWSImpl implements MarginPrivateWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + crossMarginPosition(callback: CrossMarginPositionEventCallback): Promise { + let topicPrefix = '/margin/position'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new CrossMarginPositionEventCallbackWrapper(callback), + ); + } + + isolatedMarginPosition( + symbol: string, + callback: IsolatedMarginPositionEventCallback, + ): Promise { + let topicPrefix = '/margin/isolatedPosition'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new IsolatedMarginPositionEventCallbackWrapper(callback), + ); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts new file mode 100644 index 00000000..c3ce80b3 --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CrossMarginPositionAssetListValue + implements Serializable +{ + /** + * + */ + total?: string; + /** + * + */ + available?: string; + /** + * + */ + hold?: string; + + fromJson(input: string): CrossMarginPositionAssetListValue { + const jsonObject = JSON.parse(input); + return plainToInstance(CrossMarginPositionAssetListValue, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): CrossMarginPositionAssetListValue { + return plainToInstance(CrossMarginPositionAssetListValue, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts new file mode 100644 index 00000000..42d035d2 --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -0,0 +1,111 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { CrossMarginPositionAssetListValue } from './model_cross_margin_position_asset_list_value'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class CrossMarginPositionEvent implements Response { + /** + * Debt ratio + */ + debtRatio?: number; + /** + * Total asset in BTC (interest included) + */ + totalAsset?: number; + /** + * + */ + marginCoefficientTotalAsset?: string; + /** + * Total debt in BTC (interest included) + */ + totalDebt?: string; + /** + * Asset list (interest included) + */ + assetList?: { [key: string]: CrossMarginPositionAssetListValue }; + /** + * Debt list (interest included) + */ + debtList?: { [key: string]: string }; + /** + * + */ + timestamp?: number; + /** + * Event type, **Only applicable to \"debt.ratio\" subject** + */ + type?: CrossMarginPositionEvent.TypeEnum; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): CrossMarginPositionEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(CrossMarginPositionEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): CrossMarginPositionEvent { + return plainToInstance(CrossMarginPositionEvent, jsonObject); + } +} + +export namespace CrossMarginPositionEvent { + export enum TypeEnum { + /** + * When the debt ratio exceeds the liquidation threshold and the position is frozen, the system will push this event. + */ + FROZEN_FL = 'FROZEN_FL', + /** + * When the liquidation is finished and the position returns to “EFFECTIVE” status, the system will push this event. + */ + UNFROZEN_FL = 'UNFROZEN_FL', + /** + * When the auto-borrow renewing is complete and the position returns to “EFFECTIVE” status, the system will push this event. + */ + FROZEN_RENEW = 'FROZEN_RENEW', + /** + * When the account reaches a negative balance, the system will push this event. + */ + UNFROZEN_RENEW = 'UNFROZEN_RENEW', + /** + * When the account reaches a negative balance, the system will push this event. + */ + LIABILITY = 'LIABILITY', + /** + * When all the liabilities is repaid and the position returns to “EFFECTIVE” status, the system will push this event. + */ + UNLIABILITY = 'UNLIABILITY', + } +} + +export type CrossMarginPositionEventCallback = ( + topic: string, + subject: string, + data: CrossMarginPositionEvent, +) => void; + +export class CrossMarginPositionEventCallbackWrapper implements WebSocketMessageCallback { + callback: CrossMarginPositionEventCallback; + + constructor(callback: CrossMarginPositionEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new CrossMarginPositionEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts new file mode 100644 index 00000000..89d9c2af --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts @@ -0,0 +1,38 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class IsolatedMarginPositionChangeAssetsValue + implements Serializable +{ + /** + * + */ + total?: string; + /** + * + */ + hold?: string; + /** + * + */ + liabilityPrincipal?: string; + /** + * + */ + liabilityInterest?: string; + + fromJson(input: string): IsolatedMarginPositionChangeAssetsValue { + const jsonObject = JSON.parse(input); + return plainToInstance(IsolatedMarginPositionChangeAssetsValue, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): IsolatedMarginPositionChangeAssetsValue { + return plainToInstance(IsolatedMarginPositionChangeAssetsValue, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts new file mode 100644 index 00000000..de23d06b --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -0,0 +1,147 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { IsolatedMarginPositionChangeAssetsValue } from './model_isolated_margin_position_change_assets_value'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class IsolatedMarginPositionEvent + implements Response +{ + /** + * Isolated margin symbol + */ + tag?: string; + /** + * Position status + */ + status?: IsolatedMarginPositionEvent.StatusEnum; + /** + * Status type + */ + statusBizType?: IsolatedMarginPositionEvent.StatusBizTypeEnum; + /** + * Accumulated principal + */ + accumulatedPrincipal?: string; + /** + * + */ + changeAssets?: { [key: string]: IsolatedMarginPositionChangeAssetsValue }; + /** + * + */ + timestamp?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): IsolatedMarginPositionEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(IsolatedMarginPositionEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): IsolatedMarginPositionEvent { + return plainToInstance(IsolatedMarginPositionEvent, jsonObject); + } +} + +export namespace IsolatedMarginPositionEvent { + export enum StatusEnum { + /** + * Debt + */ + DEBT = 'DEBT', + /** + * debt-free + */ + CLEAR = 'CLEAR', + /** + * Borrowing + */ + IN_BORROW = 'IN_BORROW', + /** + * Repayment in progress + */ + IN_REPAY = 'IN_REPAY', + /** + * Position closing + */ + IN_LIQUIDATION = 'IN_LIQUIDATION', + /** + * Automatically renewing + */ + IN_AUTO_RENEW = 'IN_AUTO_RENEW', + } + export enum StatusBizTypeEnum { + /** + * Liquidation + */ + FORCE_LIQUIDATION = 'FORCE_LIQUIDATION', + /** + * User borrow + */ + USER_BORROW = 'USER_BORROW', + /** + * Trade auto borrow + */ + TRADE_AUTO_BORROW = 'TRADE_AUTO_BORROW', + /** + * User reply + */ + USER_REPAY = 'USER_REPAY', + /** + * Auto reply + */ + AUTO_REPAY = 'AUTO_REPAY', + /** + * In debt + */ + DEFAULT_DEBT = 'DEFAULT_DEBT', + /** + * No debt + */ + DEFAULT_CLEAR = 'DEFAULT_CLEAR', + /** + * One click liquidation + */ + ONE_CLICK_LIQUIDATION = 'ONE_CLICK_LIQUIDATION', + /** + * B2C interest settle liquidation + */ + B2C_INTEREST_SETTLE_LIQUIDATION = 'B2C_INTEREST_SETTLE_LIQUIDATION', + /** + * Air drop liquidation + */ + AIR_DROP_LIQUIDATION = 'AIR_DROP_LIQUIDATION', + } +} + +export type IsolatedMarginPositionEventCallback = ( + topic: string, + subject: string, + data: IsolatedMarginPositionEvent, +) => void; + +export class IsolatedMarginPositionEventCallbackWrapper implements WebSocketMessageCallback { + callback: IsolatedMarginPositionEventCallback; + + constructor(callback: IsolatedMarginPositionEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new IsolatedMarginPositionEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts b/sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/marginpublic/api_margin_public.ts b/sdk/node/src/generate/margin/marginpublic/api_margin_public.ts new file mode 100644 index 00000000..c5ef2f84 --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/api_margin_public.ts @@ -0,0 +1,80 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { IndexPriceEventCallback, IndexPriceEventCallbackWrapper } from './model_index_price_event'; +import { MarkPriceEventCallback, MarkPriceEventCallbackWrapper } from './model_mark_price_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface MarginPublicWS { + /** + * indexPrice Index Price + * Subscribe to this topic to get the index price for the margin trading. The following ticker symbols are supported: List of currently supported symbol. + * push frequency: once every 1s + */ + indexPrice(symbol: Array, callback: IndexPriceEventCallback): Promise; + + /** + * markPrice Mark Price + * Subscribe to this topic to get the mark price for margin trading.The following ticker symbols are supported: List of currently supported symbol + * push frequency: once every 1s + */ + markPrice(symbol: Array, callback: MarkPriceEventCallback): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class MarginPublicWSImpl implements MarginPublicWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + indexPrice(symbol: Array, callback: IndexPriceEventCallback): Promise { + let topicPrefix = '/indicator/index'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new IndexPriceEventCallbackWrapper(callback), + ); + } + + markPrice(symbol: Array, callback: MarkPriceEventCallback): Promise { + let topicPrefix = '/indicator/markPrice'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new MarkPriceEventCallbackWrapper(callback), + ); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts new file mode 100644 index 00000000..4232f8bd --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -0,0 +1,65 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class IndexPriceEvent implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + granularity?: number; + /** + * + */ + timestamp?: number; + /** + * + */ + value?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): IndexPriceEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(IndexPriceEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): IndexPriceEvent { + return plainToInstance(IndexPriceEvent, jsonObject); + } +} + +export type IndexPriceEventCallback = ( + topic: string, + subject: string, + data: IndexPriceEvent, +) => void; + +export class IndexPriceEventCallbackWrapper implements WebSocketMessageCallback { + callback: IndexPriceEventCallback; + + constructor(callback: IndexPriceEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new IndexPriceEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts new file mode 100644 index 00000000..b84d16a7 --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class MarkPriceEvent implements Response { + /** + * + */ + symbol?: string; + /** + * + */ + granularity?: number; + /** + * + */ + timestamp?: number; + /** + * + */ + value?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): MarkPriceEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(MarkPriceEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarkPriceEvent { + return plainToInstance(MarkPriceEvent, jsonObject); + } +} + +export type MarkPriceEventCallback = (topic: string, subject: string, data: MarkPriceEvent) => void; + +export class MarkPriceEventCallbackWrapper implements WebSocketMessageCallback { + callback: MarkPriceEventCallback; + + constructor(callback: MarkPriceEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new MarkPriceEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/margin/market/api_market.template b/sdk/node/src/generate/margin/market/api_market.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/market/api_market.test.ts b/sdk/node/src/generate/margin/market/api_market.test.ts new file mode 100644 index 00000000..89bd3f23 --- /dev/null +++ b/sdk/node/src/generate/margin/market/api_market.test.ts @@ -0,0 +1,151 @@ +import { GetMarkPriceDetailReq } from './model_get_mark_price_detail_req'; +import { GetCrossMarginSymbolsResp } from './model_get_cross_margin_symbols_resp'; +import { GetMarkPriceListResp } from './model_get_mark_price_list_resp'; +import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; +import { GetIsolatedMarginSymbolsResp } from './model_get_isolated_margin_symbols_resp'; +import { GetMarkPriceDetailResp } from './model_get_mark_price_detail_resp'; +import { GetETFInfoResp } from './model_get_etf_info_resp'; +import { GetETFInfoReq } from './model_get_etf_info_req'; +import { GetMarginConfigResp } from './model_get_margin_config_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getIsolatedMarginSymbols request test', () => { + /** + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols + */ + }); + + test('getIsolatedMarginSymbols response test', () => { + /** + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols + */ + }); + test('getMarginConfig request test', () => { + /** + * getMarginConfig + * Get Margin Config + * /api/v1/margin/config + */ + }); + + test('getMarginConfig response test', () => { + /** + * getMarginConfig + * Get Margin Config + * /api/v1/margin/config + */ + }); + test('getMarkPriceDetail request test', () => { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let data = '{"symbol": "USDT-BTC"}'; + let req = new GetMarkPriceDetailReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMarkPriceDetail response test', () => { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "USDT-BTC",\n "timePoint": 1729676888000,\n "value": 1.5045E-5\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarkPriceDetailResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getETFInfo request test', () => { + /** + * getETFInfo + * Get ETF Info + * /api/v3/etf/info + */ + let data = '{"currency": "BTCUP"}'; + let req = new GetETFInfoReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getETFInfo response test', () => { + /** + * getETFInfo + * Get ETF Info + * /api/v3/etf/info + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "currency": "BTCUP",\n "netAsset": "33.846",\n "targetLeverage": "2-4",\n "actualLeverage": "2.1648",\n "issuedSize": "107134.87655291",\n "basket": "118.324559 XBTUSDTM"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetETFInfoResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getCrossMarginSymbols request test', () => { + /** + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetCrossMarginSymbolsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCrossMarginSymbols response test', () => { + /** + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols + */ + let data = + '{\n "code": "200000",\n "data": {\n "timestamp": 1729665839353,\n "items": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "enableTrading": true,\n "market": "USDS",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "baseIncrement": "0.00000001",\n "baseMinSize": "0.00001",\n "baseMaxSize": "10000000000",\n "quoteIncrement": "0.000001",\n "quoteMinSize": "0.1",\n "quoteMaxSize": "99999999",\n "priceIncrement": "0.1",\n "feeCurrency": "USDT",\n "priceLimitRate": "0.1",\n "minFunds": "0.1"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCrossMarginSymbolsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMarkPriceList request test', () => { + /** + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols + */ + }); + + test('getMarkPriceList response test', () => { + /** + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols + */ + }); +}); diff --git a/sdk/node/src/generate/margin/market/api_market.ts b/sdk/node/src/generate/margin/market/api_market.ts new file mode 100644 index 00000000..61b9438b --- /dev/null +++ b/sdk/node/src/generate/margin/market/api_market.ts @@ -0,0 +1,186 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetMarkPriceDetailReq } from './model_get_mark_price_detail_req'; +import { GetCrossMarginSymbolsResp } from './model_get_cross_margin_symbols_resp'; +import { GetMarkPriceListResp } from './model_get_mark_price_list_resp'; +import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; +import { GetIsolatedMarginSymbolsResp } from './model_get_isolated_margin_symbols_resp'; +import { GetMarkPriceDetailResp } from './model_get_mark_price_detail_resp'; +import { GetETFInfoResp } from './model_get_etf_info_resp'; +import { GetETFInfoReq } from './model_get_etf_info_req'; +import { GetMarginConfigResp } from './model_get_margin_config_resp'; + +export interface MarketAPI { + /** + * getIsolatedMarginSymbols Get Symbols - Isolated Margin + * Description: This endpoint allows querying the configuration of isolated margin symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470194 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getIsolatedMarginSymbols(): Promise; + + /** + * getMarginConfig Get Margin Config + * Description: Request via this endpoint to get the configure info of the cross margin. + * Documentation: https://www.kucoin.com/docs-new/api-3470190 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 25 | + * +---------------------+--------+ + */ + getMarginConfig(): Promise; + + /** + * getMarkPriceDetail Get Mark Price Detail + * Description: This endpoint returns the current Mark price for specified margin trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470193 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+--------+ + */ + getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise; + + /** + * getETFInfo Get ETF Info + * Description: This interface returns leveraged token information + * Documentation: https://www.kucoin.com/docs-new/api-3470191 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getETFInfo(req: GetETFInfoReq): Promise; + + /** + * getCrossMarginSymbols Get Symbols - Cross Margin + * Description: This endpoint allows querying the configuration of cross margin symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470189 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise; + + /** + * getMarkPriceList Get Mark Price List + * Description: This endpoint returns the current Mark price for all margin trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470192 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 10 | + * +---------------------+--------+ + */ + getMarkPriceList(): Promise; +} + +export class MarketAPIImpl implements MarketAPI { + constructor(private transport: Transport) {} + + getIsolatedMarginSymbols(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/isolated/symbols', + null, + new GetIsolatedMarginSymbolsResp(), + false, + ); + } + + getMarginConfig(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/margin/config', + null, + new GetMarginConfigResp(), + false, + ); + } + + getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/mark-price/{symbol}/current', + req, + new GetMarkPriceDetailResp(), + false, + ); + } + + getETFInfo(req: GetETFInfoReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/etf/info', + req, + new GetETFInfoResp(), + false, + ); + } + + getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/symbols', + req, + new GetCrossMarginSymbolsResp(), + false, + ); + } + + getMarkPriceList(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/mark-price/all-symbols', + null, + new GetMarkPriceListResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts new file mode 100644 index 00000000..b0e2f08a --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts @@ -0,0 +1,82 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCrossMarginSymbolsItems implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * symbol name + */ + name?: string; + /** + * Whether trading is enabled: true for enabled, false for disabled + */ + enableTrading?: boolean; + /** + * Trading market + */ + market?: string; + /** + * Base currency,e.g. BTC. + */ + baseCurrency?: string; + /** + * Quote currency,e.g. USDT. + */ + quoteCurrency?: string; + /** + * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. + */ + baseIncrement?: string; + /** + * The minimum order quantity requried to place an order. + */ + baseMinSize?: string; + /** + * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. + */ + quoteIncrement?: string; + /** + * The minimum order funds required to place a market order. + */ + quoteMinSize?: string; + /** + * The maximum order size required to place an order. + */ + baseMaxSize?: string; + /** + * The maximum order funds required to place a market order. + */ + quoteMaxSize?: string; + /** + * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. specifies the min order price as well as the price increment.This also applies to quote currency. + */ + priceIncrement?: string; + /** + * The currency of charged fees. + */ + feeCurrency?: string; + /** + * Threshold for price portection + */ + priceLimitRate?: string; + /** + * the minimum trading amounts + */ + minFunds?: string; + fromJson(input: string): GetCrossMarginSymbolsItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginSymbolsItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginSymbolsItems { + return plainToInstance(GetCrossMarginSymbolsItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts new file mode 100644 index 00000000..1fa3625f --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCrossMarginSymbolsReq implements Serializable { + /** + * If not provided, all cross margin symbol will be queried. If provided, only the specified symbol will be queried. + */ + symbol?: string; + + /** + * Creates a new instance of the `GetCrossMarginSymbolsReq` class. + * The builder pattern allows step-by-step construction of a `GetCrossMarginSymbolsReq` object. + */ + static builder(): GetCrossMarginSymbolsReqBuilder { + return new GetCrossMarginSymbolsReqBuilder(); + } + + /** + * Creates a new instance of the `GetCrossMarginSymbolsReq` class with the given data. + */ + static create(data: { + /** + * If not provided, all cross margin symbol will be queried. If provided, only the specified symbol will be queried. + */ + symbol?: string; + }): GetCrossMarginSymbolsReq { + let obj = new GetCrossMarginSymbolsReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetCrossMarginSymbolsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginSymbolsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginSymbolsReq { + return plainToInstance(GetCrossMarginSymbolsReq, jsonObject); + } +} + +export class GetCrossMarginSymbolsReqBuilder { + obj: GetCrossMarginSymbolsReq = new GetCrossMarginSymbolsReq(); + /** + * If not provided, all cross margin symbol will be queried. If provided, only the specified symbol will be queried. + */ + setSymbol(value: string): GetCrossMarginSymbolsReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetCrossMarginSymbolsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts new file mode 100644 index 00000000..c039593d --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetCrossMarginSymbolsItems } from './model_get_cross_margin_symbols_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetCrossMarginSymbolsResp + implements Response +{ + /** + * + */ + timestamp?: number; + /** + * + */ + @Type(() => GetCrossMarginSymbolsItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetCrossMarginSymbolsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCrossMarginSymbolsResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCrossMarginSymbolsResp { + return plainToInstance(GetCrossMarginSymbolsResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts new file mode 100644 index 00000000..9f5eb8b6 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts @@ -0,0 +1,42 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetETFInfoData implements Serializable { + /** + * ETF Currency + */ + currency?: string; + /** + * Net worth + */ + netAsset?: string; + /** + * Target leverage + */ + targetLeverage?: string; + /** + * Actual leverage + */ + actualLeverage?: string; + /** + * The amount of currency issued + */ + issuedSize?: string; + /** + * Basket information + */ + basket?: string; + fromJson(input: string): GetETFInfoData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETFInfoData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetETFInfoData { + return plainToInstance(GetETFInfoData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts new file mode 100644 index 00000000..2a3d313a --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetETFInfoReq implements Serializable { + /** + * ETF Currency, if empty query all currencies + */ + currency?: string; + + /** + * Creates a new instance of the `GetETFInfoReq` class. + * The builder pattern allows step-by-step construction of a `GetETFInfoReq` object. + */ + static builder(): GetETFInfoReqBuilder { + return new GetETFInfoReqBuilder(); + } + + /** + * Creates a new instance of the `GetETFInfoReq` class with the given data. + */ + static create(data: { + /** + * ETF Currency, if empty query all currencies + */ + currency?: string; + }): GetETFInfoReq { + let obj = new GetETFInfoReq(); + obj.currency = data.currency; + return obj; + } + + fromJson(input: string): GetETFInfoReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETFInfoReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetETFInfoReq { + return plainToInstance(GetETFInfoReq, jsonObject); + } +} + +export class GetETFInfoReqBuilder { + obj: GetETFInfoReq = new GetETFInfoReq(); + /** + * ETF Currency, if empty query all currencies + */ + setCurrency(value: string): GetETFInfoReqBuilder { + this.obj.currency = value; + return this; + } + + build(): GetETFInfoReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts new file mode 100644 index 00000000..85c74899 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetETFInfoData } from './model_get_etf_info_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetETFInfoResp implements Response { + /** + * + */ + @Type(() => GetETFInfoData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetETFInfoResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetETFInfoResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetETFInfoResp { + return plainToInstance(GetETFInfoResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts new file mode 100644 index 00000000..edd45cc2 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts @@ -0,0 +1,74 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetIsolatedMarginSymbolsData implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * symbol name + */ + symbolName?: string; + /** + * Base currency,e.g. BTC. + */ + baseCurrency?: string; + /** + * Quote currency,e.g. USDT. + */ + quoteCurrency?: string; + /** + * Max leverage of this symbol + */ + maxLeverage?: number; + /** + * + */ + flDebtRatio?: string; + /** + * + */ + tradeEnable?: boolean; + /** + * + */ + autoRenewMaxDebtRatio?: string; + /** + * + */ + baseBorrowEnable?: boolean; + /** + * + */ + quoteBorrowEnable?: boolean; + /** + * + */ + baseTransferInEnable?: boolean; + /** + * + */ + quoteTransferInEnable?: boolean; + /** + * + */ + baseBorrowCoefficient?: string; + /** + * + */ + quoteBorrowCoefficient?: string; + fromJson(input: string): GetIsolatedMarginSymbolsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginSymbolsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginSymbolsData { + return plainToInstance(GetIsolatedMarginSymbolsData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts new file mode 100644 index 00000000..48f31b9d --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetIsolatedMarginSymbolsData } from './model_get_isolated_margin_symbols_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetIsolatedMarginSymbolsResp + implements Response +{ + /** + * + */ + @Type(() => GetIsolatedMarginSymbolsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetIsolatedMarginSymbolsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetIsolatedMarginSymbolsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetIsolatedMarginSymbolsResp { + return plainToInstance(GetIsolatedMarginSymbolsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts new file mode 100644 index 00000000..daea13e2 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarginConfigResp implements Response { + /** + * Available currencies for margin trade + */ + currencyList?: Array; + /** + * Max leverage available + */ + maxLeverage?: number; + /** + * The warning debt ratio of the forced liquidation + */ + warningDebtRatio?: string; + /** + * The debt ratio of the forced liquidation + */ + liqDebtRatio?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarginConfigResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginConfigResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginConfigResp { + return plainToInstance(GetMarginConfigResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts new file mode 100644 index 00000000..99d11d87 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarkPriceDetailReq implements Serializable { + /** + * symbol + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetMarkPriceDetailReq` class. + * The builder pattern allows step-by-step construction of a `GetMarkPriceDetailReq` object. + */ + static builder(): GetMarkPriceDetailReqBuilder { + return new GetMarkPriceDetailReqBuilder(); + } + + /** + * Creates a new instance of the `GetMarkPriceDetailReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): GetMarkPriceDetailReq { + let obj = new GetMarkPriceDetailReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMarkPriceDetailReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceDetailReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarkPriceDetailReq { + return plainToInstance(GetMarkPriceDetailReq, jsonObject); + } +} + +export class GetMarkPriceDetailReqBuilder { + obj: GetMarkPriceDetailReq = new GetMarkPriceDetailReq(); + /** + * symbol + */ + setSymbol(value: string): GetMarkPriceDetailReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMarkPriceDetailReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts new file mode 100644 index 00000000..d9b47389 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts @@ -0,0 +1,41 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarkPriceDetailResp implements Response { + /** + * symbol + */ + symbol?: string; + /** + * Timestamp (milliseconds) + */ + timePoint?: number; + /** + * Mark price + */ + value?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarkPriceDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarkPriceDetailResp { + return plainToInstance(GetMarkPriceDetailResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts new file mode 100644 index 00000000..98e75981 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts @@ -0,0 +1,30 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarkPriceListData implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Timestamp (milliseconds) + */ + timePoint?: number; + /** + * Mark price + */ + value?: number; + fromJson(input: string): GetMarkPriceListData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceListData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarkPriceListData { + return plainToInstance(GetMarkPriceListData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts new file mode 100644 index 00000000..999fd883 --- /dev/null +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetMarkPriceListData } from './model_get_mark_price_list_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarkPriceListResp implements Response { + /** + * + */ + @Type(() => GetMarkPriceListData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarkPriceListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarkPriceListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMarkPriceListResp { + return plainToInstance(GetMarkPriceListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/order/api_order.template b/sdk/node/src/generate/margin/order/api_order.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/order/api_order.test.ts b/sdk/node/src/generate/margin/order/api_order.test.ts new file mode 100644 index 00000000..9f84c351 --- /dev/null +++ b/sdk/node/src/generate/margin/order/api_order.test.ts @@ -0,0 +1,436 @@ +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; +import { AddOrderV1Req } from './model_add_order_v1_req'; +import { AddOrderReq } from './model_add_order_req'; +import { GetOpenOrdersResp } from './model_get_open_orders_resp'; +import { GetClosedOrdersReq } from './model_get_closed_orders_req'; +import { CancelOrderByOrderIdReq } from './model_cancel_order_by_order_id_req'; +import { CancelAllOrdersBySymbolResp } from './model_cancel_all_orders_by_symbol_resp'; +import { GetSymbolsWithOpenOrderReq } from './model_get_symbols_with_open_order_req'; +import { GetOpenOrdersReq } from './model_get_open_orders_req'; +import { AddOrderTestV1Req } from './model_add_order_test_v1_req'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { AddOrderTestV1Resp } from './model_add_order_test_v1_resp'; +import { AddOrderV1Resp } from './model_add_order_v1_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('addOrderV1 request test', () => { + /** + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; + let req = new AddOrderV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderV1 response test', () => { + /** + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderTestV1 request test', () => { + /** + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; + let req = new AddOrderTestV1Req(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTestV1 response test', () => { + /** + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestV1Resp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills + */ + let data = + '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistory response test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills + */ + let data = + '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 137891621991,\n "symbol": "BTC-USDT",\n "tradeId": 11040911994273793,\n "orderId": "671868085584bc0007d85f46",\n "counterOrderId": "67186805b7cbdf00071621f9",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67141.6",\n "size": "0.00001",\n "funds": "0.671416",\n "fee": "0.000671416",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "MARGIN_TRADE",\n "tax": "0",\n "taxRate": "0",\n "type": "limit",\n "createdAt": 1729652744998\n }\n ],\n "lastId": 137891621991\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSymbolsWithOpenOrder request test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols + */ + let data = '{"tradeType": "MARGIN_TRADE"}'; + let req = new GetSymbolsWithOpenOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSymbolsWithOpenOrder response test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbolSize": 1,\n "symbols": [\n "BTC-USDT"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSymbolsWithOpenOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v3/hf/margin/order + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrder response test', () => { + /** + * addOrder + * Add Order + * /api/v3/hf/margin/order + */ + let data = + '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "671663e02188630007e21c9c",\n "clientOid": "5c52e11203aa677f33e1493fb",\n "borrowSize": "10.2",\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderTestReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTest response test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test + */ + let data = + '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "5bd6e9286d99522a52e458de",\n "clientOid": "5c52e11203aa677f33e493fb",\n "borrowSize": 10.2,\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOpenOrders request test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v3/hf/margin/orders/active + */ + let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; + let req = new GetOpenOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOpenOrders response test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v3/hf/margin/orders/active + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "671667306afcdb000723107f",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "active": true,\n "tax": "0",\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729521460940\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOpenOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let data = '{"clientOid": "5c52e11203aa677f33e1493fb", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOid response test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e1493fb"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByClientOid response test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelAllOrdersBySymbol request test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders + */ + let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; + let req = new CancelAllOrdersBySymbolReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelAllOrdersBySymbol response test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders + */ + let data = '{"code":"200000","data":"success"}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelAllOrdersBySymbolResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getClosedOrders request test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done + */ + let data = + '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetClosedOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getClosedOrders response test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done + */ + let data = + '{\n "code": "200000",\n "data": {\n "lastId": 136112949351,\n "items": [\n {\n "id": "6716491f6afcdb00078365c8",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0",\n "remainFunds": "0",\n "cancelledSize": "0.00001",\n "cancelledFunds": "0.5",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": true,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729513759162,\n "lastUpdatedAt": 1729521126597\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetClosedOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByOrderId request test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let data = '{"orderId": "671663e02188630007e21c9c", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByOrderId response test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let data = '{"code":"200000","data":{"orderId":"671663e02188630007e21c9c"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let data = '{"symbol": "BTC-USDT", "orderId": "671667306afcdb000723107f"}'; + let req = new GetOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByOrderId response test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/order/api_order.ts b/sdk/node/src/generate/margin/order/api_order.ts new file mode 100644 index 00000000..bc876092 --- /dev/null +++ b/sdk/node/src/generate/margin/order/api_order.ts @@ -0,0 +1,401 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; +import { AddOrderV1Req } from './model_add_order_v1_req'; +import { AddOrderReq } from './model_add_order_req'; +import { GetOpenOrdersResp } from './model_get_open_orders_resp'; +import { GetClosedOrdersReq } from './model_get_closed_orders_req'; +import { CancelOrderByOrderIdReq } from './model_cancel_order_by_order_id_req'; +import { CancelAllOrdersBySymbolResp } from './model_cancel_all_orders_by_symbol_resp'; +import { GetSymbolsWithOpenOrderReq } from './model_get_symbols_with_open_order_req'; +import { GetOpenOrdersReq } from './model_get_open_orders_req'; +import { AddOrderTestV1Req } from './model_add_order_test_v1_req'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { AddOrderTestV1Resp } from './model_add_order_test_v1_resp'; +import { AddOrderV1Resp } from './model_add_order_v1_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; + +export interface OrderAPI { + /** + * @deprecated + * addOrderV1 Add Order - V1 + * Description: Place order to the Cross-margin or Isolated-margin trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470312 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + addOrderV1(req: AddOrderV1Req): Promise; + + /** + * @deprecated + * addOrderTestV1 Add Order Test - V1 + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470313 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + addOrderTestV1(req: AddOrderTestV1Req): Promise; + + /** + * getTradeHistory Get Trade History + * Description: This endpoint can be used to obtain a list of the latest Margin transaction details. The returned data is sorted in descending order according to the latest update time of the order. + * Documentation: https://www.kucoin.com/docs-new/api-3470200 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getTradeHistory(req: GetTradeHistoryReq): Promise; + + /** + * getSymbolsWithOpenOrder Get Symbols With Open Order + * Description: This interface can query all Margin symbol that has active orders + * Documentation: https://www.kucoin.com/docs-new/api-3470196 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise; + + /** + * addOrder Add Order + * Description: Place order to the Cross-margin or Isolated-margin trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470204 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + addOrder(req: AddOrderReq): Promise; + + /** + * addOrderTest Add Order Test + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470205 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + addOrderTest(req: AddOrderTestReq): Promise; + + /** + * getOpenOrders Get Open Orders + * Description: This interface is to obtain all Margin active order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470198 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------+ + */ + getOpenOrders(req: GetOpenOrdersReq): Promise; + + /** + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: This endpoint can be used to cancel a margin order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470201 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + + /** + * getOrderByClientOid Get Order By ClientOid + * Description: This endpoint can be used to obtain information for a single Margin order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470203 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + + /** + * cancelAllOrdersBySymbol Cancel All Orders By Symbol + * Description: This interface can cancel all open Margin orders by symbol This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470197 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; + + /** + * getClosedOrders Get Closed Orders + * Description: This interface is to obtain all Margin closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470199 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getClosedOrders(req: GetClosedOrdersReq): Promise; + + /** + * cancelOrderByOrderId Cancel Order By OrderId + * Description: This endpoint can be used to cancel a margin order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470195 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | MARGIN | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; + + /** + * getOrderByOrderId Get Order By OrderId + * Description: This endpoint can be used to obtain information for a single Margin order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470202 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; +} + +export class OrderAPIImpl implements OrderAPI { + constructor(private transport: Transport) {} + + addOrderV1(req: AddOrderV1Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/margin/order', + req, + new AddOrderV1Resp(), + false, + ); + } + + addOrderTestV1(req: AddOrderTestV1Req): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/margin/order/test', + req, + new AddOrderTestV1Resp(), + false, + ); + } + + getTradeHistory(req: GetTradeHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/fills', + req, + new GetTradeHistoryResp(), + false, + ); + } + + getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/order/active/symbols', + req, + new GetSymbolsWithOpenOrderResp(), + false, + ); + } + + addOrder(req: AddOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/hf/margin/order', + req, + new AddOrderResp(), + false, + ); + } + + addOrderTest(req: AddOrderTestReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/hf/margin/order/test', + req, + new AddOrderTestResp(), + false, + ); + } + + getOpenOrders(req: GetOpenOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/orders/active', + req, + new GetOpenOrdersResp(), + false, + ); + } + + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/hf/margin/orders/client-order/{clientOid}', + req, + new CancelOrderByClientOidResp(), + false, + ); + } + + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/orders/client-order/{clientOid}', + req, + new GetOrderByClientOidResp(), + false, + ); + } + + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/hf/margin/orders', + req, + new CancelAllOrdersBySymbolResp(), + false, + ); + } + + getClosedOrders(req: GetClosedOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/orders/done', + req, + new GetClosedOrdersResp(), + false, + ); + } + + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/hf/margin/orders/{orderId}', + req, + new CancelOrderByOrderIdResp(), + false, + ); + } + + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/hf/margin/orders/{orderId}', + req, + new GetOrderByOrderIdResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_req.ts b/sdk/node/src/generate/margin/order/model_add_order_req.ts new file mode 100644 index 00000000..11b11ac3 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_req.ts @@ -0,0 +1,391 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: AddOrderReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * true - isolated margin ,false - cross margin. defult as false + */ + isIsolated?: boolean = false; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean = false; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean = false; + + /** + * Creates a new instance of the `AddOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderReq` object. + */ + static builder(): AddOrderReqBuilder { + return new AddOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderReq.TypeEnum; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: AddOrderReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * true - isolated margin ,false - cross margin. defult as false + */ + isIsolated?: boolean; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean; + }): AddOrderReq { + let obj = new AddOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.isIsolated = data.isIsolated; + obj.autoBorrow = data.autoBorrow; + obj.autoRepay = data.autoRepay; + return obj; + } + + fromJson(input: string): AddOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderReq { + return plainToInstance(AddOrderReq, jsonObject); + } +} + +export namespace AddOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddOrderReqBuilder { + obj: AddOrderReq = new AddOrderReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderReq.SideEnum): AddOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderReq.StpEnum): AddOrderReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderReq.TimeInForceEnum): AddOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * true - isolated margin ,false - cross margin. defult as false + */ + setIsIsolated(value: boolean): AddOrderReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + setAutoBorrow(value: boolean): AddOrderReqBuilder { + this.obj.autoBorrow = value; + return this; + } + + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + setAutoRepay(value: boolean): AddOrderReqBuilder { + this.obj.autoRepay = value; + return this; + } + + build(): AddOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_resp.ts new file mode 100644 index 00000000..be401709 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + loanApplyId?: string; + /** + * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + borrowSize?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderResp { + return plainToInstance(AddOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts new file mode 100644 index 00000000..676329d6 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts @@ -0,0 +1,391 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderTestReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * true - isolated margin ,false - cross margin. defult as false + */ + isIsolated?: boolean = false; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean = false; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean = false; + + /** + * Creates a new instance of the `AddOrderTestReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. + */ + static builder(): AddOrderTestReqBuilder { + return new AddOrderTestReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestReq.TypeEnum; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * true - isolated margin ,false - cross margin. defult as false + */ + isIsolated?: boolean; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean; + }): AddOrderTestReq { + let obj = new AddOrderTestReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.isIsolated = data.isIsolated; + obj.autoBorrow = data.autoBorrow; + obj.autoRepay = data.autoRepay; + return obj; + } + + fromJson(input: string): AddOrderTestReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestReq { + return plainToInstance(AddOrderTestReq, jsonObject); + } +} + +export namespace AddOrderTestReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddOrderTestReqBuilder { + obj: AddOrderTestReq = new AddOrderTestReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderTestReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestReq.SideEnum): AddOrderTestReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderTestReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderTestReq.TypeEnum): AddOrderTestReqBuilder { + this.obj.type = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderTestReq.StpEnum): AddOrderTestReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderTestReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderTestReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderTestReq.TimeInForceEnum): AddOrderTestReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderTestReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddOrderTestReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderTestReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderTestReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderTestReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * true - isolated margin ,false - cross margin. defult as false + */ + setIsIsolated(value: boolean): AddOrderTestReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + setAutoBorrow(value: boolean): AddOrderTestReqBuilder { + this.obj.autoBorrow = value; + return this; + } + + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + setAutoRepay(value: boolean): AddOrderTestReqBuilder { + this.obj.autoRepay = value; + return this; + } + + build(): AddOrderTestReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts new file mode 100644 index 00000000..a5141dc7 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderTestResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + loanApplyId?: string; + /** + * ID of the borrowing response. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + borrowSize?: number; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestResp { + return plainToInstance(AddOrderTestResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts new file mode 100644 index 00000000..cc764b34 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts @@ -0,0 +1,401 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderTestV1Req implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestV1Req.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestV1Req.TypeEnum = AddOrderTestV1Req.TypeEnum.LIMIT; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestV1Req.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderTestV1Req.TimeInForceEnum = AddOrderTestV1Req.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean = false; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean = false; + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + marginModel?: AddOrderTestV1Req.MarginModelEnum = AddOrderTestV1Req.MarginModelEnum.CROSS; + + /** + * Creates a new instance of the `AddOrderTestV1Req` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestV1Req` object. + */ + static builder(): AddOrderTestV1ReqBuilder { + return new AddOrderTestV1ReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestV1Req` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestV1Req.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestV1Req.TypeEnum; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestV1Req.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + timeInForce?: AddOrderTestV1Req.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean; + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + marginModel?: AddOrderTestV1Req.MarginModelEnum; + }): AddOrderTestV1Req { + let obj = new AddOrderTestV1Req(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.autoBorrow = data.autoBorrow; + obj.autoRepay = data.autoRepay; + obj.marginModel = data.marginModel; + return obj; + } + + fromJson(input: string): AddOrderTestV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestV1Req { + return plainToInstance(AddOrderTestV1Req, jsonObject); + } +} + +export namespace AddOrderTestV1Req { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum MarginModelEnum { + /** + * + */ + CROSS = 'cross', + /** + * + */ + ISOLATED = 'isolated', + } +} + +export class AddOrderTestV1ReqBuilder { + obj: AddOrderTestV1Req = new AddOrderTestV1Req(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderTestV1ReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestV1Req.SideEnum): AddOrderTestV1ReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderTestV1ReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderTestV1Req.TypeEnum): AddOrderTestV1ReqBuilder { + this.obj.type = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderTestV1Req.StpEnum): AddOrderTestV1ReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderTestV1ReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderTestV1ReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderTestV1Req.TimeInForceEnum): AddOrderTestV1ReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderTestV1ReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Hidden or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderTestV1ReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + setIceberg(value: boolean): AddOrderTestV1ReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderTestV1ReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderTestV1ReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderTestV1ReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + setAutoBorrow(value: boolean): AddOrderTestV1ReqBuilder { + this.obj.autoBorrow = value; + return this; + } + + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + setAutoRepay(value: boolean): AddOrderTestV1ReqBuilder { + this.obj.autoRepay = value; + return this; + } + + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + setMarginModel(value: AddOrderTestV1Req.MarginModelEnum): AddOrderTestV1ReqBuilder { + this.obj.marginModel = value; + return this; + } + + build(): AddOrderTestV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts new file mode 100644 index 00000000..68705a05 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderTestV1Resp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + loanApplyId?: string; + /** + * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + borrowSize?: string; + /** + * This return value is invalid + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestV1Resp { + return plainToInstance(AddOrderTestV1Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts new file mode 100644 index 00000000..afd68210 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts @@ -0,0 +1,401 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderV1Req implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderV1Req.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderV1Req.TypeEnum = AddOrderV1Req.TypeEnum.LIMIT; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderV1Req.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderV1Req.TimeInForceEnum = AddOrderV1Req.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean = false; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean = false; + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + marginModel?: AddOrderV1Req.MarginModelEnum = AddOrderV1Req.MarginModelEnum.CROSS; + + /** + * Creates a new instance of the `AddOrderV1Req` class. + * The builder pattern allows step-by-step construction of a `AddOrderV1Req` object. + */ + static builder(): AddOrderV1ReqBuilder { + return new AddOrderV1ReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderV1Req` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderV1Req.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderV1Req.TypeEnum; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderV1Req.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderV1Req.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + autoBorrow?: boolean; + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + autoRepay?: boolean; + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + marginModel?: AddOrderV1Req.MarginModelEnum; + }): AddOrderV1Req { + let obj = new AddOrderV1Req(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.autoBorrow = data.autoBorrow; + obj.autoRepay = data.autoRepay; + obj.marginModel = data.marginModel; + return obj; + } + + fromJson(input: string): AddOrderV1Req { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderV1Req, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderV1Req { + return plainToInstance(AddOrderV1Req, jsonObject); + } +} + +export namespace AddOrderV1Req { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum MarginModelEnum { + /** + * + */ + CROSS = 'cross', + /** + * + */ + ISOLATED = 'isolated', + } +} + +export class AddOrderV1ReqBuilder { + obj: AddOrderV1Req = new AddOrderV1Req(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderV1ReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderV1Req.SideEnum): AddOrderV1ReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderV1ReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderV1Req.TypeEnum): AddOrderV1ReqBuilder { + this.obj.type = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderV1Req.StpEnum): AddOrderV1ReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderV1ReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderV1ReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderV1Req.TimeInForceEnum): AddOrderV1ReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderV1ReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Hidden or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderV1ReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + setIceberg(value: boolean): AddOrderV1ReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderV1ReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderV1ReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderV1ReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. + */ + setAutoBorrow(value: boolean): AddOrderV1ReqBuilder { + this.obj.autoBorrow = value; + return this; + } + + /** + * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. + */ + setAutoRepay(value: boolean): AddOrderV1ReqBuilder { + this.obj.autoRepay = value; + return this; + } + + /** + * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. + */ + setMarginModel(value: AddOrderV1Req.MarginModelEnum): AddOrderV1ReqBuilder { + this.obj.marginModel = value; + return this; + } + + build(): AddOrderV1Req { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts new file mode 100644 index 00000000..4195aaac --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderV1Resp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + loanApplyId?: string; + /** + * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. + */ + borrowSize?: string; + /** + * This return value is invalid + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderV1Resp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderV1Resp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderV1Resp { + return plainToInstance(AddOrderV1Resp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts new file mode 100644 index 00000000..1aaa4f47 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts @@ -0,0 +1,92 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllOrdersBySymbolReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: CancelAllOrdersBySymbolReq.TradeTypeEnum; + + /** + * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. + * The builder pattern allows step-by-step construction of a `CancelAllOrdersBySymbolReq` object. + */ + static builder(): CancelAllOrdersBySymbolReqBuilder { + return new CancelAllOrdersBySymbolReqBuilder(); + } + + /** + * Creates a new instance of the `CancelAllOrdersBySymbolReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: CancelAllOrdersBySymbolReq.TradeTypeEnum; + }): CancelAllOrdersBySymbolReq { + let obj = new CancelAllOrdersBySymbolReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): CancelAllOrdersBySymbolReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersBySymbolReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersBySymbolReq { + return plainToInstance(CancelAllOrdersBySymbolReq, jsonObject); + } +} + +export namespace CancelAllOrdersBySymbolReq { + export enum TradeTypeEnum { + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class CancelAllOrdersBySymbolReqBuilder { + obj: CancelAllOrdersBySymbolReq = new CancelAllOrdersBySymbolReq(); + /** + * symbol + */ + setSymbol(value: string): CancelAllOrdersBySymbolReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + setTradeType( + value: CancelAllOrdersBySymbolReq.TradeTypeEnum, + ): CancelAllOrdersBySymbolReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): CancelAllOrdersBySymbolReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts new file mode 100644 index 00000000..33fc3a72 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllOrdersBySymbolResp + implements Response +{ + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllOrdersBySymbolResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { + return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts new file mode 100644 index 00000000..c715c9d1 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByClientOidReq implements Serializable { + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. + */ + static builder(): CancelOrderByClientOidReqBuilder { + return new CancelOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByClientOidReq { + let obj = new CancelOrderByClientOidReq(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidReq { + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } +} + +export class CancelOrderByClientOidReqBuilder { + obj: CancelOrderByClientOidReq = new CancelOrderByClientOidReq(); + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): CancelOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts new file mode 100644 index 00000000..431f3f4e --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByClientOidResp + implements Response +{ + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts new file mode 100644 index 00000000..715c3bf5 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdReq` object. + */ + static builder(): CancelOrderByOrderIdReqBuilder { + return new CancelOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByOrderIdReq { + let obj = new CancelOrderByOrderIdReq(); + obj.orderId = data.orderId; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdReq { + return plainToInstance(CancelOrderByOrderIdReq, jsonObject); + } +} + +export class CancelOrderByOrderIdReqBuilder { + obj: CancelOrderByOrderIdReq = new CancelOrderByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByOrderIdReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts new file mode 100644 index 00000000..f6b43376 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByOrderIdResp implements Response { + /** + * order id + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdResp { + return plainToInstance(CancelOrderByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts new file mode 100644 index 00000000..612806f6 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts @@ -0,0 +1,215 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetClosedOrdersItems implements Serializable { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersItems.TypeEnum; + /** + * Buy or sell + */ + side?: string; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: GetClosedOrdersItems.StpEnum; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * Time in force + */ + timeInForce?: GetClosedOrdersItems.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + fromJson(input: string): GetClosedOrdersItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersItems { + return plainToInstance(GetClosedOrdersItems, jsonObject); + } +} + +export namespace GetClosedOrdersItems { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts new file mode 100644 index 00000000..d5c696ff --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts @@ -0,0 +1,212 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetClosedOrdersReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: GetClosedOrdersReq.TradeTypeEnum; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetClosedOrdersReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number = 20; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetClosedOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetClosedOrdersReq` object. + */ + static builder(): GetClosedOrdersReqBuilder { + return new GetClosedOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetClosedOrdersReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: GetClosedOrdersReq.TradeTypeEnum; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetClosedOrdersReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetClosedOrdersReq { + let obj = new GetClosedOrdersReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + obj.side = data.side; + obj.type = data.type; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetClosedOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersReq { + return plainToInstance(GetClosedOrdersReq, jsonObject); + } +} + +export namespace GetClosedOrdersReq { + export enum TradeTypeEnum { + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetClosedOrdersReqBuilder { + obj: GetClosedOrdersReq = new GetClosedOrdersReq(); + /** + * symbol + */ + setSymbol(value: string): GetClosedOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + setTradeType(value: GetClosedOrdersReq.TradeTypeEnum): GetClosedOrdersReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: GetClosedOrdersReq.SideEnum): GetClosedOrdersReqBuilder { + this.obj.side = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: GetClosedOrdersReq.TypeEnum): GetClosedOrdersReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + setLastId(value: number): GetClosedOrdersReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default20,Max100 + */ + setLimit(value: number): GetClosedOrdersReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetClosedOrdersReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetClosedOrdersReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetClosedOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts new file mode 100644 index 00000000..b3e6ed36 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetClosedOrdersItems } from './model_get_closed_orders_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetClosedOrdersResp implements Response { + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * + */ + @Type(() => GetClosedOrdersItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetClosedOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersResp { + return plainToInstance(GetClosedOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts new file mode 100644 index 00000000..db53811f --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts @@ -0,0 +1,225 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOpenOrdersData implements Serializable { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOpenOrdersData.TypeEnum; + /** + * Buy or sell + */ + side?: GetOpenOrdersData.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * trading fee + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: GetOpenOrdersData.StpEnum; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * Time in force + */ + timeInForce?: GetOpenOrdersData.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + fromJson(input: string): GetOpenOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrdersData { + return plainToInstance(GetOpenOrdersData, jsonObject); + } +} + +export namespace GetOpenOrdersData { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts new file mode 100644 index 00000000..ba2de958 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOpenOrdersReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Order type: MARGIN_TRADE - cross margin trading order, MARGIN_ISOLATED_TRADE - isolated margin trading order + */ + tradeType?: GetOpenOrdersReq.TradeTypeEnum; + + /** + * Creates a new instance of the `GetOpenOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetOpenOrdersReq` object. + */ + static builder(): GetOpenOrdersReqBuilder { + return new GetOpenOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetOpenOrdersReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Order type: MARGIN_TRADE - cross margin trading order, MARGIN_ISOLATED_TRADE - isolated margin trading order + */ + tradeType?: GetOpenOrdersReq.TradeTypeEnum; + }): GetOpenOrdersReq { + let obj = new GetOpenOrdersReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): GetOpenOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrdersReq { + return plainToInstance(GetOpenOrdersReq, jsonObject); + } +} + +export namespace GetOpenOrdersReq { + export enum TradeTypeEnum { + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class GetOpenOrdersReqBuilder { + obj: GetOpenOrdersReq = new GetOpenOrdersReq(); + /** + * symbol + */ + setSymbol(value: string): GetOpenOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Order type: MARGIN_TRADE - cross margin trading order, MARGIN_ISOLATED_TRADE - isolated margin trading order + */ + setTradeType(value: GetOpenOrdersReq.TradeTypeEnum): GetOpenOrdersReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): GetOpenOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts new file mode 100644 index 00000000..3e80bc6c --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetOpenOrdersData } from './model_get_open_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOpenOrdersResp implements Response { + /** + * + */ + @Type(() => GetOpenOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOpenOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetOpenOrdersResp { + return plainToInstance(GetOpenOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts new file mode 100644 index 00000000..18d40759 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByClientOidReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. + */ + static builder(): GetOrderByClientOidReqBuilder { + return new GetOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + }): GetOrderByClientOidReq { + let obj = new GetOrderByClientOidReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): GetOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidReq { + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } +} + +export class GetOrderByClientOidReqBuilder { + obj: GetOrderByClientOidReq = new GetOrderByClientOidReq(); + /** + * symbol + */ + setSymbol(value: string): GetOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): GetOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): GetOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts new file mode 100644 index 00000000..46b92a32 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts @@ -0,0 +1,236 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByClientOidResp implements Response { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOrderByClientOidResp.TypeEnum; + /** + * Buy or sell + */ + side?: GetOrderByClientOidResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: GetOrderByClientOidResp.StpEnum; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * Time in force + */ + timeInForce?: GetOrderByClientOidResp.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidResp { + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } +} + +export namespace GetOrderByClientOidResp { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts new file mode 100644 index 00000000..c823c0ca --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByOrderIdReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. + */ + static builder(): GetOrderByOrderIdReqBuilder { + return new GetOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): GetOrderByOrderIdReq { + let obj = new GetOrderByOrderIdReq(); + obj.symbol = data.symbol; + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } +} + +export class GetOrderByOrderIdReqBuilder { + obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + /** + * symbol + */ + setSymbol(value: string): GetOrderByOrderIdReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): GetOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts new file mode 100644 index 00000000..31ccb6ee --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts @@ -0,0 +1,236 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByOrderIdResp implements Response { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOrderByOrderIdResp.TypeEnum; + /** + * Buy or sell + */ + side?: GetOrderByOrderIdResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC + */ + stp?: GetOrderByOrderIdResp.StpEnum; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * Time in force + */ + timeInForce?: GetOrderByOrderIdResp.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdResp { + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } +} + +export namespace GetOrderByOrderIdResp { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts new file mode 100644 index 00000000..3ed2e478 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts @@ -0,0 +1,75 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSymbolsWithOpenOrderReq implements Serializable { + /** + * Cross Margin: MARGIN_TRADE, Isolated Margin: MARGIN_ISOLATED_TRADE + */ + tradeType?: GetSymbolsWithOpenOrderReq.TradeTypeEnum; + + /** + * Creates a new instance of the `GetSymbolsWithOpenOrderReq` class. + * The builder pattern allows step-by-step construction of a `GetSymbolsWithOpenOrderReq` object. + */ + static builder(): GetSymbolsWithOpenOrderReqBuilder { + return new GetSymbolsWithOpenOrderReqBuilder(); + } + + /** + * Creates a new instance of the `GetSymbolsWithOpenOrderReq` class with the given data. + */ + static create(data: { + /** + * Cross Margin: MARGIN_TRADE, Isolated Margin: MARGIN_ISOLATED_TRADE + */ + tradeType?: GetSymbolsWithOpenOrderReq.TradeTypeEnum; + }): GetSymbolsWithOpenOrderReq { + let obj = new GetSymbolsWithOpenOrderReq(); + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): GetSymbolsWithOpenOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolsWithOpenOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolsWithOpenOrderReq { + return plainToInstance(GetSymbolsWithOpenOrderReq, jsonObject); + } +} + +export namespace GetSymbolsWithOpenOrderReq { + export enum TradeTypeEnum { + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class GetSymbolsWithOpenOrderReqBuilder { + obj: GetSymbolsWithOpenOrderReq = new GetSymbolsWithOpenOrderReq(); + /** + * Cross Margin: MARGIN_TRADE, Isolated Margin: MARGIN_ISOLATED_TRADE + */ + setTradeType( + value: GetSymbolsWithOpenOrderReq.TradeTypeEnum, + ): GetSymbolsWithOpenOrderReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): GetSymbolsWithOpenOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts new file mode 100644 index 00000000..2eb945bf --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSymbolsWithOpenOrderResp + implements Response +{ + /** + * Symbol Size + */ + symbolSize?: number; + /** + * The symbol that has active orders + */ + symbols?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSymbolsWithOpenOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { + return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts new file mode 100644 index 00000000..6c6387f9 --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts @@ -0,0 +1,131 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryItems implements Serializable { + /** + * Id of transaction detail + */ + id?: number; + /** + * symbol + */ + symbol?: string; + /** + * Trade Id, symbol latitude increment + */ + tradeId?: number; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Counterparty order Id + */ + counterOrderId?: string; + /** + * Buy or sell + */ + side?: GetTradeHistoryItems.SideEnum; + /** + * Liquidity type: taker or maker + */ + liquidity?: GetTradeHistoryItems.LiquidityEnum; + /** + * + */ + forceTaker?: boolean; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * Fee rate + */ + feeRate?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty + */ + stop?: string; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Tax Rate, Users in some regions need query this field + */ + taxRate?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryItems.TypeEnum; + /** + * + */ + createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToInstance(GetTradeHistoryItems, jsonObject); + } +} + +export namespace GetTradeHistoryItems { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum LiquidityEnum { + /** + * + */ + TAKER = 'taker', + /** + * + */ + MAKER = 'maker', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts new file mode 100644 index 00000000..a00fb26b --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts @@ -0,0 +1,229 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Trade type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: GetTradeHistoryReq.TradeTypeEnum; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number = 20; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. + */ + static builder(): GetTradeHistoryReqBuilder { + return new GetTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Trade type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + tradeType?: GetTradeHistoryReq.TradeTypeEnum; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default100,Max200 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetTradeHistoryReq { + let obj = new GetTradeHistoryReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + obj.orderId = data.orderId; + obj.side = data.side; + obj.type = data.type; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToInstance(GetTradeHistoryReq, jsonObject); + } +} + +export namespace GetTradeHistoryReq { + export enum TradeTypeEnum { + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetTradeHistoryReqBuilder { + obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + /** + * symbol + */ + setSymbol(value: string): GetTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Trade type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade + */ + setTradeType(value: GetTradeHistoryReq.TradeTypeEnum): GetTradeHistoryReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + setOrderId(value: string): GetTradeHistoryReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: GetTradeHistoryReq.SideEnum): GetTradeHistoryReqBuilder { + this.obj.side = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: GetTradeHistoryReq.TypeEnum): GetTradeHistoryReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + setLastId(value: number): GetTradeHistoryReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default100,Max200 + */ + setLimit(value: number): GetTradeHistoryReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetTradeHistoryReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetTradeHistoryReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts new file mode 100644 index 00000000..8620360e --- /dev/null +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetTradeHistoryItems } from './model_get_trade_history_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryResp implements Response { + /** + * + */ + @Type(() => GetTradeHistoryItems) + items?: Array; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryResp { + return plainToInstance(GetTradeHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.template b/sdk/node/src/generate/margin/risklimit/api_risk_limit.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts new file mode 100644 index 00000000..2ce8c453 --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts @@ -0,0 +1,37 @@ +import { GetMarginRiskLimitResp } from './model_get_margin_risk_limit_resp'; +import { GetMarginRiskLimitReq } from './model_get_margin_risk_limit_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getMarginRiskLimit request test', () => { + /** + * getMarginRiskLimit + * Get Margin Risk Limit + * /api/v3/margin/currencies + */ + let data = '{"isIsolated": true, "currency": "BTC", "symbol": "BTC-USDT"}'; + let req = new GetMarginRiskLimitReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMarginRiskLimit response test', () => { + /** + * getMarginRiskLimit + * Get Margin Risk Limit + * /api/v3/margin/currencies + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "timestamp": 1729678659275,\n "currency": "BTC",\n "borrowMaxAmount": "75.15",\n "buyMaxAmount": "217.12",\n "holdMaxAmount": "217.12",\n "borrowCoefficient": "1",\n "marginCoefficient": "1",\n "precision": 8,\n "borrowMinAmount": "0.001",\n "borrowMinUnit": "0.0001",\n "borrowEnabled": true\n }\n ]\n}\n'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarginRiskLimitResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.ts b/sdk/node/src/generate/margin/risklimit/api_risk_limit.ts new file mode 100644 index 00000000..38ee29c6 --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetMarginRiskLimitResp } from './model_get_margin_risk_limit_resp'; +import { GetMarginRiskLimitReq } from './model_get_margin_risk_limit_req'; + +export interface RiskLimitAPI { + /** + * getMarginRiskLimit Get Margin Risk Limit + * Description: Request via this endpoint to get the Configure and Risk limit info of the margin. + * Documentation: https://www.kucoin.com/docs-new/api-3470219 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + getMarginRiskLimit(req: GetMarginRiskLimitReq): Promise; +} + +export class RiskLimitAPIImpl implements RiskLimitAPI { + constructor(private transport: Transport) {} + + getMarginRiskLimit(req: GetMarginRiskLimitReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/margin/currencies', + req, + new GetMarginRiskLimitResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts new file mode 100644 index 00000000..be338656 --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts @@ -0,0 +1,138 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginRiskLimitData implements Serializable { + /** + * Time stamp + */ + timestamp?: number; + /** + * CROSS MARGIN RESPONSES, Currency + */ + currency?: string; + /** + * CROSS MARGIN RESPONSES, Maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. + */ + borrowMaxAmount?: string; + /** + * CROSS MARGIN RESPONSES, Maximum buy amount + */ + buyMaxAmount?: string; + /** + * CROSS MARGIN RESPONSES, Maximum holding amount + */ + holdMaxAmount?: string; + /** + * CROSS MARGIN RESPONSES, [Borrow Coefficient](https://www.kucoin.com/land/price-protect) + */ + borrowCoefficient?: string; + /** + * CROSS MARGIN RESPONSES, [Margin Coefficient](https://www.kucoin.com/land/price-protect) + */ + marginCoefficient?: string; + /** + * CROSS MARGIN RESPONSES, Currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 + */ + precision?: number; + /** + * CROSS MARGIN RESPONSES, Minimum personal borrow amount + */ + borrowMinAmount?: string; + /** + * CROSS MARGIN RESPONSES, Minimum unit for borrowing, the borrowed amount must be an integer multiple of this value + */ + borrowMinUnit?: string; + /** + * CROSS MARGIN RESPONSES, Whether to support borrowing + */ + borrowEnabled?: boolean; + /** + * ISOLATED MARGIN RESPONSES, Symbol + */ + symbol?: string; + /** + * ISOLATED MARGIN RESPONSES, Base maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. + */ + baseMaxBorrowAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Quote maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. + */ + quoteMaxBorrowAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Base maximum buy amount + */ + baseMaxBuyAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Quote maximum buy amount + */ + quoteMaxBuyAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Base maximum holding amount + */ + baseMaxHoldAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Quote maximum holding amount + */ + quoteMaxHoldAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Base currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 + */ + basePrecision?: number; + /** + * ISOLATED MARGIN RESPONSES, Quote currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 + */ + quotePrecision?: number; + /** + * ISOLATED MARGIN RESPONSES, Base minimum personal borrow amount + */ + baseBorrowMinAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Quote minimum personal borrow amount + */ + quoteBorrowMinAmount?: string; + /** + * ISOLATED MARGIN RESPONSES, Base minimum unit for borrowing, the borrowed amount must be an integer multiple of this value + */ + baseBorrowMinUnit?: string; + /** + * ISOLATED MARGIN RESPONSES, Quote minimum unit for borrowing, the borrowed amount must be an integer multiple of this value + */ + quoteBorrowMinUnit?: string; + /** + * ISOLATED MARGIN RESPONSES, Base whether to support borrowing + */ + baseBorrowEnabled?: boolean; + /** + * ISOLATED MARGIN RESPONSES, Quote whether to support borrowing + */ + quoteBorrowEnabled?: boolean; + /** + * ISOLATED MARGIN RESPONSES, [Base Borrow Coefficient](https://www.kucoin.com/land/price-protect) + */ + baseBorrowCoefficient?: string; + /** + * ISOLATED MARGIN RESPONSES, [Quote Borrow Coefficient](https://www.kucoin.com/land/price-protect) + */ + quoteBorrowCoefficient?: string; + /** + * ISOLATED MARGIN RESPONSES, [Base Margin Coefficient](https://www.kucoin.com/land/price-protect) + */ + baseMarginCoefficient?: string; + /** + * ISOLATED MARGIN RESPONSES, [Quote Margin Coefficient](https://www.kucoin.com/land/price-protect) + */ + quoteMarginCoefficient?: string; + fromJson(input: string): GetMarginRiskLimitData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginRiskLimitData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginRiskLimitData { + return plainToInstance(GetMarginRiskLimitData, jsonObject); + } +} diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts new file mode 100644 index 00000000..df125fab --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetMarginRiskLimitReq implements Serializable { + /** + * true-isolated, false-cross + */ + isIsolated?: boolean; + /** + * currency, This field is only required for cross margin + */ + currency?: string; + /** + * symbol, This field is only required for isolated margin + */ + symbol?: string; + + /** + * Creates a new instance of the `GetMarginRiskLimitReq` class. + * The builder pattern allows step-by-step construction of a `GetMarginRiskLimitReq` object. + */ + static builder(): GetMarginRiskLimitReqBuilder { + return new GetMarginRiskLimitReqBuilder(); + } + + /** + * Creates a new instance of the `GetMarginRiskLimitReq` class with the given data. + */ + static create(data: { + /** + * true-isolated, false-cross + */ + isIsolated?: boolean; + /** + * currency, This field is only required for cross margin + */ + currency?: string; + /** + * symbol, This field is only required for isolated margin + */ + symbol?: string; + }): GetMarginRiskLimitReq { + let obj = new GetMarginRiskLimitReq(); + obj.isIsolated = data.isIsolated; + obj.currency = data.currency; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMarginRiskLimitReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginRiskLimitReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMarginRiskLimitReq { + return plainToInstance(GetMarginRiskLimitReq, jsonObject); + } +} + +export class GetMarginRiskLimitReqBuilder { + obj: GetMarginRiskLimitReq = new GetMarginRiskLimitReq(); + /** + * true-isolated, false-cross + */ + setIsIsolated(value: boolean): GetMarginRiskLimitReqBuilder { + this.obj.isIsolated = value; + return this; + } + + /** + * currency, This field is only required for cross margin + */ + setCurrency(value: string): GetMarginRiskLimitReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * symbol, This field is only required for isolated margin + */ + setSymbol(value: string): GetMarginRiskLimitReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMarginRiskLimitReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts new file mode 100644 index 00000000..e6f2c7dc --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetMarginRiskLimitData } from './model_get_margin_risk_limit_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarginRiskLimitResp implements Response { + /** + * + */ + @Type(() => GetMarginRiskLimitData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarginRiskLimitResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarginRiskLimitResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMarginRiskLimitResp { + return plainToInstance(GetMarginRiskLimitResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/service/account_api.ts b/sdk/node/src/generate/service/account_api.ts new file mode 100644 index 00000000..9b9e0f64 --- /dev/null +++ b/sdk/node/src/generate/service/account_api.ts @@ -0,0 +1,68 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { FeeAPI, FeeAPIImpl } from '@generate/account/fee/api_fee'; +import { TransferAPI, TransferAPIImpl } from '@generate/account/transfer/api_transfer'; +import { AccountAPI, AccountAPIImpl } from '@generate/account/account/api_account'; +import { SubAccountAPIImpl, SubAccountAPI } from '@generate/account/subaccount/api_sub_account'; +import { WithdrawalAPIImpl, WithdrawalAPI } from '@generate/account/withdrawal/api_withdrawal'; +import { DepositAPIImpl, DepositAPI } from '@generate/account/deposit/api_deposit'; + +export abstract class AccountService { + abstract getAccountApi(): AccountAPI; + + abstract getDepositApi(): DepositAPI; + + abstract getWithdrawalApi(): WithdrawalAPI; + + abstract getFeeApi(): FeeAPI; + + abstract getSubAccountApi(): SubAccountAPI; + + abstract getTransferApi(): TransferAPI; +} + +export class AccountServiceImpl implements AccountService { + private readonly transport: Transport; + private readonly account: AccountAPI; + private readonly deposit: DepositAPI; + private readonly withdrawal: WithdrawalAPI; + private readonly fee: FeeAPI; + private readonly subAccount: SubAccountAPI; + private readonly transfer: TransferAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.account = new AccountAPIImpl(transport); + this.deposit = new DepositAPIImpl(transport); + this.withdrawal = new WithdrawalAPIImpl(transport); + this.fee = new FeeAPIImpl(transport); + this.subAccount = new SubAccountAPIImpl(transport); + this.transfer = new TransferAPIImpl(transport); + } + + getAccountApi(): AccountAPI { + return this.account; + } + + getDepositApi(): DepositAPI { + return this.deposit; + } + + getWithdrawalApi(): WithdrawalAPI { + return this.withdrawal; + } + + getFeeApi(): FeeAPI { + return this.fee; + } + + getSubAccountApi(): SubAccountAPI { + return this.subAccount; + } + + getTransferApi(): TransferAPI { + return this.transfer; + } +} diff --git a/sdk/node/src/generate/service/affiliate_api.ts b/sdk/node/src/generate/service/affiliate_api.ts new file mode 100644 index 00000000..3188958c --- /dev/null +++ b/sdk/node/src/generate/service/affiliate_api.ts @@ -0,0 +1,23 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { AffiliateAPIImpl, AffiliateAPI } from '@generate/affiliate/affiliate/api_affiliate'; + +export abstract class AffiliateService { + abstract getAffiliateApi(): AffiliateAPI; +} + +export class AffiliateServiceImpl implements AffiliateService { + private readonly transport: Transport; + private readonly affiliate: AffiliateAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.affiliate = new AffiliateAPIImpl(transport); + } + + getAffiliateApi(): AffiliateAPI { + return this.affiliate; + } +} diff --git a/sdk/node/src/generate/service/broker_api.ts b/sdk/node/src/generate/service/broker_api.ts new file mode 100644 index 00000000..ade92be2 --- /dev/null +++ b/sdk/node/src/generate/service/broker_api.ts @@ -0,0 +1,32 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { APIBrokerAPIImpl, APIBrokerAPI } from '@generate/broker/apibroker/api_a_pi_broker'; +import { NDBrokerAPI, NDBrokerAPIImpl } from '@generate/broker/ndbroker/api_n_d_broker'; + +export abstract class BrokerService { + abstract getAPIBrokerApi(): APIBrokerAPI; + + abstract getNDBrokerApi(): NDBrokerAPI; +} + +export class BrokerServiceImpl implements BrokerService { + private readonly transport: Transport; + private readonly aPIBroker: APIBrokerAPI; + private readonly nDBroker: NDBrokerAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.aPIBroker = new APIBrokerAPIImpl(transport); + this.nDBroker = new NDBrokerAPIImpl(transport); + } + + getAPIBrokerApi(): APIBrokerAPI { + return this.aPIBroker; + } + + getNDBrokerApi(): NDBrokerAPI { + return this.nDBroker; + } +} diff --git a/sdk/node/src/generate/service/earn_api.ts b/sdk/node/src/generate/service/earn_api.ts new file mode 100644 index 00000000..e9da0f87 --- /dev/null +++ b/sdk/node/src/generate/service/earn_api.ts @@ -0,0 +1,23 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { EarnAPIImpl, EarnAPI } from '@generate/earn/earn/api_earn'; + +export abstract class EarnService { + abstract getEarnApi(): EarnAPI; +} + +export class EarnServiceImpl implements EarnService { + private readonly transport: Transport; + private readonly earn: EarnAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.earn = new EarnAPIImpl(transport); + } + + getEarnApi(): EarnAPI { + return this.earn; + } +} diff --git a/sdk/node/src/generate/service/futures_api.ts b/sdk/node/src/generate/service/futures_api.ts new file mode 100644 index 00000000..a3fc3492 --- /dev/null +++ b/sdk/node/src/generate/service/futures_api.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { MarketAPIImpl, MarketAPI } from '@generate/futures/market/api_market'; +import { PositionsAPI, PositionsAPIImpl } from '@generate/futures/positions/api_positions'; +import { OrderAPIImpl, OrderAPI } from '@generate/futures/order/api_order'; +import { FundingFeesAPIImpl, FundingFeesAPI } from '@generate/futures/fundingfees/api_funding_fees'; + +export abstract class FuturesService { + abstract getOrderApi(): OrderAPI; + + abstract getPositionsApi(): PositionsAPI; + + abstract getFundingFeesApi(): FundingFeesAPI; + + abstract getMarketApi(): MarketAPI; +} + +export class FuturesServiceImpl implements FuturesService { + private readonly transport: Transport; + private readonly order: OrderAPI; + private readonly positions: PositionsAPI; + private readonly fundingFees: FundingFeesAPI; + private readonly market: MarketAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.order = new OrderAPIImpl(transport); + this.positions = new PositionsAPIImpl(transport); + this.fundingFees = new FundingFeesAPIImpl(transport); + this.market = new MarketAPIImpl(transport); + } + + getOrderApi(): OrderAPI { + return this.order; + } + + getPositionsApi(): PositionsAPI { + return this.positions; + } + + getFundingFeesApi(): FundingFeesAPI { + return this.fundingFees; + } + + getMarketApi(): MarketAPI { + return this.market; + } +} diff --git a/sdk/node/src/generate/service/margin_api.ts b/sdk/node/src/generate/service/margin_api.ts new file mode 100644 index 00000000..e6568da4 --- /dev/null +++ b/sdk/node/src/generate/service/margin_api.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { DebitAPI, DebitAPIImpl } from '@generate/margin/debit/api_debit'; +import { OrderAPIImpl, OrderAPI } from '@generate/margin/order/api_order'; +import { RiskLimitAPIImpl, RiskLimitAPI } from '@generate/margin/risklimit/api_risk_limit'; +import { CreditAPI, CreditAPIImpl } from '@generate/margin/credit/api_credit'; +import { MarketAPIImpl, MarketAPI } from '@generate/margin/market/api_market'; + +export abstract class MarginService { + abstract getOrderApi(): OrderAPI; + + abstract getDebitApi(): DebitAPI; + + abstract getCreditApi(): CreditAPI; + + abstract getMarketApi(): MarketAPI; + + abstract getRiskLimitApi(): RiskLimitAPI; +} + +export class MarginServiceImpl implements MarginService { + private readonly transport: Transport; + private readonly order: OrderAPI; + private readonly debit: DebitAPI; + private readonly credit: CreditAPI; + private readonly market: MarketAPI; + private readonly riskLimit: RiskLimitAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.order = new OrderAPIImpl(transport); + this.debit = new DebitAPIImpl(transport); + this.credit = new CreditAPIImpl(transport); + this.market = new MarketAPIImpl(transport); + this.riskLimit = new RiskLimitAPIImpl(transport); + } + + getOrderApi(): OrderAPI { + return this.order; + } + + getDebitApi(): DebitAPI { + return this.debit; + } + + getCreditApi(): CreditAPI { + return this.credit; + } + + getMarketApi(): MarketAPI { + return this.market; + } + + getRiskLimitApi(): RiskLimitAPI { + return this.riskLimit; + } +} diff --git a/sdk/node/src/generate/service/spot_api.ts b/sdk/node/src/generate/service/spot_api.ts new file mode 100644 index 00000000..e255025c --- /dev/null +++ b/sdk/node/src/generate/service/spot_api.ts @@ -0,0 +1,32 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { MarketAPIImpl, MarketAPI } from '@generate/spot/market/api_market'; +import { OrderAPIImpl, OrderAPI } from '@generate/spot/order/api_order'; + +export abstract class SpotService { + abstract getOrderApi(): OrderAPI; + + abstract getMarketApi(): MarketAPI; +} + +export class SpotServiceImpl implements SpotService { + private readonly transport: Transport; + private readonly order: OrderAPI; + private readonly market: MarketAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.order = new OrderAPIImpl(transport); + this.market = new MarketAPIImpl(transport); + } + + getOrderApi(): OrderAPI { + return this.order; + } + + getMarketApi(): MarketAPI { + return this.market; + } +} diff --git a/sdk/node/src/generate/service/viplending_api.ts b/sdk/node/src/generate/service/viplending_api.ts new file mode 100644 index 00000000..a609d254 --- /dev/null +++ b/sdk/node/src/generate/service/viplending_api.ts @@ -0,0 +1,23 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { VIPLendingAPI, VIPLendingAPIImpl } from '@generate/viplending/viplending/api_v_ip_lending'; + +export abstract class VIPLendingService { + abstract getVIPLendingApi(): VIPLendingAPI; +} + +export class VIPLendingServiceImpl implements VIPLendingService { + private readonly transport: Transport; + private readonly vIPLending: VIPLendingAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.vIPLending = new VIPLendingAPIImpl(transport); + } + + getVIPLendingApi(): VIPLendingAPI { + return this.vIPLending; + } +} diff --git a/sdk/node/src/generate/spot/market/api_market.template b/sdk/node/src/generate/spot/market/api_market.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/spot/market/api_market.test.ts b/sdk/node/src/generate/spot/market/api_market.test.ts new file mode 100644 index 00000000..a1696a82 --- /dev/null +++ b/sdk/node/src/generate/spot/market/api_market.test.ts @@ -0,0 +1,481 @@ +import { GetAnnouncementsResp } from './model_get_announcements_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { Get24hrStatsReq } from './model_get24hr_stats_req'; +import { GetAllSymbolsReq } from './model_get_all_symbols_req'; +import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetTickerReq } from './model_get_ticker_req'; +import { GetPrivateTokenResp } from './model_get_private_token_resp'; +import { GetFiatPriceResp } from './model_get_fiat_price_resp'; +import { GetPartOrderBookReq } from './model_get_part_order_book_req'; +import { GetSymbolReq } from './model_get_symbol_req'; +import { GetSymbolResp } from './model_get_symbol_resp'; +import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; +import { GetFullOrderBookReq } from './model_get_full_order_book_req'; +import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetMarketListResp } from './model_get_market_list_resp'; +import { GetCurrencyReq } from './model_get_currency_req'; +import { GetAllCurrenciesResp } from './model_get_all_currencies_resp'; +import { Get24hrStatsResp } from './model_get24hr_stats_resp'; +import { GetKlinesReq } from './model_get_klines_req'; +import { GetCurrencyResp } from './model_get_currency_resp'; +import { GetPartOrderBookResp } from './model_get_part_order_book_resp'; +import { GetFiatPriceReq } from './model_get_fiat_price_req'; +import { GetAllTickersResp } from './model_get_all_tickers_resp'; +import { GetServerTimeResp } from './model_get_server_time_resp'; +import { GetAnnouncementsReq } from './model_get_announcements_req'; +import { GetKlinesResp } from './model_get_klines_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private + */ + }); + + test('getPrivateToken response test', () => { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private + */ + }); + test('getPublicToken request test', () => { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + }); + + test('getPublicToken response test', () => { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + }); + test('getAllTickers request test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers + */ + }); + + test('getAllTickers response test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers + */ + }); + test('getKlines request test', () => { + /** + * getKlines + * Get Klines + * /api/v1/market/candles + */ + let data = + '{"symbol": "BTC-USDT", "type": "1min", "startAt": 1566703297, "endAt": 1566789757}'; + let req = new GetKlinesReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getKlines response test', () => { + /** + * getKlines + * Get Klines + * /api/v1/market/candles + */ + let data = + '{\n "code": "200000",\n "data": [\n [\n "1566789720",\n "10411.5",\n "10401.9",\n "10411.5",\n "10396.3",\n "29.11357276",\n "302889.301529914"\n ],\n [\n "1566789660",\n "10416",\n "10411.5",\n "10422.3",\n "10411.5",\n "15.61781842",\n "162703.708997029"\n ],\n [\n "1566789600",\n "10408.6",\n "10416",\n "10416",\n "10405.4",\n "12.45584973",\n "129666.51508559"\n ]\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetKlinesResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/market/histories + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistory response test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/market/histories + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "sequence": "10976028003549185",\n "price": "67122",\n "size": "0.000025",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549188",\n "price": "67122",\n "size": "0.01792257",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549191",\n "price": "67122.9",\n "size": "0.05654289",\n "side": "buy",\n "time": 1729177117877000000\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getTicker request test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/market/orderbook/level1 + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetTickerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTicker response test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/market/orderbook/level1 + */ + let data = + '{"code":"200000","data":{"time":1729172965609,"sequence":"14609309753","price":"67269","size":"0.000025","bestBid":"67267.5","bestBidSize":"0.000025","bestAsk":"67267.6","bestAskSize":"1.24808993"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTickerResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getPartOrderBook request test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} + */ + let data = '{"symbol": "BTC-USDT", "size": "20"}'; + let req = new GetPartOrderBookReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getPartOrderBook response test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} + */ + let data = + '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetPartOrderBookResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('get24hrStats request test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new Get24hrStatsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('get24hrStats response test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats + */ + let data = + '{"code":"200000","data":{"time":1729175612158,"symbol":"BTC-USDT","buy":"66982.4","sell":"66982.5","changeRate":"-0.0114","changePrice":"-778.1","high":"68107.7","low":"66683.3","vol":"1738.02898182","volValue":"117321982.415978333","last":"66981.5","averagePrice":"67281.21437289","takerFeeRate":"0.001","makerFeeRate":"0.001","takerCoefficient":"1","makerCoefficient":"1"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new Get24hrStatsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getMarketList request test', () => { + /** + * getMarketList + * Get Market List + * /api/v1/markets + */ + }); + + test('getMarketList response test', () => { + /** + * getMarketList + * Get Market List + * /api/v1/markets + */ + }); + test('getFiatPrice request test', () => { + /** + * getFiatPrice + * Get Fiat Price + * /api/v1/prices + */ + let data = '{"base": "USD", "currencies": "example_string_default_value"}'; + let req = new GetFiatPriceReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFiatPrice response test', () => { + /** + * getFiatPrice + * Get Fiat Price + * /api/v1/prices + */ + let data = + '{"code":"200000","data":{"AGLD":"1.1174410000000001","DFI":"0.0168915500000000","PYTHUP":"0.0397880960000000","ISLM":"0.0606196750000000","NEAR":"4.7185395500000000","AIOZ":"0.4862867350000000","AUDIO":"0.1219390000000000","BBL":"0.0067766100000000","WLD":"2.2893547500000000","HNT":"5.8990489999999984","ETHFI":"1.5892050000000000","DMAIL":"0.2726636000000000","OPUP":"0.0986506500000000","VET3S":"0.0003700448850000","MANA3S":"0.0006056970000000","TIDAL":"0.0001154422500000","HALO":"0.0058270850000000","OPUL":"0.0839480050000000","MANA3L":"0.0029569407900000","DGB":"0.0066556705000000","AA":"0.2406796000000000","BCH":"366.2167999999996484","GMEE":"0.0113333305000000","JST":"0.0302348750000000","PBUX":"0.0208795550000000","AR":"18.5457224999999909","SEI":"0.4332832500000000","PSTAKE":"0.0493153300000000","LMWR":"0.1618190500000000","UNFIDOWN":"0.0062058955000000","BB":"0.3245376500000000","JTO":"2.1239375000000002","WEMIX":"0.7916040000000000","G":"0.0324037900000000","MARSH":"0.0617591050000000","BN":"0.0036961510000000","FLIP":"1.0976509000000000","FLR":"0.0144827550000000","BIGTIME":"0.1238780300000000","FLY":"0.0005157420000000","T":"0.0233483200000000","W":"0.2865566500000000","BDX":"0.0774012800000000","BABYDOGE":"0.0000000029375305","SFP":"0.7256370000000000","DIA":"0.9179408000000000","ISME":"0.0022388800000000","LYM":"0.0010155919500000","VET3L":"0.0000289755050000","JUP":"0.8230882500000000","LYX":"1.4501745500000001","AIEPK":"0.0050094940000000","SILLY":"0.0159420250000000","SCPT":"0.0122038950000000","WOO":"0.1796601250000000","BLUR":"0.2462768000000000","STRK":"0.3963117450000000","BFC":"0.0383608100000000","DC":"0.0003097450500000","KARATE":"0.0007296350000000","SUSHI3L":"0.5115441000000000","NETVR":"0.0976111700000000","WAVES":"1.0806594000000000","LITH":"0.0001520239500000","HAPI":"8.6533711499999987","SUSHI3S":"1.2752620500000000","CEEK":"0.0294852500000000","FLOKI":"0.0001414292500000","SHR":"0.0012463765000000","SAND":"0.2566616050000000","TURT":"0.0020889550000000","UMA":"2.5207390000000000","BEPRO":"0.0003955021500000","SCRT":"0.1995002000000000","TUSD":"0.9945025000000000","COOKIE":"0.0220089900000000","LRDS":"0.6218889000000000","SIN":"0.0033633175000000","OAS":"0.0331933950000000","ROOT":"0.0183108400000000","ADA3L":"0.0046396790000000","TIAUP":"0.1228385500000000","HTR":"0.0353023400000000","UNB":"0.0003837080500000","UNA":"0.0164917500000000","HARD":"0.1087056200000000","G3":"0.0502648550000000","ADA3S":"0.0006191202850000","MYRO":"0.1071863800000000","HTX":"0.0000013693150000","FT":"0.3585206500000000","BTCDOWN":"0.1065467000000000","UNI":"7.3571195999999993","FX":"0.1379310000000000","OBI":"0.0079030465000000","UNO":"0.0137131400000000","WRX":"0.1221389000000000","TIADOWN":"0.0000914642450000","ETHDOWN":"0.1306346500000000","WELL":"0.0471244260000000","SWFTC":"0.0028966509500000","SKL":"0.0362418700000000","UOS":"0.0867765900000000","AIPAD":"0.0478660550000000","BRETT":"0.1037481000000000","SKY":"0.0520139800000000","FRM":"0.0153123400000000","VISION":"0.0014451770500000","LENDS":"0.0047276350000000","SLF":"0.3318340000000000","BULL":"0.0023988000000000","FLOW":"0.5372312500000000","ODDZ":"0.0063368300000000","SLN":"0.2804597000000000","UPO":"0.0440779500000000","SLP":"0.0023997995000000","ID":"0.3718140000000000","SLIM":"0.0906446550000000","SPOT":"0.0021289350000000","DOP":"0.0023028480000000","ISSP":"0.0000874562500000","UQC":"3.2339822000000003","IO":"1.8185902499999999","DOT":"4.2022978000000005","1INCH":"0.2645676500000000","SMH":"0.3448275000000000","MAK":"0.0396701550000000","TOKO":"0.0005923037000000","TURBO":"0.0108085930000000","UNFI":"2.8555714999999996","MAN":"0.0210764565000000","EVER":"0.0332733550000000","FTM":"0.7259068650000000","SHRAP":"0.0476361700000000","MAV":"0.1738130500000000","MAX":"0.2864966800000000","DPR":"0.0018240875000000","FTT":"2.0559715000000002","ARKM":"1.7444273499999999","ATOM":"4.2954512000000002","PENDLE":"4.1554212500000007","QUICK":"0.0365317250000000","BLZ":"0.1217191100000000","BOBA":"0.2014092450000000","MBL":"0.0027856065000000","OFN":"0.1252373500000000","UNIO":"0.0025487250000000","SNS":"0.0200899500000000","SNX":"1.4282854999999999","NXRA":"0.0272763550000000","TAIKO":"1.4392800000000001","AVAX3L":"0.1410875109550000","L3":"0.0608395650000000","API3":"1.3728132500000001","XRP3S":"0.0028095945000000","QKC":"0.0085157400000000","AVAX3S":"0.5148424500000000","ROSE":"0.0693453100000000","SATS":"0.0000002701648500","BMX":"0.3100449000000000","PORTAL":"0.2811593500000000","TOMI":"0.0309045400000000","XRP3L":"2.1586201500000002","SOL":"151.7250995000003583","SON":"0.0002421788500000","BNC":"0.1882058500000000","SOCIAL":"0.0026486750000000","CGPT":"0.1305147100000000","CELR":"0.0127736100000000","BNB":"591.0973035000118935","OGN":"0.0852573500000000","CELO":"0.7711142500000000","AUCTION":"13.1634150000000014","MANTA":"0.7564216000000000","LAYER":"0.0372713550000000","AERO":"1.3783104999999999","CETUS":"0.1808295400000000","LL":"0.0201199350000000","SPA":"0.0067426270000000","PYTHDOWN":"0.0011834080000000","NEIROCTO":"0.0019964013000000","UTK":"0.0365217300000000","GMRX":"0.0007386305000000","BOB":"0.0000380619595000","HOTCROSS":"0.0056491740000000","AERGO":"0.1007595950000000","MOCA":"0.0783608000000000","SQD":"0.0380809500000000","MV":"0.0081359300000000","BNB3L":"0.2761618500000000","BNB3S":"0.0008545725000000","GALAX3L":"0.0057571999600000","KAI":"0.0020080954500000","SQR":"0.0470764500000000","GALAX3S":"0.1933033000000000","EGLD":"25.5272299999999713","ZBCN":"0.0010404795000000","KAS":"0.1216691350000000","MEW":"0.0086176890000000","PUNDIX":"0.4130933500000000","LOOKS":"0.0392803500000000","FXS":"1.9060465000000000","BOSON":"0.2732633000000000","BRISE":"0.0000000860569500","AEVO":"0.3388305000000000","FLUX":"0.5276360500000000","PRCL":"0.1969015000000000","UNFIUP":"0.0011654170000000","SEIDOWN":"0.0442778500000000","DOAI":"0.0052363805000000","QNT":"65.4312679999998206","REDO":"0.2837580500000000","STRIKE":"6.8225869999999997","ETHW":"3.2418782499999998","OM":"1.5396797750000000","OP":"1.6911539999999999","WHALE":"0.8134930500000000","1CAT":"0.0018460765000000","NEON":"0.4446775500000000","GTAI":"0.7786105000000000","SSV":"21.2393749999999841","ETH2":"2601.6678843156403923","KCS":"8.7646155000000020","ARPA":"0.0393882960000000","ARTFI":"0.0141029450000000","BRL":"0.1742807323452485","ALEX":"0.0924537500000000","STG":"0.2943527500000000","SHIB":"0.0000178060925000","IOTX":"0.0394202800000000","OLE":"0.0171414250000000","KDA":"0.5653172000000000","CERE":"0.0022548720000000","DOCK":"0.0018990500000000","STX":"1.8157916500000000","OLT":"0.0007596200000000","QI":"0.0131754090000000","SDAO":"0.2748625000000000","BLAST":"0.0087636160000000","LINK3S":"0.0000702948350000","IOST":"0.0049745115000000","SUI":"2.0589700000000000","CAKE":"1.7941024999999999","BSW":"0.0586706500000000","OMG":"0.2597700500000000","VOLT":"0.0000002716641000","LINK3L":"1.3408292499999999","GEEQ":"0.0385607100000000","PYUSD":"0.9988003500000000","SUN":"0.0186106900000000","TOWER":"0.0014812590000000","BTC":"67133.4165000832051564","IOTA":"0.1189405000000000","REEF":"0.0019960015000000","TRIAS":"3.3683149999999998","KEY":"0.0037594713240047","ETH3L":"0.0003305946200000","BTT":"0.0000009117439000","ONE":"0.0132003965000000","RENDER":"5.2263854999999995","ETH3S":"0.5517240000000000","ANKR":"0.0264867500000000","ALGO":"0.1188405500000000","SYLO":"0.0007600198000000","ZCX":"0.0784707450000000","SD":"0.3851073500000000","ONT":"0.1877960550000000","MJT":"0.0132433750000000","DYM":"1.6659666000000001","DYP":"0.0205397250000000","BAKEUP":"0.0389894955000000","OOE":"0.0079360300000000","ZELIX":"0.0000649675000000","DOGE3L":"0.3837080500000000","ARTY":"0.3980009000000000","QORPO":"0.1204297550000000","ICE":"0.0051504235000000","NOTAI":"0.0000892753400000","DOGE3S":"0.2291853500000000","NAKA":"1.0695649500000000","GALAX":"0.0212893500000000","MKR":"1245.8767500000163833","DODO":"0.1152423500000000","ICP":"7.6731615000000027","ZEC":"35.9400209999999543","ZEE":"0.0065767100000000","ICX":"0.1383308000000000","KMNO":"0.0921499020000000","TT":"0.0033883050000000","DOT3L":"0.1454272500000000","XAI":"0.2038980000000000","ZEN":"8.0149905000000007","DOGE":"0.1213093150000000","ALPHA":"0.0567416150000000","DUSK":"0.1964517250000000","DOT3S":"0.0053613180000000","SXP":"0.2538730000000000","HBAR":"0.0510044850000000","SYNT":"0.0467166300000000","ZEX":"0.0571714000000000","BONDLY":"0.0022208890000000","MLK":"0.2080859050000000","KICKS":"0.0001301249050000","PEPE":"0.0000100249850000","OUSD":"0.9982006500000000","LUNCDOWN":"0.0000733333150000","DOGS":"0.0007086455000000","REV3L":"0.0094672640000000","CTSI":"0.1257371000000000","C98":"0.1219390000000000","OSMO":"0.5370313500000000","NTRN":"0.3869064500000000","CFX2S":"0.0084757600000000","SYN":"0.5636180500000000","VIDT":"0.0308745550000000","SYS":"0.0997501000000000","GAS":"4.3029474500000008","BOME":"0.0087336310000000","COMBO":"0.4068964500000000","XCH":"14.9825050000000010","VR":"0.0063538215000000","CFX2L":"0.0499660045000000","VSYS":"0.0005201398000000","PANDORA":"1629.2949450001102772","THETA":"1.2461766000000000","XCN":"0.0012699647000000","NEXG":"0.0039180400000000","MELOS":"0.0021244372500000","XCV":"0.0013253370000000","ORN":"0.8797599000000000","WLKN":"0.0010624685000000","AAVE":"154.2708259999996162","MNT":"0.6168914000000000","BONK":"0.0000227296295000","PERP":"0.6037979500000000","XDC":"0.0276361750000000","MNW":"0.3681158500000000","XDB":"0.0002578710000000","BOND":"1.5662165000000000","SUIA":"0.0809595000000000","MOG":"0.0000019330330000","SUTER":"0.0001840079500000","TIME":"16.2648634999999969","RACA":"0.0001949025000000","BICO":"0.2021988500000000","MON":"0.1066466500000000","SWEAT":"0.0063718125000000","MOXIE":"0.0022088950000000","BABYBNB":"0.0289755050000000","IGU":"0.0050674650000000","HMSTR":"0.0037990995000000","XEC":"0.0000354722550000","MONI":"0.0058470750000000","XR":"0.2374812000000000","PEOPLE":"0.0796601500000000","PUMLX":"0.0054572700000000","ZIL":"0.0145927000000000","WLDDOWN":"0.2089954500000000","VAI":"0.0799999800000000","XEN":"0.0000000839580000","MPC":"0.1001499000000000","XEM":"0.0176951480000000","JASMY3S":"0.0019670160000000","OTK":"0.0290464695000000","TRAC":"0.4521738000000000","DFYN":"0.0070664650000000","BIDP":"0.0001939030000000","JASMY3L":"0.0001653772700000","INJDOWN":"0.0000194902500000","KLV":"0.0019310340000000","WAXL":"0.7858069000000000","TRBDOWN":"0.0023138425000000","BCH3L":"4.6390663064999996","GMT3S":"0.0000457771000000","KMD":"0.2493752500000000","BCH3S":"0.9634180500000000","ECOX":"0.0987506000000000","AAVE3S":"0.0560719500000000","GMT3L":"0.0053983694650000","EPIK":"0.0045857060000000","SUIP":"0.1067565950000000","AAVE3L":"0.3638687346200000","ZK":"0.1262368500000000","ZKF":"0.0008595700000000","OMNIA":"0.7624186000000000","ZKJ":"1.1124435000000000","ZKL":"0.1255372000000000","GAFI":"3.0634675000000001","CARV":"0.8703646000000000","KNC":"0.4433782000000000","CATS":"0.0000599700000000","PROM":"5.2833570000000006","ALEPH":"0.1756121500000000","PONKE":"0.3958020000000000","OVR":"0.1553223000000000","CATI":"0.4105146400000000","ORDER":"0.1183008200000000","GFT":"0.0166616650000000","BIFI":"0.0020489750000000","GGC":"6.9965029985000000","GGG":"0.0403798000000000","DAPPX":"0.0043788095000000","SUKU":"0.0618790450000000","ULTI":"0.0168015950000000","CREDI":"0.0192903500000000","ERTHA":"0.0010014990000000","FURY":"0.1405297000000000","KARRAT":"0.5577210000000000","MOBILE":"0.0009005495000000","SIDUS":"0.0037671155000000","NAVI":"0.1254672350000000","TAO":"583.4081500000051807","USDJ":"1.1386304000000001","MTL":"0.9563216000000000","VET":"0.0225387250000000","FITFI":"0.0036421780000000","USDT":"0.9995000000000000","OXT":"0.0695652000000000","CANDY":"0.0005597200000000","USDP":"0.9932031500000000","MTS":"0.0027516235000000","TADA":"0.0283858000000000","MTV":"0.0006559718500000","NAVX":"0.1342228550000000","ILV":"35.6771524999999671","VINU":"0.0000000109045450","GHX":"0.0903548000000000","EDU":"0.5167415000000000","HYVE":"0.0137331300000000","BTC3L":"0.0058620675000000","ANYONE":"0.9015490000000000","BEAT":"0.0012593700000000","KING":"0.0004821588000000","CREAM":"15.6541689999999973","CAS":"0.0038590695000000","IMX":"1.4944524000000000","CAT":"0.0000256981445000","BTC3S":"0.0014142925000000","USDE":"0.9985005000000000","USDD":"1.0000997000000000","CWAR":"0.0037981000000000","USDC":"0.9997998500000000","KRL":"0.3543127550000000","INJ":"21.7691100000000194","GAME":"0.0139630150000000","TRIBL":"1.0994500000000000","XLM":"0.0948525500000000","TRBUP":"0.0012293850000000","VRADOWN":"0.0013433280000000","SUPER":"1.2853570000000000","EIGEN":"3.1536223999999999","IOI":"0.0146926500000000","KSM":"17.5212350000000129","CCD":"0.0034832575000000","EGO":"0.0093553200000000","EGP":"2.7946019999999998","MXC":"0.0066866550000000","TEL":"0.0014432780000000","MOVR":"9.1340307000000027","XMR":"155.5421899999990755","MXM":"0.0092853550000000","OORT":"0.1099949750000000","GLM":"0.3231383500000000","RAY":"2.0228880499999998","XTAG":"0.0218190850000000","GLQ":"0.0854572500000000","CWEB":"0.0038480750000000","REVU":"0.0105047450000000","REVV":"0.0039760110000000","ZRO":"3.7952014499999994","XNL":"0.0093853050000000","XNO":"0.8496749500000000","SAROS":"0.0019290350000000","KACE":"2.1165411999999998","ZRX":"0.3186406000000000","WLTH":"0.0374312750000000","ATOM3L":"0.0321719060000000","GMM":"0.0001497251000000","BEER":"0.0000138670630000","GMT":"0.1275362000000000","HEART":"0.0159920000000000","GMX":"22.7186349999999882","ABBC":"0.0061769100000000","OMNI":"8.9235359999999970","ATOM3S":"0.0007945225400000","IRL":"0.0099650150000000","CFG":"0.3248375000000000","WSDM":"0.0139830050000000","GNS":"1.8390800000000001","VANRY":"0.0809295150000000","CFX":"0.1595202000000000","GRAIL":"817.1212349999937891","BEFI":"0.0175712100000000","VELO":"0.0132043945000000","XPR":"0.0008077959000000","DOVI":"0.0584707500000000","ACE":"0.0021349320000000","ACH":"0.0190534685000000","ISP":"0.0012161916000000","XCAD":"0.2834582000000000","MINA":"0.5630183500000000","TIA":"5.9318325999999999","DRIFT":"0.4350823500000000","ACQ":"0.0056981495000000","ACS":"0.0014917537500000","MIND":"0.0018920535000000","STORE":"0.0062358805000000","REN":"0.0351224300000000","ELA":"1.7282354500000000","DREAMS":"0.0002498750000000","ADA":"0.3463267500000000","ELF":"0.3777110500000000","REQ":"0.0959919800000000","STORJ":"0.5662167500000000","LADYS":"0.0000000837581000","PAXG":"2697.9303600003123340","REZ":"0.0409795000000000","XRD":"0.0157821050000000","CHO":"0.0205097400000000","CHR":"0.1769115000000000","ADS":"0.1889055000000000","CHZ":"0.0738030800000000","ADX":"0.1575212000000000","XRP":"0.5525036100000000","JASMY":"0.0188615645000000","KAGI":"0.1834582250000000","FIDA":"0.2282858000000000","PBR":"0.0291953950000000","AEG":"0.0093453250000000","H2O":"0.1610194500000000","CHMB":"0.0001715641750000","SAND3L":"0.0015447972150000","PBX":"0.0006879558500000","SOLVE":"0.0084557700000000","DECHAT":"0.1512243500000000","GARI":"0.0076861550000000","SHIB2L":"1.1996998499999999","SHIB2S":"0.0240879500000000","ENA":"0.3942028000000000","VEMP":"0.0029335325000000","ENJ":"0.1467266000000000","AFG":"0.0072163900000000","RATS":"0.0001211593900000","GRT":"0.1646076550000000","FORWARD":"0.0012873560000000","TFUEL":"0.0598800450000000","ENS":"17.0634640000000052","KASDOWN":"0.0258770550000000","XTM":"0.0251074400000000","DEGEN":"0.0084857550000000","TLM":"0.0100449750000000","DYDXDOWN":"0.1042598440000000","CKB":"0.0146026950000000","LUNC":"0.0000889255150000","AURORA":"0.1204397500000000","LUNA":"0.3624187000000000","XTZ":"0.6776610000000000","ELON":"0.0000001410294500","DMTR":"0.0891554000000000","EOS":"0.4759619000000000","GST":"0.0118940500000000","FORT":"0.1155422000000000","FLAME":"0.0247076400000000","PATEX":"0.9605195000000000","DEEP":"0.0328885475000000","ID3L":"0.0016201895000000","GTC":"0.6625685500000000","ID3S":"0.0071674145000000","RIO":"0.7616190000000000","CLH":"0.0008555720000000","BURGER":"0.4016990500000000","VRA":"0.0029765110000000","SUNDOG":"0.2173912500000000","GTT":"0.0002038980000000","INJUP":"0.2327835500000000","CPOOL":"0.1557720750000000","EPX":"0.0000740629500000","CLV":"0.0329835000000000","FEAR":"0.0560519600000000","MEME":"0.0124847545000000","ROOBEE":"0.0004520738500000","DEFI":"0.0192903500000000","TOKEN":"0.0477361200000000","GRAPE":"0.0020599695000000","KASUP":"0.3996001000000000","XWG":"0.0003843077500000","SKEY":"0.0621289200000000","SFUND":"1.3243375000000000","EQX":"0.0032823580000000","ORDIUP":"0.0548315705000000","TON":"5.1857058499999995","DEGO":"2.2667660500000001","IZI":"0.0088455750000000","ERG":"0.6605695500000000","ERN":"1.9255367500000001","VENOM":"0.0817591000000000","VOXEL":"0.1497251000000000","RLC":"1.4649671500000000","PHA":"0.1093453000000000","DYDXUP":"0.0112573685000000","APE3S":"0.0008475760000000","ORBS":"0.0288955450000000","OPDOWN":"0.6758619000000000","ESE":"0.0139130400000000","APE3L":"0.1339330000000000","HMND":"0.0982208650000000","COQ":"0.0000014432780000","AURY":"0.3340329000000000","CULT":"0.0000028025980000","AKT":"2.4642672500000001","GLMR":"0.1606196500000000","XYM":"0.0142528700000000","ORAI":"6.1769100000000012","XYO":"0.0058680645000000","ETC":"18.8458723500000169","LAI":"0.0142828550000000","PIP":"0.0178310800000000","ETH":"2607.6655149998362673","NEO":"10.3575186499999991","RMV":"0.0081659150000000","KLAY":"0.1251374000000000","PIT":"0.0000000003268365","TARA":"0.0043978000000000","KALT":"0.1128735350000000","PIX":"0.0001023687900000","ETN":"0.0021579205000000","CSIX":"0.0141729100000000","TRADE":"0.4708644500000000","MAVIA":"1.3592200500000001","HIGH":"1.3043474999999999","TRB":"62.5387150000000006","ORDI":"35.7421200000000126","TRVL":"0.0373643085000000","AMB":"0.0059670150000000","TRU":"0.0762018800000000","LOGX":"0.0271963950000000","FINC":"0.0362018900000000","INFRA":"0.1978010500000000","NATIX":"0.0008729633000000","NFP":"0.2152923000000000","TRY":"0.0292166033323590","TRX":"0.1597201000000000","LBP":"0.0001243378000000","LBR":"0.0595702000000000","EUL":"2.9735125000000000","NFT":"0.0000004077960000","SEIUP":"0.0478110825000000","PUFFER":"0.3676161000000000","EUR":"1.0811249323958897","ORCA":"2.0664662499999999","NEAR3L":"0.0117010765350000","AMP":"0.0038330825000000","XDEFI":"0.0472563600000000","HIFI":"0.4947525000000000","TRUF":"0.0459570100000000","AITECH":"0.1045477000000000","AMU":"0.0043978000000000","USTC":"0.0214692600000000","KNGL":"0.0499750000000000","FOXY":"0.0102686631000000","NGC":"0.0147935995000000","TENET":"0.0043278350000000","NEAR3S":"0.0072553705000000","MAHA":"1.1904045000000000","NGL":"0.0701748950000000","TST":"0.0080359800000000","HIPPO":"0.0104447750000000","AXS3S":"0.0308705570000000","CRO":"0.0781409100000000","ZPAY":"0.0050574700000000","MNDE":"0.1026786350000000","CRV":"0.2534732000000000","SWASH":"0.0056271850000000","AXS3L":"0.0106388779000000","VERSE":"0.0001803098000000","RPK":"0.0049975000000000","RPL":"10.9745099999999958","AZERO":"0.3789104500000000","SOUL":"0.0534332700000000","VXV":"0.2619689500000000","LDO":"1.0885554500000000","MAGIC":"0.3390304000000000","ALICE":"1.0324835000000000","SEAM":"1.1933030499999999","PLU":"1.9300345000000001","AOG":"0.0031224380000000","SMOLE":"0.0000387806000000","EWT":"1.1094450000000000","TSUGT":"0.0029185400000000","PMG":"0.0800599500000000","OPAI":"0.0006826585000000","LOCUS":"0.0216591650000000","CTA":"0.0825087250000000","NIM":"0.0013673160000000","CTC":"0.4033982000000000","APE":"0.7035480500000000","MERL":"0.2720639000000000","JAM":"0.0004770613500000","CTI":"0.0130314810000000","APP":"0.0021989000000000","APT":"9.9947001500000000","WLDUP":"0.0093043455000000","ZEND":"0.1280759300000000","FIRE":"0.9113441000000000","DENT":"0.0008630682500000","PYTH":"0.3390603850000000","LFT":"0.0155322300000000","DPET":"0.0319040400000000","ORDIDOWN":"0.3788105000000000","KPOL":"0.0029175405000000","ETHUP":"8.4971493000000032","BAND":"1.0939527500000001","POL":"0.3656171000000000","ASTR":"0.0582608550000000","NKN":"0.0691654000000000","RSR":"0.0068055955000000","DVPN":"0.0005979009000000","TWT":"1.1119437500000000","ARB":"0.5510243500000000","CVC":"0.1409801746501747","ARC":"0.0300849500000000","XETA":"0.0022888550000000","MTRG":"0.4007995000000000","LOKA":"0.1867066000000000","LPOOL":"0.0660069800000000","TURBOS":"0.0034812585000000","CVX":"1.7816087499999999","ARX":"0.0007556220000000","MPLX":"0.4355221300000000","SUSHI":"0.7011492500000000","NLK":"0.0114442750000000","PEPE2":"0.0000000313843000","WBTC":"66881.4425499645548419","SUI3L":"0.0211204345000000","CWS":"0.1927036000000000","SUI3S":"0.0000579110300000","INSP":"0.0264167850000000","MANA":"0.2945026750000000","VRTX":"0.0641679000000000","CSPR":"0.0116441750000000","ATA":"0.0785007300000000","OPEN":"0.0080049955000000","HAI":"0.0448275750000000","NMR":"14.7436245000000072","ATH":"0.0540929400000000","LIT":"0.6282857000000000","TLOS":"0.3263467450000000","TNSR":"0.3662168000000000","CXT":"0.0871364100000000","POLYX":"0.2346826000000000","ZERO":"0.0002507745500000","ROUTE":"0.0610694500000000","LOOM":"0.0580009850000000","PRE":"0.0078680640000000","VRAUP":"0.0134652640000000","HBB":"0.0714742450000000","RVN":"0.0165017450000000","PRQ":"0.0715741950000000","ONDO":"0.7134930750000000","PEPEDOWN":"0.0000155022450000","WOOP":"0.0020179905000000","LUNCUP":"0.0168355780000000","KAVA":"0.3522238000000000","LKI":"0.0104187880000000","AVA":"0.4857570000000000","NOM":"0.0233883000000000","MAPO":"0.0089015470000000","PEPEUP":"0.0114252845000000","STRAX":"0.0487156300000000","NOT":"0.0078670645000000","ZERC":"0.1108245600000000","BCUT":"0.0255672100000000","MASA":"0.0691354150000000","WAN":"0.1785077544737212","WAT":"0.0003273762300000","WAX":"0.0327636100000000","MASK":"2.2259864500000002","EOS3L":"0.0002122138400000","IDEA":"0.0005887055000000","EOS3S":"0.0034472755000000","YFI":"4919.4290549999908843","MOODENG":"0.0774612500000000","XCUR":"0.0048845565000000","HYDRA":"0.2225886500000000","POPCAT":"1.3382305500000000","LQTY":"0.7848074000000000","PIXEL":"0.1406596350000000","LMR":"0.0145437245000000","ZETA":"0.5997999500000000","YGG":"0.4717640000000000","AXS":"4.6006985000000006","BCHSV":"49.8250749999999370","NRN":"0.0395802000000000","FTON":"0.0091954000000000","COMP":"43.6581599999999881","XPRT":"0.1819090000000000","HFT":"0.1443278000000000","UXLINK":"0.5085456000000000","STAMP":"0.0335032400000000","RUNE":"4.9233370999999996","ZEUS":"0.2587705500000000","LTC3L":"1.8294848000000001","DAPP":"0.1763118000000000","FORTH":"2.9508238500000004","ALPINE":"1.5322335000000000","SENSO":"0.0328835500000000","LTC3S":"0.0006986505000000","DEXE":"8.3795081500000028","GOAL":"0.0175912000000000","AVAX":"27.5602130000000058","LISTA":"0.3782108000000000","AMPL":"1.3743124999999999","WORK":"0.1384307500000000","BRWL":"0.0017391300000000","BANANA":"57.1314200000001362","PUSH":"0.0750624500000000","WEN":"0.0001015492000000","NEIRO":"0.0879560000000000","BTCUP":"34.7711057499999789","SOL3S":"0.0007816090000000","BRAWL":"0.0004776610500000","LAY3R":"0.2161918500000000","LPT":"11.9304317999999945","GODS":"0.1807096000000000","SAND3S":"4.6152911999999992","RDNT":"0.0640679500000000","SOL3L":"1.8351913752850000","NIBI":"0.0653772950000000","NUM":"0.0436181800000000","PYR":"2.5590198499999997","DAG":"0.0226176855000000","DAI":"0.9989006596042375","HIP":"0.0034982500000000","DAO":"0.2848575000000000","AVAIL":"0.1300929210000000","DAR":"0.1512243500000000","FET":"1.3760116500000000","FCON":"0.0001197600900000","XAVA":"0.3789104500000000","LRC":"0.1208395500000000","UNI3S":"0.0000653573050000","PZP":"0.0599600050000000","POKT":"0.0424787500000000","DASH":"23.6881500000000109","BAKEDOWN":"0.0003324636850000","POLC":"0.0061389290000000","DBR":"0.0377671070000000","CIRUS":"0.0055772100000000","UNI3L":"0.0993921490650000","NWC":"0.0681659000000000","POLK":"0.0142628650000000","LSD":"0.9420287500000000","MARS4":"0.0005878059500000","LSK":"0.8080957500000000","BLOCK":"0.0261869000000000","ANALOS":"0.0000446776500000","SAFE":"0.8779608000000000","DCK":"0.0234082900000000","LSS":"0.0562718500000000","DCR":"12.4337799999999929","LIKE":"0.0559720000000000","DATA":"0.0361819000000000","WIF":"2.5696145499999999","BLOK":"0.0006546725000000","LTC":"71.6261690000000611","METIS":"42.0289750000000612","WIN":"0.0000868365600000","HLG":"0.0018790600000000","LTO":"0.1166116650000000","DYDX":"0.9341327000000000","ARB3S":"0.0509025360000000","MUBI":"0.0303848000000000","ARB3L":"0.0025917035000000","RBTC1":"0.0000039480250000","POND":"0.0118640650000000","LINA":"0.0037771105000000","MYRIA":"0.0025337325000000","LINK":"11.0244849999999944","QTUM":"2.4262016723130069","TUNE":"0.0148025950000000","UFO":"0.0000006479758500","CYBER":"2.8755615000000001","WILD":"0.2433782500000000","POLS":"0.2809594500000000","NYM":"0.0719640000000000","FIL":"3.6786597500000005","BAL":"2.0099945000000000","SCA":"0.3999999000000000","STND":"0.0133123405000000","WMTX":"0.2138930000000000","SCLP":"0.1545227000000000","MANEKI":"0.0073963000000000","BAT":"0.1721139000000000","AKRO":"0.0042302838000000","FTM3L":"8.2574692000000024","BAX":"0.0000709645000000","FTM3S":"0.0000255072400000","COTI":"0.0951524000000000"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFiatPriceResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getServiceStatus request test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + + test('getServiceStatus response test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + test('getServerTime request test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + }); + + test('getServerTime response test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + }); + test('getAllSymbols request test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v2/symbols + */ + let data = '{"market": "ALTS"}'; + let req = new GetAllSymbolsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getAllSymbols response test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v2/symbols + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "feeCurrency": "USDT",\n "market": "USDS",\n "baseMinSize": "0.00001",\n "quoteMinSize": "0.1",\n "baseMaxSize": "10000000000",\n "quoteMaxSize": "99999999",\n "baseIncrement": "0.00000001",\n "quoteIncrement": "0.000001",\n "priceIncrement": "0.1",\n "priceLimitRate": "0.1",\n "minFunds": "0.1",\n "isMarginEnabled": true,\n "enableTrading": true,\n "feeCategory": 1,\n "makerFeeCoefficient": "1.00",\n "takerFeeCoefficient": "1.00",\n "st": false\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetAllSymbolsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSymbol request test', () => { + /** + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetSymbolReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getSymbol response test', () => { + /** + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} + */ + let data = + '{"code":"200000","data":{"symbol":"BTC-USDT","name":"BTC-USDT","baseCurrency":"BTC","quoteCurrency":"USDT","feeCurrency":"USDT","market":"USDS","baseMinSize":"0.00001","quoteMinSize":"0.1","baseMaxSize":"10000000000","quoteMaxSize":"99999999","baseIncrement":"0.00000001","quoteIncrement":"0.000001","priceIncrement":"0.1","priceLimitRate":"0.1","minFunds":"0.1","isMarginEnabled":true,"enableTrading":true,"feeCategory":1,"makerFeeCoefficient":"1.00","takerFeeCoefficient":"1.00","st":false}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSymbolResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getAnnouncements request test', () => { + /** + * getAnnouncements + * Get Announcements + * /api/v3/announcements + */ + let data = + '{"currentPage": 1, "pageSize": 50, "annType": "latest-announcements", "lang": "en_US", "startTime": 1729594043000, "endTime": 1729697729000}'; + let req = new GetAnnouncementsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getAnnouncements response test', () => { + /** + * getAnnouncements + * Get Announcements + * /api/v3/announcements + */ + let data = + '{\n "code": "200000",\n "data": {\n "totalNum": 195,\n "totalPage": 13,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "annId": 129045,\n "annTitle": "KuCoin Isolated Margin Adds the Scroll (SCR) Trading Pair",\n "annType": [\n "latest-announcements"\n ],\n "annDesc": "To enrich the variety of assets available,\xa0KuCoin\u2019s Isolated Margin Trading platform has added the Scroll (SCR)\xa0asset and trading pair.",\n "cTime": 1729594043000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/kucoin-isolated-margin-adds-scr?lang=en_US"\n },\n {\n "annId": 129001,\n "annTitle": "DAPP-30D Fixed Promotion, Enjoy an APR of 200%!\u200b",\n "annType": [\n "latest-announcements",\n "activities"\n ],\n "annDesc": "KuCoin Earn will be launching the DAPP Fixed Promotion at 10:00:00 on October 22, 2024 (UTC). The available product is \u201cDAPP-30D\'\' with an APR of 200%.",\n "cTime": 1729588460000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/dapp-30d-fixed-promotion-enjoy?lang=en_US"\n },\n {\n "annId": 128581,\n "annTitle": "NAYM (NAYM) Gets Listed on KuCoin! World Premiere!",\n "annType": [\n "latest-announcements",\n "new-listings"\n ],\n "annDesc": "Trading:\xa011:00 on October 22, 2024 (UTC)",\n "cTime": 1729497729000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/en-naym-naym-gets-listed-on-kucoin-world-premiere?lang=en_US"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetAnnouncementsResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getCurrency request test', () => { + /** + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} + */ + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetCurrencyReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCurrency response test', () => { + /** + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} + */ + let data = + '{"code":"200000","data":{"currency":"BTC","name":"BTC","fullName":"Bitcoin","precision":8,"confirms":null,"contractAddress":null,"isMarginEnabled":true,"isDebitEnabled":true,"chains":[{"chainName":"BTC","withdrawalMinSize":"0.001","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":3,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"btc"},{"chainName":"Lightning Network","withdrawalMinSize":"0.00001","depositMinSize":"0.00001","withdrawFeeRate":"0","withdrawalMinFee":"0.000015","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":1,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":"0.03","needTag":false,"chainId":"btcln"},{"chainName":"KCC","withdrawalMinSize":"0.0008","depositMinSize":null,"withdrawFeeRate":"0","withdrawalMinFee":"0.00002","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":20,"preConfirms":20,"contractAddress":"0xfa93c12cd345c658bc4644d1d4e1b9615952258c","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"kcc"},{"chainName":"BTC-Segwit","withdrawalMinSize":"0.0008","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":false,"isDepositEnabled":true,"confirms":2,"preConfirms":2,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"bech32"}]}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCurrencyResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getAllCurrencies request test', () => { + /** + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies + */ + }); + + test('getAllCurrencies response test', () => { + /** + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies + */ + }); + test('getFullOrderBook request test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetFullOrderBookReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getFullOrderBook response test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 + */ + let data = + '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetFullOrderBookResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/spot/market/api_market.ts b/sdk/node/src/generate/spot/market/api_market.ts new file mode 100644 index 00000000..b23f270f --- /dev/null +++ b/sdk/node/src/generate/spot/market/api_market.ts @@ -0,0 +1,542 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetAnnouncementsResp } from './model_get_announcements_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { Get24hrStatsReq } from './model_get24hr_stats_req'; +import { GetAllSymbolsReq } from './model_get_all_symbols_req'; +import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetTickerReq } from './model_get_ticker_req'; +import { GetPrivateTokenResp } from './model_get_private_token_resp'; +import { GetFiatPriceResp } from './model_get_fiat_price_resp'; +import { GetPartOrderBookReq } from './model_get_part_order_book_req'; +import { GetSymbolReq } from './model_get_symbol_req'; +import { GetSymbolResp } from './model_get_symbol_resp'; +import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; +import { GetFullOrderBookReq } from './model_get_full_order_book_req'; +import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetMarketListResp } from './model_get_market_list_resp'; +import { GetCurrencyReq } from './model_get_currency_req'; +import { GetAllCurrenciesResp } from './model_get_all_currencies_resp'; +import { Get24hrStatsResp } from './model_get24hr_stats_resp'; +import { GetKlinesReq } from './model_get_klines_req'; +import { GetCurrencyResp } from './model_get_currency_resp'; +import { GetPartOrderBookResp } from './model_get_part_order_book_resp'; +import { GetFiatPriceReq } from './model_get_fiat_price_req'; +import { GetAllTickersResp } from './model_get_all_tickers_resp'; +import { GetServerTimeResp } from './model_get_server_time_resp'; +import { GetAnnouncementsReq } from './model_get_announcements_req'; +import { GetKlinesResp } from './model_get_klines_resp'; + +export interface MarketAPI { + /** + * getPrivateToken Get Private Token - Spot/Margin + * Description: This interface can obtain the token required for websocket to establish a Spot/Margin private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token + * Documentation: https://www.kucoin.com/docs-new/api-3470295 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getPrivateToken(): Promise; + + /** + * getPublicToken Get Public Token - Spot/Margin + * Description: This interface can obtain the token required for websocket to establish a Spot/Margin connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token + * Documentation: https://www.kucoin.com/docs-new/api-3470294 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 10 | + * +---------------------+--------+ + */ + getPublicToken(): Promise; + + /** + * getAllTickers Get All Tickers + * Description: Request market tickers for all the trading pairs in the market (including 24h volume), takes a snapshot every 2 seconds. On the rare occasion that we will change the currency name, if you still want the changed symbol name, you can use the symbolName field instead of the symbol field via “Get all tickers” endpoint. + * Documentation: https://www.kucoin.com/docs-new/api-3470167 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 15 | + * +---------------------+--------+ + */ + getAllTickers(): Promise; + + /** + * getKlines Get Klines + * Description: Get the Kline of the symbol. Data are returned in grouped buckets based on requested type. For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time. + * Documentation: https://www.kucoin.com/docs-new/api-3470163 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getKlines(req: GetKlinesReq): Promise; + + /** + * getTradeHistory Get Trade History + * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. + * Documentation: https://www.kucoin.com/docs-new/api-3470162 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getTradeHistory(req: GetTradeHistoryReq): Promise; + + /** + * getTicker Get Ticker + * Description: Request via this endpoint to get Level 1 Market Data. The returned value includes the best bid price and size, the best ask price and size as well as the last traded price and the last traded size. + * Documentation: https://www.kucoin.com/docs-new/api-3470160 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+--------+ + */ + getTicker(req: GetTickerReq): Promise; + + /** + * getPartOrderBook Get Part OrderBook + * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. + * Documentation: https://www.kucoin.com/docs-new/api-3470165 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+--------+ + */ + getPartOrderBook(req: GetPartOrderBookReq): Promise; + + /** + * get24hrStats Get 24hr Stats + * Description: Request via this endpoint to get the statistics of the specified ticker in the last 24 hours. + * Documentation: https://www.kucoin.com/docs-new/api-3470161 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 15 | + * +---------------------+--------+ + */ + get24hrStats(req: Get24hrStatsReq): Promise; + + /** + * getMarketList Get Market List + * Description: Request via this endpoint to get the transaction currency for the entire trading market. + * Documentation: https://www.kucoin.com/docs-new/api-3470166 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getMarketList(): Promise; + + /** + * getFiatPrice Get Fiat Price + * Description: Request via this endpoint to get the fiat price of the currencies for the available trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470153 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getFiatPrice(req: GetFiatPriceReq): Promise; + + /** + * getServiceStatus Get Service Status + * Description: Get the service status + * Documentation: https://www.kucoin.com/docs-new/api-3470158 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getServiceStatus(): Promise; + + /** + * getServerTime Get Server Time + * Description: Get the server time. + * Documentation: https://www.kucoin.com/docs-new/api-3470156 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getServerTime(): Promise; + + /** + * getAllSymbols Get All Symbols + * Description: Request via this endpoint to get a list of available currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. + * Documentation: https://www.kucoin.com/docs-new/api-3470154 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 4 | + * +---------------------+--------+ + */ + getAllSymbols(req: GetAllSymbolsReq): Promise; + + /** + * getSymbol Get Symbol + * Description: Request via this endpoint to get detail currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. + * Documentation: https://www.kucoin.com/docs-new/api-3470159 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 4 | + * +---------------------+--------+ + */ + getSymbol(req: GetSymbolReq): Promise; + + /** + * getAnnouncements Get Announcements + * Description: This interface can obtain the latest news announcements, and the default page search is for announcements within a month. + * Documentation: https://www.kucoin.com/docs-new/api-3470157 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 20 | + * +---------------------+--------+ + */ + getAnnouncements(req: GetAnnouncementsReq): Promise; + + /** + * getCurrency Get Currency + * Description: Request via this endpoint to get the currency details of a specified currency + * Documentation: https://www.kucoin.com/docs-new/api-3470155 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getCurrency(req: GetCurrencyReq): Promise; + + /** + * getAllCurrencies Get All Currencies + * Description: Request via this endpoint to get the currency list.Not all currencies currently can be used for trading. + * Documentation: https://www.kucoin.com/docs-new/api-3470152 + * +---------------------+--------+ + * | Extra API Info | Value | + * +---------------------+--------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | + * +---------------------+--------+ + */ + getAllCurrencies(): Promise; + + /** + * getFullOrderBook Get Full OrderBook + * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. + * Documentation: https://www.kucoin.com/docs-new/api-3470164 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getFullOrderBook(req: GetFullOrderBookReq): Promise; +} + +export class MarketAPIImpl implements MarketAPI { + constructor(private transport: Transport) {} + + getPrivateToken(): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/bullet-private', + null, + new GetPrivateTokenResp(), + false, + ); + } + + getPublicToken(): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/bullet-public', + null, + new GetPublicTokenResp(), + false, + ); + } + + getAllTickers(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/allTickers', + null, + new GetAllTickersResp(), + false, + ); + } + + getKlines(req: GetKlinesReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/candles', + req, + new GetKlinesResp(), + false, + ); + } + + getTradeHistory(req: GetTradeHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/histories', + req, + new GetTradeHistoryResp(), + false, + ); + } + + getTicker(req: GetTickerReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/orderbook/level1', + req, + new GetTickerResp(), + false, + ); + } + + getPartOrderBook(req: GetPartOrderBookReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/orderbook/level2_{size}', + req, + new GetPartOrderBookResp(), + false, + ); + } + + get24hrStats(req: Get24hrStatsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/market/stats', + req, + new Get24hrStatsResp(), + false, + ); + } + + getMarketList(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/markets', + null, + new GetMarketListResp(), + false, + ); + } + + getFiatPrice(req: GetFiatPriceReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/prices', + req, + new GetFiatPriceResp(), + false, + ); + } + + getServiceStatus(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/status', + null, + new GetServiceStatusResp(), + false, + ); + } + + getServerTime(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/timestamp', + null, + new GetServerTimeResp(), + false, + ); + } + + getAllSymbols(req: GetAllSymbolsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/symbols', + req, + new GetAllSymbolsResp(), + false, + ); + } + + getSymbol(req: GetSymbolReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v2/symbols/{symbol}', + req, + new GetSymbolResp(), + false, + ); + } + + getAnnouncements(req: GetAnnouncementsReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/announcements', + req, + new GetAnnouncementsResp(), + false, + ); + } + + getCurrency(req: GetCurrencyReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/currencies/{currency}', + req, + new GetCurrencyResp(), + false, + ); + } + + getAllCurrencies(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/currencies', + null, + new GetAllCurrenciesResp(), + false, + ); + } + + getFullOrderBook(req: GetFullOrderBookReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/market/orderbook/level2', + req, + new GetFullOrderBookResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts new file mode 100644 index 00000000..3e033cd4 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class Get24hrStatsReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `Get24hrStatsReq` class. + * The builder pattern allows step-by-step construction of a `Get24hrStatsReq` object. + */ + static builder(): Get24hrStatsReqBuilder { + return new Get24hrStatsReqBuilder(); + } + + /** + * Creates a new instance of the `Get24hrStatsReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): Get24hrStatsReq { + let obj = new Get24hrStatsReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): Get24hrStatsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(Get24hrStatsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): Get24hrStatsReq { + return plainToInstance(Get24hrStatsReq, jsonObject); + } +} + +export class Get24hrStatsReqBuilder { + obj: Get24hrStatsReq = new Get24hrStatsReq(); + /** + * symbol + */ + setSymbol(value: string): Get24hrStatsReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): Get24hrStatsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts new file mode 100644 index 00000000..6ab9a292 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts @@ -0,0 +1,93 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class Get24hrStatsResp implements Response { + /** + * timestamp + */ + time?: number; + /** + * Symbol + */ + symbol?: string; + /** + * Best bid price + */ + buy?: string; + /** + * Best ask price + */ + sell?: string; + /** + * 24h change rate + */ + changeRate?: string; + /** + * 24h change price + */ + changePrice?: string; + /** + * Highest price in 24h + */ + high?: string; + /** + * Lowest price in 24h + */ + low?: string; + /** + * 24h volume, executed based on base currency + */ + vol?: string; + /** + * 24h traded amount + */ + volValue?: string; + /** + * Last traded price + */ + last?: string; + /** + * Average trading price in the last 24 hours + */ + averagePrice?: string; + /** + * Basic Taker Fee + */ + takerFeeRate?: string; + /** + * Basic Maker Fee + */ + makerFeeRate?: string; + /** + * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + takerCoefficient?: string; + /** + * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + makerCoefficient?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): Get24hrStatsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(Get24hrStatsResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): Get24hrStatsResp { + return plainToInstance(Get24hrStatsResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts new file mode 100644 index 00000000..8a335bf7 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts @@ -0,0 +1,56 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetAllCurrenciesDataChains } from './model_get_all_currencies_data_chains'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllCurrenciesData implements Serializable { + /** + * A unique currency code that will never change + */ + currency?: string; + /** + * Currency name, will change after renaming + */ + name?: string; + /** + * Full name of a currency, will change after renaming + */ + fullName?: string; + /** + * Currency precision + */ + precision?: number; + /** + * Number of block confirmations + */ + confirms?: number; + /** + * Contract address + */ + contractAddress?: string; + /** + * Support margin or not + */ + isMarginEnabled?: boolean; + /** + * Support debit or not + */ + isDebitEnabled?: boolean; + /** + * chain list + */ + @Type(() => GetAllCurrenciesDataChains) + chains?: Array; + fromJson(input: string): GetAllCurrenciesData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllCurrenciesData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllCurrenciesData { + return plainToInstance(GetAllCurrenciesData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts new file mode 100644 index 00000000..6bfe3623 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllCurrenciesDataChains implements Serializable { + /** + * chain name of currency + */ + chainName?: string; + /** + * Minimum withdrawal amount + */ + withdrawalMinSize?: string; + /** + * Minimum deposit amount + */ + depositMinSize?: string; + /** + * withdraw fee rate + */ + withdrawFeeRate?: string; + /** + * Minimum fees charged for withdrawal + */ + withdrawalMinFee?: string; + /** + * Support withdrawal or not + */ + isWithdrawEnabled?: boolean; + /** + * Support deposit or not + */ + isDepositEnabled?: boolean; + /** + * Number of block confirmations + */ + confirms?: number; + /** + * The number of blocks (confirmations) for advance on-chain verification + */ + preConfirms?: number; + /** + * Contract address + */ + contractAddress?: string; + /** + * Withdrawal precision bit, indicating the maximum supported length after the decimal point of the withdrawal amount + */ + withdrawPrecision?: number; + /** + * Maximum amount of single withdrawal + */ + maxWithdraw?: string; + /** + * Maximum amount of single deposit (only applicable to Lightning Network) + */ + maxDeposit?: string; + /** + * whether memo/tag is needed + */ + needTag?: boolean; + /** + * chain id of currency + */ + chainId?: string; + /** + * deposit fee rate (some currencies have this param, the default is empty) + */ + depositFeeRate?: string; + /** + * withdraw max fee(some currencies have this param, the default is empty) + */ + withdrawMaxFee?: string; + /** + * + */ + depositTierFee?: string; + fromJson(input: string): GetAllCurrenciesDataChains { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllCurrenciesDataChains, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllCurrenciesDataChains { + return plainToInstance(GetAllCurrenciesDataChains, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts new file mode 100644 index 00000000..315fd290 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAllCurrenciesData } from './model_get_all_currencies_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAllCurrenciesResp implements Response { + /** + * + */ + @Type(() => GetAllCurrenciesData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAllCurrenciesResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllCurrenciesResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetAllCurrenciesResp { + return plainToInstance(GetAllCurrenciesResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts new file mode 100644 index 00000000..ad1cc6c1 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts @@ -0,0 +1,119 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllSymbolsData implements Serializable { + /** + * unique code of a symbol, it would not change after renaming + */ + symbol?: string; + /** + * Name of trading pairs, it would change after renaming + */ + name?: string; + /** + * Base currency,e.g. BTC. + */ + baseCurrency?: string; + /** + * Quote currency,e.g. USDT. + */ + quoteCurrency?: string; + /** + * The currency of charged fees. + */ + feeCurrency?: string; + /** + * The trading market. + */ + market?: string; + /** + * The minimum order quantity requried to place an order. + */ + baseMinSize?: string; + /** + * The minimum order funds required to place a market order. + */ + quoteMinSize?: string; + /** + * The maximum order size required to place an order. + */ + baseMaxSize?: string; + /** + * The maximum order funds required to place a market order. + */ + quoteMaxSize?: string; + /** + * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. + */ + baseIncrement?: string; + /** + * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. + */ + quoteIncrement?: string; + /** + * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. specifies the min order price as well as the price increment.This also applies to quote currency. + */ + priceIncrement?: string; + /** + * Threshold for price portection + */ + priceLimitRate?: string; + /** + * the minimum trading amounts + */ + minFunds?: string; + /** + * Available for margin or not. + */ + isMarginEnabled?: boolean; + /** + * Available for transaction or not. + */ + enableTrading?: boolean; + /** + * [Fee Type](https://www.kucoin.com/vip/privilege) + */ + feeCategory?: GetAllSymbolsData.FeeCategoryEnum; + /** + * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + makerFeeCoefficient?: string; + /** + * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + takerFeeCoefficient?: string; + /** + * Whether it is an [Special Treatment](https://www.kucoin.com/legal/special-treatment) symbol + */ + st?: boolean; + fromJson(input: string): GetAllSymbolsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllSymbolsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllSymbolsData { + return plainToInstance(GetAllSymbolsData, jsonObject); + } +} + +export namespace GetAllSymbolsData { + export enum FeeCategoryEnum { + /** + * classA + */ + CLASSA = 1, + /** + * classB + */ + CLASSB = 2, + /** + * classC + */ + CLASSC = 3, + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts new file mode 100644 index 00000000..10466c88 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllSymbolsReq implements Serializable { + /** + * [The trading market](https://www.kucoin.com/docs-new/api-222921786) + */ + market?: string; + + /** + * Creates a new instance of the `GetAllSymbolsReq` class. + * The builder pattern allows step-by-step construction of a `GetAllSymbolsReq` object. + */ + static builder(): GetAllSymbolsReqBuilder { + return new GetAllSymbolsReqBuilder(); + } + + /** + * Creates a new instance of the `GetAllSymbolsReq` class with the given data. + */ + static create(data: { + /** + * [The trading market](https://www.kucoin.com/docs-new/api-222921786) + */ + market?: string; + }): GetAllSymbolsReq { + let obj = new GetAllSymbolsReq(); + obj.market = data.market; + return obj; + } + + fromJson(input: string): GetAllSymbolsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllSymbolsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllSymbolsReq { + return plainToInstance(GetAllSymbolsReq, jsonObject); + } +} + +export class GetAllSymbolsReqBuilder { + obj: GetAllSymbolsReq = new GetAllSymbolsReq(); + /** + * [The trading market](https://www.kucoin.com/docs-new/api-222921786) + */ + setMarket(value: string): GetAllSymbolsReqBuilder { + this.obj.market = value; + return this; + } + + build(): GetAllSymbolsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts new file mode 100644 index 00000000..23aa741a --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetAllSymbolsData } from './model_get_all_symbols_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAllSymbolsResp implements Response { + /** + * + */ + @Type(() => GetAllSymbolsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAllSymbolsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllSymbolsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetAllSymbolsResp { + return plainToInstance(GetAllSymbolsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts new file mode 100644 index 00000000..08d18f59 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAllTickersTicker } from './model_get_all_tickers_ticker'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAllTickersResp implements Response { + /** + * timestamp + */ + time?: number; + /** + * + */ + @Type(() => GetAllTickersTicker) + ticker?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAllTickersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllTickersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllTickersResp { + return plainToInstance(GetAllTickersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts new file mode 100644 index 00000000..e50527ab --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts @@ -0,0 +1,113 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAllTickersTicker implements Serializable { + /** + * Symbol + */ + symbol?: string; + /** + * Name of trading pairs, it would change after renaming + */ + symbolName?: string; + /** + * Best bid price + */ + buy?: string; + /** + * Best bid size + */ + bestBidSize?: string; + /** + * Best ask price + */ + sell?: string; + /** + * Best ask size + */ + bestAskSize?: string; + /** + * 24h change rate + */ + changeRate?: string; + /** + * 24h change price + */ + changePrice?: string; + /** + * Highest price in 24h + */ + high?: string; + /** + * Lowest price in 24h + */ + low?: string; + /** + * 24h volume, executed based on base currency + */ + vol?: string; + /** + * 24h traded amount + */ + volValue?: string; + /** + * Last traded price + */ + last?: string; + /** + * Average trading price in the last 24 hours + */ + averagePrice?: string; + /** + * Basic Taker Fee + */ + takerFeeRate?: string; + /** + * Basic Maker Fee + */ + makerFeeRate?: string; + /** + * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + takerCoefficient?: GetAllTickersTicker.TakerCoefficientEnum; + /** + * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + makerCoefficient?: GetAllTickersTicker.MakerCoefficientEnum; + fromJson(input: string): GetAllTickersTicker { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAllTickersTicker, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAllTickersTicker { + return plainToInstance(GetAllTickersTicker, jsonObject); + } +} + +export namespace GetAllTickersTicker { + export enum TakerCoefficientEnum { + /** + * the taker fee coefficient is 1 + */ + _1 = '1', + /** + * no fee + */ + _0 = '0', + } + export enum MakerCoefficientEnum { + /** + * the maker fee coefficient is 1 + */ + _1 = '1', + /** + * no fee + */ + _0 = '0', + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts new file mode 100644 index 00000000..f8bbe2a4 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts @@ -0,0 +1,46 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAnnouncementsItems implements Serializable { + /** + * Announcement ID + */ + annId?: number; + /** + * Announcement title + */ + annTitle?: string; + /** + * Announcement type + */ + annType?: Array; + /** + * Announcement description + */ + annDesc?: string; + /** + * Announcement release time, Unix millisecond timestamp format + */ + cTime?: number; + /** + * language type + */ + language?: string; + /** + * Announcement link + */ + annUrl?: string; + fromJson(input: string): GetAnnouncementsItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAnnouncementsItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAnnouncementsItems { + return plainToInstance(GetAnnouncementsItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts new file mode 100644 index 00000000..652f04af --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts @@ -0,0 +1,277 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAnnouncementsReq implements Serializable { + /** + * page number + */ + currentPage?: number; + /** + * page Size + */ + pageSize?: number; + /** + * Announcement types: latest-announcements , activities (latest activities), new-listings (new currency online), product-updates (product updates), vip (institutions and VIPs), maintenance-updates (system maintenance), product -updates (product news), delistings (currency offline), others, api-campaigns (API user activities), default : latest-announcements + */ + annType?: GetAnnouncementsReq.AnnTypeEnum = + GetAnnouncementsReq.AnnTypeEnum.LATEST_ANNOUNCEMENTS; + /** + * Language type, the default is en_US, the specific value parameters are as follows + */ + lang?: GetAnnouncementsReq.LangEnum = GetAnnouncementsReq.LangEnum.EN_US; + /** + * Announcement online start time (milliseconds) + */ + startTime?: number; + /** + * Announcement online end time (milliseconds) + */ + endTime?: number; + + /** + * Creates a new instance of the `GetAnnouncementsReq` class. + * The builder pattern allows step-by-step construction of a `GetAnnouncementsReq` object. + */ + static builder(): GetAnnouncementsReqBuilder { + return new GetAnnouncementsReqBuilder(); + } + + /** + * Creates a new instance of the `GetAnnouncementsReq` class with the given data. + */ + static create(data: { + /** + * page number + */ + currentPage?: number; + /** + * page Size + */ + pageSize?: number; + /** + * Announcement types: latest-announcements , activities (latest activities), new-listings (new currency online), product-updates (product updates), vip (institutions and VIPs), maintenance-updates (system maintenance), product -updates (product news), delistings (currency offline), others, api-campaigns (API user activities), default : latest-announcements + */ + annType?: GetAnnouncementsReq.AnnTypeEnum; + /** + * Language type, the default is en_US, the specific value parameters are as follows + */ + lang?: GetAnnouncementsReq.LangEnum; + /** + * Announcement online start time (milliseconds) + */ + startTime?: number; + /** + * Announcement online end time (milliseconds) + */ + endTime?: number; + }): GetAnnouncementsReq { + let obj = new GetAnnouncementsReq(); + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + obj.annType = data.annType; + obj.lang = data.lang; + obj.startTime = data.startTime; + obj.endTime = data.endTime; + return obj; + } + + fromJson(input: string): GetAnnouncementsReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAnnouncementsReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAnnouncementsReq { + return plainToInstance(GetAnnouncementsReq, jsonObject); + } +} + +export namespace GetAnnouncementsReq { + export enum AnnTypeEnum { + /** + * latest-announcements + */ + LATEST_ANNOUNCEMENTS = 'latest-announcements', + /** + * latest activities + */ + ACTIVITIES = 'activities', + /** + * product updates + */ + PRODUCT_UPDATES = 'product-updates', + /** + * institutions and VIPs + */ + VIPS = 'vip', + /** + * system maintenance + */ + MAINTENANCE_UPDATE = 'maintenance-updates', + /** + * currency offline + */ + DELISTINGS = 'delistings', + /** + * others + */ + OTHERS = 'others', + /** + * API user activities + */ + API_CAMPAIGNS = 'api-campaigns', + /** + * new currency online + */ + NEW_LISTINGS = 'new-listings', + } + export enum LangEnum { + /** + * Chinese (Hong Kong) + */ + ZH_HK = 'zh_HK', + /** + * Japanese (Japan) + */ + JA_JP = 'ja_JP', + /** + * Korean (Korea) + */ + KO_KR = 'ko_KR', + /** + * English + */ + EN_US = 'en_US', + /** + * Polish (Poland) + */ + PL_PL = 'pl_PL', + /** + * Spanish (Spain) + */ + ES_ES = 'es_ES', + /** + * French (France) + */ + FR_FR = 'fr_FR', + /** + * Arabic (Egypt) + */ + AR_AE = 'ar_AE', + /** + * Italian (Italy) + */ + IT_IT = 'it_IT', + /** + * Indonesian (Indonesia) + */ + ID_ID = 'id_ID', + /** + * Dutch (Netherlands) + */ + NL_NL = 'nl_NL', + /** + * Portuguese (Brazil) + */ + PT_PT = 'pt_PT', + /** + * Vietnamese (Vietnam) + */ + VI_VN = 'vi_VN', + /** + * German (Germany) + */ + DE_DE = 'de_DE', + /** + * Turkish (Turkey) + */ + TR_TR = 'tr_TR', + /** + * Malay (Malaysia) + */ + MS_MY = 'ms_MY', + /** + * Russian (Russia) + */ + RU_RU = 'ru_RU', + /** + * Thai (Thailand) + */ + TH_TH = 'th_TH', + /** + * Hindi (India) + */ + HI_IN = 'hi_IN', + /** + * Bengali (Bangladesh) + */ + BN_BD = 'bn_BD', + /** + * Filipino (Philippines) + */ + FIL_PH = 'fil_PH', + /** + * Urdu (Pakistan) + */ + UR_PK = 'ur_PK', + } +} + +export class GetAnnouncementsReqBuilder { + obj: GetAnnouncementsReq = new GetAnnouncementsReq(); + /** + * page number + */ + setCurrentPage(value: number): GetAnnouncementsReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * page Size + */ + setPageSize(value: number): GetAnnouncementsReqBuilder { + this.obj.pageSize = value; + return this; + } + + /** + * Announcement types: latest-announcements , activities (latest activities), new-listings (new currency online), product-updates (product updates), vip (institutions and VIPs), maintenance-updates (system maintenance), product -updates (product news), delistings (currency offline), others, api-campaigns (API user activities), default : latest-announcements + */ + setAnnType(value: GetAnnouncementsReq.AnnTypeEnum): GetAnnouncementsReqBuilder { + this.obj.annType = value; + return this; + } + + /** + * Language type, the default is en_US, the specific value parameters are as follows + */ + setLang(value: GetAnnouncementsReq.LangEnum): GetAnnouncementsReqBuilder { + this.obj.lang = value; + return this; + } + + /** + * Announcement online start time (milliseconds) + */ + setStartTime(value: number): GetAnnouncementsReqBuilder { + this.obj.startTime = value; + return this; + } + + /** + * Announcement online end time (milliseconds) + */ + setEndTime(value: number): GetAnnouncementsReqBuilder { + this.obj.endTime = value; + return this; + } + + build(): GetAnnouncementsReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts new file mode 100644 index 00000000..bb92b2da --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAnnouncementsItems } from './model_get_announcements_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAnnouncementsResp implements Response { + /** + * Total Number + */ + totalNum?: number; + /** + * + */ + @Type(() => GetAnnouncementsItems) + items?: Array; + /** + * Current page + */ + currentPage?: number; + /** + * Page size + */ + pageSize?: number; + /** + * Total Page + */ + totalPage?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAnnouncementsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAnnouncementsResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAnnouncementsResp { + return plainToInstance(GetAnnouncementsResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_currency_chains.ts b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts new file mode 100644 index 00000000..8a9c5b63 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCurrencyChains implements Serializable { + /** + * chain name of currency + */ + chainName?: string; + /** + * Minimum withdrawal amount + */ + withdrawalMinSize?: string; + /** + * Minimum deposit amount + */ + depositMinSize?: string; + /** + * withdraw fee rate + */ + withdrawFeeRate?: string; + /** + * Minimum fees charged for withdrawal + */ + withdrawalMinFee?: string; + /** + * Support withdrawal or not + */ + isWithdrawEnabled?: boolean; + /** + * Support deposit or not + */ + isDepositEnabled?: boolean; + /** + * Number of block confirmations + */ + confirms?: number; + /** + * The number of blocks (confirmations) for advance on-chain verification + */ + preConfirms?: number; + /** + * Contract address + */ + contractAddress?: string; + /** + * Withdrawal precision bit, indicating the maximum supported length after the decimal point of the withdrawal amount + */ + withdrawPrecision?: number; + /** + * Maximum amount of single withdrawal + */ + maxWithdraw?: number; + /** + * Maximum amount of single deposit (only applicable to Lightning Network) + */ + maxDeposit?: string; + /** + * whether memo/tag is needed + */ + needTag?: boolean; + /** + * chain id of currency + */ + chainId?: string; + fromJson(input: string): GetCurrencyChains { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCurrencyChains, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCurrencyChains { + return plainToInstance(GetCurrencyChains, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_currency_req.ts b/sdk/node/src/generate/spot/market/model_get_currency_req.ts new file mode 100644 index 00000000..0d14e989 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_currency_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetCurrencyReq implements Serializable { + /** + * Path parameter, Currency + */ + @Reflect.metadata('path', 'currency') + currency?: string; + /** + * Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + + /** + * Creates a new instance of the `GetCurrencyReq` class. + * The builder pattern allows step-by-step construction of a `GetCurrencyReq` object. + */ + static builder(): GetCurrencyReqBuilder { + return new GetCurrencyReqBuilder(); + } + + /** + * Creates a new instance of the `GetCurrencyReq` class with the given data. + */ + static create(data: { + /** + * Path parameter, Currency + */ + currency?: string; + /** + * Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + chain?: string; + }): GetCurrencyReq { + let obj = new GetCurrencyReq(); + obj.currency = data.currency; + obj.chain = data.chain; + return obj; + } + + fromJson(input: string): GetCurrencyReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCurrencyReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCurrencyReq { + return plainToInstance(GetCurrencyReq, jsonObject); + } +} + +export class GetCurrencyReqBuilder { + obj: GetCurrencyReq = new GetCurrencyReq(); + /** + * Path parameter, Currency + */ + setCurrency(value: string): GetCurrencyReqBuilder { + this.obj.currency = value; + return this; + } + + /** + * Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. + */ + setChain(value: string): GetCurrencyReqBuilder { + this.obj.chain = value; + return this; + } + + build(): GetCurrencyReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts new file mode 100644 index 00000000..7b0764df --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts @@ -0,0 +1,67 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetCurrencyChains } from './model_get_currency_chains'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetCurrencyResp implements Response { + /** + * A unique currency code that will never change + */ + currency?: string; + /** + * Currency name, will change after renaming + */ + name?: string; + /** + * Full name of a currency, will change after renaming + */ + fullName?: string; + /** + * Currency precision + */ + precision?: number; + /** + * Number of block confirmations + */ + confirms?: number; + /** + * Contract address + */ + contractAddress?: string; + /** + * Support margin or not + */ + isMarginEnabled?: boolean; + /** + * Support debit or not + */ + isDebitEnabled?: boolean; + /** + * chain list + */ + @Type(() => GetCurrencyChains) + chains?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetCurrencyResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetCurrencyResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetCurrencyResp { + return plainToInstance(GetCurrencyResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts new file mode 100644 index 00000000..d87803cd --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFiatPriceReq implements Serializable { + /** + * Ticker symbol of a base currency,eg.USD,EUR. Default is USD + */ + base?: string = 'USD'; + /** + * Comma-separated cryptocurrencies to be converted into fiat, e.g.: BTC,ETH, etc. Default to return the fiat price of all currencies. + */ + currencies?: string; + + /** + * Creates a new instance of the `GetFiatPriceReq` class. + * The builder pattern allows step-by-step construction of a `GetFiatPriceReq` object. + */ + static builder(): GetFiatPriceReqBuilder { + return new GetFiatPriceReqBuilder(); + } + + /** + * Creates a new instance of the `GetFiatPriceReq` class with the given data. + */ + static create(data: { + /** + * Ticker symbol of a base currency,eg.USD,EUR. Default is USD + */ + base?: string; + /** + * Comma-separated cryptocurrencies to be converted into fiat, e.g.: BTC,ETH, etc. Default to return the fiat price of all currencies. + */ + currencies?: string; + }): GetFiatPriceReq { + let obj = new GetFiatPriceReq(); + obj.base = data.base; + obj.currencies = data.currencies; + return obj; + } + + fromJson(input: string): GetFiatPriceReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFiatPriceReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFiatPriceReq { + return plainToInstance(GetFiatPriceReq, jsonObject); + } +} + +export class GetFiatPriceReqBuilder { + obj: GetFiatPriceReq = new GetFiatPriceReq(); + /** + * Ticker symbol of a base currency,eg.USD,EUR. Default is USD + */ + setBase(value: string): GetFiatPriceReqBuilder { + this.obj.base = value; + return this; + } + + /** + * Comma-separated cryptocurrencies to be converted into fiat, e.g.: BTC,ETH, etc. Default to return the fiat price of all currencies. + */ + setCurrencies(value: string): GetFiatPriceReqBuilder { + this.obj.currencies = value; + return this; + } + + build(): GetFiatPriceReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts new file mode 100644 index 00000000..4c495cb4 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts @@ -0,0 +1,3615 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance, Expose } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFiatPriceResp implements Response { + /** + * + */ + AGLD?: string; + /** + * + */ + DFI?: string; + /** + * + */ + PYTHUP?: string; + /** + * + */ + ISLM?: string; + /** + * + */ + NEAR?: string; + /** + * + */ + AIOZ?: string; + /** + * + */ + AUDIO?: string; + /** + * + */ + BBL?: string; + /** + * + */ + WLD?: string; + /** + * + */ + HNT?: string; + /** + * + */ + ETHFI?: string; + /** + * + */ + DMAIL?: string; + /** + * + */ + OPUP?: string; + /** + * + */ + VET3S?: string; + /** + * + */ + MANA3S?: string; + /** + * + */ + TIDAL?: string; + /** + * + */ + HALO?: string; + /** + * + */ + OPUL?: string; + /** + * + */ + MANA3L?: string; + /** + * + */ + DGB?: string; + /** + * + */ + AA?: string; + /** + * + */ + BCH?: string; + /** + * + */ + GMEE?: string; + /** + * + */ + JST?: string; + /** + * + */ + PBUX?: string; + /** + * + */ + AR?: string; + /** + * + */ + SEI?: string; + /** + * + */ + PSTAKE?: string; + /** + * + */ + LMWR?: string; + /** + * + */ + UNFIDOWN?: string; + /** + * + */ + BB?: string; + /** + * + */ + JTO?: string; + /** + * + */ + WEMIX?: string; + /** + * + */ + G?: string; + /** + * + */ + MARSH?: string; + /** + * + */ + BN?: string; + /** + * + */ + FLIP?: string; + /** + * + */ + FLR?: string; + /** + * + */ + BIGTIME?: string; + /** + * + */ + FLY?: string; + /** + * + */ + T?: string; + /** + * + */ + W?: string; + /** + * + */ + BDX?: string; + /** + * + */ + BABYDOGE?: string; + /** + * + */ + SFP?: string; + /** + * + */ + DIA?: string; + /** + * + */ + ISME?: string; + /** + * + */ + LYM?: string; + /** + * + */ + VET3L?: string; + /** + * + */ + JUP?: string; + /** + * + */ + LYX?: string; + /** + * + */ + AIEPK?: string; + /** + * + */ + SILLY?: string; + /** + * + */ + SCPT?: string; + /** + * + */ + WOO?: string; + /** + * + */ + BLUR?: string; + /** + * + */ + STRK?: string; + /** + * + */ + BFC?: string; + /** + * + */ + DC?: string; + /** + * + */ + KARATE?: string; + /** + * + */ + SUSHI3L?: string; + /** + * + */ + NETVR?: string; + /** + * + */ + WAVES?: string; + /** + * + */ + LITH?: string; + /** + * + */ + HAPI?: string; + /** + * + */ + SUSHI3S?: string; + /** + * + */ + CEEK?: string; + /** + * + */ + FLOKI?: string; + /** + * + */ + SHR?: string; + /** + * + */ + SAND?: string; + /** + * + */ + TURT?: string; + /** + * + */ + UMA?: string; + /** + * + */ + BEPRO?: string; + /** + * + */ + SCRT?: string; + /** + * + */ + TUSD?: string; + /** + * + */ + COOKIE?: string; + /** + * + */ + LRDS?: string; + /** + * + */ + SIN?: string; + /** + * + */ + OAS?: string; + /** + * + */ + ROOT?: string; + /** + * + */ + ADA3L?: string; + /** + * + */ + TIAUP?: string; + /** + * + */ + HTR?: string; + /** + * + */ + UNB?: string; + /** + * + */ + UNA?: string; + /** + * + */ + HARD?: string; + /** + * + */ + G3?: string; + /** + * + */ + ADA3S?: string; + /** + * + */ + MYRO?: string; + /** + * + */ + HTX?: string; + /** + * + */ + FT?: string; + /** + * + */ + BTCDOWN?: string; + /** + * + */ + UNI?: string; + /** + * + */ + FX?: string; + /** + * + */ + OBI?: string; + /** + * + */ + UNO?: string; + /** + * + */ + WRX?: string; + /** + * + */ + TIADOWN?: string; + /** + * + */ + ETHDOWN?: string; + /** + * + */ + WELL?: string; + /** + * + */ + SWFTC?: string; + /** + * + */ + SKL?: string; + /** + * + */ + UOS?: string; + /** + * + */ + AIPAD?: string; + /** + * + */ + BRETT?: string; + /** + * + */ + SKY?: string; + /** + * + */ + FRM?: string; + /** + * + */ + VISION?: string; + /** + * + */ + LENDS?: string; + /** + * + */ + SLF?: string; + /** + * + */ + BULL?: string; + /** + * + */ + FLOW?: string; + /** + * + */ + ODDZ?: string; + /** + * + */ + SLN?: string; + /** + * + */ + UPO?: string; + /** + * + */ + SLP?: string; + /** + * + */ + ID?: string; + /** + * + */ + SLIM?: string; + /** + * + */ + SPOT?: string; + /** + * + */ + DOP?: string; + /** + * + */ + ISSP?: string; + /** + * + */ + UQC?: string; + /** + * + */ + IO?: string; + /** + * + */ + DOT?: string; + /** + * + */ + @Expose({ name: '1INCH' }) + _1INCH?: string; + /** + * + */ + SMH?: string; + /** + * + */ + MAK?: string; + /** + * + */ + TOKO?: string; + /** + * + */ + TURBO?: string; + /** + * + */ + UNFI?: string; + /** + * + */ + MAN?: string; + /** + * + */ + EVER?: string; + /** + * + */ + FTM?: string; + /** + * + */ + SHRAP?: string; + /** + * + */ + MAV?: string; + /** + * + */ + MAX?: string; + /** + * + */ + DPR?: string; + /** + * + */ + FTT?: string; + /** + * + */ + ARKM?: string; + /** + * + */ + ATOM?: string; + /** + * + */ + PENDLE?: string; + /** + * + */ + QUICK?: string; + /** + * + */ + BLZ?: string; + /** + * + */ + BOBA?: string; + /** + * + */ + MBL?: string; + /** + * + */ + OFN?: string; + /** + * + */ + UNIO?: string; + /** + * + */ + SNS?: string; + /** + * + */ + SNX?: string; + /** + * + */ + NXRA?: string; + /** + * + */ + TAIKO?: string; + /** + * + */ + AVAX3L?: string; + /** + * + */ + L3?: string; + /** + * + */ + API3?: string; + /** + * + */ + XRP3S?: string; + /** + * + */ + QKC?: string; + /** + * + */ + AVAX3S?: string; + /** + * + */ + ROSE?: string; + /** + * + */ + SATS?: string; + /** + * + */ + BMX?: string; + /** + * + */ + PORTAL?: string; + /** + * + */ + TOMI?: string; + /** + * + */ + XRP3L?: string; + /** + * + */ + SOL?: string; + /** + * + */ + SON?: string; + /** + * + */ + BNC?: string; + /** + * + */ + SOCIAL?: string; + /** + * + */ + CGPT?: string; + /** + * + */ + CELR?: string; + /** + * + */ + BNB?: string; + /** + * + */ + OGN?: string; + /** + * + */ + CELO?: string; + /** + * + */ + AUCTION?: string; + /** + * + */ + MANTA?: string; + /** + * + */ + LAYER?: string; + /** + * + */ + AERO?: string; + /** + * + */ + CETUS?: string; + /** + * + */ + LL?: string; + /** + * + */ + SPA?: string; + /** + * + */ + PYTHDOWN?: string; + /** + * + */ + NEIROCTO?: string; + /** + * + */ + UTK?: string; + /** + * + */ + GMRX?: string; + /** + * + */ + BOB?: string; + /** + * + */ + HOTCROSS?: string; + /** + * + */ + AERGO?: string; + /** + * + */ + MOCA?: string; + /** + * + */ + SQD?: string; + /** + * + */ + MV?: string; + /** + * + */ + BNB3L?: string; + /** + * + */ + BNB3S?: string; + /** + * + */ + GALAX3L?: string; + /** + * + */ + KAI?: string; + /** + * + */ + SQR?: string; + /** + * + */ + GALAX3S?: string; + /** + * + */ + EGLD?: string; + /** + * + */ + ZBCN?: string; + /** + * + */ + KAS?: string; + /** + * + */ + MEW?: string; + /** + * + */ + PUNDIX?: string; + /** + * + */ + LOOKS?: string; + /** + * + */ + FXS?: string; + /** + * + */ + BOSON?: string; + /** + * + */ + BRISE?: string; + /** + * + */ + AEVO?: string; + /** + * + */ + FLUX?: string; + /** + * + */ + PRCL?: string; + /** + * + */ + UNFIUP?: string; + /** + * + */ + SEIDOWN?: string; + /** + * + */ + DOAI?: string; + /** + * + */ + QNT?: string; + /** + * + */ + REDO?: string; + /** + * + */ + STRIKE?: string; + /** + * + */ + ETHW?: string; + /** + * + */ + OM?: string; + /** + * + */ + OP?: string; + /** + * + */ + WHALE?: string; + /** + * + */ + @Expose({ name: '1CAT' }) + _1CAT?: string; + /** + * + */ + NEON?: string; + /** + * + */ + GTAI?: string; + /** + * + */ + SSV?: string; + /** + * + */ + ETH2?: string; + /** + * + */ + KCS?: string; + /** + * + */ + ARPA?: string; + /** + * + */ + ARTFI?: string; + /** + * + */ + BRL?: string; + /** + * + */ + ALEX?: string; + /** + * + */ + STG?: string; + /** + * + */ + SHIB?: string; + /** + * + */ + IOTX?: string; + /** + * + */ + OLE?: string; + /** + * + */ + KDA?: string; + /** + * + */ + CERE?: string; + /** + * + */ + DOCK?: string; + /** + * + */ + STX?: string; + /** + * + */ + OLT?: string; + /** + * + */ + QI?: string; + /** + * + */ + SDAO?: string; + /** + * + */ + BLAST?: string; + /** + * + */ + LINK3S?: string; + /** + * + */ + IOST?: string; + /** + * + */ + SUI?: string; + /** + * + */ + CAKE?: string; + /** + * + */ + BSW?: string; + /** + * + */ + OMG?: string; + /** + * + */ + VOLT?: string; + /** + * + */ + LINK3L?: string; + /** + * + */ + GEEQ?: string; + /** + * + */ + PYUSD?: string; + /** + * + */ + SUN?: string; + /** + * + */ + TOWER?: string; + /** + * + */ + BTC?: string; + /** + * + */ + IOTA?: string; + /** + * + */ + REEF?: string; + /** + * + */ + TRIAS?: string; + /** + * + */ + KEY?: string; + /** + * + */ + ETH3L?: string; + /** + * + */ + BTT?: string; + /** + * + */ + ONE?: string; + /** + * + */ + RENDER?: string; + /** + * + */ + ETH3S?: string; + /** + * + */ + ANKR?: string; + /** + * + */ + ALGO?: string; + /** + * + */ + SYLO?: string; + /** + * + */ + ZCX?: string; + /** + * + */ + SD?: string; + /** + * + */ + ONT?: string; + /** + * + */ + MJT?: string; + /** + * + */ + DYM?: string; + /** + * + */ + DYP?: string; + /** + * + */ + BAKEUP?: string; + /** + * + */ + OOE?: string; + /** + * + */ + ZELIX?: string; + /** + * + */ + DOGE3L?: string; + /** + * + */ + ARTY?: string; + /** + * + */ + QORPO?: string; + /** + * + */ + ICE?: string; + /** + * + */ + NOTAI?: string; + /** + * + */ + DOGE3S?: string; + /** + * + */ + NAKA?: string; + /** + * + */ + GALAX?: string; + /** + * + */ + MKR?: string; + /** + * + */ + DODO?: string; + /** + * + */ + ICP?: string; + /** + * + */ + ZEC?: string; + /** + * + */ + ZEE?: string; + /** + * + */ + ICX?: string; + /** + * + */ + KMNO?: string; + /** + * + */ + TT?: string; + /** + * + */ + DOT3L?: string; + /** + * + */ + XAI?: string; + /** + * + */ + ZEN?: string; + /** + * + */ + DOGE?: string; + /** + * + */ + ALPHA?: string; + /** + * + */ + DUSK?: string; + /** + * + */ + DOT3S?: string; + /** + * + */ + SXP?: string; + /** + * + */ + HBAR?: string; + /** + * + */ + SYNT?: string; + /** + * + */ + ZEX?: string; + /** + * + */ + BONDLY?: string; + /** + * + */ + MLK?: string; + /** + * + */ + KICKS?: string; + /** + * + */ + PEPE?: string; + /** + * + */ + OUSD?: string; + /** + * + */ + LUNCDOWN?: string; + /** + * + */ + DOGS?: string; + /** + * + */ + REV3L?: string; + /** + * + */ + CTSI?: string; + /** + * + */ + C98?: string; + /** + * + */ + OSMO?: string; + /** + * + */ + NTRN?: string; + /** + * + */ + CFX2S?: string; + /** + * + */ + SYN?: string; + /** + * + */ + VIDT?: string; + /** + * + */ + SYS?: string; + /** + * + */ + GAS?: string; + /** + * + */ + BOME?: string; + /** + * + */ + COMBO?: string; + /** + * + */ + XCH?: string; + /** + * + */ + VR?: string; + /** + * + */ + CFX2L?: string; + /** + * + */ + VSYS?: string; + /** + * + */ + PANDORA?: string; + /** + * + */ + THETA?: string; + /** + * + */ + XCN?: string; + /** + * + */ + NEXG?: string; + /** + * + */ + MELOS?: string; + /** + * + */ + XCV?: string; + /** + * + */ + ORN?: string; + /** + * + */ + WLKN?: string; + /** + * + */ + AAVE?: string; + /** + * + */ + MNT?: string; + /** + * + */ + BONK?: string; + /** + * + */ + PERP?: string; + /** + * + */ + XDC?: string; + /** + * + */ + MNW?: string; + /** + * + */ + XDB?: string; + /** + * + */ + BOND?: string; + /** + * + */ + SUIA?: string; + /** + * + */ + MOG?: string; + /** + * + */ + SUTER?: string; + /** + * + */ + TIME?: string; + /** + * + */ + RACA?: string; + /** + * + */ + BICO?: string; + /** + * + */ + MON?: string; + /** + * + */ + SWEAT?: string; + /** + * + */ + MOXIE?: string; + /** + * + */ + BABYBNB?: string; + /** + * + */ + IGU?: string; + /** + * + */ + HMSTR?: string; + /** + * + */ + XEC?: string; + /** + * + */ + MONI?: string; + /** + * + */ + XR?: string; + /** + * + */ + PEOPLE?: string; + /** + * + */ + PUMLX?: string; + /** + * + */ + ZIL?: string; + /** + * + */ + WLDDOWN?: string; + /** + * + */ + VAI?: string; + /** + * + */ + XEN?: string; + /** + * + */ + MPC?: string; + /** + * + */ + XEM?: string; + /** + * + */ + JASMY3S?: string; + /** + * + */ + OTK?: string; + /** + * + */ + TRAC?: string; + /** + * + */ + DFYN?: string; + /** + * + */ + BIDP?: string; + /** + * + */ + JASMY3L?: string; + /** + * + */ + INJDOWN?: string; + /** + * + */ + KLV?: string; + /** + * + */ + WAXL?: string; + /** + * + */ + TRBDOWN?: string; + /** + * + */ + BCH3L?: string; + /** + * + */ + GMT3S?: string; + /** + * + */ + KMD?: string; + /** + * + */ + BCH3S?: string; + /** + * + */ + ECOX?: string; + /** + * + */ + AAVE3S?: string; + /** + * + */ + GMT3L?: string; + /** + * + */ + EPIK?: string; + /** + * + */ + SUIP?: string; + /** + * + */ + AAVE3L?: string; + /** + * + */ + ZK?: string; + /** + * + */ + ZKF?: string; + /** + * + */ + OMNIA?: string; + /** + * + */ + ZKJ?: string; + /** + * + */ + ZKL?: string; + /** + * + */ + GAFI?: string; + /** + * + */ + CARV?: string; + /** + * + */ + KNC?: string; + /** + * + */ + CATS?: string; + /** + * + */ + PROM?: string; + /** + * + */ + ALEPH?: string; + /** + * + */ + PONKE?: string; + /** + * + */ + OVR?: string; + /** + * + */ + CATI?: string; + /** + * + */ + ORDER?: string; + /** + * + */ + GFT?: string; + /** + * + */ + BIFI?: string; + /** + * + */ + GGC?: string; + /** + * + */ + GGG?: string; + /** + * + */ + DAPPX?: string; + /** + * + */ + SUKU?: string; + /** + * + */ + ULTI?: string; + /** + * + */ + CREDI?: string; + /** + * + */ + ERTHA?: string; + /** + * + */ + FURY?: string; + /** + * + */ + KARRAT?: string; + /** + * + */ + MOBILE?: string; + /** + * + */ + SIDUS?: string; + /** + * + */ + NAVI?: string; + /** + * + */ + TAO?: string; + /** + * + */ + USDJ?: string; + /** + * + */ + MTL?: string; + /** + * + */ + VET?: string; + /** + * + */ + FITFI?: string; + /** + * + */ + USDT?: string; + /** + * + */ + OXT?: string; + /** + * + */ + CANDY?: string; + /** + * + */ + USDP?: string; + /** + * + */ + MTS?: string; + /** + * + */ + TADA?: string; + /** + * + */ + MTV?: string; + /** + * + */ + NAVX?: string; + /** + * + */ + ILV?: string; + /** + * + */ + VINU?: string; + /** + * + */ + GHX?: string; + /** + * + */ + EDU?: string; + /** + * + */ + HYVE?: string; + /** + * + */ + BTC3L?: string; + /** + * + */ + ANYONE?: string; + /** + * + */ + BEAT?: string; + /** + * + */ + KING?: string; + /** + * + */ + CREAM?: string; + /** + * + */ + CAS?: string; + /** + * + */ + IMX?: string; + /** + * + */ + CAT?: string; + /** + * + */ + BTC3S?: string; + /** + * + */ + USDE?: string; + /** + * + */ + USDD?: string; + /** + * + */ + CWAR?: string; + /** + * + */ + USDC?: string; + /** + * + */ + KRL?: string; + /** + * + */ + INJ?: string; + /** + * + */ + GAME?: string; + /** + * + */ + TRIBL?: string; + /** + * + */ + XLM?: string; + /** + * + */ + TRBUP?: string; + /** + * + */ + VRADOWN?: string; + /** + * + */ + SUPER?: string; + /** + * + */ + EIGEN?: string; + /** + * + */ + IOI?: string; + /** + * + */ + KSM?: string; + /** + * + */ + CCD?: string; + /** + * + */ + EGO?: string; + /** + * + */ + EGP?: string; + /** + * + */ + MXC?: string; + /** + * + */ + TEL?: string; + /** + * + */ + MOVR?: string; + /** + * + */ + XMR?: string; + /** + * + */ + MXM?: string; + /** + * + */ + OORT?: string; + /** + * + */ + GLM?: string; + /** + * + */ + RAY?: string; + /** + * + */ + XTAG?: string; + /** + * + */ + GLQ?: string; + /** + * + */ + CWEB?: string; + /** + * + */ + REVU?: string; + /** + * + */ + REVV?: string; + /** + * + */ + ZRO?: string; + /** + * + */ + XNL?: string; + /** + * + */ + XNO?: string; + /** + * + */ + SAROS?: string; + /** + * + */ + KACE?: string; + /** + * + */ + ZRX?: string; + /** + * + */ + WLTH?: string; + /** + * + */ + ATOM3L?: string; + /** + * + */ + GMM?: string; + /** + * + */ + BEER?: string; + /** + * + */ + GMT?: string; + /** + * + */ + HEART?: string; + /** + * + */ + GMX?: string; + /** + * + */ + ABBC?: string; + /** + * + */ + OMNI?: string; + /** + * + */ + ATOM3S?: string; + /** + * + */ + IRL?: string; + /** + * + */ + CFG?: string; + /** + * + */ + WSDM?: string; + /** + * + */ + GNS?: string; + /** + * + */ + VANRY?: string; + /** + * + */ + CFX?: string; + /** + * + */ + GRAIL?: string; + /** + * + */ + BEFI?: string; + /** + * + */ + VELO?: string; + /** + * + */ + XPR?: string; + /** + * + */ + DOVI?: string; + /** + * + */ + ACE?: string; + /** + * + */ + ACH?: string; + /** + * + */ + ISP?: string; + /** + * + */ + XCAD?: string; + /** + * + */ + MINA?: string; + /** + * + */ + TIA?: string; + /** + * + */ + DRIFT?: string; + /** + * + */ + ACQ?: string; + /** + * + */ + ACS?: string; + /** + * + */ + MIND?: string; + /** + * + */ + STORE?: string; + /** + * + */ + REN?: string; + /** + * + */ + ELA?: string; + /** + * + */ + DREAMS?: string; + /** + * + */ + ADA?: string; + /** + * + */ + ELF?: string; + /** + * + */ + REQ?: string; + /** + * + */ + STORJ?: string; + /** + * + */ + LADYS?: string; + /** + * + */ + PAXG?: string; + /** + * + */ + REZ?: string; + /** + * + */ + XRD?: string; + /** + * + */ + CHO?: string; + /** + * + */ + CHR?: string; + /** + * + */ + ADS?: string; + /** + * + */ + CHZ?: string; + /** + * + */ + ADX?: string; + /** + * + */ + XRP?: string; + /** + * + */ + JASMY?: string; + /** + * + */ + KAGI?: string; + /** + * + */ + FIDA?: string; + /** + * + */ + PBR?: string; + /** + * + */ + AEG?: string; + /** + * + */ + H2O?: string; + /** + * + */ + CHMB?: string; + /** + * + */ + SAND3L?: string; + /** + * + */ + PBX?: string; + /** + * + */ + SOLVE?: string; + /** + * + */ + DECHAT?: string; + /** + * + */ + GARI?: string; + /** + * + */ + SHIB2L?: string; + /** + * + */ + SHIB2S?: string; + /** + * + */ + ENA?: string; + /** + * + */ + VEMP?: string; + /** + * + */ + ENJ?: string; + /** + * + */ + AFG?: string; + /** + * + */ + RATS?: string; + /** + * + */ + GRT?: string; + /** + * + */ + FORWARD?: string; + /** + * + */ + TFUEL?: string; + /** + * + */ + ENS?: string; + /** + * + */ + KASDOWN?: string; + /** + * + */ + XTM?: string; + /** + * + */ + DEGEN?: string; + /** + * + */ + TLM?: string; + /** + * + */ + DYDXDOWN?: string; + /** + * + */ + CKB?: string; + /** + * + */ + LUNC?: string; + /** + * + */ + AURORA?: string; + /** + * + */ + LUNA?: string; + /** + * + */ + XTZ?: string; + /** + * + */ + ELON?: string; + /** + * + */ + DMTR?: string; + /** + * + */ + EOS?: string; + /** + * + */ + GST?: string; + /** + * + */ + FORT?: string; + /** + * + */ + FLAME?: string; + /** + * + */ + PATEX?: string; + /** + * + */ + DEEP?: string; + /** + * + */ + ID3L?: string; + /** + * + */ + GTC?: string; + /** + * + */ + ID3S?: string; + /** + * + */ + RIO?: string; + /** + * + */ + CLH?: string; + /** + * + */ + BURGER?: string; + /** + * + */ + VRA?: string; + /** + * + */ + SUNDOG?: string; + /** + * + */ + GTT?: string; + /** + * + */ + INJUP?: string; + /** + * + */ + CPOOL?: string; + /** + * + */ + EPX?: string; + /** + * + */ + CLV?: string; + /** + * + */ + FEAR?: string; + /** + * + */ + MEME?: string; + /** + * + */ + ROOBEE?: string; + /** + * + */ + DEFI?: string; + /** + * + */ + TOKEN?: string; + /** + * + */ + GRAPE?: string; + /** + * + */ + KASUP?: string; + /** + * + */ + XWG?: string; + /** + * + */ + SKEY?: string; + /** + * + */ + SFUND?: string; + /** + * + */ + EQX?: string; + /** + * + */ + ORDIUP?: string; + /** + * + */ + TON?: string; + /** + * + */ + DEGO?: string; + /** + * + */ + IZI?: string; + /** + * + */ + ERG?: string; + /** + * + */ + ERN?: string; + /** + * + */ + VENOM?: string; + /** + * + */ + VOXEL?: string; + /** + * + */ + RLC?: string; + /** + * + */ + PHA?: string; + /** + * + */ + DYDXUP?: string; + /** + * + */ + APE3S?: string; + /** + * + */ + ORBS?: string; + /** + * + */ + OPDOWN?: string; + /** + * + */ + ESE?: string; + /** + * + */ + APE3L?: string; + /** + * + */ + HMND?: string; + /** + * + */ + COQ?: string; + /** + * + */ + AURY?: string; + /** + * + */ + CULT?: string; + /** + * + */ + AKT?: string; + /** + * + */ + GLMR?: string; + /** + * + */ + XYM?: string; + /** + * + */ + ORAI?: string; + /** + * + */ + XYO?: string; + /** + * + */ + ETC?: string; + /** + * + */ + LAI?: string; + /** + * + */ + PIP?: string; + /** + * + */ + ETH?: string; + /** + * + */ + NEO?: string; + /** + * + */ + RMV?: string; + /** + * + */ + KLAY?: string; + /** + * + */ + PIT?: string; + /** + * + */ + TARA?: string; + /** + * + */ + KALT?: string; + /** + * + */ + PIX?: string; + /** + * + */ + ETN?: string; + /** + * + */ + CSIX?: string; + /** + * + */ + TRADE?: string; + /** + * + */ + MAVIA?: string; + /** + * + */ + HIGH?: string; + /** + * + */ + TRB?: string; + /** + * + */ + ORDI?: string; + /** + * + */ + TRVL?: string; + /** + * + */ + AMB?: string; + /** + * + */ + TRU?: string; + /** + * + */ + LOGX?: string; + /** + * + */ + FINC?: string; + /** + * + */ + INFRA?: string; + /** + * + */ + NATIX?: string; + /** + * + */ + NFP?: string; + /** + * + */ + TRY?: string; + /** + * + */ + TRX?: string; + /** + * + */ + LBP?: string; + /** + * + */ + LBR?: string; + /** + * + */ + EUL?: string; + /** + * + */ + NFT?: string; + /** + * + */ + SEIUP?: string; + /** + * + */ + PUFFER?: string; + /** + * + */ + EUR?: string; + /** + * + */ + ORCA?: string; + /** + * + */ + NEAR3L?: string; + /** + * + */ + AMP?: string; + /** + * + */ + XDEFI?: string; + /** + * + */ + HIFI?: string; + /** + * + */ + TRUF?: string; + /** + * + */ + AITECH?: string; + /** + * + */ + AMU?: string; + /** + * + */ + USTC?: string; + /** + * + */ + KNGL?: string; + /** + * + */ + FOXY?: string; + /** + * + */ + NGC?: string; + /** + * + */ + TENET?: string; + /** + * + */ + NEAR3S?: string; + /** + * + */ + MAHA?: string; + /** + * + */ + NGL?: string; + /** + * + */ + TST?: string; + /** + * + */ + HIPPO?: string; + /** + * + */ + AXS3S?: string; + /** + * + */ + CRO?: string; + /** + * + */ + ZPAY?: string; + /** + * + */ + MNDE?: string; + /** + * + */ + CRV?: string; + /** + * + */ + SWASH?: string; + /** + * + */ + AXS3L?: string; + /** + * + */ + VERSE?: string; + /** + * + */ + RPK?: string; + /** + * + */ + RPL?: string; + /** + * + */ + AZERO?: string; + /** + * + */ + SOUL?: string; + /** + * + */ + VXV?: string; + /** + * + */ + LDO?: string; + /** + * + */ + MAGIC?: string; + /** + * + */ + ALICE?: string; + /** + * + */ + SEAM?: string; + /** + * + */ + PLU?: string; + /** + * + */ + AOG?: string; + /** + * + */ + SMOLE?: string; + /** + * + */ + EWT?: string; + /** + * + */ + TSUGT?: string; + /** + * + */ + PMG?: string; + /** + * + */ + OPAI?: string; + /** + * + */ + LOCUS?: string; + /** + * + */ + CTA?: string; + /** + * + */ + NIM?: string; + /** + * + */ + CTC?: string; + /** + * + */ + APE?: string; + /** + * + */ + MERL?: string; + /** + * + */ + JAM?: string; + /** + * + */ + CTI?: string; + /** + * + */ + APP?: string; + /** + * + */ + APT?: string; + /** + * + */ + WLDUP?: string; + /** + * + */ + ZEND?: string; + /** + * + */ + FIRE?: string; + /** + * + */ + DENT?: string; + /** + * + */ + PYTH?: string; + /** + * + */ + LFT?: string; + /** + * + */ + DPET?: string; + /** + * + */ + ORDIDOWN?: string; + /** + * + */ + KPOL?: string; + /** + * + */ + ETHUP?: string; + /** + * + */ + BAND?: string; + /** + * + */ + POL?: string; + /** + * + */ + ASTR?: string; + /** + * + */ + NKN?: string; + /** + * + */ + RSR?: string; + /** + * + */ + DVPN?: string; + /** + * + */ + TWT?: string; + /** + * + */ + ARB?: string; + /** + * + */ + CVC?: string; + /** + * + */ + ARC?: string; + /** + * + */ + XETA?: string; + /** + * + */ + MTRG?: string; + /** + * + */ + LOKA?: string; + /** + * + */ + LPOOL?: string; + /** + * + */ + TURBOS?: string; + /** + * + */ + CVX?: string; + /** + * + */ + ARX?: string; + /** + * + */ + MPLX?: string; + /** + * + */ + SUSHI?: string; + /** + * + */ + NLK?: string; + /** + * + */ + PEPE2?: string; + /** + * + */ + WBTC?: string; + /** + * + */ + SUI3L?: string; + /** + * + */ + CWS?: string; + /** + * + */ + SUI3S?: string; + /** + * + */ + INSP?: string; + /** + * + */ + MANA?: string; + /** + * + */ + VRTX?: string; + /** + * + */ + CSPR?: string; + /** + * + */ + ATA?: string; + /** + * + */ + OPEN?: string; + /** + * + */ + HAI?: string; + /** + * + */ + NMR?: string; + /** + * + */ + ATH?: string; + /** + * + */ + LIT?: string; + /** + * + */ + TLOS?: string; + /** + * + */ + TNSR?: string; + /** + * + */ + CXT?: string; + /** + * + */ + POLYX?: string; + /** + * + */ + ZERO?: string; + /** + * + */ + ROUTE?: string; + /** + * + */ + LOOM?: string; + /** + * + */ + PRE?: string; + /** + * + */ + VRAUP?: string; + /** + * + */ + HBB?: string; + /** + * + */ + RVN?: string; + /** + * + */ + PRQ?: string; + /** + * + */ + ONDO?: string; + /** + * + */ + PEPEDOWN?: string; + /** + * + */ + WOOP?: string; + /** + * + */ + LUNCUP?: string; + /** + * + */ + KAVA?: string; + /** + * + */ + LKI?: string; + /** + * + */ + AVA?: string; + /** + * + */ + NOM?: string; + /** + * + */ + MAPO?: string; + /** + * + */ + PEPEUP?: string; + /** + * + */ + STRAX?: string; + /** + * + */ + NOT?: string; + /** + * + */ + ZERC?: string; + /** + * + */ + BCUT?: string; + /** + * + */ + MASA?: string; + /** + * + */ + WAN?: string; + /** + * + */ + WAT?: string; + /** + * + */ + WAX?: string; + /** + * + */ + MASK?: string; + /** + * + */ + EOS3L?: string; + /** + * + */ + IDEA?: string; + /** + * + */ + EOS3S?: string; + /** + * + */ + YFI?: string; + /** + * + */ + MOODENG?: string; + /** + * + */ + XCUR?: string; + /** + * + */ + HYDRA?: string; + /** + * + */ + POPCAT?: string; + /** + * + */ + LQTY?: string; + /** + * + */ + PIXEL?: string; + /** + * + */ + LMR?: string; + /** + * + */ + ZETA?: string; + /** + * + */ + YGG?: string; + /** + * + */ + AXS?: string; + /** + * + */ + BCHSV?: string; + /** + * + */ + NRN?: string; + /** + * + */ + FTON?: string; + /** + * + */ + COMP?: string; + /** + * + */ + XPRT?: string; + /** + * + */ + HFT?: string; + /** + * + */ + UXLINK?: string; + /** + * + */ + STAMP?: string; + /** + * + */ + RUNE?: string; + /** + * + */ + ZEUS?: string; + /** + * + */ + LTC3L?: string; + /** + * + */ + DAPP?: string; + /** + * + */ + FORTH?: string; + /** + * + */ + ALPINE?: string; + /** + * + */ + SENSO?: string; + /** + * + */ + LTC3S?: string; + /** + * + */ + DEXE?: string; + /** + * + */ + GOAL?: string; + /** + * + */ + AVAX?: string; + /** + * + */ + LISTA?: string; + /** + * + */ + AMPL?: string; + /** + * + */ + WORK?: string; + /** + * + */ + BRWL?: string; + /** + * + */ + BANANA?: string; + /** + * + */ + PUSH?: string; + /** + * + */ + WEN?: string; + /** + * + */ + NEIRO?: string; + /** + * + */ + BTCUP?: string; + /** + * + */ + SOL3S?: string; + /** + * + */ + BRAWL?: string; + /** + * + */ + LAY3R?: string; + /** + * + */ + LPT?: string; + /** + * + */ + GODS?: string; + /** + * + */ + SAND3S?: string; + /** + * + */ + RDNT?: string; + /** + * + */ + SOL3L?: string; + /** + * + */ + NIBI?: string; + /** + * + */ + NUM?: string; + /** + * + */ + PYR?: string; + /** + * + */ + DAG?: string; + /** + * + */ + DAI?: string; + /** + * + */ + HIP?: string; + /** + * + */ + DAO?: string; + /** + * + */ + AVAIL?: string; + /** + * + */ + DAR?: string; + /** + * + */ + FET?: string; + /** + * + */ + FCON?: string; + /** + * + */ + XAVA?: string; + /** + * + */ + LRC?: string; + /** + * + */ + UNI3S?: string; + /** + * + */ + POKT?: string; + /** + * + */ + DASH?: string; + /** + * + */ + BAKEDOWN?: string; + /** + * + */ + POLC?: string; + /** + * + */ + CIRUS?: string; + /** + * + */ + UNI3L?: string; + /** + * + */ + NWC?: string; + /** + * + */ + POLK?: string; + /** + * + */ + LSD?: string; + /** + * + */ + MARS4?: string; + /** + * + */ + LSK?: string; + /** + * + */ + BLOCK?: string; + /** + * + */ + ANALOS?: string; + /** + * + */ + SAFE?: string; + /** + * + */ + DCK?: string; + /** + * + */ + LSS?: string; + /** + * + */ + DCR?: string; + /** + * + */ + LIKE?: string; + /** + * + */ + DATA?: string; + /** + * + */ + WIF?: string; + /** + * + */ + BLOK?: string; + /** + * + */ + LTC?: string; + /** + * + */ + METIS?: string; + /** + * + */ + WIN?: string; + /** + * + */ + HLG?: string; + /** + * + */ + LTO?: string; + /** + * + */ + DYDX?: string; + /** + * + */ + ARB3S?: string; + /** + * + */ + MUBI?: string; + /** + * + */ + ARB3L?: string; + /** + * + */ + RBTC1?: string; + /** + * + */ + POND?: string; + /** + * + */ + LINA?: string; + /** + * + */ + MYRIA?: string; + /** + * + */ + LINK?: string; + /** + * + */ + QTUM?: string; + /** + * + */ + TUNE?: string; + /** + * + */ + UFO?: string; + /** + * + */ + CYBER?: string; + /** + * + */ + WILD?: string; + /** + * + */ + POLS?: string; + /** + * + */ + NYM?: string; + /** + * + */ + FIL?: string; + /** + * + */ + BAL?: string; + /** + * + */ + SCA?: string; + /** + * + */ + STND?: string; + /** + * + */ + WMTX?: string; + /** + * + */ + SCLP?: string; + /** + * + */ + MANEKI?: string; + /** + * + */ + BAT?: string; + /** + * + */ + AKRO?: string; + /** + * + */ + FTM3L?: string; + /** + * + */ + BAX?: string; + /** + * + */ + FTM3S?: string; + /** + * + */ + COTI?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFiatPriceResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFiatPriceResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFiatPriceResp { + return plainToInstance(GetFiatPriceResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts new file mode 100644 index 00000000..3957e801 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetFullOrderBookReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `GetFullOrderBookReq` class. + * The builder pattern allows step-by-step construction of a `GetFullOrderBookReq` object. + */ + static builder(): GetFullOrderBookReqBuilder { + return new GetFullOrderBookReqBuilder(); + } + + /** + * Creates a new instance of the `GetFullOrderBookReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): GetFullOrderBookReq { + let obj = new GetFullOrderBookReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetFullOrderBookReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFullOrderBookReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFullOrderBookReq { + return plainToInstance(GetFullOrderBookReq, jsonObject); + } +} + +export class GetFullOrderBookReqBuilder { + obj: GetFullOrderBookReq = new GetFullOrderBookReq(); + /** + * symbol + */ + setSymbol(value: string): GetFullOrderBookReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetFullOrderBookReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts new file mode 100644 index 00000000..5faf70ae --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetFullOrderBookResp implements Response { + /** + * Timestamp(millisecond) + */ + time?: number; + /** + * Sequence number + */ + sequence?: string; + /** + * bids, from high to low + */ + bids?: Array>; + /** + * asks, from low to high + */ + asks?: Array>; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetFullOrderBookResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetFullOrderBookResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetFullOrderBookResp { + return plainToInstance(GetFullOrderBookResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_klines_req.ts b/sdk/node/src/generate/spot/market/model_get_klines_req.ts new file mode 100644 index 00000000..89e8f0f8 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_klines_req.ts @@ -0,0 +1,172 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetKlinesReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week, 1month + */ + type?: GetKlinesReq.TypeEnum; + /** + * Start time (second), default is 0 + */ + startAt?: number = 0; + /** + * End time (second), default is 0 + */ + endAt?: number = 0; + + /** + * Creates a new instance of the `GetKlinesReq` class. + * The builder pattern allows step-by-step construction of a `GetKlinesReq` object. + */ + static builder(): GetKlinesReqBuilder { + return new GetKlinesReqBuilder(); + } + + /** + * Creates a new instance of the `GetKlinesReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week, 1month + */ + type?: GetKlinesReq.TypeEnum; + /** + * Start time (second), default is 0 + */ + startAt?: number; + /** + * End time (second), default is 0 + */ + endAt?: number; + }): GetKlinesReq { + let obj = new GetKlinesReq(); + obj.symbol = data.symbol; + obj.type = data.type; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetKlinesReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKlinesReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetKlinesReq { + return plainToInstance(GetKlinesReq, jsonObject); + } +} + +export namespace GetKlinesReq { + export enum TypeEnum { + /** + * 1min + */ + _1MIN = '1min', + /** + * 3min + */ + _3MIN = '3min', + /** + * 5min + */ + _5MIN = '5min', + /** + * 15min + */ + _15MIN = '15min', + /** + * 30min + */ + _30MIN = '30min', + /** + * 1hour + */ + _1HOUR = '1hour', + /** + * 2hour + */ + _2HOUR = '2hour', + /** + * 4hour + */ + _4HOUR = '4hour', + /** + * 6hour + */ + _6HOUR = '6hour', + /** + * 8hour + */ + _8HOUR = '8hour', + /** + * 12hour + */ + _12HOUR = '12hour', + /** + * 1day + */ + _1DAY = '1day', + /** + * 1week + */ + _1WEEK = '1week', + /** + * 1month + */ + _1MONTH = '1month', + } +} + +export class GetKlinesReqBuilder { + obj: GetKlinesReq = new GetKlinesReq(); + /** + * symbol + */ + setSymbol(value: string): GetKlinesReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week, 1month + */ + setType(value: GetKlinesReq.TypeEnum): GetKlinesReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Start time (second), default is 0 + */ + setStartAt(value: number): GetKlinesReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (second), default is 0 + */ + setEndAt(value: number): GetKlinesReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetKlinesReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts new file mode 100644 index 00000000..9633279d --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetKlinesResp implements Response { + /** + * + */ + data?: Array>; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetKlinesResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetKlinesResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetKlinesResp { + return plainToInstance(GetKlinesResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts new file mode 100644 index 00000000..19fc9949 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetMarketListResp implements Response { + /** + * + */ + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMarketListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMarketListResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMarketListResp { + return plainToInstance(GetMarketListResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts new file mode 100644 index 00000000..7f47b0d3 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPartOrderBookReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Get the depth layer, optional value: 20, 100 + */ + @Reflect.metadata('path', 'size') + size?: string; + + /** + * Creates a new instance of the `GetPartOrderBookReq` class. + * The builder pattern allows step-by-step construction of a `GetPartOrderBookReq` object. + */ + static builder(): GetPartOrderBookReqBuilder { + return new GetPartOrderBookReqBuilder(); + } + + /** + * Creates a new instance of the `GetPartOrderBookReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Get the depth layer, optional value: 20, 100 + */ + size?: string; + }): GetPartOrderBookReq { + let obj = new GetPartOrderBookReq(); + obj.symbol = data.symbol; + obj.size = data.size; + return obj; + } + + fromJson(input: string): GetPartOrderBookReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPartOrderBookReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPartOrderBookReq { + return plainToInstance(GetPartOrderBookReq, jsonObject); + } +} + +export class GetPartOrderBookReqBuilder { + obj: GetPartOrderBookReq = new GetPartOrderBookReq(); + /** + * symbol + */ + setSymbol(value: string): GetPartOrderBookReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Get the depth layer, optional value: 20, 100 + */ + setSize(value: string): GetPartOrderBookReqBuilder { + this.obj.size = value; + return this; + } + + build(): GetPartOrderBookReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts new file mode 100644 index 00000000..2d295434 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPartOrderBookResp implements Response { + /** + * Timestamp(millisecond) + */ + time?: number; + /** + * Sequence number + */ + sequence?: string; + /** + * bids, from high to low + */ + bids?: Array>; + /** + * asks, from low to high + */ + asks?: Array>; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPartOrderBookResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPartOrderBookResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPartOrderBookResp { + return plainToInstance(GetPartOrderBookResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts new file mode 100644 index 00000000..40190529 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts @@ -0,0 +1,49 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPrivateTokenInstanceServers + implements Serializable +{ + /** + * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change + */ + endpoint?: string; + /** + * Whether to encrypt. Currently only supports wss, not ws + */ + encrypt?: boolean; + /** + * Network Protocol + */ + protocol?: GetPrivateTokenInstanceServers.ProtocolEnum; + /** + * Recommended ping interval(millisecond) + */ + pingInterval?: number; + /** + * Heartbeat timeout(millisecond) + */ + pingTimeout?: number; + fromJson(input: string): GetPrivateTokenInstanceServers { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { + return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + } +} + +export namespace GetPrivateTokenInstanceServers { + export enum ProtocolEnum { + /** + * websocket + */ + WEBSOCKET = 'websocket', + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts new file mode 100644 index 00000000..66c91797 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPrivateTokenResp implements Response { + /** + * The token required to establish a websocket connection + */ + token?: string; + /** + * + */ + @Type(() => GetPrivateTokenInstanceServers) + instanceServers?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPrivateTokenResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPrivateTokenResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPrivateTokenResp { + return plainToInstance(GetPrivateTokenResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts new file mode 100644 index 00000000..c8671c1c --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts @@ -0,0 +1,47 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetPublicTokenInstanceServers implements Serializable { + /** + * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change + */ + endpoint?: string; + /** + * Whether to encrypt. Currently only supports wss, not ws + */ + encrypt?: boolean; + /** + * Network Protocol + */ + protocol?: GetPublicTokenInstanceServers.ProtocolEnum; + /** + * Recommended ping interval(millisecond) + */ + pingInterval?: number; + /** + * Heartbeat timeout(millisecond) + */ + pingTimeout?: number; + fromJson(input: string): GetPublicTokenInstanceServers { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicTokenInstanceServers { + return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + } +} + +export namespace GetPublicTokenInstanceServers { + export enum ProtocolEnum { + /** + * websocket + */ + WEBSOCKET = 'websocket', + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts new file mode 100644 index 00000000..557b3e34 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetPublicTokenResp implements Response { + /** + * The token required to establish a websocket connection + */ + token?: string; + /** + * + */ + @Type(() => GetPublicTokenInstanceServers) + instanceServers?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetPublicTokenResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetPublicTokenResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetPublicTokenResp { + return plainToInstance(GetPublicTokenResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts new file mode 100644 index 00000000..65ad2ca0 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetServerTimeResp implements Response { + /** + * ServerTime(millisecond) + */ + data?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetServerTimeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetServerTimeResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetServerTimeResp { + return plainToInstance(GetServerTimeResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts new file mode 100644 index 00000000..7fbe3eb1 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts @@ -0,0 +1,54 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetServiceStatusResp implements Response { + /** + * Status of service: open:normal transaction, close:Stop Trading/Maintenance, cancelonly:can only cancel the order but not place order + */ + status?: GetServiceStatusResp.StatusEnum; + /** + * Remark for operation + */ + msg?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetServiceStatusResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetServiceStatusResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetServiceStatusResp { + return plainToInstance(GetServiceStatusResp, jsonObject); + } +} + +export namespace GetServiceStatusResp { + export enum StatusEnum { + /** + * normal transaction + */ + OPEN = 'open', + /** + * Stop Trading/Maintenance + */ + CLOSE = 'close', + /** + * can only cancel the order but not place order + */ + CANCELONLY = 'cancelonly', + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_req.ts b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts new file mode 100644 index 00000000..2c6ca179 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetSymbolReq implements Serializable { + /** + * Path parameter, Symbol + */ + @Reflect.metadata('path', 'symbol') + symbol?: string; + + /** + * Creates a new instance of the `GetSymbolReq` class. + * The builder pattern allows step-by-step construction of a `GetSymbolReq` object. + */ + static builder(): GetSymbolReqBuilder { + return new GetSymbolReqBuilder(); + } + + /** + * Creates a new instance of the `GetSymbolReq` class with the given data. + */ + static create(data: { + /** + * Path parameter, Symbol + */ + symbol?: string; + }): GetSymbolReq { + let obj = new GetSymbolReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetSymbolReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolReq { + return plainToInstance(GetSymbolReq, jsonObject); + } +} + +export class GetSymbolReqBuilder { + obj: GetSymbolReq = new GetSymbolReq(); + /** + * Path parameter, Symbol + */ + setSymbol(value: string): GetSymbolReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetSymbolReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts new file mode 100644 index 00000000..00625a48 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts @@ -0,0 +1,130 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSymbolResp implements Response { + /** + * unique code of a symbol, it would not change after renaming + */ + symbol?: string; + /** + * Name of trading pairs, it would change after renaming + */ + name?: string; + /** + * Base currency,e.g. BTC. + */ + baseCurrency?: string; + /** + * Quote currency,e.g. USDT. + */ + quoteCurrency?: string; + /** + * The currency of charged fees. + */ + feeCurrency?: string; + /** + * The trading market. + */ + market?: string; + /** + * The minimum order quantity requried to place an order. + */ + baseMinSize?: string; + /** + * The minimum order funds required to place a market order. + */ + quoteMinSize?: string; + /** + * The maximum order size required to place an order. + */ + baseMaxSize?: string; + /** + * The maximum order funds required to place a market order. + */ + quoteMaxSize?: string; + /** + * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. + */ + baseIncrement?: string; + /** + * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. + */ + quoteIncrement?: string; + /** + * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. + */ + priceIncrement?: string; + /** + * Threshold for price portection + */ + priceLimitRate?: string; + /** + * the minimum trading amounts + */ + minFunds?: string; + /** + * Available for margin or not. + */ + isMarginEnabled?: boolean; + /** + * Available for transaction or not. + */ + enableTrading?: boolean; + /** + * [Fee Type](https://www.kucoin.com/vip/privilege) + */ + feeCategory?: GetSymbolResp.FeeCategoryEnum; + /** + * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + makerFeeCoefficient?: string; + /** + * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee + */ + takerFeeCoefficient?: string; + /** + * + */ + st?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSymbolResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolResp { + return plainToInstance(GetSymbolResp, jsonObject); + } +} + +export namespace GetSymbolResp { + export enum FeeCategoryEnum { + /** + * classA + */ + CLASSA = 1, + /** + * classB + */ + CLASSB = 2, + /** + * classC + */ + CLASSC = 3, + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts new file mode 100644 index 00000000..f0117b08 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTickerReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `GetTickerReq` class. + * The builder pattern allows step-by-step construction of a `GetTickerReq` object. + */ + static builder(): GetTickerReqBuilder { + return new GetTickerReqBuilder(); + } + + /** + * Creates a new instance of the `GetTickerReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): GetTickerReq { + let obj = new GetTickerReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetTickerReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTickerReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTickerReq { + return plainToInstance(GetTickerReq, jsonObject); + } +} + +export class GetTickerReqBuilder { + obj: GetTickerReq = new GetTickerReq(); + /** + * symbol + */ + setSymbol(value: string): GetTickerReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetTickerReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts new file mode 100644 index 00000000..63d5ab83 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTickerResp implements Response { + /** + * timestamp + */ + time?: number; + /** + * Sequence + */ + sequence?: string; + /** + * Last traded price + */ + price?: string; + /** + * Last traded size + */ + size?: string; + /** + * Best bid price + */ + bestBid?: string; + /** + * Best bid size + */ + bestBidSize?: string; + /** + * Best ask price + */ + bestAsk?: string; + /** + * Best ask size + */ + bestAskSize?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTickerResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTickerResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTickerResp { + return plainToInstance(GetTickerResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts new file mode 100644 index 00000000..66632449 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryData implements Serializable { + /** + * Sequence number + */ + sequence?: string; + /** + * Filled price + */ + price?: string; + /** + * Filled amount + */ + size?: string; + /** + * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. + */ + side?: GetTradeHistoryData.SideEnum; + /** + * Filled timestamp(nanosecond) + */ + time?: number; + fromJson(input: string): GetTradeHistoryData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryData { + return plainToInstance(GetTradeHistoryData, jsonObject); + } +} + +export namespace GetTradeHistoryData { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts new file mode 100644 index 00000000..0be60980 --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `GetTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. + */ + static builder(): GetTradeHistoryReqBuilder { + return new GetTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): GetTradeHistoryReq { + let obj = new GetTradeHistoryReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToInstance(GetTradeHistoryReq, jsonObject); + } +} + +export class GetTradeHistoryReqBuilder { + obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + /** + * symbol + */ + setSymbol(value: string): GetTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts new file mode 100644 index 00000000..2e10640a --- /dev/null +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetTradeHistoryData } from './model_get_trade_history_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryResp implements Response { + /** + * + */ + @Type(() => GetTradeHistoryData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetTradeHistoryResp { + return plainToInstance(GetTradeHistoryResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/api_order.template b/sdk/node/src/generate/spot/order/api_order.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/spot/order/api_order.test.ts b/sdk/node/src/generate/spot/order/api_order.test.ts new file mode 100644 index 00000000..cf29ccd2 --- /dev/null +++ b/sdk/node/src/generate/spot/order/api_order.test.ts @@ -0,0 +1,1554 @@ +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetTradeHistoryOldReq } from './model_get_trade_history_old_req'; +import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; +import { CancelOrderByOrderIdSyncResp } from './model_cancel_order_by_order_id_sync_resp'; +import { CancelStopOrderByOrderIdResp } from './model_cancel_stop_order_by_order_id_resp'; +import { CancelStopOrderByClientOidResp } from './model_cancel_stop_order_by_client_oid_resp'; +import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; +import { GetOrderByClientOidOldResp } from './model_get_order_by_client_oid_old_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { SetDCPResp } from './model_set_dcp_resp'; +import { BatchCancelOrderOldResp } from './model_batch_cancel_order_old_resp'; +import { BatchCancelOrderOldReq } from './model_batch_cancel_order_old_req'; +import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; +import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; +import { GetOrdersListOldResp } from './model_get_orders_list_old_resp'; +import { GetClosedOrdersReq } from './model_get_closed_orders_req'; +import { GetRecentTradeHistoryOldResp } from './model_get_recent_trade_history_old_resp'; +import { CancelStopOrderByOrderIdReq } from './model_cancel_stop_order_by_order_id_req'; +import { AddOrderOldReq } from './model_add_order_old_req'; +import { AddStopOrderReq } from './model_add_stop_order_req'; +import { GetStopOrderByClientOidResp } from './model_get_stop_order_by_client_oid_resp'; +import { GetRecentOrdersListOldResp } from './model_get_recent_orders_list_old_resp'; +import { CancelOcoOrderByClientOidReq } from './model_cancel_oco_order_by_client_oid_req'; +import { ModifyOrderReq } from './model_modify_order_req'; +import { CancelOrderByClientOidOldResp } from './model_cancel_order_by_client_oid_old_resp'; +import { AddStopOrderResp } from './model_add_stop_order_resp'; +import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; +import { GetStopOrderByClientOidReq } from './model_get_stop_order_by_client_oid_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; +import { GetTradeHistoryOldResp } from './model_get_trade_history_old_resp'; +import { CancelOrderByOrderIdOldReq } from './model_cancel_order_by_order_id_old_req'; +import { CancelOrderByOrderIdSyncReq } from './model_cancel_order_by_order_id_sync_req'; +import { BatchAddOrdersSyncReq } from './model_batch_add_orders_sync_req'; +import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; +import { GetOrdersListOldReq } from './model_get_orders_list_old_req'; +import { GetOcoOrderByClientOidReq } from './model_get_oco_order_by_client_oid_req'; +import { CancelPartialOrderReq } from './model_cancel_partial_order_req'; +import { BatchAddOrdersSyncResp } from './model_batch_add_orders_sync_resp'; +import { BatchAddOrdersOldResp } from './model_batch_add_orders_old_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetOcoOrderListReq } from './model_get_oco_order_list_req'; +import { GetOcoOrderByClientOidResp } from './model_get_oco_order_by_client_oid_resp'; +import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; +import { AddOrderTestOldReq } from './model_add_order_test_old_req'; +import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; +import { AddOcoOrderResp } from './model_add_oco_order_resp'; +import { CancelOrderByClientOidSyncReq } from './model_cancel_order_by_client_oid_sync_req'; +import { GetOrderByOrderIdOldReq } from './model_get_order_by_order_id_old_req'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { ModifyOrderResp } from './model_modify_order_resp'; +import { SetDCPReq } from './model_set_dcp_req'; +import { CancelOcoOrderByOrderIdReq } from './model_cancel_oco_order_by_order_id_req'; +import { CancelOrderByOrderIdOldResp } from './model_cancel_order_by_order_id_old_resp'; +import { CancelAllOrdersResp } from './model_cancel_all_orders_resp'; +import { CancelOrderByClientOidSyncResp } from './model_cancel_order_by_client_oid_sync_resp'; +import { CancelOcoOrderByOrderIdResp } from './model_cancel_oco_order_by_order_id_resp'; +import { GetOpenOrdersResp } from './model_get_open_orders_resp'; +import { AddOcoOrderReq } from './model_add_oco_order_req'; +import { GetStopOrderByOrderIdResp } from './model_get_stop_order_by_order_id_resp'; +import { CancelOrderByOrderIdReq } from './model_cancel_order_by_order_id_req'; +import { GetStopOrderByOrderIdReq } from './model_get_stop_order_by_order_id_req'; +import { GetOcoOrderByOrderIdReq } from './model_get_oco_order_by_order_id_req'; +import { GetOcoOrderDetailByOrderIdReq } from './model_get_oco_order_detail_by_order_id_req'; +import { GetDCPResp } from './model_get_dcp_resp'; +import { CancelPartialOrderResp } from './model_cancel_partial_order_resp'; +import { CancelAllOrdersBySymbolResp } from './model_cancel_all_orders_by_symbol_resp'; +import { GetOcoOrderListResp } from './model_get_oco_order_list_resp'; +import { AddOrderSyncResp } from './model_add_order_sync_resp'; +import { BatchAddOrdersOldReq } from './model_batch_add_orders_old_req'; +import { GetOpenOrdersReq } from './model_get_open_orders_req'; +import { GetStopOrdersListReq } from './model_get_stop_orders_list_req'; +import { GetRecentTradeHistoryOldReq } from './model_get_recent_trade_history_old_req'; +import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; +import { AddOrderOldResp } from './model_add_order_old_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetOrderByOrderIdOldResp } from './model_get_order_by_order_id_old_resp'; +import { BatchCancelOcoOrdersResp } from './model_batch_cancel_oco_orders_resp'; +import { GetOcoOrderByOrderIdResp } from './model_get_oco_order_by_order_id_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByClientOidOldReq } from './model_cancel_order_by_client_oid_old_req'; +import { CancelOcoOrderByClientOidResp } from './model_cancel_oco_order_by_client_oid_resp'; +import { GetRecentOrdersListOldReq } from './model_get_recent_orders_list_old_req'; +import { AddOrderResp } from './model_add_order_resp'; +import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; +import { BatchAddOrdersReq } from './model_batch_add_orders_req'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { CancelStopOrderByClientOidReq } from './model_cancel_stop_order_by_client_oid_req'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { AddOrderSyncReq } from './model_add_order_sync_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getTradeHistoryOld request test', () => { + /** + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills + */ + let data = + '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetTradeHistoryOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistoryOld response test', () => { + /** + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "symbol": "DOGE-USDT",\n "tradeId": "10862827223795713",\n "orderId": "6745698ef4f1200007c561a8",\n "counterOrderId": "6745695ef15b270007ac5076",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "0.40739",\n "size": "10",\n "funds": "4.0739",\n "fee": "0.0040739",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "market",\n "createdAt": 1732602254928\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills + */ + let data = + '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetTradeHistoryReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getTradeHistory response test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills + */ + let data = + '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 19814995255305,\n "orderId": "6717422bd51c29000775ea03",\n "counterOrderId": "67174228135f9e000709da8c",\n "tradeId": 11029373945659392,\n "symbol": "BTC-USDT",\n "side": "buy",\n "liquidity": "taker",\n "type": "limit",\n "forceTaker": false,\n "price": "67717.6",\n "size": "0.00001",\n "funds": "0.677176",\n "fee": "0.000677176",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "taxRate": "0",\n "tax": "0",\n "createdAt": 1729577515473\n }\n ],\n "lastId": 19814995255305\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTradeHistoryResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOpenOrders request test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetOpenOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOpenOrders response test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "67120bbef094e200070976f6",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": "order tags",\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true,\n "createdAt": 1729235902748,\n "lastUpdatedAt": 1729235909862\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOpenOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getSymbolsWithOpenOrder request test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols + */ + }); + + test('getSymbolsWithOpenOrder response test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols + */ + }); + test('modifyOrder request test', () => { + /** + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter + */ + let data = + '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; + let req = new ModifyOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyOrder response test', () => { + /** + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter + */ + let data = + '{"code":"200000","data":{"newOrderId":"67112258f9406e0007408827","clientOid":"client order id 12"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelAllOrders request test', () => { + /** + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll + */ + }); + + test('cancelAllOrders response test', () => { + /** + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll + */ + }); + test('cancelPartialOrder request test', () => { + /** + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} + */ + let data = + '{"orderId": "6711f73c1ef16c000717bb31", "symbol": "BTC-USDT", "cancelSize": "0.00001"}'; + let req = new CancelPartialOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelPartialOrder response test', () => { + /** + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "6711f73c1ef16c000717bb31",\n "cancelSize": "0.00001"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelPartialOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOid response test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e493fb"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByClientOid response test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('setDCP request test', () => { + /** + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all + */ + let data = '{"timeout": 5, "symbols": "BTC-USDT,ETH-USDT"}'; + let req = new SetDCPReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('setDCP response test', () => { + /** + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all + */ + let data = '{"code":"200000","data":{"currentTime":1729656588,"triggerTime":1729656593}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new SetDCPResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getDCP request test', () => { + /** + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query + */ + }); + + test('getDCP response test', () => { + /** + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query + */ + }); + test('cancelAllOrdersBySymbol request test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v1/hf/orders + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new CancelAllOrdersBySymbolReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelAllOrdersBySymbol response test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v1/hf/orders + */ + let data = '{"code":"200000","data":"success"}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelAllOrdersBySymbolResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getClosedOrders request test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done + */ + let data = + '{"symbol": "BTC-USDT", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetClosedOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getClosedOrders response test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done + */ + let data = + '{\n "code": "200000",\n "data": {\n "lastId": 19814995255305,\n "items": [\n {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetClosedOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchAddOrders request test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi + */ + let data = + '{"orderList": [{"clientOid": "client order id 12", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 13", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; + let req = new BatchAddOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchAddOrders response test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "orderId": "6710d8336afcdb0007319c27",\n "clientOid": "client order id 12",\n "success": true\n },\n {\n "success": false,\n "failMsg": "The order funds should more then 0.1 USDT."\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchAddOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchAddOrdersSync request test', () => { + /** + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync + */ + let data = + '{"orderList": [{"clientOid": "client order id 13", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 14", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; + let req = new BatchAddOrdersSyncReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchAddOrdersSync response test', () => { + /** + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync + */ + let data = + '{"code":"200000","data":[{"orderId":"6711195e5584bc0007bd5aef","clientOid":"client order id 13","orderTime":1729173854299,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729173854326,"success":true},{"success":false,"failMsg":"The order funds should more then 0.1 USDT."}]}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchAddOrdersSyncResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByOrderId request test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let data = '{"orderId": "671124f9365ccb00073debd4", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByOrderId response test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671124f9365ccb00073debd4"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let data = '{"symbol": "BTC-USDT", "orderId": "6717422bd51c29000775ea03"}'; + let req = new GetOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByOrderId response test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/hf/orders + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrder response test', () => { + /** + * addOrder + * Add Order + * /api/v1/hf/orders + */ + let data = + '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByClientOidSync request test', () => { + /** + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} + */ + let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByClientOidSyncReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOidSync response test', () => { + /** + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f33e493fb",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidSyncResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByOrderIdSync request test', () => { + /** + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} + */ + let data = '{"orderId": "671128ee365ccb0007534d45", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdSyncReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByOrderIdSync response test', () => { + /** + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671128ee365ccb0007534d45",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByOrderIdSyncResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderSync request test', () => { + /** + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; + let req = new AddOrderSyncReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderSync response test', () => { + /** + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync + */ + let data = + '{"code":"200000","data":{"orderId":"67111a7cb7cbdf000703e1f6","clientOid":"5c52e11203aa677f33e493f","orderTime":1729174140586,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729174140588}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderSyncResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; + let req = new AddOrderTestReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTest response test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test + */ + let data = + '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRecentTradeHistoryOld request test', () => { + /** + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills + */ + let data = '{"currentPage": 1, "pageSize": 50}'; + let req = new GetRecentTradeHistoryOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRecentTradeHistoryOld response test', () => { + /** + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "tradeId": "11732720444522497",\n "orderId": "674aab24754b1e00077dbc69",\n "counterOrderId": "674aab1fb26bfb0007a18b67",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "96999.6",\n "size": "0.00001",\n "funds": "0.969996",\n "fee": "0.000969996",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "limit",\n "createdAt": 1732946724082\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRecentTradeHistoryOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getRecentOrdersListOld request test', () => { + /** + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders + */ + let data = '{"currentPage": 1, "pageSize": 50}'; + let req = new GetRecentOrdersListOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRecentOrdersListOld response test', () => { + /** + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRecentOrdersListOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByClientOidOld request test', () => { + /** + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e4923fb"}'; + let req = new CancelOrderByClientOidOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOidOld response test', () => { + /** + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "674a9a872033a50007e2790d",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "cancelledOcoOrderIds": null\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByClientOidOld request test', () => { + /** + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let data = '{"clientOid": "3d07008668054da6b3cb12e432c2b13a"}'; + let req = new GetOrderByClientOidOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByClientOidOld response test', () => { + /** + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByClientOidOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchCancelOrderOld request test', () => { + /** + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders + */ + let data = '{"symbol": "BTC-USDT", "tradeType": "TRADE"}'; + let req = new BatchCancelOrderOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchCancelOrderOld response test', () => { + /** + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a8635b38d120007709c0f",\n "674a8630439c100007d3bce1"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchCancelOrderOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrdersListOld request test', () => { + /** + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders + */ + let data = + '{"symbol": "BTC-USDT", "status": "active", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetOrdersListOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrdersListOld response test', () => { + /** + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrdersListOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchAddOrdersOld request test', () => { + /** + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi + */ + let data = + '{"symbol": "BTC-USDT", "orderList": [{"clientOid": "3d07008668054da6b3cb12e432c2b13a", "side": "buy", "type": "limit", "price": "50000", "size": "0.0001"}, {"clientOid": "37245dbe6e134b5c97732bfb36cd4a9d", "side": "buy", "type": "limit", "price": "49999", "size": "0.0001"}]}'; + let req = new BatchAddOrdersOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchAddOrdersOld response test', () => { + /** + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi + */ + let data = + '{\n "code": "200000",\n "data": {\n "data": [\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dfef434f0007efc431",\n "status": "success",\n "failMsg": null,\n "clientOid": "3d07008668054da6b3cb12e432c2b13a"\n },\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "49999",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dffb378b00077b9c20",\n "status": "fail",\n "failMsg": "Balance insufficient!",\n "clientOid": "37245dbe6e134b5c97732bfb36cd4a9d"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchAddOrdersOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOrderByOrderIdOld request test', () => { + /** + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let data = '{"symbol": "BTC-USDT", "orderId": "674a97dfef434f0007efc431"}'; + let req = new CancelOrderByOrderIdOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByOrderIdOld response test', () => { + /** + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a97dfef434f0007efc431"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByOrderIdOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOrderByOrderIdOld request test', () => { + /** + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let data = '{"orderId": "674a97dfef434f0007efc431"}'; + let req = new GetOrderByOrderIdOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOrderByOrderIdOld response test', () => { + /** + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOrderByOrderIdOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderOld request test', () => { + /** + * addOrderOld + * Add Order - Old + * /api/v1/orders + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderOld response test', () => { + /** + * addOrderOld + * Add Order - Old + * /api/v1/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "674a8635b38d120007709c0f"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOrderTestOld request test', () => { + /** + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderTestOldReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTestOld response test', () => { + /** + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "674a8776291d9e00074f1edf"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestOldResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchCancelStopOrder request test', () => { + /** + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel + */ + let data = + '{"symbol": "example_string_default_value", "tradeType": "example_string_default_value", "orderIds": "example_string_default_value"}'; + let req = new BatchCancelStopOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchCancelStopOrder response test', () => { + /** + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchCancelStopOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelStopOrderByClientOid request test', () => { + /** + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid + */ + let data = '{"symbol": "BTC-USDT", "clientOid": "689ff597f4414061aa819cc414836abd"}'; + let req = new CancelStopOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelStopOrderByClientOid response test', () => { + /** + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "vs8hoo8ksc8mario0035a74n",\n "clientOid": "689ff597f4414061aa819cc414836abd"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelStopOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getStopOrdersList request test', () => { + /** + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order + */ + let data = + '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; + let req = new GetStopOrdersListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getStopOrdersList response test', () => { + /** + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "vs8hoo8kqjnklv4m0038lrfq",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "404814a0fb4311eb9098acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1628755183702150100,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1628755183704,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetStopOrdersListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelStopOrderByOrderId request test', () => { + /** + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let data = '{"orderId": "671124f9365ccb00073debd4"}'; + let req = new CancelStopOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelStopOrderByOrderId response test', () => { + /** + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelStopOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getStopOrderByOrderId request test', () => { + /** + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let data = '{"orderId": "example_string_default_value"}'; + let req = new GetStopOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getStopOrderByOrderId response test', () => { + /** + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "vs8hoo8q2ceshiue003b67c0",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "40e0eb9efe6311eb8e58acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1629098781127530200,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629098781128,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetStopOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addStopOrder request test', () => { + /** + * addStopOrder + * Add Stop Order + * /api/v1/stop-order + */ + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddStopOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addStopOrder response test', () => { + /** + * addStopOrder + * Add Stop Order + * /api/v1/stop-order + */ + let data = + '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddStopOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getStopOrderByClientOid request test', () => { + /** + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid + */ + let data = + '{"clientOid": "example_string_default_value", "symbol": "example_string_default_value"}'; + let req = new GetStopOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getStopOrderByClientOid response test', () => { + /** + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "vs8hoo8os561f5np0032vngj",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "2b700942b5db41cebe578cff48960e09",\n "remark": null,\n "tags": null,\n "orderTime": 1629020492834532600,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629020492837,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "1.00000000000000000000"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetStopOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOcoOrderByClientOid request test', () => { + /** + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let data = '{"clientOid": "5c52e11203aa67f1e493fb"}'; + let req = new CancelOcoOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOcoOrderByClientOid response test', () => { + /** + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6r0mkk57003gok3h",\n "vs93gpqc6r0mkk57003gok3i"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOcoOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOcoOrderByClientOid request test', () => { + /** + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let data = '{"clientOid": "5c52e1203aa6f3g7f1e493fb"}'; + let req = new GetOcoOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOcoOrderByClientOid response test', () => { + /** + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOcoOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOcoOrderDetailByOrderId request test', () => { + /** + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} + */ + let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; + let req = new GetOcoOrderDetailByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOcoOrderDetailByOrderId response test', () => { + /** + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW",\n "orders": [\n {\n "id": "vs93gpqc7dn6h3fa003sfelj",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "94000.00000000000000000000",\n "stopPrice": "94000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n },\n {\n "id": "vs93gpqc7dn6h3fa003sfelk",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "96000.00000000000000000000",\n "stopPrice": "98000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOcoOrderDetailByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('cancelOcoOrderByOrderId request test', () => { + /** + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let data = '{"orderId": "674c316e688dea0007c7b986"}'; + let req = new CancelOcoOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOcoOrderByOrderId response test', () => { + /** + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6kkmkk57003gok16",\n "vs93gpqc6kkmkk57003gok17"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOcoOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOcoOrderByOrderId request test', () => { + /** + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; + let req = new GetOcoOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOcoOrderByOrderId response test', () => { + /** + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOcoOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('addOcoOrder request test', () => { + /** + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order + */ + let data = + '{"symbol": "BTC-USDT", "side": "buy", "price": "94000", "size": "0.1", "clientOid": "5c52e11203aa67f1e493fb", "stopPrice": "98000", "limitPrice": "96000", "remark": "this is remark", "tradeType": "TRADE"}'; + let req = new AddOcoOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOcoOrder response test', () => { + /** + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order + */ + let data = '{"code":"200000","data":{"orderId":"674c316e688dea0007c7b986"}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOcoOrderResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('batchCancelOcoOrders request test', () => { + /** + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders + */ + let data = + '{"orderIds": "674c388172cf2800072ee746,674c38bdfd8300000795167e", "symbol": "BTC-USDT"}'; + let req = new BatchCancelOcoOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('batchCancelOcoOrders response test', () => { + /** + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc750mkk57003gok6i",\n "vs93gpqc750mkk57003gok6j",\n "vs93gpqc75c39p83003tnriu",\n "vs93gpqc75c39p83003tnriv"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchCancelOcoOrdersResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('getOcoOrderList request test', () => { + /** + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders + */ + let data = + '{"symbol": "BTC-USDT", "startAt": 123456, "endAt": 123456, "orderIds": "example_string_default_value", "pageSize": 50, "currentPage": 1}'; + let req = new GetOcoOrderListReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getOcoOrderList response test', () => { + /** + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetOcoOrderListResp(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/spot/order/api_order.ts b/sdk/node/src/generate/spot/order/api_order.ts new file mode 100644 index 00000000..bf21fb63 --- /dev/null +++ b/sdk/node/src/generate/spot/order/api_order.ts @@ -0,0 +1,1500 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetTradeHistoryOldReq } from './model_get_trade_history_old_req'; +import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; +import { CancelOrderByOrderIdSyncResp } from './model_cancel_order_by_order_id_sync_resp'; +import { CancelStopOrderByOrderIdResp } from './model_cancel_stop_order_by_order_id_resp'; +import { CancelStopOrderByClientOidResp } from './model_cancel_stop_order_by_client_oid_resp'; +import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; +import { GetOrderByClientOidOldResp } from './model_get_order_by_client_oid_old_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { SetDCPResp } from './model_set_dcp_resp'; +import { BatchCancelOrderOldResp } from './model_batch_cancel_order_old_resp'; +import { BatchCancelOrderOldReq } from './model_batch_cancel_order_old_req'; +import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; +import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; +import { GetOrdersListOldResp } from './model_get_orders_list_old_resp'; +import { GetClosedOrdersReq } from './model_get_closed_orders_req'; +import { GetRecentTradeHistoryOldResp } from './model_get_recent_trade_history_old_resp'; +import { CancelStopOrderByOrderIdReq } from './model_cancel_stop_order_by_order_id_req'; +import { AddOrderOldReq } from './model_add_order_old_req'; +import { AddStopOrderReq } from './model_add_stop_order_req'; +import { GetStopOrderByClientOidResp } from './model_get_stop_order_by_client_oid_resp'; +import { GetRecentOrdersListOldResp } from './model_get_recent_orders_list_old_resp'; +import { CancelOcoOrderByClientOidReq } from './model_cancel_oco_order_by_client_oid_req'; +import { ModifyOrderReq } from './model_modify_order_req'; +import { CancelOrderByClientOidOldResp } from './model_cancel_order_by_client_oid_old_resp'; +import { AddStopOrderResp } from './model_add_stop_order_resp'; +import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; +import { GetStopOrderByClientOidReq } from './model_get_stop_order_by_client_oid_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; +import { GetTradeHistoryOldResp } from './model_get_trade_history_old_resp'; +import { CancelOrderByOrderIdOldReq } from './model_cancel_order_by_order_id_old_req'; +import { CancelOrderByOrderIdSyncReq } from './model_cancel_order_by_order_id_sync_req'; +import { BatchAddOrdersSyncReq } from './model_batch_add_orders_sync_req'; +import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; +import { GetOrdersListOldReq } from './model_get_orders_list_old_req'; +import { GetOcoOrderByClientOidReq } from './model_get_oco_order_by_client_oid_req'; +import { CancelPartialOrderReq } from './model_cancel_partial_order_req'; +import { BatchAddOrdersSyncResp } from './model_batch_add_orders_sync_resp'; +import { BatchAddOrdersOldResp } from './model_batch_add_orders_old_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetOcoOrderListReq } from './model_get_oco_order_list_req'; +import { GetOcoOrderByClientOidResp } from './model_get_oco_order_by_client_oid_resp'; +import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; +import { AddOrderTestOldReq } from './model_add_order_test_old_req'; +import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; +import { AddOcoOrderResp } from './model_add_oco_order_resp'; +import { CancelOrderByClientOidSyncReq } from './model_cancel_order_by_client_oid_sync_req'; +import { GetOrderByOrderIdOldReq } from './model_get_order_by_order_id_old_req'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { ModifyOrderResp } from './model_modify_order_resp'; +import { SetDCPReq } from './model_set_dcp_req'; +import { CancelOcoOrderByOrderIdReq } from './model_cancel_oco_order_by_order_id_req'; +import { CancelOrderByOrderIdOldResp } from './model_cancel_order_by_order_id_old_resp'; +import { CancelAllOrdersResp } from './model_cancel_all_orders_resp'; +import { CancelOrderByClientOidSyncResp } from './model_cancel_order_by_client_oid_sync_resp'; +import { CancelOcoOrderByOrderIdResp } from './model_cancel_oco_order_by_order_id_resp'; +import { GetOpenOrdersResp } from './model_get_open_orders_resp'; +import { AddOcoOrderReq } from './model_add_oco_order_req'; +import { GetStopOrderByOrderIdResp } from './model_get_stop_order_by_order_id_resp'; +import { CancelOrderByOrderIdReq } from './model_cancel_order_by_order_id_req'; +import { GetStopOrderByOrderIdReq } from './model_get_stop_order_by_order_id_req'; +import { GetOcoOrderByOrderIdReq } from './model_get_oco_order_by_order_id_req'; +import { GetOcoOrderDetailByOrderIdReq } from './model_get_oco_order_detail_by_order_id_req'; +import { GetDCPResp } from './model_get_dcp_resp'; +import { CancelPartialOrderResp } from './model_cancel_partial_order_resp'; +import { CancelAllOrdersBySymbolResp } from './model_cancel_all_orders_by_symbol_resp'; +import { GetOcoOrderListResp } from './model_get_oco_order_list_resp'; +import { AddOrderSyncResp } from './model_add_order_sync_resp'; +import { BatchAddOrdersOldReq } from './model_batch_add_orders_old_req'; +import { GetOpenOrdersReq } from './model_get_open_orders_req'; +import { GetStopOrdersListReq } from './model_get_stop_orders_list_req'; +import { GetRecentTradeHistoryOldReq } from './model_get_recent_trade_history_old_req'; +import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; +import { AddOrderOldResp } from './model_add_order_old_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetOrderByOrderIdOldResp } from './model_get_order_by_order_id_old_resp'; +import { BatchCancelOcoOrdersResp } from './model_batch_cancel_oco_orders_resp'; +import { GetOcoOrderByOrderIdResp } from './model_get_oco_order_by_order_id_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByClientOidOldReq } from './model_cancel_order_by_client_oid_old_req'; +import { CancelOcoOrderByClientOidResp } from './model_cancel_oco_order_by_client_oid_resp'; +import { GetRecentOrdersListOldReq } from './model_get_recent_orders_list_old_req'; +import { AddOrderResp } from './model_add_order_resp'; +import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; +import { BatchAddOrdersReq } from './model_batch_add_orders_req'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { CancelStopOrderByClientOidReq } from './model_cancel_stop_order_by_client_oid_req'; +import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; +import { AddOrderSyncReq } from './model_add_order_sync_req'; + +export interface OrderAPI { + /** + * @deprecated + * getTradeHistoryOld Get Trade History - Old + * Description: Request via this endpoint to get the recent fills. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470350 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise; + + /** + * getTradeHistory Get Trade History + * Description: This endpoint can be used to obtain a list of the latest Spot transaction details. The returned data is sorted in descending order according to the latest update time of the order. + * Documentation: https://www.kucoin.com/docs-new/api-3470180 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getTradeHistory(req: GetTradeHistoryReq): Promise; + + /** + * getOpenOrders Get Open Orders + * Description: This interface is to obtain all Spot active order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470178 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOpenOrders(req: GetOpenOrdersReq): Promise; + + /** + * getSymbolsWithOpenOrder Get Symbols With Open Order + * Description: This interface can query all spot symbol that has active orders + * Documentation: https://www.kucoin.com/docs-new/api-3470177 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getSymbolsWithOpenOrder(): Promise; + + /** + * modifyOrder Modify Order + * Description: This interface can modify the price and quantity of the order according to orderId or clientOid. The implementation of this interface is: cancel the order and place a new order on the same trading pair, and return the modification result to the client synchronously When the quantity of the new order updated by the user is less than the filled quantity of this order, the order will be considered as completed, and the order will be cancelled, and no new order will be placed + * Documentation: https://www.kucoin.com/docs-new/api-3470171 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + modifyOrder(req: ModifyOrderReq): Promise; + + /** + * cancelAllOrders Cancel All Orders + * Description: This endpoint can cancel all spot orders for all symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470176 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 30 | + * +---------------------+---------+ + */ + cancelAllOrders(): Promise; + + /** + * cancelPartialOrder Cancel Partial Order + * Description: This interface can cancel the specified quantity of the order according to the orderId. The order execution order is: price first, time first, this interface will not change the queue order + * Documentation: https://www.kucoin.com/docs-new/api-3470183 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + cancelPartialOrder(req: CancelPartialOrderReq): Promise; + + /** + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: This endpoint can be used to cancel a spot order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470184 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + + /** + * getOrderByClientOid Get Order By ClientOid + * Description: This endpoint can be used to obtain information for a single Spot order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470182 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + + /** + * setDCP Set DCP + * Description: Set Disconnection Protect(Deadman Swich)Through this interface, Call this interface to automatically cancel all orders of the set trading pair after the specified time. If this interface is not called again for renewal or cancellation before the set time, the system will help the user to cancel the order of the corresponding trading pair. Otherwise it will not. + * Documentation: https://www.kucoin.com/docs-new/api-3470173 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + setDCP(req: SetDCPReq): Promise; + + /** + * getDCP Get DCP + * Description: Get Disconnection Protect(Deadman Swich)Through this interface, you can query the settings of automatic order cancellation + * Documentation: https://www.kucoin.com/docs-new/api-3470172 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getDCP(): Promise; + + /** + * cancelAllOrdersBySymbol Cancel All Orders By Symbol + * Description: This endpoint can cancel all spot orders for specific symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470175 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; + + /** + * getClosedOrders Get Closed Orders + * Description: This interface is to obtain all Spot closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470179 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getClosedOrders(req: GetClosedOrdersReq): Promise; + + /** + * batchAddOrders Batch Add Orders + * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair + * Documentation: https://www.kucoin.com/docs-new/api-3470168 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + batchAddOrders(req: BatchAddOrdersReq): Promise; + + /** + * batchAddOrdersSync Batch Add Orders Sync + * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair + * Documentation: https://www.kucoin.com/docs-new/api-3470169 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise; + + /** + * cancelOrderByOrderId Cancel Order By OrderId + * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470174 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; + + /** + * getOrderByOrderId Get Order By OrderId + * Description: This endpoint can be used to obtain information for a single Spot order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470181 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; + + /** + * addOrder Add Order + * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470188 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + addOrder(req: AddOrderReq): Promise; + + /** + * cancelOrderByClientOidSync Cancel Order By ClientOid Sync + * Description: This endpoint can be used to cancel a spot order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470186 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderByClientOidSync( + req: CancelOrderByClientOidSyncReq, + ): Promise; + + /** + * cancelOrderByOrderIdSync Cancel Order By OrderId Sync + * Description: This endpoint can be used to cancel a spot order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470185 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + cancelOrderByOrderIdSync( + req: CancelOrderByOrderIdSyncReq, + ): Promise; + + /** + * addOrderSync Add Order Sync + * Description: Place order to the spot trading system The difference between this interface and \"Add order\" is that this interface will synchronously return the order information after the order matching is completed. For higher latency requirements, please select the \"Add order\" interface. If there is a requirement for returning data integrity, please select this interface + * Documentation: https://www.kucoin.com/docs-new/api-3470170 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + addOrderSync(req: AddOrderSyncReq): Promise; + + /** + * addOrderTest Add Order Test + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470187 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + addOrderTest(req: AddOrderTestReq): Promise; + + /** + * @deprecated + * getRecentTradeHistoryOld Get Recent Trade History - Old + * Description: Request via this endpoint to get a list of 1000 fills in the last 24 hours. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470351 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + getRecentTradeHistoryOld( + req: GetRecentTradeHistoryOldReq, + ): Promise; + + /** + * @deprecated + * getRecentOrdersListOld Get Recent Orders List - Old + * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470347 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise; + + /** + * cancelOrderByClientOidOld Cancel Order By ClientOid - Old + * Description: This endpoint can be used to cancel a spot order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470344 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + cancelOrderByClientOidOld( + req: CancelOrderByClientOidOldReq, + ): Promise; + + /** + * @deprecated + * getOrderByClientOidOld Get Order By ClientOid - Old + * Description: Request via this interface to check the information of a single active order via clientOid. The system will prompt that the order does not exists if the order does not exist or has been settled. + * Documentation: https://www.kucoin.com/docs-new/api-3470349 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise; + + /** + * @deprecated + * batchCancelOrderOld Batch Cancel Order - Old + * Description: Request via this endpoint to cancel all open orders. The response is a list of ids of the canceled orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470345 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 20 | + * +---------------------+---------+ + */ + batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise; + + /** + * @deprecated + * getOrdersListOld Get Orders List - Old + * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470346 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOrdersListOld(req: GetOrdersListOldReq): Promise; + + /** + * @deprecated + * batchAddOrdersOld Batch Add Orders - Old + * Description: Request via this endpoint to place 5 orders at the same time. The order type must be a limit order of the same symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470342 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise; + + /** + * @deprecated + * cancelOrderByOrderIdOld Cancel Order By OrderId - Old + * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470343 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise; + + /** + * @deprecated + * getOrderByOrderIdOld Get Order By OrderId - Old + * Description: Request via this endpoint to get a single order info by order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470348 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise; + + /** + * @deprecated + * addOrderOld Add Order - Old + * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470333 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addOrderOld(req: AddOrderOldReq): Promise; + + /** + * @deprecated + * addOrderTestOld Add Order Test - Old + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470341 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addOrderTestOld(req: AddOrderTestOldReq): Promise; + + /** + * batchCancelStopOrder Batch Cancel Stop Orders + * Description: This endpoint can be used to cancel a spot stop orders by batch. + * Documentation: https://www.kucoin.com/docs-new/api-3470337 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise; + + /** + * @deprecated + * cancelStopOrderByClientOid Cancel Stop Order By ClientOid + * Description: This endpoint can be used to cancel a spot stop order by clientOid. + * Documentation: https://www.kucoin.com/docs-new/api-3470336 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 5 | + * +---------------------+---------+ + */ + cancelStopOrderByClientOid( + req: CancelStopOrderByClientOidReq, + ): Promise; + + /** + * getStopOrdersList Get Stop Orders List + * Description: This interface is to obtain all Spot active stop order lists + * Documentation: https://www.kucoin.com/docs-new/api-3470338 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 8 | + * +---------------------+---------+ + */ + getStopOrdersList(req: GetStopOrdersListReq): Promise; + + /** + * @deprecated + * cancelStopOrderByOrderId Cancel Stop Order By OrderId + * Description: This endpoint can be used to cancel a spot stop order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470335 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + cancelStopOrderByOrderId( + req: CancelStopOrderByOrderIdReq, + ): Promise; + + /** + * getStopOrderByOrderId Get Stop Order By OrderId + * Description: This interface is to obtain Spot stop order details by orderId + * Documentation: https://www.kucoin.com/docs-new/api-3470339 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise; + + /** + * @deprecated + * addStopOrder Add Stop Order + * Description: Place stop order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470334 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 1 | + * +---------------------+---------+ + */ + addStopOrder(req: AddStopOrderReq): Promise; + + /** + * getStopOrderByClientOid Get Stop Order By ClientOid + * Description: This interface is to obtain Spot stop order details by orderId + * Documentation: https://www.kucoin.com/docs-new/api-3470340 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise; + + /** + * @deprecated + * cancelOcoOrderByClientOid Cancel OCO Order By ClientOid + * Description: Request via this interface to cancel a stop order via the clientOid. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. + * Documentation: https://www.kucoin.com/docs-new/api-3470355 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + cancelOcoOrderByClientOid( + req: CancelOcoOrderByClientOidReq, + ): Promise; + + /** + * @deprecated + * getOcoOrderByClientOid Get OCO Order By ClientOid + * Description: Request via this interface to get a oco order information via the client order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470358 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise; + + /** + * @deprecated + * getOcoOrderDetailByOrderId Get OCO Order Detail By OrderId + * Description: Request via this interface to get a oco order detail via the order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470359 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOcoOrderDetailByOrderId( + req: GetOcoOrderDetailByOrderIdReq, + ): Promise; + + /** + * @deprecated + * cancelOcoOrderByOrderId Cancel OCO Order By OrderId + * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470354 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise; + + /** + * @deprecated + * getOcoOrderByOrderId Get OCO Order By OrderId + * Description: Request via this interface to get a oco order information via the order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470357 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise; + + /** + * @deprecated + * addOcoOrder Add OCO Order + * Description: Place OCO order to the Spot trading system + * Documentation: https://www.kucoin.com/docs-new/api-3470353 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + addOcoOrder(req: AddOcoOrderReq): Promise; + + /** + * @deprecated + * batchCancelOcoOrders Batch Cancel OCO Order + * Description: This interface can batch cancel OCO orders through orderIds. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. + * Documentation: https://www.kucoin.com/docs-new/api-3470356 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | SPOT | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise; + + /** + * @deprecated + * getOcoOrderList Get OCO Order List + * Description: Request via this endpoint to get your current OCO order list. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470360 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getOcoOrderList(req: GetOcoOrderListReq): Promise; +} + +export class OrderAPIImpl implements OrderAPI { + constructor(private transport: Transport) {} + + getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/fills', + req, + new GetTradeHistoryOldResp(), + false, + ); + } + + getTradeHistory(req: GetTradeHistoryReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/fills', + req, + new GetTradeHistoryResp(), + false, + ); + } + + getOpenOrders(req: GetOpenOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/active', + req, + new GetOpenOrdersResp(), + false, + ); + } + + getSymbolsWithOpenOrder(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/active/symbols', + null, + new GetSymbolsWithOpenOrderResp(), + false, + ); + } + + modifyOrder(req: ModifyOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/alter', + req, + new ModifyOrderResp(), + false, + ); + } + + cancelAllOrders(): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/cancelAll', + null, + new CancelAllOrdersResp(), + false, + ); + } + + cancelPartialOrder(req: CancelPartialOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/cancel/{orderId}', + req, + new CancelPartialOrderResp(), + false, + ); + } + + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/client-order/{clientOid}', + req, + new CancelOrderByClientOidResp(), + false, + ); + } + + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/client-order/{clientOid}', + req, + new GetOrderByClientOidResp(), + false, + ); + } + + setDCP(req: SetDCPReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/dead-cancel-all', + req, + new SetDCPResp(), + false, + ); + } + + getDCP(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/dead-cancel-all/query', + null, + new GetDCPResp(), + false, + ); + } + + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders', + req, + new CancelAllOrdersBySymbolResp(), + false, + ); + } + + getClosedOrders(req: GetClosedOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/done', + req, + new GetClosedOrdersResp(), + false, + ); + } + + batchAddOrders(req: BatchAddOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/multi', + req, + new BatchAddOrdersResp(), + false, + ); + } + + batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/multi/sync', + req, + new BatchAddOrdersSyncResp(), + false, + ); + } + + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/{orderId}', + req, + new CancelOrderByOrderIdResp(), + false, + ); + } + + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/hf/orders/{orderId}', + req, + new GetOrderByOrderIdResp(), + false, + ); + } + + addOrder(req: AddOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders', + req, + new AddOrderResp(), + false, + ); + } + + cancelOrderByClientOidSync( + req: CancelOrderByClientOidSyncReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/sync/client-order/{clientOid}', + req, + new CancelOrderByClientOidSyncResp(), + false, + ); + } + + cancelOrderByOrderIdSync( + req: CancelOrderByOrderIdSyncReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/hf/orders/sync/{orderId}', + req, + new CancelOrderByOrderIdSyncResp(), + false, + ); + } + + addOrderSync(req: AddOrderSyncReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/sync', + req, + new AddOrderSyncResp(), + false, + ); + } + + addOrderTest(req: AddOrderTestReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/hf/orders/test', + req, + new AddOrderTestResp(), + false, + ); + } + + getRecentTradeHistoryOld( + req: GetRecentTradeHistoryOldReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/limit/fills', + req, + new GetRecentTradeHistoryOldResp(), + false, + ); + } + + getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/limit/orders', + req, + new GetRecentOrdersListOldResp(), + false, + ); + } + + cancelOrderByClientOidOld( + req: CancelOrderByClientOidOldReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/order/client-order/{clientOid}', + req, + new CancelOrderByClientOidOldResp(), + false, + ); + } + + getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/order/client-order/{clientOid}', + req, + new GetOrderByClientOidOldResp(), + false, + ); + } + + batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/orders', + req, + new BatchCancelOrderOldResp(), + false, + ); + } + + getOrdersListOld(req: GetOrdersListOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/orders', + req, + new GetOrdersListOldResp(), + false, + ); + } + + batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/orders/multi', + req, + new BatchAddOrdersOldResp(), + false, + ); + } + + cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/orders/{orderId}', + req, + new CancelOrderByOrderIdOldResp(), + false, + ); + } + + getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/orders/{orderId}', + req, + new GetOrderByOrderIdOldResp(), + false, + ); + } + + addOrderOld(req: AddOrderOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/orders', + req, + new AddOrderOldResp(), + false, + ); + } + + addOrderTestOld(req: AddOrderTestOldReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/orders/test', + req, + new AddOrderTestOldResp(), + false, + ); + } + + batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/stop-order/cancel', + req, + new BatchCancelStopOrderResp(), + false, + ); + } + + cancelStopOrderByClientOid( + req: CancelStopOrderByClientOidReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/stop-order/cancelOrderByClientOid', + req, + new CancelStopOrderByClientOidResp(), + false, + ); + } + + getStopOrdersList(req: GetStopOrdersListReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/stop-order', + req, + new GetStopOrdersListResp(), + true, + ); + } + + cancelStopOrderByOrderId( + req: CancelStopOrderByOrderIdReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v1/stop-order/{orderId}', + req, + new CancelStopOrderByOrderIdResp(), + false, + ); + } + + getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/stop-order/{orderId}', + req, + new GetStopOrderByOrderIdResp(), + false, + ); + } + + addStopOrder(req: AddStopOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v1/stop-order', + req, + new AddStopOrderResp(), + false, + ); + } + + getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/stop-order/queryOrderByClientOid', + req, + new GetStopOrderByClientOidResp(), + false, + ); + } + + cancelOcoOrderByClientOid( + req: CancelOcoOrderByClientOidReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/oco/client-order/{clientOid}', + req, + new CancelOcoOrderByClientOidResp(), + false, + ); + } + + getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/oco/client-order/{clientOid}', + req, + new GetOcoOrderByClientOidResp(), + false, + ); + } + + getOcoOrderDetailByOrderId( + req: GetOcoOrderDetailByOrderIdReq, + ): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/oco/order/details/{orderId}', + req, + new GetOcoOrderDetailByOrderIdResp(), + false, + ); + } + + cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/oco/order/{orderId}', + req, + new CancelOcoOrderByOrderIdResp(), + false, + ); + } + + getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/oco/order/{orderId}', + req, + new GetOcoOrderByOrderIdResp(), + false, + ); + } + + addOcoOrder(req: AddOcoOrderReq): Promise { + return this.transport.call( + 'spot', + false, + 'POST', + '/api/v3/oco/order', + req, + new AddOcoOrderResp(), + false, + ); + } + + batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'DELETE', + '/api/v3/oco/orders', + req, + new BatchCancelOcoOrdersResp(), + false, + ); + } + + getOcoOrderList(req: GetOcoOrderListReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/oco/orders', + req, + new GetOcoOrderListResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts new file mode 100644 index 00000000..596835e0 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts @@ -0,0 +1,215 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOcoOrderReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOcoOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order + */ + size?: string; + /** + * trigger price. + */ + stopPrice?: string; + /** + * The limit order price after take-profit and stop-loss are triggered. + */ + limitPrice?: string; + /** + * Transaction Type, currently only supports TRADE (spot transactions), the default is TRADE + */ + tradeType?: AddOcoOrderReq.TradeTypeEnum; + + /** + * Creates a new instance of the `AddOcoOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddOcoOrderReq` object. + */ + static builder(): AddOcoOrderReqBuilder { + return new AddOcoOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddOcoOrderReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOcoOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order + */ + size?: string; + /** + * trigger price. + */ + stopPrice?: string; + /** + * The limit order price after take-profit and stop-loss are triggered. + */ + limitPrice?: string; + /** + * Transaction Type, currently only supports TRADE (spot transactions), the default is TRADE + */ + tradeType?: AddOcoOrderReq.TradeTypeEnum; + }): AddOcoOrderReq { + let obj = new AddOcoOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.remark = data.remark; + obj.price = data.price; + obj.size = data.size; + obj.stopPrice = data.stopPrice; + obj.limitPrice = data.limitPrice; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): AddOcoOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOcoOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOcoOrderReq { + return plainToInstance(AddOcoOrderReq, jsonObject); + } +} + +export namespace AddOcoOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TradeTypeEnum { + /** + * Spot Trading + */ + TRADE = 'TRADE', + } +} + +export class AddOcoOrderReqBuilder { + obj: AddOcoOrderReq = new AddOcoOrderReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOcoOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOcoOrderReq.SideEnum): AddOcoOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOcoOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOcoOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Specify price for order + */ + setPrice(value: string): AddOcoOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order + */ + setSize(value: string): AddOcoOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * trigger price. + */ + setStopPrice(value: string): AddOcoOrderReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * The limit order price after take-profit and stop-loss are triggered. + */ + setLimitPrice(value: string): AddOcoOrderReqBuilder { + this.obj.limitPrice = value; + return this; + } + + /** + * Transaction Type, currently only supports TRADE (spot transactions), the default is TRADE + */ + setTradeType(value: AddOcoOrderReq.TradeTypeEnum): AddOcoOrderReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): AddOcoOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts new file mode 100644 index 00000000..645531f0 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOcoOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOcoOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOcoOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOcoOrderResp { + return plainToInstance(AddOcoOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts new file mode 100644 index 00000000..18b87555 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts @@ -0,0 +1,384 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderOldReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderOldReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderOldReq.TypeEnum = AddOrderOldReq.TypeEnum.LIMIT; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderOldReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderOldReq.TimeInForceEnum = AddOrderOldReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + tradeType?: AddOrderOldReq.TradeTypeEnum = AddOrderOldReq.TradeTypeEnum.TRADE; + + /** + * Creates a new instance of the `AddOrderOldReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderOldReq` object. + */ + static builder(): AddOrderOldReqBuilder { + return new AddOrderOldReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderOldReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderOldReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderOldReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderOldReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderOldReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + tradeType?: AddOrderOldReq.TradeTypeEnum; + }): AddOrderOldReq { + let obj = new AddOrderOldReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): AddOrderOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderOldReq { + return plainToInstance(AddOrderOldReq, jsonObject); + } +} + +export namespace AddOrderOldReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit order + */ + LIMIT = 'limit', + /** + * market order + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum TradeTypeEnum { + /** + * Spot + */ + TRADE = 'TRADE', + /** + * Margin + */ + MARGIN_TRADE = 'MARGIN_TRADE', + } +} + +export class AddOrderOldReqBuilder { + obj: AddOrderOldReq = new AddOrderOldReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderOldReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderOldReq.SideEnum): AddOrderOldReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderOldReq.TypeEnum): AddOrderOldReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOrderOldReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderOldReq.StpEnum): AddOrderOldReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderOldReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderOldReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderOldReq.TimeInForceEnum): AddOrderOldReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderOldReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Hidden or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderOldReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + setIceberg(value: boolean): AddOrderOldReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderOldReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderOldReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderOldReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + setTradeType(value: AddOrderOldReq.TradeTypeEnum): AddOrderOldReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): AddOrderOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts new file mode 100644 index 00000000..0e988713 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderOldResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderOldResp { + return plainToInstance(AddOrderOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_req.ts b/sdk/node/src/generate/spot/order/model_add_order_req.ts new file mode 100644 index 00000000..62b5b23b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_req.ts @@ -0,0 +1,374 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + + /** + * Creates a new instance of the `AddOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderReq` object. + */ + static builder(): AddOrderReqBuilder { + return new AddOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + }): AddOrderReq { + let obj = new AddOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.tags = data.tags; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + return obj; + } + + fromJson(input: string): AddOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderReq { + return plainToInstance(AddOrderReq, jsonObject); + } +} + +export namespace AddOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddOrderReqBuilder { + obj: AddOrderReq = new AddOrderReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderReq.SideEnum): AddOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderReq.StpEnum): AddOrderReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderReq.TimeInForceEnum): AddOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + setTags(value: string): AddOrderReqBuilder { + this.obj.tags = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderReqBuilder { + this.obj.funds = value; + return this; + } + + build(): AddOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_resp.ts new file mode 100644 index 00000000..de72a007 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderResp { + return plainToInstance(AddOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts new file mode 100644 index 00000000..a53a593a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts @@ -0,0 +1,374 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderSyncReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderSyncReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderSyncReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderSyncReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderSyncReq.TimeInForceEnum = AddOrderSyncReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + + /** + * Creates a new instance of the `AddOrderSyncReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderSyncReq` object. + */ + static builder(): AddOrderSyncReqBuilder { + return new AddOrderSyncReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderSyncReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderSyncReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderSyncReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderSyncReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderSyncReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + }): AddOrderSyncReq { + let obj = new AddOrderSyncReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.tags = data.tags; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + return obj; + } + + fromJson(input: string): AddOrderSyncReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderSyncReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderSyncReq { + return plainToInstance(AddOrderSyncReq, jsonObject); + } +} + +export namespace AddOrderSyncReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddOrderSyncReqBuilder { + obj: AddOrderSyncReq = new AddOrderSyncReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderSyncReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderSyncReq.SideEnum): AddOrderSyncReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderSyncReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderSyncReq.TypeEnum): AddOrderSyncReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOrderSyncReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderSyncReq.StpEnum): AddOrderSyncReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderSyncReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderSyncReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderSyncReq.TimeInForceEnum): AddOrderSyncReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderSyncReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderSyncReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddOrderSyncReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderSyncReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + setTags(value: string): AddOrderSyncReqBuilder { + this.obj.tags = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderSyncReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderSyncReqBuilder { + this.obj.funds = value; + return this; + } + + build(): AddOrderSyncReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts new file mode 100644 index 00000000..bbfe7e63 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderSyncResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * + */ + orderTime?: number; + /** + * original order size + */ + originSize?: string; + /** + * deal size + */ + dealSize?: string; + /** + * remain size + */ + remainSize?: string; + /** + * Cumulative canceled size + */ + canceledSize?: string; + /** + * Order Status. open:order is active; done:order has been completed + */ + status?: AddOrderSyncResp.StatusEnum; + /** + * + */ + matchTime?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderSyncResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderSyncResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderSyncResp { + return plainToInstance(AddOrderSyncResp, jsonObject); + } +} + +export namespace AddOrderSyncResp { + export enum StatusEnum { + /** + * + */ + OPEN = 'open', + /** + * + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts new file mode 100644 index 00000000..322b6966 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts @@ -0,0 +1,384 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderTestOldReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestOldReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestOldReq.TypeEnum = AddOrderTestOldReq.TypeEnum.LIMIT; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestOldReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderTestOldReq.TimeInForceEnum = AddOrderTestOldReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + tradeType?: AddOrderTestOldReq.TradeTypeEnum = AddOrderTestOldReq.TradeTypeEnum.TRADE; + + /** + * Creates a new instance of the `AddOrderTestOldReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestOldReq` object. + */ + static builder(): AddOrderTestOldReqBuilder { + return new AddOrderTestOldReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestOldReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestOldReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestOldReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestOldReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderTestOldReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + tradeType?: AddOrderTestOldReq.TradeTypeEnum; + }): AddOrderTestOldReq { + let obj = new AddOrderTestOldReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): AddOrderTestOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestOldReq { + return plainToInstance(AddOrderTestOldReq, jsonObject); + } +} + +export namespace AddOrderTestOldReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit order + */ + LIMIT = 'limit', + /** + * market order + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum TradeTypeEnum { + /** + * Spot + */ + TRADE = 'TRADE', + /** + * Margin + */ + MARGIN_TRADE = 'MARGIN_TRADE', + } +} + +export class AddOrderTestOldReqBuilder { + obj: AddOrderTestOldReq = new AddOrderTestOldReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderTestOldReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestOldReq.SideEnum): AddOrderTestOldReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderTestOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderTestOldReq.TypeEnum): AddOrderTestOldReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOrderTestOldReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderTestOldReq.StpEnum): AddOrderTestOldReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderTestOldReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderTestOldReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderTestOldReq.TimeInForceEnum): AddOrderTestOldReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderTestOldReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Hidden or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderTestOldReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + setIceberg(value: boolean): AddOrderTestOldReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderTestOldReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderTestOldReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderTestOldReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** + */ + setTradeType(value: AddOrderTestOldReq.TradeTypeEnum): AddOrderTestOldReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): AddOrderTestOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts new file mode 100644 index 00000000..cdde62d9 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderTestOldResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestOldResp { + return plainToInstance(AddOrderTestOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts new file mode 100644 index 00000000..36d6c1b6 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts @@ -0,0 +1,374 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddOrderTestReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + + /** + * Creates a new instance of the `AddOrderTestReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. + */ + static builder(): AddOrderTestReqBuilder { + return new AddOrderTestReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddOrderTestReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddOrderTestReq.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + }): AddOrderTestReq { + let obj = new AddOrderTestReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.tags = data.tags; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + return obj; + } + + fromJson(input: string): AddOrderTestReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestReq { + return plainToInstance(AddOrderTestReq, jsonObject); + } +} + +export namespace AddOrderTestReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddOrderTestReqBuilder { + obj: AddOrderTestReq = new AddOrderTestReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddOrderTestReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestReq.SideEnum): AddOrderTestReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddOrderTestReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddOrderTestReq.TypeEnum): AddOrderTestReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddOrderTestReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddOrderTestReq.StpEnum): AddOrderTestReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddOrderTestReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddOrderTestReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: AddOrderTestReq.TimeInForceEnum): AddOrderTestReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddOrderTestReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddOrderTestReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): AddOrderTestReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + setTags(value: string): AddOrderTestReqBuilder { + this.obj.tags = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): AddOrderTestReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddOrderTestReqBuilder { + this.obj.funds = value; + return this; + } + + build(): AddOrderTestReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts new file mode 100644 index 00000000..c6cd3a89 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddOrderTestResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestResp { + return plainToInstance(AddOrderTestResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts new file mode 100644 index 00000000..590bffde --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts @@ -0,0 +1,391 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AddStopOrderReq implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddStopOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddStopOrderReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddStopOrderReq.StpEnum; + /** + * Specify price for order, not need for market order. When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading. Required for limit orders. + */ + timeInForce?: AddStopOrderReq.TimeInForceEnum = AddStopOrderReq.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK if **type** is limit. + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * When **type** is limit, this is Maximum visible quantity in iceberg orders. + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT when **type** is limit. + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The trigger price. + */ + stopPrice?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: string; + + /** + * Creates a new instance of the `AddStopOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddStopOrderReq` object. + */ + static builder(): AddStopOrderReqBuilder { + return new AddStopOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddStopOrderReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddStopOrderReq.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + type?: AddStopOrderReq.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: AddStopOrderReq.StpEnum; + /** + * Specify price for order, not need for market order. When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading. Required for limit orders. + */ + timeInForce?: AddStopOrderReq.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK if **type** is limit. + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * When **type** is limit, this is Maximum visible quantity in iceberg orders. + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT when **type** is limit. + */ + cancelAfter?: number; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + /** + * The trigger price. + */ + stopPrice?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: string; + }): AddStopOrderReq { + let obj = new AddStopOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.funds = data.funds; + obj.stopPrice = data.stopPrice; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): AddStopOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddStopOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddStopOrderReq { + return plainToInstance(AddStopOrderReq, jsonObject); + } +} + +export namespace AddStopOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} + +export class AddStopOrderReqBuilder { + obj: AddStopOrderReq = new AddStopOrderReq(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): AddStopOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddStopOrderReq.SideEnum): AddStopOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): AddStopOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. + */ + setType(value: AddStopOrderReq.TypeEnum): AddStopOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): AddStopOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: AddStopOrderReq.StpEnum): AddStopOrderReqBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order, not need for market order. When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): AddStopOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): AddStopOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading. Required for limit orders. + */ + setTimeInForce(value: AddStopOrderReq.TimeInForceEnum): AddStopOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK if **type** is limit. + */ + setPostOnly(value: boolean): AddStopOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): AddStopOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): AddStopOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * When **type** is limit, this is Maximum visible quantity in iceberg orders. + */ + setVisibleSize(value: string): AddStopOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT when **type** is limit. + */ + setCancelAfter(value: number): AddStopOrderReqBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): AddStopOrderReqBuilder { + this.obj.funds = value; + return this; + } + + /** + * The trigger price. + */ + setStopPrice(value: string): AddStopOrderReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + setTradeType(value: string): AddStopOrderReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): AddStopOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts new file mode 100644 index 00000000..aa602da7 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class AddStopOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddStopOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddStopOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddStopOrderResp { + return plainToInstance(AddStopOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts new file mode 100644 index 00000000..a4fa32bb --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersData implements Serializable { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * Add order success/failure + */ + success?: boolean; + /** + * error message + */ + failMsg?: string; + fromJson(input: string): BatchAddOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersData { + return plainToInstance(BatchAddOrdersData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts new file mode 100644 index 00000000..d8174b9a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts @@ -0,0 +1,102 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersOldData implements Serializable { + /** + * + */ + symbol?: string; + /** + * + */ + type?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + stp?: string; + /** + * + */ + stop?: string; + /** + * + */ + stopPrice?: string; + /** + * + */ + timeInForce?: string; + /** + * + */ + cancelAfter?: number; + /** + * + */ + postOnly?: boolean; + /** + * + */ + hidden?: boolean; + /** + * + */ + iceberge?: boolean; + /** + * + */ + iceberg?: boolean; + /** + * + */ + visibleSize?: string; + /** + * + */ + channel?: string; + /** + * + */ + id?: string; + /** + * + */ + status?: string; + /** + * + */ + failMsg?: string; + /** + * + */ + clientOid?: string; + fromJson(input: string): BatchAddOrdersOldData { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersOldData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersOldData { + return plainToInstance(BatchAddOrdersOldData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts new file mode 100644 index 00000000..613c6780 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts @@ -0,0 +1,409 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersOldOrderList implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersOldOrderList.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * only limit (default is limit) + */ + type?: BatchAddOrdersOldOrderList.TypeEnum = BatchAddOrdersOldOrderList.TypeEnum.LIMIT; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersOldOrderList.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersOldOrderList.TimeInForceEnum = + BatchAddOrdersOldOrderList.TimeInForceEnum.GTC; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * The type of trading : **TRADE**(Spot Trade) + */ + tradeType?: BatchAddOrdersOldOrderList.TradeTypeEnum = + BatchAddOrdersOldOrderList.TradeTypeEnum.TRADE; + /** + * Either loss or entry. Requires stopPrice to be defined + */ + stop?: BatchAddOrdersOldOrderList.StopEnum; + /** + * Stop price, Need to be defined if stop is specified. + */ + stopPrice?: string; + + /** + * Creates a new instance of the `BatchAddOrdersOldOrderList` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersOldOrderList` object. + */ + static builder(): BatchAddOrdersOldOrderListBuilder { + return new BatchAddOrdersOldOrderListBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersOldOrderList` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersOldOrderList.SideEnum; + /** + * symbol + */ + symbol?: string; + /** + * only limit (default is limit) + */ + type?: BatchAddOrdersOldOrderList.TypeEnum; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersOldOrderList.StpEnum; + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersOldOrderList.TimeInForceEnum; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * Hidden or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * The type of trading : **TRADE**(Spot Trade) + */ + tradeType?: BatchAddOrdersOldOrderList.TradeTypeEnum; + /** + * Either loss or entry. Requires stopPrice to be defined + */ + stop?: BatchAddOrdersOldOrderList.StopEnum; + /** + * Stop price, Need to be defined if stop is specified. + */ + stopPrice?: string; + }): BatchAddOrdersOldOrderList { + let obj = new BatchAddOrdersOldOrderList(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.type = data.type; + obj.remark = data.remark; + obj.stp = data.stp; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.cancelAfter = data.cancelAfter; + obj.tradeType = data.tradeType; + obj.stop = data.stop; + obj.stopPrice = data.stopPrice; + return obj; + } + + fromJson(input: string): BatchAddOrdersOldOrderList { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersOldOrderList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersOldOrderList { + return plainToInstance(BatchAddOrdersOldOrderList, jsonObject); + } +} + +export namespace BatchAddOrdersOldOrderList { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit order + */ + LIMIT = 'limit', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum TradeTypeEnum { + /** + * Spot + */ + TRADE = 'TRADE', + } + export enum StopEnum { + /** + * <= + */ + LOSS = 'loss', + /** + * >= + */ + ENTRY = 'entry', + } +} + +export class BatchAddOrdersOldOrderListBuilder { + obj: BatchAddOrdersOldOrderList = new BatchAddOrdersOldOrderList(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. + */ + setClientOid(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: BatchAddOrdersOldOrderList.SideEnum): BatchAddOrdersOldOrderListBuilder { + this.obj.side = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.symbol = value; + return this; + } + + /** + * only limit (default is limit) + */ + setType(value: BatchAddOrdersOldOrderList.TypeEnum): BatchAddOrdersOldOrderListBuilder { + this.obj.type = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.remark = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: BatchAddOrdersOldOrderList.StpEnum): BatchAddOrdersOldOrderListBuilder { + this.obj.stp = value; + return this; + } + + /** + * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. + */ + setPrice(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.size = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce( + value: BatchAddOrdersOldOrderList.TimeInForceEnum, + ): BatchAddOrdersOldOrderListBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): BatchAddOrdersOldOrderListBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Hidden or not (not shown in order book) + */ + setHidden(value: boolean): BatchAddOrdersOldOrderListBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in iceberg orders + */ + setIceberg(value: boolean): BatchAddOrdersOldOrderListBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): BatchAddOrdersOldOrderListBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * The type of trading : **TRADE**(Spot Trade) + */ + setTradeType( + value: BatchAddOrdersOldOrderList.TradeTypeEnum, + ): BatchAddOrdersOldOrderListBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * Either loss or entry. Requires stopPrice to be defined + */ + setStop(value: BatchAddOrdersOldOrderList.StopEnum): BatchAddOrdersOldOrderListBuilder { + this.obj.stop = value; + return this; + } + + /** + * Stop price, Need to be defined if stop is specified. + */ + setStopPrice(value: string): BatchAddOrdersOldOrderListBuilder { + this.obj.stopPrice = value; + return this; + } + + build(): BatchAddOrdersOldOrderList { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts new file mode 100644 index 00000000..9edf5ed5 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchAddOrdersOldOrderList } from './model_batch_add_orders_old_order_list'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersOldReq implements Serializable { + /** + * + */ + @Type(() => BatchAddOrdersOldOrderList) + orderList?: Array; + /** + * + */ + symbol?: string; + + /** + * Creates a new instance of the `BatchAddOrdersOldReq` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersOldReq` object. + */ + static builder(): BatchAddOrdersOldReqBuilder { + return new BatchAddOrdersOldReqBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersOldReq` class with the given data. + */ + static create(data: { + /** + * + */ + orderList?: Array; + /** + * + */ + symbol?: string; + }): BatchAddOrdersOldReq { + let obj = new BatchAddOrdersOldReq(); + obj.orderList = data.orderList; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): BatchAddOrdersOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersOldReq { + return plainToInstance(BatchAddOrdersOldReq, jsonObject); + } +} + +export class BatchAddOrdersOldReqBuilder { + obj: BatchAddOrdersOldReq = new BatchAddOrdersOldReq(); + /** + * + */ + setOrderList(value: Array): BatchAddOrdersOldReqBuilder { + this.obj.orderList = value; + return this; + } + + /** + * + */ + setSymbol(value: string): BatchAddOrdersOldReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): BatchAddOrdersOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts new file mode 100644 index 00000000..d59b07e2 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchAddOrdersOldData } from './model_batch_add_orders_old_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchAddOrdersOldResp implements Response { + /** + * + */ + @Type(() => BatchAddOrdersOldData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchAddOrdersOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersOldResp { + return plainToInstance(BatchAddOrdersOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts new file mode 100644 index 00000000..878abc79 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts @@ -0,0 +1,371 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersOrderList implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: BatchAddOrdersOrderList.TypeEnum; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersOrderList.TimeInForceEnum = + BatchAddOrdersOrderList.TimeInForceEnum.GTC; + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersOrderList.SideEnum; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersOrderList.StpEnum; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + + /** + * Creates a new instance of the `BatchAddOrdersOrderList` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersOrderList` object. + */ + static builder(): BatchAddOrdersOrderListBuilder { + return new BatchAddOrdersOrderListBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersOrderList` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: BatchAddOrdersOrderList.TypeEnum; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersOrderList.TimeInForceEnum; + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersOrderList.SideEnum; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersOrderList.StpEnum; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + }): BatchAddOrdersOrderList { + let obj = new BatchAddOrdersOrderList(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + obj.type = data.type; + obj.timeInForce = data.timeInForce; + obj.side = data.side; + obj.price = data.price; + obj.size = data.size; + obj.stp = data.stp; + obj.cancelAfter = data.cancelAfter; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.tags = data.tags; + obj.remark = data.remark; + obj.funds = data.funds; + return obj; + } + + fromJson(input: string): BatchAddOrdersOrderList { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersOrderList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersOrderList { + return plainToInstance(BatchAddOrdersOrderList, jsonObject); + } +} + +export namespace BatchAddOrdersOrderList { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } +} + +export class BatchAddOrdersOrderListBuilder { + obj: BatchAddOrdersOrderList = new BatchAddOrdersOrderList(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + setClientOid(value: string): BatchAddOrdersOrderListBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): BatchAddOrdersOrderListBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: BatchAddOrdersOrderList.TypeEnum): BatchAddOrdersOrderListBuilder { + this.obj.type = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce(value: BatchAddOrdersOrderList.TimeInForceEnum): BatchAddOrdersOrderListBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: BatchAddOrdersOrderList.SideEnum): BatchAddOrdersOrderListBuilder { + this.obj.side = value; + return this; + } + + /** + * Specify price for order + */ + setPrice(value: string): BatchAddOrdersOrderListBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): BatchAddOrdersOrderListBuilder { + this.obj.size = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: BatchAddOrdersOrderList.StpEnum): BatchAddOrdersOrderListBuilder { + this.obj.stp = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): BatchAddOrdersOrderListBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): BatchAddOrdersOrderListBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): BatchAddOrdersOrderListBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): BatchAddOrdersOrderListBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): BatchAddOrdersOrderListBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + setTags(value: string): BatchAddOrdersOrderListBuilder { + this.obj.tags = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): BatchAddOrdersOrderListBuilder { + this.obj.remark = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): BatchAddOrdersOrderListBuilder { + this.obj.funds = value; + return this; + } + + build(): BatchAddOrdersOrderList { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts new file mode 100644 index 00000000..9b1971cd --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchAddOrdersOrderList } from './model_batch_add_orders_order_list'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersReq implements Serializable { + /** + * Order List + */ + @Type(() => BatchAddOrdersOrderList) + orderList?: Array; + + /** + * Creates a new instance of the `BatchAddOrdersReq` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersReq` object. + */ + static builder(): BatchAddOrdersReqBuilder { + return new BatchAddOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersReq` class with the given data. + */ + static create(data: { + /** + * Order List + */ + orderList?: Array; + }): BatchAddOrdersReq { + let obj = new BatchAddOrdersReq(); + obj.orderList = data.orderList; + return obj; + } + + fromJson(input: string): BatchAddOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersReq { + return plainToInstance(BatchAddOrdersReq, jsonObject); + } +} + +export class BatchAddOrdersReqBuilder { + obj: BatchAddOrdersReq = new BatchAddOrdersReq(); + /** + * Order List + */ + setOrderList(value: Array): BatchAddOrdersReqBuilder { + this.obj.orderList = value; + return this; + } + + build(): BatchAddOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts new file mode 100644 index 00000000..cf7ed011 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { BatchAddOrdersData } from './model_batch_add_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchAddOrdersResp implements Response { + /** + * + */ + @Type(() => BatchAddOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchAddOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): BatchAddOrdersResp { + return plainToInstance(BatchAddOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts new file mode 100644 index 00000000..9d6cc062 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts @@ -0,0 +1,75 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersSyncData implements Serializable { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + /** + * + */ + orderTime?: number; + /** + * original order size + */ + originSize?: string; + /** + * deal size + */ + dealSize?: string; + /** + * remain size + */ + remainSize?: string; + /** + * Cumulative canceled size + */ + canceledSize?: string; + /** + * Order Status. open:order is active; done:order has been completed + */ + status?: BatchAddOrdersSyncData.StatusEnum; + /** + * + */ + matchTime?: number; + /** + * Add order success/failure + */ + success?: boolean; + /** + * error message + */ + failMsg?: string; + fromJson(input: string): BatchAddOrdersSyncData { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersSyncData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersSyncData { + return plainToInstance(BatchAddOrdersSyncData, jsonObject); + } +} + +export namespace BatchAddOrdersSyncData { + export enum StatusEnum { + /** + * + */ + OPEN = 'open', + /** + * + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts new file mode 100644 index 00000000..8992f80b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts @@ -0,0 +1,373 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersSyncOrderList implements Serializable { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: BatchAddOrdersSyncOrderList.TypeEnum; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersSyncOrderList.TimeInForceEnum = + BatchAddOrdersSyncOrderList.TimeInForceEnum.GTC; + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersSyncOrderList.SideEnum; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersSyncOrderList.StpEnum; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean = false; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean = false; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean = false; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + + /** + * Creates a new instance of the `BatchAddOrdersSyncOrderList` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersSyncOrderList` object. + */ + static builder(): BatchAddOrdersSyncOrderListBuilder { + return new BatchAddOrdersSyncOrderListBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersSyncOrderList` class with the given data. + */ + static create(data: { + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: BatchAddOrdersSyncOrderList.TypeEnum; + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + timeInForce?: BatchAddOrdersSyncOrderList.TimeInForceEnum; + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + side?: BatchAddOrdersSyncOrderList.SideEnum; + /** + * Specify price for order + */ + price?: string; + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + size?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + stp?: BatchAddOrdersSyncOrderList.StpEnum; + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + cancelAfter?: number; + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + postOnly?: boolean; + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + hidden?: boolean; + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + iceberg?: boolean; + /** + * Maximum visible quantity in iceberg orders + */ + visibleSize?: string; + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + tags?: string; + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + remark?: string; + /** + * When **type** is market, select one out of two: size or funds + */ + funds?: string; + }): BatchAddOrdersSyncOrderList { + let obj = new BatchAddOrdersSyncOrderList(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + obj.type = data.type; + obj.timeInForce = data.timeInForce; + obj.side = data.side; + obj.price = data.price; + obj.size = data.size; + obj.stp = data.stp; + obj.cancelAfter = data.cancelAfter; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.tags = data.tags; + obj.remark = data.remark; + obj.funds = data.funds; + return obj; + } + + fromJson(input: string): BatchAddOrdersSyncOrderList { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersSyncOrderList, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersSyncOrderList { + return plainToInstance(BatchAddOrdersSyncOrderList, jsonObject); + } +} + +export namespace BatchAddOrdersSyncOrderList { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } +} + +export class BatchAddOrdersSyncOrderListBuilder { + obj: BatchAddOrdersSyncOrderList = new BatchAddOrdersSyncOrderList(); + /** + * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. + */ + setClientOid(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: BatchAddOrdersSyncOrderList.TypeEnum): BatchAddOrdersSyncOrderListBuilder { + this.obj.type = value; + return this; + } + + /** + * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading + */ + setTimeInForce( + value: BatchAddOrdersSyncOrderList.TimeInForceEnum, + ): BatchAddOrdersSyncOrderListBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: BatchAddOrdersSyncOrderList.SideEnum): BatchAddOrdersSyncOrderListBuilder { + this.obj.side = value; + return this; + } + + /** + * Specify price for order + */ + setPrice(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.price = value; + return this; + } + + /** + * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds + */ + setSize(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.size = value; + return this; + } + + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC + */ + setStp(value: BatchAddOrdersSyncOrderList.StpEnum): BatchAddOrdersSyncOrderListBuilder { + this.obj.stp = value; + return this; + } + + /** + * Cancel after n seconds,the order timing strategy is GTT + */ + setCancelAfter(value: number): BatchAddOrdersSyncOrderListBuilder { + this.obj.cancelAfter = value; + return this; + } + + /** + * passive order labels, this is disabled when the order timing strategy is IOC or FOK + */ + setPostOnly(value: boolean): BatchAddOrdersSyncOrderListBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) + */ + setHidden(value: boolean): BatchAddOrdersSyncOrderListBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) + */ + setIceberg(value: boolean): BatchAddOrdersSyncOrderListBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Maximum visible quantity in iceberg orders + */ + setVisibleSize(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Order tag, length cannot exceed 20 characters (ASCII) + */ + setTags(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.tags = value; + return this; + } + + /** + * Order placement remarks, length cannot exceed 20 characters (ASCII) + */ + setRemark(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.remark = value; + return this; + } + + /** + * When **type** is market, select one out of two: size or funds + */ + setFunds(value: string): BatchAddOrdersSyncOrderListBuilder { + this.obj.funds = value; + return this; + } + + build(): BatchAddOrdersSyncOrderList { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts new file mode 100644 index 00000000..8b6032b5 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { BatchAddOrdersSyncOrderList } from './model_batch_add_orders_sync_order_list'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchAddOrdersSyncReq implements Serializable { + /** + * Order List + */ + @Type(() => BatchAddOrdersSyncOrderList) + orderList?: Array; + + /** + * Creates a new instance of the `BatchAddOrdersSyncReq` class. + * The builder pattern allows step-by-step construction of a `BatchAddOrdersSyncReq` object. + */ + static builder(): BatchAddOrdersSyncReqBuilder { + return new BatchAddOrdersSyncReqBuilder(); + } + + /** + * Creates a new instance of the `BatchAddOrdersSyncReq` class with the given data. + */ + static create(data: { + /** + * Order List + */ + orderList?: Array; + }): BatchAddOrdersSyncReq { + let obj = new BatchAddOrdersSyncReq(); + obj.orderList = data.orderList; + return obj; + } + + fromJson(input: string): BatchAddOrdersSyncReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersSyncReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchAddOrdersSyncReq { + return plainToInstance(BatchAddOrdersSyncReq, jsonObject); + } +} + +export class BatchAddOrdersSyncReqBuilder { + obj: BatchAddOrdersSyncReq = new BatchAddOrdersSyncReq(); + /** + * Order List + */ + setOrderList(value: Array): BatchAddOrdersSyncReqBuilder { + this.obj.orderList = value; + return this; + } + + build(): BatchAddOrdersSyncReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts new file mode 100644 index 00000000..fb8fab60 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { BatchAddOrdersSyncData } from './model_batch_add_orders_sync_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchAddOrdersSyncResp implements Response { + /** + * + */ + @Type(() => BatchAddOrdersSyncData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchAddOrdersSyncResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchAddOrdersSyncResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): BatchAddOrdersSyncResp { + return plainToInstance(BatchAddOrdersSyncResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts new file mode 100644 index 00000000..34544438 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelOcoOrdersReq implements Serializable { + /** + * Specify the order id, there can be multiple orders, separated by commas. If not passed, all oco orders will be canceled by default. + */ + orderIds?: string; + /** + * trading pair. If not passed, the oco orders of all symbols will be canceled by default. + */ + symbol?: string; + + /** + * Creates a new instance of the `BatchCancelOcoOrdersReq` class. + * The builder pattern allows step-by-step construction of a `BatchCancelOcoOrdersReq` object. + */ + static builder(): BatchCancelOcoOrdersReqBuilder { + return new BatchCancelOcoOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `BatchCancelOcoOrdersReq` class with the given data. + */ + static create(data: { + /** + * Specify the order id, there can be multiple orders, separated by commas. If not passed, all oco orders will be canceled by default. + */ + orderIds?: string; + /** + * trading pair. If not passed, the oco orders of all symbols will be canceled by default. + */ + symbol?: string; + }): BatchCancelOcoOrdersReq { + let obj = new BatchCancelOcoOrdersReq(); + obj.orderIds = data.orderIds; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): BatchCancelOcoOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOcoOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOcoOrdersReq { + return plainToInstance(BatchCancelOcoOrdersReq, jsonObject); + } +} + +export class BatchCancelOcoOrdersReqBuilder { + obj: BatchCancelOcoOrdersReq = new BatchCancelOcoOrdersReq(); + /** + * Specify the order id, there can be multiple orders, separated by commas. If not passed, all oco orders will be canceled by default. + */ + setOrderIds(value: string): BatchCancelOcoOrdersReqBuilder { + this.obj.orderIds = value; + return this; + } + + /** + * trading pair. If not passed, the oco orders of all symbols will be canceled by default. + */ + setSymbol(value: string): BatchCancelOcoOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): BatchCancelOcoOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts new file mode 100644 index 00000000..c80ca58b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchCancelOcoOrdersResp implements Response { + /** + * List of two order IDs related to the canceled OCO order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchCancelOcoOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOcoOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOcoOrdersResp { + return plainToInstance(BatchCancelOcoOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts new file mode 100644 index 00000000..bdc56f1e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelOrderOldReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The type of trading :TRADE(Spot Trading), MARGIN_TRADE(Cross Margin Trading), MARGIN_ISOLATED_TRADE(Isolated Margin Trading), and the default is TRADE to cancel the spot trading orders. + */ + tradeType?: BatchCancelOrderOldReq.TradeTypeEnum = BatchCancelOrderOldReq.TradeTypeEnum.TRADE; + + /** + * Creates a new instance of the `BatchCancelOrderOldReq` class. + * The builder pattern allows step-by-step construction of a `BatchCancelOrderOldReq` object. + */ + static builder(): BatchCancelOrderOldReqBuilder { + return new BatchCancelOrderOldReqBuilder(); + } + + /** + * Creates a new instance of the `BatchCancelOrderOldReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The type of trading :TRADE(Spot Trading), MARGIN_TRADE(Cross Margin Trading), MARGIN_ISOLATED_TRADE(Isolated Margin Trading), and the default is TRADE to cancel the spot trading orders. + */ + tradeType?: BatchCancelOrderOldReq.TradeTypeEnum; + }): BatchCancelOrderOldReq { + let obj = new BatchCancelOrderOldReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + return obj; + } + + fromJson(input: string): BatchCancelOrderOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrderOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOrderOldReq { + return plainToInstance(BatchCancelOrderOldReq, jsonObject); + } +} + +export namespace BatchCancelOrderOldReq { + export enum TradeTypeEnum { + /** + * Spot Trading + */ + TRADE = 'TRADE', + /** + * Cross Margin Trading + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * Isolated Margin Trading + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class BatchCancelOrderOldReqBuilder { + obj: BatchCancelOrderOldReq = new BatchCancelOrderOldReq(); + /** + * symbol + */ + setSymbol(value: string): BatchCancelOrderOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The type of trading :TRADE(Spot Trading), MARGIN_TRADE(Cross Margin Trading), MARGIN_ISOLATED_TRADE(Isolated Margin Trading), and the default is TRADE to cancel the spot trading orders. + */ + setTradeType(value: BatchCancelOrderOldReq.TradeTypeEnum): BatchCancelOrderOldReqBuilder { + this.obj.tradeType = value; + return this; + } + + build(): BatchCancelOrderOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts new file mode 100644 index 00000000..9685692d --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchCancelOrderOldResp implements Response { + /** + * + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchCancelOrderOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelOrderOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelOrderOldResp { + return plainToInstance(BatchCancelOrderOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts new file mode 100644 index 00000000..9abfb49e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts @@ -0,0 +1,94 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class BatchCancelStopOrderReq implements Serializable { + /** + * Cancel the open order for the specified symbol + */ + symbol?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: string; + /** + * Comma seperated order IDs. + */ + orderIds?: string; + + /** + * Creates a new instance of the `BatchCancelStopOrderReq` class. + * The builder pattern allows step-by-step construction of a `BatchCancelStopOrderReq` object. + */ + static builder(): BatchCancelStopOrderReqBuilder { + return new BatchCancelStopOrderReqBuilder(); + } + + /** + * Creates a new instance of the `BatchCancelStopOrderReq` class with the given data. + */ + static create(data: { + /** + * Cancel the open order for the specified symbol + */ + symbol?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: string; + /** + * Comma seperated order IDs. + */ + orderIds?: string; + }): BatchCancelStopOrderReq { + let obj = new BatchCancelStopOrderReq(); + obj.symbol = data.symbol; + obj.tradeType = data.tradeType; + obj.orderIds = data.orderIds; + return obj; + } + + fromJson(input: string): BatchCancelStopOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelStopOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelStopOrderReq { + return plainToInstance(BatchCancelStopOrderReq, jsonObject); + } +} + +export class BatchCancelStopOrderReqBuilder { + obj: BatchCancelStopOrderReq = new BatchCancelStopOrderReq(); + /** + * Cancel the open order for the specified symbol + */ + setSymbol(value: string): BatchCancelStopOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + setTradeType(value: string): BatchCancelStopOrderReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * Comma seperated order IDs. + */ + setOrderIds(value: string): BatchCancelStopOrderReqBuilder { + this.obj.orderIds = value; + return this; + } + + build(): BatchCancelStopOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts new file mode 100644 index 00000000..d895ed6c --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class BatchCancelStopOrderResp implements Response { + /** + * order id array + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): BatchCancelStopOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(BatchCancelStopOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): BatchCancelStopOrderResp { + return plainToInstance(BatchCancelStopOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts new file mode 100644 index 00000000..a848bb43 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllOrdersBySymbolReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. + * The builder pattern allows step-by-step construction of a `CancelAllOrdersBySymbolReq` object. + */ + static builder(): CancelAllOrdersBySymbolReqBuilder { + return new CancelAllOrdersBySymbolReqBuilder(); + } + + /** + * Creates a new instance of the `CancelAllOrdersBySymbolReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): CancelAllOrdersBySymbolReq { + let obj = new CancelAllOrdersBySymbolReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelAllOrdersBySymbolReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersBySymbolReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersBySymbolReq { + return plainToInstance(CancelAllOrdersBySymbolReq, jsonObject); + } +} + +export class CancelAllOrdersBySymbolReqBuilder { + obj: CancelAllOrdersBySymbolReq = new CancelAllOrdersBySymbolReq(); + /** + * symbol + */ + setSymbol(value: string): CancelAllOrdersBySymbolReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelAllOrdersBySymbolReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts new file mode 100644 index 00000000..33fc3a72 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllOrdersBySymbolResp + implements Response +{ + /** + * + */ + data?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllOrdersBySymbolResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { + return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts new file mode 100644 index 00000000..2a2d2839 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts @@ -0,0 +1,26 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelAllOrdersFailedSymbols implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * error message + */ + error?: string; + fromJson(input: string): CancelAllOrdersFailedSymbols { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersFailedSymbols, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersFailedSymbols { + return plainToInstance(CancelAllOrdersFailedSymbols, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts new file mode 100644 index 00000000..191dbfbc --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { CancelAllOrdersFailedSymbols } from './model_cancel_all_orders_failed_symbols'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelAllOrdersResp implements Response { + /** + * The Symbols Successfully cancelled + */ + succeedSymbols?: Array; + /** + * The Symbols Failed to cancel + */ + @Type(() => CancelAllOrdersFailedSymbols) + failedSymbols?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelAllOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelAllOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelAllOrdersResp { + return plainToInstance(CancelAllOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts new file mode 100644 index 00000000..3d30522b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOcoOrderByClientOidReq implements Serializable { + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `CancelOcoOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelOcoOrderByClientOidReq` object. + */ + static builder(): CancelOcoOrderByClientOidReqBuilder { + return new CancelOcoOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOcoOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + }): CancelOcoOrderByClientOidReq { + let obj = new CancelOcoOrderByClientOidReq(); + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): CancelOcoOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOcoOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOcoOrderByClientOidReq { + return plainToInstance(CancelOcoOrderByClientOidReq, jsonObject); + } +} + +export class CancelOcoOrderByClientOidReqBuilder { + obj: CancelOcoOrderByClientOidReq = new CancelOcoOrderByClientOidReq(); + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): CancelOcoOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): CancelOcoOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts new file mode 100644 index 00000000..2168897a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOcoOrderByClientOidResp + implements Response +{ + /** + * List of two order IDs related to the canceled OCO order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOcoOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOcoOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOcoOrderByClientOidResp { + return plainToInstance(CancelOcoOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts new file mode 100644 index 00000000..2d2a1664 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOcoOrderByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `CancelOcoOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelOcoOrderByOrderIdReq` object. + */ + static builder(): CancelOcoOrderByOrderIdReqBuilder { + return new CancelOcoOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOcoOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): CancelOcoOrderByOrderIdReq { + let obj = new CancelOcoOrderByOrderIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): CancelOcoOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOcoOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOcoOrderByOrderIdReq { + return plainToInstance(CancelOcoOrderByOrderIdReq, jsonObject); + } +} + +export class CancelOcoOrderByOrderIdReqBuilder { + obj: CancelOcoOrderByOrderIdReq = new CancelOcoOrderByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelOcoOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): CancelOcoOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts new file mode 100644 index 00000000..497ad81e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOcoOrderByOrderIdResp + implements Response +{ + /** + * List of two order IDs related to the canceled OCO order + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOcoOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOcoOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOcoOrderByOrderIdResp { + return plainToInstance(CancelOcoOrderByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts new file mode 100644 index 00000000..c72fbc76 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByClientOidOldReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidOldReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidOldReq` object. + */ + static builder(): CancelOrderByClientOidOldReqBuilder { + return new CancelOrderByClientOidOldReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidOldReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + }): CancelOrderByClientOidOldReq { + let obj = new CancelOrderByClientOidOldReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidOldReq { + return plainToInstance(CancelOrderByClientOidOldReq, jsonObject); + } +} + +export class CancelOrderByClientOidOldReqBuilder { + obj: CancelOrderByClientOidOldReq = new CancelOrderByClientOidOldReq(); + /** + * symbol + */ + setSymbol(value: string): CancelOrderByClientOidOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): CancelOrderByClientOidOldReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): CancelOrderByClientOidOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts new file mode 100644 index 00000000..1c6ded8a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts @@ -0,0 +1,43 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByClientOidOldResp + implements Response +{ + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * + */ + cancelledOrderId?: string; + /** + * + */ + cancelledOcoOrderIds?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidOldResp { + return plainToInstance(CancelOrderByClientOidOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts new file mode 100644 index 00000000..c715c9d1 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByClientOidReq implements Serializable { + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. + */ + static builder(): CancelOrderByClientOidReqBuilder { + return new CancelOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByClientOidReq { + let obj = new CancelOrderByClientOidReq(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidReq { + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } +} + +export class CancelOrderByClientOidReqBuilder { + obj: CancelOrderByClientOidReq = new CancelOrderByClientOidReq(); + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): CancelOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts new file mode 100644 index 00000000..431f3f4e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByClientOidResp + implements Response +{ + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts new file mode 100644 index 00000000..24642b0e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByClientOidSyncReq implements Serializable { + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidSyncReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidSyncReq` object. + */ + static builder(): CancelOrderByClientOidSyncReqBuilder { + return new CancelOrderByClientOidSyncReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidSyncReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByClientOidSyncReq { + let obj = new CancelOrderByClientOidSyncReq(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidSyncReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidSyncReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidSyncReq { + return plainToInstance(CancelOrderByClientOidSyncReq, jsonObject); + } +} + +export class CancelOrderByClientOidSyncReqBuilder { + obj: CancelOrderByClientOidSyncReq = new CancelOrderByClientOidSyncReq(); + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): CancelOrderByClientOidSyncReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByClientOidSyncReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByClientOidSyncReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts new file mode 100644 index 00000000..c635ef52 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts @@ -0,0 +1,68 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByClientOidSyncResp + implements Response +{ + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * original order size + */ + originSize?: string; + /** + * deal size + */ + dealSize?: string; + /** + * remain size + */ + remainSize?: string; + /** + * Cumulative canceled size + */ + canceledSize?: string; + /** + * Order Status. open:order is active; done:order has been completed + */ + status?: CancelOrderByClientOidSyncResp.StatusEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidSyncResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidSyncResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidSyncResp { + return plainToInstance(CancelOrderByClientOidSyncResp, jsonObject); + } +} + +export namespace CancelOrderByClientOidSyncResp { + export enum StatusEnum { + /** + * + */ + OPEN = 'open', + /** + * + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts new file mode 100644 index 00000000..66d1f6b2 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByOrderIdOldReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `CancelOrderByOrderIdOldReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdOldReq` object. + */ + static builder(): CancelOrderByOrderIdOldReqBuilder { + return new CancelOrderByOrderIdOldReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByOrderIdOldReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): CancelOrderByOrderIdOldReq { + let obj = new CancelOrderByOrderIdOldReq(); + obj.symbol = data.symbol; + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): CancelOrderByOrderIdOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdOldReq { + return plainToInstance(CancelOrderByOrderIdOldReq, jsonObject); + } +} + +export class CancelOrderByOrderIdOldReqBuilder { + obj: CancelOrderByOrderIdOldReq = new CancelOrderByOrderIdOldReq(); + /** + * symbol + */ + setSymbol(value: string): CancelOrderByOrderIdOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelOrderByOrderIdOldReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): CancelOrderByOrderIdOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts new file mode 100644 index 00000000..ff599efe --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByOrderIdOldResp + implements Response +{ + /** + * + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByOrderIdOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdOldResp { + return plainToInstance(CancelOrderByOrderIdOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts new file mode 100644 index 00000000..715c3bf5 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdReq` object. + */ + static builder(): CancelOrderByOrderIdReqBuilder { + return new CancelOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByOrderIdReq { + let obj = new CancelOrderByOrderIdReq(); + obj.orderId = data.orderId; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdReq { + return plainToInstance(CancelOrderByOrderIdReq, jsonObject); + } +} + +export class CancelOrderByOrderIdReqBuilder { + obj: CancelOrderByOrderIdReq = new CancelOrderByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByOrderIdReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts new file mode 100644 index 00000000..f6b43376 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts @@ -0,0 +1,33 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByOrderIdResp implements Response { + /** + * order id + */ + orderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdResp { + return plainToInstance(CancelOrderByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts new file mode 100644 index 00000000..9b19dcf5 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelOrderByOrderIdSyncReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `CancelOrderByOrderIdSyncReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdSyncReq` object. + */ + static builder(): CancelOrderByOrderIdSyncReqBuilder { + return new CancelOrderByOrderIdSyncReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByOrderIdSyncReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + }): CancelOrderByOrderIdSyncReq { + let obj = new CancelOrderByOrderIdSyncReq(); + obj.orderId = data.orderId; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): CancelOrderByOrderIdSyncReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdSyncReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdSyncReq { + return plainToInstance(CancelOrderByOrderIdSyncReq, jsonObject); + } +} + +export class CancelOrderByOrderIdSyncReqBuilder { + obj: CancelOrderByOrderIdSyncReq = new CancelOrderByOrderIdSyncReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelOrderByOrderIdSyncReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelOrderByOrderIdSyncReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): CancelOrderByOrderIdSyncReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts new file mode 100644 index 00000000..36c149b0 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts @@ -0,0 +1,68 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelOrderByOrderIdSyncResp + implements Response +{ + /** + * order id + */ + orderId?: string; + /** + * original order size + */ + originSize?: string; + /** + * deal size + */ + dealSize?: string; + /** + * remain size + */ + remainSize?: string; + /** + * Cumulative canceled size + */ + canceledSize?: string; + /** + * Order Status. open:order is active; done:order has been completed + */ + status?: CancelOrderByOrderIdSyncResp.StatusEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByOrderIdSyncResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByOrderIdSyncResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByOrderIdSyncResp { + return plainToInstance(CancelOrderByOrderIdSyncResp, jsonObject); + } +} + +export namespace CancelOrderByOrderIdSyncResp { + export enum StatusEnum { + /** + * + */ + OPEN = 'open', + /** + * + */ + DONE = 'done', + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts new file mode 100644 index 00000000..c062db26 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts @@ -0,0 +1,96 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelPartialOrderReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + /** + * symbol + */ + symbol?: string; + /** + * The size you want cancel + */ + cancelSize?: string; + + /** + * Creates a new instance of the `CancelPartialOrderReq` class. + * The builder pattern allows step-by-step construction of a `CancelPartialOrderReq` object. + */ + static builder(): CancelPartialOrderReqBuilder { + return new CancelPartialOrderReqBuilder(); + } + + /** + * Creates a new instance of the `CancelPartialOrderReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + /** + * The size you want cancel + */ + cancelSize?: string; + }): CancelPartialOrderReq { + let obj = new CancelPartialOrderReq(); + obj.orderId = data.orderId; + obj.symbol = data.symbol; + obj.cancelSize = data.cancelSize; + return obj; + } + + fromJson(input: string): CancelPartialOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelPartialOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelPartialOrderReq { + return plainToInstance(CancelPartialOrderReq, jsonObject); + } +} + +export class CancelPartialOrderReqBuilder { + obj: CancelPartialOrderReq = new CancelPartialOrderReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelPartialOrderReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): CancelPartialOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The size you want cancel + */ + setCancelSize(value: string): CancelPartialOrderReqBuilder { + this.obj.cancelSize = value; + return this; + } + + build(): CancelPartialOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts new file mode 100644 index 00000000..5a64500a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelPartialOrderResp implements Response { + /** + * order id + */ + orderId?: string; + /** + * The size you canceled + */ + cancelSize?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelPartialOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelPartialOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelPartialOrderResp { + return plainToInstance(CancelPartialOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts new file mode 100644 index 00000000..0f764bea --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelStopOrderByClientOidReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + + /** + * Creates a new instance of the `CancelStopOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelStopOrderByClientOidReq` object. + */ + static builder(): CancelStopOrderByClientOidReqBuilder { + return new CancelStopOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelStopOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + }): CancelStopOrderByClientOidReq { + let obj = new CancelStopOrderByClientOidReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): CancelStopOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelStopOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelStopOrderByClientOidReq { + return plainToInstance(CancelStopOrderByClientOidReq, jsonObject); + } +} + +export class CancelStopOrderByClientOidReqBuilder { + obj: CancelStopOrderByClientOidReq = new CancelStopOrderByClientOidReq(); + /** + * symbol + */ + setSymbol(value: string): CancelStopOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Unique order id created by users to identify their orders + */ + setClientOid(value: string): CancelStopOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): CancelStopOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts new file mode 100644 index 00000000..b6eda59a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelStopOrderByClientOidResp + implements Response +{ + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Unique ID of the cancelled order + */ + cancelledOrderId?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelStopOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelStopOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelStopOrderByClientOidResp { + return plainToInstance(CancelStopOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts new file mode 100644 index 00000000..cbb334ee --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class CancelStopOrderByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `CancelStopOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelStopOrderByOrderIdReq` object. + */ + static builder(): CancelStopOrderByOrderIdReqBuilder { + return new CancelStopOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelStopOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): CancelStopOrderByOrderIdReq { + let obj = new CancelStopOrderByOrderIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): CancelStopOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelStopOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelStopOrderByOrderIdReq { + return plainToInstance(CancelStopOrderByOrderIdReq, jsonObject); + } +} + +export class CancelStopOrderByOrderIdReqBuilder { + obj: CancelStopOrderByOrderIdReq = new CancelStopOrderByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): CancelStopOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): CancelStopOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts new file mode 100644 index 00000000..7ec76514 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class CancelStopOrderByOrderIdResp + implements Response +{ + /** + * order id array + */ + cancelledOrderIds?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelStopOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelStopOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelStopOrderByOrderIdResp { + return plainToInstance(CancelStopOrderByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts new file mode 100644 index 00000000..1c2e4634 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts @@ -0,0 +1,213 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetClosedOrdersItems implements Serializable { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersItems.TypeEnum; + /** + * Buy or sell + */ + side?: GetClosedOrdersItems.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) + */ + stp?: GetClosedOrdersItems.StpEnum; + /** + * Time in force + */ + timeInForce?: GetClosedOrdersItems.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + fromJson(input: string): GetClosedOrdersItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersItems { + return plainToInstance(GetClosedOrdersItems, jsonObject); + } +} + +export namespace GetClosedOrdersItems { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts new file mode 100644 index 00000000..b9c90643 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts @@ -0,0 +1,185 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetClosedOrdersReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetClosedOrdersReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number = 20; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetClosedOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetClosedOrdersReq` object. + */ + static builder(): GetClosedOrdersReqBuilder { + return new GetClosedOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetClosedOrdersReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetClosedOrdersReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetClosedOrdersReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetClosedOrdersReq { + let obj = new GetClosedOrdersReq(); + obj.symbol = data.symbol; + obj.side = data.side; + obj.type = data.type; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetClosedOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersReq { + return plainToInstance(GetClosedOrdersReq, jsonObject); + } +} + +export namespace GetClosedOrdersReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetClosedOrdersReqBuilder { + obj: GetClosedOrdersReq = new GetClosedOrdersReq(); + /** + * symbol + */ + setSymbol(value: string): GetClosedOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: GetClosedOrdersReq.SideEnum): GetClosedOrdersReqBuilder { + this.obj.side = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: GetClosedOrdersReq.TypeEnum): GetClosedOrdersReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + setLastId(value: number): GetClosedOrdersReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default20,Max100 + */ + setLimit(value: number): GetClosedOrdersReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetClosedOrdersReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetClosedOrdersReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetClosedOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts new file mode 100644 index 00000000..b3e6ed36 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetClosedOrdersItems } from './model_get_closed_orders_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetClosedOrdersResp implements Response { + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * + */ + @Type(() => GetClosedOrdersItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetClosedOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetClosedOrdersResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetClosedOrdersResp { + return plainToInstance(GetClosedOrdersResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts new file mode 100644 index 00000000..f8dbaee5 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts @@ -0,0 +1,45 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetDCPResp implements Response { + /** + * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400 + */ + timeout?: number; + /** + * List of trading pairs. Separated by commas, empty means all trading pairs + */ + symbols?: string; + /** + * System current time (in seconds) + */ + currentTime?: number; + /** + * Trigger cancellation time (in seconds) + */ + triggerTime?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetDCPResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetDCPResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetDCPResp { + return plainToInstance(GetDCPResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts new file mode 100644 index 00000000..6cafa030 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderByClientOidReq implements Serializable { + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `GetOcoOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `GetOcoOrderByClientOidReq` object. + */ + static builder(): GetOcoOrderByClientOidReqBuilder { + return new GetOcoOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `GetOcoOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + }): GetOcoOrderByClientOidReq { + let obj = new GetOcoOrderByClientOidReq(); + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): GetOcoOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderByClientOidReq { + return plainToInstance(GetOcoOrderByClientOidReq, jsonObject); + } +} + +export class GetOcoOrderByClientOidReqBuilder { + obj: GetOcoOrderByClientOidReq = new GetOcoOrderByClientOidReq(); + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): GetOcoOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): GetOcoOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts new file mode 100644 index 00000000..18b5d39b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOcoOrderByClientOidResp + implements Response +{ + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id + */ + clientOid?: string; + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Order placement time, milliseconds + */ + orderTime?: number; + /** + * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled + */ + status?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOcoOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderByClientOidResp { + return plainToInstance(GetOcoOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts new file mode 100644 index 00000000..4ececba4 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetOcoOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetOcoOrderByOrderIdReq` object. + */ + static builder(): GetOcoOrderByOrderIdReqBuilder { + return new GetOcoOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetOcoOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): GetOcoOrderByOrderIdReq { + let obj = new GetOcoOrderByOrderIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetOcoOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderByOrderIdReq { + return plainToInstance(GetOcoOrderByOrderIdReq, jsonObject); + } +} + +export class GetOcoOrderByOrderIdReqBuilder { + obj: GetOcoOrderByOrderIdReq = new GetOcoOrderByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): GetOcoOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetOcoOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts new file mode 100644 index 00000000..d996624f --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts @@ -0,0 +1,70 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOcoOrderByOrderIdResp implements Response { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id + */ + clientOid?: string; + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * Order placement time, milliseconds + */ + orderTime?: number; + /** + * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled + */ + status?: GetOcoOrderByOrderIdResp.StatusEnum; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOcoOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderByOrderIdResp { + return plainToInstance(GetOcoOrderByOrderIdResp, jsonObject); + } +} + +export namespace GetOcoOrderByOrderIdResp { + export enum StatusEnum { + /** + * New + */ + NEW = 'NEW', + /** + * Completed + */ + DONE = 'DONE', + /** + * Triggered + */ + TRIGGERED = 'TRIGGERED', + /** + * Cancelled + */ + CANCELLED = 'CANCELLED', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts new file mode 100644 index 00000000..6dd07971 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts @@ -0,0 +1,48 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderDetailByOrderIdOrders + implements Serializable +{ + /** + * + */ + id?: string; + /** + * + */ + symbol?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + stopPrice?: string; + /** + * + */ + size?: string; + /** + * + */ + status?: string; + fromJson(input: string): GetOcoOrderDetailByOrderIdOrders { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderDetailByOrderIdOrders, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdOrders { + return plainToInstance(GetOcoOrderDetailByOrderIdOrders, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts new file mode 100644 index 00000000..8c305e2e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderDetailByOrderIdReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetOcoOrderDetailByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetOcoOrderDetailByOrderIdReq` object. + */ + static builder(): GetOcoOrderDetailByOrderIdReqBuilder { + return new GetOcoOrderDetailByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetOcoOrderDetailByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): GetOcoOrderDetailByOrderIdReq { + let obj = new GetOcoOrderDetailByOrderIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetOcoOrderDetailByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderDetailByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdReq { + return plainToInstance(GetOcoOrderDetailByOrderIdReq, jsonObject); + } +} + +export class GetOcoOrderDetailByOrderIdReqBuilder { + obj: GetOcoOrderDetailByOrderIdReq = new GetOcoOrderDetailByOrderIdReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): GetOcoOrderDetailByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetOcoOrderDetailByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts new file mode 100644 index 00000000..21faab8c --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetOcoOrderDetailByOrderIdOrders } from './model_get_oco_order_detail_by_order_id_orders'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOcoOrderDetailByOrderIdResp + implements Response +{ + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id + */ + clientOid?: string; + /** + * Order placement time, milliseconds + */ + orderTime?: number; + /** + * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled + */ + status?: string; + /** + * + */ + @Type(() => GetOcoOrderDetailByOrderIdOrders) + orders?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOcoOrderDetailByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderDetailByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdResp { + return plainToInstance(GetOcoOrderDetailByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts new file mode 100644 index 00000000..746589bf --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderListItems implements Serializable { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id + */ + clientOid?: string; + /** + * Order placement time, milliseconds + */ + orderTime?: number; + /** + * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled + */ + status?: GetOcoOrderListItems.StatusEnum; + fromJson(input: string): GetOcoOrderListItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderListItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderListItems { + return plainToInstance(GetOcoOrderListItems, jsonObject); + } +} + +export namespace GetOcoOrderListItems { + export enum StatusEnum { + /** + * New + */ + NEW = 'NEW', + /** + * Completed + */ + DONE = 'DONE', + /** + * Triggered + */ + TRIGGERED = 'TRIGGERED', + /** + * Cancelled + */ + CANCELLED = 'CANCELLED', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts new file mode 100644 index 00000000..665bab53 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts @@ -0,0 +1,145 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOcoOrderListReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Start time (milliseconds) + */ + startAt?: number; + /** + * End time (milliseconds) + */ + endAt?: number; + /** + * Specify orderId collection, up to 500 orders + */ + orderIds?: string; + /** + * Size per page, minimum value 10, maximum value 500 + */ + pageSize?: number = 50; + /** + * Page number, minimum value 1 + */ + currentPage?: number = 1; + + /** + * Creates a new instance of the `GetOcoOrderListReq` class. + * The builder pattern allows step-by-step construction of a `GetOcoOrderListReq` object. + */ + static builder(): GetOcoOrderListReqBuilder { + return new GetOcoOrderListReqBuilder(); + } + + /** + * Creates a new instance of the `GetOcoOrderListReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Start time (milliseconds) + */ + startAt?: number; + /** + * End time (milliseconds) + */ + endAt?: number; + /** + * Specify orderId collection, up to 500 orders + */ + orderIds?: string; + /** + * Size per page, minimum value 10, maximum value 500 + */ + pageSize?: number; + /** + * Page number, minimum value 1 + */ + currentPage?: number; + }): GetOcoOrderListReq { + let obj = new GetOcoOrderListReq(); + obj.symbol = data.symbol; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.orderIds = data.orderIds; + obj.pageSize = data.pageSize; + obj.currentPage = data.currentPage; + return obj; + } + + fromJson(input: string): GetOcoOrderListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderListReq { + return plainToInstance(GetOcoOrderListReq, jsonObject); + } +} + +export class GetOcoOrderListReqBuilder { + obj: GetOcoOrderListReq = new GetOcoOrderListReq(); + /** + * symbol + */ + setSymbol(value: string): GetOcoOrderListReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Start time (milliseconds) + */ + setStartAt(value: number): GetOcoOrderListReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milliseconds) + */ + setEndAt(value: number): GetOcoOrderListReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Specify orderId collection, up to 500 orders + */ + setOrderIds(value: string): GetOcoOrderListReqBuilder { + this.obj.orderIds = value; + return this; + } + + /** + * Size per page, minimum value 10, maximum value 500 + */ + setPageSize(value: number): GetOcoOrderListReqBuilder { + this.obj.pageSize = value; + return this; + } + + /** + * Page number, minimum value 1 + */ + setCurrentPage(value: number): GetOcoOrderListReqBuilder { + this.obj.currentPage = value; + return this; + } + + build(): GetOcoOrderListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts new file mode 100644 index 00000000..cdc1c41d --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetOcoOrderListItems } from './model_get_oco_order_list_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOcoOrderListResp implements Response { + /** + * + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetOcoOrderListItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOcoOrderListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOcoOrderListResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOcoOrderListResp { + return plainToInstance(GetOcoOrderListResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts new file mode 100644 index 00000000..3279ba35 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts @@ -0,0 +1,213 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOpenOrdersData implements Serializable { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOpenOrdersData.TypeEnum; + /** + * Buy or sell + */ + side?: GetOpenOrdersData.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) + */ + stp?: GetOpenOrdersData.StpEnum; + /** + * Time in force + */ + timeInForce?: GetOpenOrdersData.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + fromJson(input: string): GetOpenOrdersData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrdersData { + return plainToInstance(GetOpenOrdersData, jsonObject); + } +} + +export namespace GetOpenOrdersData { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts new file mode 100644 index 00000000..f628fe02 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts @@ -0,0 +1,60 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOpenOrdersReq implements Serializable { + /** + * symbol + */ + symbol?: string; + + /** + * Creates a new instance of the `GetOpenOrdersReq` class. + * The builder pattern allows step-by-step construction of a `GetOpenOrdersReq` object. + */ + static builder(): GetOpenOrdersReqBuilder { + return new GetOpenOrdersReqBuilder(); + } + + /** + * Creates a new instance of the `GetOpenOrdersReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + }): GetOpenOrdersReq { + let obj = new GetOpenOrdersReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetOpenOrdersReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOpenOrdersReq { + return plainToInstance(GetOpenOrdersReq, jsonObject); + } +} + +export class GetOpenOrdersReqBuilder { + obj: GetOpenOrdersReq = new GetOpenOrdersReq(); + /** + * symbol + */ + setSymbol(value: string): GetOpenOrdersReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetOpenOrdersReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts new file mode 100644 index 00000000..3e80bc6c --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetOpenOrdersData } from './model_get_open_orders_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOpenOrdersResp implements Response { + /** + * + */ + @Type(() => GetOpenOrdersData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOpenOrdersResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOpenOrdersResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetOpenOrdersResp { + return plainToInstance(GetOpenOrdersResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts new file mode 100644 index 00000000..55066102 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByClientOidOldReq implements Serializable { + /** + * Unique order id created by users to identify their orders + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `GetOrderByClientOidOldReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByClientOidOldReq` object. + */ + static builder(): GetOrderByClientOidOldReqBuilder { + return new GetOrderByClientOidOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByClientOidOldReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders + */ + clientOid?: string; + }): GetOrderByClientOidOldReq { + let obj = new GetOrderByClientOidOldReq(); + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): GetOrderByClientOidOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidOldReq { + return plainToInstance(GetOrderByClientOidOldReq, jsonObject); + } +} + +export class GetOrderByClientOidOldReqBuilder { + obj: GetOrderByClientOidOldReq = new GetOrderByClientOidOldReq(); + /** + * Unique order id created by users to identify their orders + */ + setClientOid(value: string): GetOrderByClientOidOldReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): GetOrderByClientOidOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts new file mode 100644 index 00000000..89685295 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts @@ -0,0 +1,151 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByClientOidOldResp + implements Response +{ + /** + * + */ + id?: string; + /** + * + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * + */ + type?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + dealFunds?: string; + /** + * + */ + dealSize?: string; + /** + * + */ + fee?: string; + /** + * + */ + feeCurrency?: string; + /** + * + */ + stp?: string; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * + */ + timeInForce?: string; + /** + * + */ + postOnly?: boolean; + /** + * + */ + hidden?: boolean; + /** + * + */ + iceberg?: boolean; + /** + * + */ + visibleSize?: string; + /** + * + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * + */ + clientOid?: string; + /** + * + */ + remark?: string; + /** + * + */ + tags?: string; + /** + * + */ + isActive?: boolean; + /** + * + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + tradeType?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByClientOidOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidOldResp { + return plainToInstance(GetOrderByClientOidOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts new file mode 100644 index 00000000..18d40759 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByClientOidReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + @Reflect.metadata('path', 'clientOid') + clientOid?: string; + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. + */ + static builder(): GetOrderByClientOidReqBuilder { + return new GetOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + }): GetOrderByClientOidReq { + let obj = new GetOrderByClientOidReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): GetOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidReq { + return plainToInstance(GetOrderByClientOidReq, jsonObject); + } +} + +export class GetOrderByClientOidReqBuilder { + obj: GetOrderByClientOidReq = new GetOrderByClientOidReq(); + /** + * symbol + */ + setSymbol(value: string): GetOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Client Order Id,unique identifier created by the user + */ + setClientOid(value: string): GetOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): GetOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts new file mode 100644 index 00000000..4edcecdc --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts @@ -0,0 +1,224 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByClientOidResp implements Response { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOrderByClientOidResp.TypeEnum; + /** + * Buy or sell + */ + side?: GetOrderByClientOidResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) + */ + stp?: GetOrderByClientOidResp.StpEnum; + /** + * Time in force + */ + timeInForce?: GetOrderByClientOidResp.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByClientOidResp { + return plainToInstance(GetOrderByClientOidResp, jsonObject); + } +} + +export namespace GetOrderByClientOidResp { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts new file mode 100644 index 00000000..c07de168 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByOrderIdOldReq implements Serializable { + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetOrderByOrderIdOldReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdOldReq` object. + */ + static builder(): GetOrderByOrderIdOldReqBuilder { + return new GetOrderByOrderIdOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByOrderIdOldReq` class with the given data. + */ + static create(data: { + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): GetOrderByOrderIdOldReq { + let obj = new GetOrderByOrderIdOldReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetOrderByOrderIdOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdOldReq { + return plainToInstance(GetOrderByOrderIdOldReq, jsonObject); + } +} + +export class GetOrderByOrderIdOldReqBuilder { + obj: GetOrderByOrderIdOldReq = new GetOrderByOrderIdOldReq(); + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): GetOrderByOrderIdOldReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetOrderByOrderIdOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts new file mode 100644 index 00000000..9acfc8db --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts @@ -0,0 +1,149 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByOrderIdOldResp implements Response { + /** + * + */ + id?: string; + /** + * + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * + */ + type?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + dealFunds?: string; + /** + * + */ + dealSize?: string; + /** + * + */ + fee?: string; + /** + * + */ + feeCurrency?: string; + /** + * + */ + stp?: string; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * + */ + timeInForce?: string; + /** + * + */ + postOnly?: boolean; + /** + * + */ + hidden?: boolean; + /** + * + */ + iceberg?: boolean; + /** + * + */ + visibleSize?: string; + /** + * + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * + */ + clientOid?: string; + /** + * + */ + remark?: string; + /** + * + */ + tags?: string; + /** + * + */ + isActive?: boolean; + /** + * + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + tradeType?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByOrderIdOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdOldResp { + return plainToInstance(GetOrderByOrderIdOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts new file mode 100644 index 00000000..c823c0ca --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts @@ -0,0 +1,79 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrderByOrderIdReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. + */ + static builder(): GetOrderByOrderIdReqBuilder { + return new GetOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + }): GetOrderByOrderIdReq { + let obj = new GetOrderByOrderIdReq(); + obj.symbol = data.symbol; + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToInstance(GetOrderByOrderIdReq, jsonObject); + } +} + +export class GetOrderByOrderIdReqBuilder { + obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + /** + * symbol + */ + setSymbol(value: string): GetOrderByOrderIdReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The unique order id generated by the trading system + */ + setOrderId(value: string): GetOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts new file mode 100644 index 00000000..750d9929 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts @@ -0,0 +1,224 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrderByOrderIdResp implements Response { + /** + * The unique order id generated by the trading system + */ + id?: string; + /** + * symbol + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetOrderByOrderIdResp.TypeEnum; + /** + * Buy or sell + */ + side?: GetOrderByOrderIdResp.SideEnum; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * Number of filled transactions + */ + dealSize?: string; + /** + * Funds of filled transactions + */ + dealFunds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) + */ + stp?: GetOrderByOrderIdResp.StpEnum; + /** + * Time in force + */ + timeInForce?: GetOrderByOrderIdResp.TimeInForceEnum; + /** + * Whether its a postOnly order. + */ + postOnly?: boolean; + /** + * Whether its a hidden order. + */ + hidden?: boolean; + /** + * Whether its a iceberg order. + */ + iceberg?: boolean; + /** + * Visible size of iceberg order in order book. + */ + visibleSize?: string; + /** + * A GTT timeInForce that expires in n seconds + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * Client Order Id,unique identifier created by the user + */ + clientOid?: string; + /** + * Order placement remarks + */ + remark?: string; + /** + * Order tag + */ + tags?: string; + /** + * Whether there is a cancellation record for the order. + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + lastUpdatedAt?: number; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook + */ + inOrderBook?: boolean; + /** + * Number of canceled transactions + */ + cancelledSize?: string; + /** + * Funds of canceled transactions + */ + cancelledFunds?: string; + /** + * Number of remain transactions + */ + remainSize?: string; + /** + * Funds of remain transactions + */ + remainFunds?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Order status: true-The status of the order isactive; false-The status of the order is done + */ + active?: boolean; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrderByOrderIdResp { + return plainToInstance(GetOrderByOrderIdResp, jsonObject); + } +} + +export namespace GetOrderByOrderIdResp { + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum StpEnum { + /** + * + */ + DC = 'DC', + /** + * + */ + CO = 'CO', + /** + * + */ + CN = 'CN', + /** + * + */ + CB = 'CB', + } + export enum TimeInForceEnum { + /** + * + */ + GTC = 'GTC', + /** + * + */ + GTT = 'GTT', + /** + * + */ + IOC = 'IOC', + /** + * + */ + FOK = 'FOK', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts new file mode 100644 index 00000000..28bab27f --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts @@ -0,0 +1,138 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrdersListOldItems implements Serializable { + /** + * + */ + id?: string; + /** + * + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * + */ + type?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + dealFunds?: string; + /** + * + */ + dealSize?: string; + /** + * + */ + fee?: string; + /** + * + */ + feeCurrency?: string; + /** + * + */ + stp?: string; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * + */ + timeInForce?: string; + /** + * + */ + postOnly?: boolean; + /** + * + */ + hidden?: boolean; + /** + * + */ + iceberg?: boolean; + /** + * + */ + visibleSize?: string; + /** + * + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * + */ + clientOid?: string; + /** + * + */ + remark?: string; + /** + * + */ + tags?: string; + /** + * + */ + isActive?: boolean; + /** + * + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + tradeType?: string; + fromJson(input: string): GetOrdersListOldItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrdersListOldItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrdersListOldItems { + return plainToInstance(GetOrdersListOldItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts new file mode 100644 index 00000000..5c5f3b8b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts @@ -0,0 +1,251 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetOrdersListOldReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * active or done(done as default), Only list orders with a specific status . + */ + status?: GetOrdersListOldReq.StatusEnum = GetOrdersListOldReq.StatusEnum.DONE; + /** + * buy or sell + */ + side?: GetOrdersListOldReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetOrdersListOldReq.TypeEnum; + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + tradeType?: GetOrdersListOldReq.TradeTypeEnum = GetOrdersListOldReq.TradeTypeEnum.TRADE; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetOrdersListOldReq` class. + * The builder pattern allows step-by-step construction of a `GetOrdersListOldReq` object. + */ + static builder(): GetOrdersListOldReqBuilder { + return new GetOrdersListOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetOrdersListOldReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * active or done(done as default), Only list orders with a specific status . + */ + status?: GetOrdersListOldReq.StatusEnum; + /** + * buy or sell + */ + side?: GetOrdersListOldReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetOrdersListOldReq.TypeEnum; + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + tradeType?: GetOrdersListOldReq.TradeTypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetOrdersListOldReq { + let obj = new GetOrdersListOldReq(); + obj.symbol = data.symbol; + obj.status = data.status; + obj.side = data.side; + obj.type = data.type; + obj.tradeType = data.tradeType; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetOrdersListOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrdersListOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrdersListOldReq { + return plainToInstance(GetOrdersListOldReq, jsonObject); + } +} + +export namespace GetOrdersListOldReq { + export enum StatusEnum { + /** + * Active order + */ + ACTIVE = 'active', + /** + * Done orders + */ + DONE = 'done', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + /** + * limit_stop + */ + LIMIT_STOP = 'limit_stop', + /** + * market_stop + */ + MARKET_STOP = 'market_stop', + } + export enum TradeTypeEnum { + /** + * Spot Trading + */ + TRADE = 'TRADE', + /** + * Cross Margin Trading + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * Isolated Margin Trading + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class GetOrdersListOldReqBuilder { + obj: GetOrdersListOldReq = new GetOrdersListOldReq(); + /** + * symbol + */ + setSymbol(value: string): GetOrdersListOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * active or done(done as default), Only list orders with a specific status . + */ + setStatus(value: GetOrdersListOldReq.StatusEnum): GetOrdersListOldReqBuilder { + this.obj.status = value; + return this; + } + + /** + * buy or sell + */ + setSide(value: GetOrdersListOldReq.SideEnum): GetOrdersListOldReqBuilder { + this.obj.side = value; + return this; + } + + /** + * limit, market, limit_stop or market_stop + */ + setType(value: GetOrdersListOldReq.TypeEnum): GetOrdersListOldReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + setTradeType(value: GetOrdersListOldReq.TradeTypeEnum): GetOrdersListOldReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetOrdersListOldReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetOrdersListOldReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetOrdersListOldReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetOrdersListOldReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetOrdersListOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts new file mode 100644 index 00000000..7cb4f708 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetOrdersListOldItems } from './model_get_orders_list_old_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetOrdersListOldResp implements Response { + /** + * + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetOrdersListOldItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetOrdersListOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetOrdersListOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetOrdersListOldResp { + return plainToInstance(GetOrdersListOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts new file mode 100644 index 00000000..19a95158 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts @@ -0,0 +1,138 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentOrdersListOldData implements Serializable { + /** + * + */ + id?: string; + /** + * + */ + symbol?: string; + /** + * + */ + opType?: string; + /** + * + */ + type?: string; + /** + * + */ + side?: string; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + dealFunds?: string; + /** + * + */ + dealSize?: string; + /** + * + */ + fee?: string; + /** + * + */ + feeCurrency?: string; + /** + * + */ + stp?: string; + /** + * + */ + stop?: string; + /** + * + */ + stopTriggered?: boolean; + /** + * + */ + stopPrice?: string; + /** + * + */ + timeInForce?: string; + /** + * + */ + postOnly?: boolean; + /** + * + */ + hidden?: boolean; + /** + * + */ + iceberg?: boolean; + /** + * + */ + visibleSize?: string; + /** + * + */ + cancelAfter?: number; + /** + * + */ + channel?: string; + /** + * + */ + clientOid?: string; + /** + * + */ + remark?: string; + /** + * + */ + tags?: string; + /** + * + */ + isActive?: boolean; + /** + * + */ + cancelExist?: boolean; + /** + * + */ + createdAt?: number; + /** + * + */ + tradeType?: string; + fromJson(input: string): GetRecentOrdersListOldData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentOrdersListOldData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentOrdersListOldData { + return plainToInstance(GetRecentOrdersListOldData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts new file mode 100644 index 00000000..6bef2096 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentOrdersListOldReq implements Serializable { + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number = 50; + + /** + * Creates a new instance of the `GetRecentOrdersListOldReq` class. + * The builder pattern allows step-by-step construction of a `GetRecentOrdersListOldReq` object. + */ + static builder(): GetRecentOrdersListOldReqBuilder { + return new GetRecentOrdersListOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetRecentOrdersListOldReq` class with the given data. + */ + static create(data: { + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetRecentOrdersListOldReq { + let obj = new GetRecentOrdersListOldReq(); + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetRecentOrdersListOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentOrdersListOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentOrdersListOldReq { + return plainToInstance(GetRecentOrdersListOldReq, jsonObject); + } +} + +export class GetRecentOrdersListOldReqBuilder { + obj: GetRecentOrdersListOldReq = new GetRecentOrdersListOldReq(); + /** + * Current request page. + */ + setCurrentPage(value: number): GetRecentOrdersListOldReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetRecentOrdersListOldReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetRecentOrdersListOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts new file mode 100644 index 00000000..f0c64c3a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetRecentOrdersListOldData } from './model_get_recent_orders_list_old_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRecentOrdersListOldResp + implements Response +{ + /** + * + */ + @Type(() => GetRecentOrdersListOldData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRecentOrdersListOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentOrdersListOldResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetRecentOrdersListOldResp { + return plainToInstance(GetRecentOrdersListOldResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts new file mode 100644 index 00000000..e2b3215c --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts @@ -0,0 +1,86 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentTradeHistoryOldData implements Serializable { + /** + * + */ + symbol?: string; + /** + * + */ + tradeId?: string; + /** + * + */ + orderId?: string; + /** + * + */ + counterOrderId?: string; + /** + * + */ + side?: string; + /** + * + */ + liquidity?: string; + /** + * + */ + forceTaker?: boolean; + /** + * + */ + price?: string; + /** + * + */ + size?: string; + /** + * + */ + funds?: string; + /** + * + */ + fee?: string; + /** + * + */ + feeRate?: string; + /** + * + */ + feeCurrency?: string; + /** + * + */ + stop?: string; + /** + * + */ + tradeType?: string; + /** + * + */ + type?: string; + /** + * + */ + createdAt?: number; + fromJson(input: string): GetRecentTradeHistoryOldData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryOldData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryOldData { + return plainToInstance(GetRecentTradeHistoryOldData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts new file mode 100644 index 00000000..dffec6dc --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetRecentTradeHistoryOldReq implements Serializable { + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + + /** + * Creates a new instance of the `GetRecentTradeHistoryOldReq` class. + * The builder pattern allows step-by-step construction of a `GetRecentTradeHistoryOldReq` object. + */ + static builder(): GetRecentTradeHistoryOldReqBuilder { + return new GetRecentTradeHistoryOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetRecentTradeHistoryOldReq` class with the given data. + */ + static create(data: { + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetRecentTradeHistoryOldReq { + let obj = new GetRecentTradeHistoryOldReq(); + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetRecentTradeHistoryOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryOldReq { + return plainToInstance(GetRecentTradeHistoryOldReq, jsonObject); + } +} + +export class GetRecentTradeHistoryOldReqBuilder { + obj: GetRecentTradeHistoryOldReq = new GetRecentTradeHistoryOldReq(); + /** + * Current request page. + */ + setCurrentPage(value: number): GetRecentTradeHistoryOldReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetRecentTradeHistoryOldReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetRecentTradeHistoryOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts new file mode 100644 index 00000000..d7ea292b --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetRecentTradeHistoryOldData } from './model_get_recent_trade_history_old_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetRecentTradeHistoryOldResp + implements Response +{ + /** + * + */ + @Type(() => GetRecentTradeHistoryOldData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetRecentTradeHistoryOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetRecentTradeHistoryOldResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetRecentTradeHistoryOldResp { + return plainToInstance(GetRecentTradeHistoryOldResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts new file mode 100644 index 00000000..3376be87 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts @@ -0,0 +1,142 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrderByClientOidData implements Serializable { + /** + * Order ID, the ID of an order. + */ + id?: string; + /** + * Symbol name + */ + symbol?: string; + /** + * User ID + */ + userId?: string; + /** + * Order status, include NEW, TRIGGERED + */ + status?: string; + /** + * Order type,limit, market, limit_stop or market_stop + */ + type?: string; + /** + * transaction direction,include buy and sell + */ + side?: string; + /** + * order price + */ + price?: string; + /** + * order quantity + */ + size?: string; + /** + * order funds + */ + funds?: string; + /** + * + */ + stp?: string; + /** + * time InForce,include GTC,GTT,IOC,FOK + */ + timeInForce?: string; + /** + * cancel orders after n seconds,requires timeInForce to be GTT + */ + cancelAfter?: number; + /** + * postOnly + */ + postOnly?: boolean; + /** + * hidden order + */ + hidden?: boolean; + /** + * Iceberg order + */ + iceberg?: boolean; + /** + * displayed quantity for iceberg order + */ + visibleSize?: string; + /** + * order source + */ + channel?: string; + /** + * user-entered order unique mark + */ + clientOid?: string; + /** + * Remarks at stop order creation + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * domainId, e.g: kucoin + */ + domainId?: string; + /** + * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) + */ + tradeSource?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). + */ + tradeType?: string; + /** + * The currency of the fee + */ + feeCurrency?: string; + /** + * Fee Rate of taker + */ + takerFeeRate?: string; + /** + * Fee Rate of maker + */ + makerFeeRate?: string; + /** + * order creation time + */ + createdAt?: number; + /** + * Stop order type, include loss and entry + */ + stop?: string; + /** + * The trigger time of the stop order + */ + stopTriggerTime?: number; + /** + * stop price + */ + stopPrice?: string; + /** + * Time of place a stop order, accurate to nanoseconds + */ + orderTime?: number; + fromJson(input: string): GetStopOrderByClientOidData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderByClientOidData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderByClientOidData { + return plainToInstance(GetStopOrderByClientOidData, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts new file mode 100644 index 00000000..f12679ae --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrderByClientOidReq implements Serializable { + /** + * The client order id + */ + clientOid?: string; + /** + * symbol name + */ + symbol?: string; + + /** + * Creates a new instance of the `GetStopOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `GetStopOrderByClientOidReq` object. + */ + static builder(): GetStopOrderByClientOidReqBuilder { + return new GetStopOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `GetStopOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * The client order id + */ + clientOid?: string; + /** + * symbol name + */ + symbol?: string; + }): GetStopOrderByClientOidReq { + let obj = new GetStopOrderByClientOidReq(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetStopOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderByClientOidReq { + return plainToInstance(GetStopOrderByClientOidReq, jsonObject); + } +} + +export class GetStopOrderByClientOidReqBuilder { + obj: GetStopOrderByClientOidReq = new GetStopOrderByClientOidReq(); + /** + * The client order id + */ + setClientOid(value: string): GetStopOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol name + */ + setSymbol(value: string): GetStopOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetStopOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts new file mode 100644 index 00000000..e728fa98 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetStopOrderByClientOidData } from './model_get_stop_order_by_client_oid_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetStopOrderByClientOidResp + implements Response +{ + /** + * the return code + */ + @Type(() => GetStopOrderByClientOidData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetStopOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderByClientOidResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetStopOrderByClientOidResp { + return plainToInstance(GetStopOrderByClientOidResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts new file mode 100644 index 00000000..e16961f0 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts @@ -0,0 +1,62 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import 'reflect-metadata'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrderByOrderIdReq implements Serializable { + /** + * The order id + */ + @Reflect.metadata('path', 'orderId') + orderId?: string; + + /** + * Creates a new instance of the `GetStopOrderByOrderIdReq` class. + * The builder pattern allows step-by-step construction of a `GetStopOrderByOrderIdReq` object. + */ + static builder(): GetStopOrderByOrderIdReqBuilder { + return new GetStopOrderByOrderIdReqBuilder(); + } + + /** + * Creates a new instance of the `GetStopOrderByOrderIdReq` class with the given data. + */ + static create(data: { + /** + * The order id + */ + orderId?: string; + }): GetStopOrderByOrderIdReq { + let obj = new GetStopOrderByOrderIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): GetStopOrderByOrderIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderByOrderIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderByOrderIdReq { + return plainToInstance(GetStopOrderByOrderIdReq, jsonObject); + } +} + +export class GetStopOrderByOrderIdReqBuilder { + obj: GetStopOrderByOrderIdReq = new GetStopOrderByOrderIdReq(); + /** + * The order id + */ + setOrderId(value: string): GetStopOrderByOrderIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): GetStopOrderByOrderIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts new file mode 100644 index 00000000..65994fc7 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts @@ -0,0 +1,155 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetStopOrderByOrderIdResp + implements Response +{ + /** + * Order ID, the ID of an order. + */ + id?: string; + /** + * Symbol name + */ + symbol?: string; + /** + * User ID + */ + userId?: string; + /** + * Order status, include NEW, TRIGGERED + */ + status?: string; + /** + * Order type,limit, market, limit_stop or market_stop + */ + type?: string; + /** + * transaction direction,include buy and sell + */ + side?: string; + /** + * order price + */ + price?: string; + /** + * order quantity + */ + size?: string; + /** + * order funds + */ + funds?: string; + /** + * + */ + stp?: string; + /** + * time InForce,include GTC,GTT,IOC,FOK + */ + timeInForce?: string; + /** + * cancel orders after n seconds,requires timeInForce to be GTT + */ + cancelAfter?: number; + /** + * postOnly + */ + postOnly?: boolean; + /** + * hidden order + */ + hidden?: boolean; + /** + * Iceberg order + */ + iceberg?: boolean; + /** + * displayed quantity for iceberg order + */ + visibleSize?: string; + /** + * order source + */ + channel?: string; + /** + * user-entered order unique mark + */ + clientOid?: string; + /** + * Remarks at stop order creation + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * domainId, e.g: kucoin + */ + domainId?: string; + /** + * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) + */ + tradeSource?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). + */ + tradeType?: string; + /** + * The currency of the fee + */ + feeCurrency?: string; + /** + * Fee Rate of taker + */ + takerFeeRate?: string; + /** + * Fee Rate of maker + */ + makerFeeRate?: string; + /** + * order creation time + */ + createdAt?: number; + /** + * Stop order type, include loss and entry + */ + stop?: string; + /** + * The trigger time of the stop order + */ + stopTriggerTime?: number; + /** + * stop price + */ + stopPrice?: string; + /** + * Time of place a stop order, accurate to nanoseconds + */ + orderTime?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetStopOrderByOrderIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrderByOrderIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrderByOrderIdResp { + return plainToInstance(GetStopOrderByOrderIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts new file mode 100644 index 00000000..b50886a9 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts @@ -0,0 +1,142 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrdersListItems implements Serializable { + /** + * Order ID, the ID of an order. + */ + id?: string; + /** + * Symbol name + */ + symbol?: string; + /** + * User ID + */ + userId?: string; + /** + * Order status, include NEW, TRIGGERED + */ + status?: string; + /** + * Order type,limit, market, limit_stop or market_stop + */ + type?: string; + /** + * transaction direction,include buy and sell + */ + side?: string; + /** + * order price + */ + price?: string; + /** + * order quantity + */ + size?: string; + /** + * order funds + */ + funds?: string; + /** + * + */ + stp?: string; + /** + * time InForce,include GTC,GTT,IOC,FOK + */ + timeInForce?: string; + /** + * cancel orders after n seconds,requires timeInForce to be GTT + */ + cancelAfter?: number; + /** + * postOnly + */ + postOnly?: boolean; + /** + * hidden order + */ + hidden?: boolean; + /** + * Iceberg order + */ + iceberg?: boolean; + /** + * displayed quantity for iceberg order + */ + visibleSize?: string; + /** + * order source + */ + channel?: string; + /** + * user-entered order unique mark + */ + clientOid?: string; + /** + * Remarks at stop order creation + */ + remark?: string; + /** + * tag order source + */ + tags?: string; + /** + * Time of place a stop order, accurate to nanoseconds + */ + orderTime?: number; + /** + * domainId, e.g: kucoin + */ + domainId?: string; + /** + * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) + */ + tradeSource?: string; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). + */ + tradeType?: string; + /** + * The currency of the fee + */ + feeCurrency?: string; + /** + * Fee Rate of taker + */ + takerFeeRate?: string; + /** + * Fee Rate of maker + */ + makerFeeRate?: string; + /** + * order creation time + */ + createdAt?: number; + /** + * Stop order type, include loss and entry + */ + stop?: string; + /** + * The trigger time of the stop order + */ + stopTriggerTime?: number; + /** + * stop price + */ + stopPrice?: string; + fromJson(input: string): GetStopOrdersListItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrdersListItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrdersListItems { + return plainToInstance(GetStopOrdersListItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts new file mode 100644 index 00000000..8b8b8dbd --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts @@ -0,0 +1,258 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetStopOrdersListReq implements Serializable { + /** + * Only list orders for a specific symbol + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetStopOrdersListReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetStopOrdersListReq.TypeEnum; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: GetStopOrdersListReq.TradeTypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * current page + */ + currentPage?: number; + /** + * comma seperated order ID list + */ + orderIds?: string; + /** + * page size + */ + pageSize?: number; + /** + * Order type: stop: stop loss order, oco: oco order + */ + stop?: string; + + /** + * Creates a new instance of the `GetStopOrdersListReq` class. + * The builder pattern allows step-by-step construction of a `GetStopOrdersListReq` object. + */ + static builder(): GetStopOrdersListReqBuilder { + return new GetStopOrdersListReqBuilder(); + } + + /** + * Creates a new instance of the `GetStopOrdersListReq` class with the given data. + */ + static create(data: { + /** + * Only list orders for a specific symbol + */ + symbol?: string; + /** + * buy or sell + */ + side?: GetStopOrdersListReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetStopOrdersListReq.TypeEnum; + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + tradeType?: GetStopOrdersListReq.TradeTypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * current page + */ + currentPage?: number; + /** + * comma seperated order ID list + */ + orderIds?: string; + /** + * page size + */ + pageSize?: number; + /** + * Order type: stop: stop loss order, oco: oco order + */ + stop?: string; + }): GetStopOrdersListReq { + let obj = new GetStopOrdersListReq(); + obj.symbol = data.symbol; + obj.side = data.side; + obj.type = data.type; + obj.tradeType = data.tradeType; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.orderIds = data.orderIds; + obj.pageSize = data.pageSize; + obj.stop = data.stop; + return obj; + } + + fromJson(input: string): GetStopOrdersListReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrdersListReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrdersListReq { + return plainToInstance(GetStopOrdersListReq, jsonObject); + } +} + +export namespace GetStopOrdersListReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + /** + * + */ + LIMIT_STOP = 'limit_stop', + /** + * + */ + MARKET_STOP = 'market_stop', + } + export enum TradeTypeEnum { + /** + * + */ + TRADE = 'TRADE', + /** + * + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class GetStopOrdersListReqBuilder { + obj: GetStopOrdersListReq = new GetStopOrdersListReq(); + /** + * Only list orders for a specific symbol + */ + setSymbol(value: string): GetStopOrdersListReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * buy or sell + */ + setSide(value: GetStopOrdersListReq.SideEnum): GetStopOrdersListReqBuilder { + this.obj.side = value; + return this; + } + + /** + * limit, market, limit_stop or market_stop + */ + setType(value: GetStopOrdersListReq.TypeEnum): GetStopOrdersListReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE + */ + setTradeType(value: GetStopOrdersListReq.TradeTypeEnum): GetStopOrdersListReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetStopOrdersListReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetStopOrdersListReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * current page + */ + setCurrentPage(value: number): GetStopOrdersListReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * comma seperated order ID list + */ + setOrderIds(value: string): GetStopOrdersListReqBuilder { + this.obj.orderIds = value; + return this; + } + + /** + * page size + */ + setPageSize(value: number): GetStopOrdersListReqBuilder { + this.obj.pageSize = value; + return this; + } + + /** + * Order type: stop: stop loss order, oco: oco order + */ + setStop(value: string): GetStopOrdersListReqBuilder { + this.obj.stop = value; + return this; + } + + build(): GetStopOrdersListReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts new file mode 100644 index 00000000..84e64270 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetStopOrdersListItems } from './model_get_stop_orders_list_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetStopOrdersListResp implements Response { + /** + * current page id + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * the stop order count + */ + totalNum?: number; + /** + * total page count of the list + */ + totalPage?: number; + /** + * the list of stop orders + */ + @Type(() => GetStopOrdersListItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetStopOrdersListResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetStopOrdersListResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetStopOrdersListResp { + return plainToInstance(GetStopOrdersListResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts new file mode 100644 index 00000000..4f42ca50 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetSymbolsWithOpenOrderResp + implements Response +{ + /** + * The symbol that has active orders + */ + symbols?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetSymbolsWithOpenOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { + return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts new file mode 100644 index 00000000..d140561a --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts @@ -0,0 +1,131 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryItems implements Serializable { + /** + * Id of transaction detail + */ + id?: number; + /** + * symbol + */ + symbol?: string; + /** + * Trade Id, symbol latitude increment + */ + tradeId?: number; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Counterparty order Id + */ + counterOrderId?: string; + /** + * Buy or sell + */ + side?: GetTradeHistoryItems.SideEnum; + /** + * Liquidity type: taker or maker + */ + liquidity?: GetTradeHistoryItems.LiquidityEnum; + /** + * + */ + forceTaker?: boolean; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * Fee rate + */ + feeRate?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty + */ + stop?: string; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Tax Rate, Users in some regions need query this field + */ + taxRate?: string; + /** + * Users in some regions need query this field + */ + tax?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryItems.TypeEnum; + /** + * + */ + createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToInstance(GetTradeHistoryItems, jsonObject); + } +} + +export namespace GetTradeHistoryItems { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum LiquidityEnum { + /** + * + */ + TAKER = 'taker', + /** + * + */ + MAKER = 'maker', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts new file mode 100644 index 00000000..e27b1820 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts @@ -0,0 +1,86 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryOldItems implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * + */ + tradeId?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Counterparty order Id + */ + counterOrderId?: string; + /** + * Buy or sell + */ + side?: string; + /** + * Liquidity type: taker or maker + */ + liquidity?: string; + /** + * + */ + forceTaker?: boolean; + /** + * Order price + */ + price?: string; + /** + * Order size + */ + size?: string; + /** + * Order Funds + */ + funds?: string; + /** + * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) + */ + fee?: string; + /** + * Fee rate + */ + feeRate?: string; + /** + * currency used to calculate trading fee + */ + feeCurrency?: string; + /** + * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty + */ + stop?: string; + /** + * Trade type, redundancy param + */ + tradeType?: string; + /** + * Specify if the order is an \'limit\' order or \'market\' order. + */ + type?: string; + /** + * + */ + createdAt?: number; + fromJson(input: string): GetTradeHistoryOldItems { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryOldItems, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryOldItems { + return plainToInstance(GetTradeHistoryOldItems, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts new file mode 100644 index 00000000..ad8c5d8e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts @@ -0,0 +1,241 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryOldReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryOldReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetTradeHistoryOldReq.TypeEnum; + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + tradeType?: GetTradeHistoryOldReq.TradeTypeEnum = GetTradeHistoryOldReq.TradeTypeEnum.TRADE; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number = 1; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + + /** + * Creates a new instance of the `GetTradeHistoryOldReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryOldReq` object. + */ + static builder(): GetTradeHistoryOldReqBuilder { + return new GetTradeHistoryOldReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryOldReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryOldReq.SideEnum; + /** + * limit, market, limit_stop or market_stop + */ + type?: GetTradeHistoryOldReq.TypeEnum; + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + tradeType?: GetTradeHistoryOldReq.TradeTypeEnum; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + /** + * Current request page. + */ + currentPage?: number; + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + pageSize?: number; + }): GetTradeHistoryOldReq { + let obj = new GetTradeHistoryOldReq(); + obj.symbol = data.symbol; + obj.orderId = data.orderId; + obj.side = data.side; + obj.type = data.type; + obj.tradeType = data.tradeType; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + obj.currentPage = data.currentPage; + obj.pageSize = data.pageSize; + return obj; + } + + fromJson(input: string): GetTradeHistoryOldReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryOldReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryOldReq { + return plainToInstance(GetTradeHistoryOldReq, jsonObject); + } +} + +export namespace GetTradeHistoryOldReq { + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + /** + * limit_stop + */ + LIMIT_STOP = 'limit_stop', + /** + * market_stop + */ + MARKET_STOP = 'market_stop', + } + export enum TradeTypeEnum { + /** + * Spot Trading + */ + TRADE = 'TRADE', + /** + * Cross Margin Trading + */ + MARGIN_TRADE = 'MARGIN_TRADE', + /** + * Isolated Margin Trading + */ + MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE', + } +} + +export class GetTradeHistoryOldReqBuilder { + obj: GetTradeHistoryOldReq = new GetTradeHistoryOldReq(); + /** + * symbol + */ + setSymbol(value: string): GetTradeHistoryOldReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + setOrderId(value: string): GetTradeHistoryOldReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: GetTradeHistoryOldReq.SideEnum): GetTradeHistoryOldReqBuilder { + this.obj.side = value; + return this; + } + + /** + * limit, market, limit_stop or market_stop + */ + setType(value: GetTradeHistoryOldReq.TypeEnum): GetTradeHistoryOldReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. + */ + setTradeType(value: GetTradeHistoryOldReq.TradeTypeEnum): GetTradeHistoryOldReqBuilder { + this.obj.tradeType = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetTradeHistoryOldReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetTradeHistoryOldReqBuilder { + this.obj.endAt = value; + return this; + } + + /** + * Current request page. + */ + setCurrentPage(value: number): GetTradeHistoryOldReqBuilder { + this.obj.currentPage = value; + return this; + } + + /** + * Number of results per request. Minimum is 10, maximum is 500. + */ + setPageSize(value: number): GetTradeHistoryOldReqBuilder { + this.obj.pageSize = value; + return this; + } + + build(): GetTradeHistoryOldReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts new file mode 100644 index 00000000..6b1e05b1 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts @@ -0,0 +1,51 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetTradeHistoryOldItems } from './model_get_trade_history_old_items'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryOldResp implements Response { + /** + * + */ + currentPage?: number; + /** + * + */ + pageSize?: number; + /** + * + */ + totalNum?: number; + /** + * + */ + totalPage?: number; + /** + * + */ + @Type(() => GetTradeHistoryOldItems) + items?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryOldResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryOldResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryOldResp { + return plainToInstance(GetTradeHistoryOldResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts new file mode 100644 index 00000000..a6abbe19 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts @@ -0,0 +1,202 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetTradeHistoryReq implements Serializable { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number = 20; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + + /** + * Creates a new instance of the `GetTradeHistoryReq` class. + * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. + */ + static builder(): GetTradeHistoryReqBuilder { + return new GetTradeHistoryReqBuilder(); + } + + /** + * Creates a new instance of the `GetTradeHistoryReq` class with the given data. + */ + static create(data: { + /** + * symbol + */ + symbol?: string; + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + orderId?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: GetTradeHistoryReq.SideEnum; + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + type?: GetTradeHistoryReq.TypeEnum; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * Default20,Max100 + */ + limit?: number; + /** + * Start time (milisecond) + */ + startAt?: number; + /** + * End time (milisecond) + */ + endAt?: number; + }): GetTradeHistoryReq { + let obj = new GetTradeHistoryReq(); + obj.symbol = data.symbol; + obj.orderId = data.orderId; + obj.side = data.side; + obj.type = data.type; + obj.lastId = data.lastId; + obj.limit = data.limit; + obj.startAt = data.startAt; + obj.endAt = data.endAt; + return obj; + } + + fromJson(input: string): GetTradeHistoryReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToInstance(GetTradeHistoryReq, jsonObject); + } +} + +export namespace GetTradeHistoryReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } +} + +export class GetTradeHistoryReqBuilder { + obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + /** + * symbol + */ + setSymbol(value: string): GetTradeHistoryReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) + */ + setOrderId(value: string): GetTradeHistoryReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: GetTradeHistoryReq.SideEnum): GetTradeHistoryReqBuilder { + this.obj.side = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order. + */ + setType(value: GetTradeHistoryReq.TypeEnum): GetTradeHistoryReqBuilder { + this.obj.type = value; + return this; + } + + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + setLastId(value: number): GetTradeHistoryReqBuilder { + this.obj.lastId = value; + return this; + } + + /** + * Default20,Max100 + */ + setLimit(value: number): GetTradeHistoryReqBuilder { + this.obj.limit = value; + return this; + } + + /** + * Start time (milisecond) + */ + setStartAt(value: number): GetTradeHistoryReqBuilder { + this.obj.startAt = value; + return this; + } + + /** + * End time (milisecond) + */ + setEndAt(value: number): GetTradeHistoryReqBuilder { + this.obj.endAt = value; + return this; + } + + build(): GetTradeHistoryReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts new file mode 100644 index 00000000..8620360e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetTradeHistoryItems } from './model_get_trade_history_items'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetTradeHistoryResp implements Response { + /** + * + */ + @Type(() => GetTradeHistoryItems) + items?: Array; + /** + * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. + */ + lastId?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetTradeHistoryResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetTradeHistoryResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetTradeHistoryResp { + return plainToInstance(GetTradeHistoryResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_modify_order_req.ts b/sdk/node/src/generate/spot/order/model_modify_order_req.ts new file mode 100644 index 00000000..f6e2055e --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_modify_order_req.ts @@ -0,0 +1,128 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class ModifyOrderReq implements Serializable { + /** + * The old client order id,orderId and clientOid must choose one + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * The old order id, orderId and clientOid must choose one + */ + orderId?: string; + /** + * The modified price of the new order, newPrice and newSize must choose one + */ + newPrice?: string; + /** + * The modified size of the new order, newPrice and newSize must choose one + */ + newSize?: string; + + /** + * Creates a new instance of the `ModifyOrderReq` class. + * The builder pattern allows step-by-step construction of a `ModifyOrderReq` object. + */ + static builder(): ModifyOrderReqBuilder { + return new ModifyOrderReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyOrderReq` class with the given data. + */ + static create(data: { + /** + * The old client order id,orderId and clientOid must choose one + */ + clientOid?: string; + /** + * symbol + */ + symbol?: string; + /** + * The old order id, orderId and clientOid must choose one + */ + orderId?: string; + /** + * The modified price of the new order, newPrice and newSize must choose one + */ + newPrice?: string; + /** + * The modified size of the new order, newPrice and newSize must choose one + */ + newSize?: string; + }): ModifyOrderReq { + let obj = new ModifyOrderReq(); + obj.clientOid = data.clientOid; + obj.symbol = data.symbol; + obj.orderId = data.orderId; + obj.newPrice = data.newPrice; + obj.newSize = data.newSize; + return obj; + } + + fromJson(input: string): ModifyOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyOrderReq { + return plainToInstance(ModifyOrderReq, jsonObject); + } +} + +export class ModifyOrderReqBuilder { + obj: ModifyOrderReq = new ModifyOrderReq(); + /** + * The old client order id,orderId and clientOid must choose one + */ + setClientOid(value: string): ModifyOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * symbol + */ + setSymbol(value: string): ModifyOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The old order id, orderId and clientOid must choose one + */ + setOrderId(value: string): ModifyOrderReqBuilder { + this.obj.orderId = value; + return this; + } + + /** + * The modified price of the new order, newPrice and newSize must choose one + */ + setNewPrice(value: string): ModifyOrderReqBuilder { + this.obj.newPrice = value; + return this; + } + + /** + * The modified size of the new order, newPrice and newSize must choose one + */ + setNewSize(value: string): ModifyOrderReqBuilder { + this.obj.newSize = value; + return this; + } + + build(): ModifyOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts new file mode 100644 index 00000000..6854db90 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class ModifyOrderResp implements Response { + /** + * The new order id + */ + newOrderId?: string; + /** + * The original client order id + */ + clientOid?: string; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyOrderResp { + return plainToInstance(ModifyOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts new file mode 100644 index 00000000..48e952a1 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SetDCPReq implements Serializable { + /** + * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. + */ + timeout?: number; + /** + * List of trading pairs. When this parameter is not empty, separate it with commas and support up to 50 trading pairs. Empty means all trading pairs. When this parameter is changed, the previous setting will be overwritten. + */ + symbols?: string; + + /** + * Creates a new instance of the `SetDCPReq` class. + * The builder pattern allows step-by-step construction of a `SetDCPReq` object. + */ + static builder(): SetDCPReqBuilder { + return new SetDCPReqBuilder(); + } + + /** + * Creates a new instance of the `SetDCPReq` class with the given data. + */ + static create(data: { + /** + * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. + */ + timeout?: number; + /** + * List of trading pairs. When this parameter is not empty, separate it with commas and support up to 50 trading pairs. Empty means all trading pairs. When this parameter is changed, the previous setting will be overwritten. + */ + symbols?: string; + }): SetDCPReq { + let obj = new SetDCPReq(); + obj.timeout = data.timeout; + obj.symbols = data.symbols; + return obj; + } + + fromJson(input: string): SetDCPReq { + const jsonObject = JSON.parse(input); + return plainToInstance(SetDCPReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SetDCPReq { + return plainToInstance(SetDCPReq, jsonObject); + } +} + +export class SetDCPReqBuilder { + obj: SetDCPReq = new SetDCPReq(); + /** + * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. + */ + setTimeout(value: number): SetDCPReqBuilder { + this.obj.timeout = value; + return this; + } + + /** + * List of trading pairs. When this parameter is not empty, separate it with commas and support up to 50 trading pairs. Empty means all trading pairs. When this parameter is changed, the previous setting will be overwritten. + */ + setSymbols(value: string): SetDCPReqBuilder { + this.obj.symbols = value; + return this; + } + + build(): SetDCPReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts new file mode 100644 index 00000000..c033d084 --- /dev/null +++ b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class SetDCPResp implements Response { + /** + * System current time (in seconds) + */ + currentTime?: number; + /** + * Trigger cancellation time (in seconds) + */ + triggerTime?: number; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): SetDCPResp { + const jsonObject = JSON.parse(input); + return plainToInstance(SetDCPResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): SetDCPResp { + return plainToInstance(SetDCPResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts b/sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/spot/spotprivate/api_spot_private.ts b/sdk/node/src/generate/spot/spotprivate/api_spot_private.ts new file mode 100644 index 00000000..ffe6efdf --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/api_spot_private.ts @@ -0,0 +1,100 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { OrderV2EventCallbackWrapper, OrderV2EventCallback } from './model_order_v2_event'; +import { AccountEventCallback, AccountEventCallbackWrapper } from './model_account_event'; +import { OrderV1EventCallback, OrderV1EventCallbackWrapper } from './model_order_v1_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface SpotPrivateWS { + /** + * account Get Account Balance + * You will receive this message when an account balance changes. The message contains the details of the change. + * push frequency: real-time + */ + account(callback: AccountEventCallback): Promise; + + /** + * orderV1 Get Order(V1) + * This topic will push all change events of your orders. + * push frequency: real-time + */ + orderV1(callback: OrderV1EventCallback): Promise; + + /** + * orderV2 Get Order(V2) + * This topic will push all change events of your orders. Compared with v1, v2 adds an Order Status: \"new\", there is no difference in push speed + * push frequency: real-time + */ + orderV2(callback: OrderV2EventCallback): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class SpotPrivateWSImpl implements SpotPrivateWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + account(callback: AccountEventCallback): Promise { + let topicPrefix = '/account/balance'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new AccountEventCallbackWrapper(callback), + ); + } + + orderV1(callback: OrderV1EventCallback): Promise { + let topicPrefix = '/spotMarket/tradeOrders'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderV1EventCallbackWrapper(callback), + ); + } + + orderV2(callback: OrderV2EventCallback): Promise { + let topicPrefix = '/spotMarket/tradeOrdersV2'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderV2EventCallbackWrapper(callback), + ); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts new file mode 100644 index 00000000..9435cbc5 --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -0,0 +1,90 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { AccountRelationContext } from './model_account_relation_context'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class AccountEvent implements Response { + /** + * Account ID + */ + accountId?: string; + /** + * Funds available to withdraw or trade + */ + available?: string; + /** + * The change of available Funds + */ + availableChange?: string; + /** + * currency + */ + currency?: string; + /** + * Funds on hold (not available for use) + */ + hold?: string; + /** + * The change of hold funds + */ + holdChange?: string; + /** + * + */ + relationContext?: AccountRelationContext; + /** + * Relation event + */ + relationEvent?: string; + /** + * Relation event Id + */ + relationEventId?: string; + /** + * + */ + time?: string; + /** + * Total balance = available + hold + */ + total?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): AccountEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(AccountEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AccountEvent { + return plainToInstance(AccountEvent, jsonObject); + } +} + +export type AccountEventCallback = (topic: string, subject: string, data: AccountEvent) => void; + +export class AccountEventCallbackWrapper implements WebSocketMessageCallback { + callback: AccountEventCallback; + + constructor(callback: AccountEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new AccountEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts new file mode 100644 index 00000000..0e61e6ff --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -0,0 +1,28 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class AccountRelationContext implements Serializable { + /** + * + */ + symbol?: string; + /** + * + */ + orderId?: string; + + fromJson(input: string): AccountRelationContext { + const jsonObject = JSON.parse(input); + return plainToInstance(AccountRelationContext, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AccountRelationContext { + return plainToInstance(AccountRelationContext, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts new file mode 100644 index 00000000..94875f82 --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -0,0 +1,216 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderV1Event implements Response { + /** + * Cumulative number of cancellations + */ + canceledSize?: string; + /** + * Client Order Id,The ClientOid field is a unique ID created by the user + */ + clientOid?: string; + /** + * Cumulative number of filled + */ + filledSize?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Order time(millisecond) + */ + orderTime?: number; + /** + * User-specified order type + */ + orderType?: OrderV1Event.OrderTypeEnum; + /** + * User-specified order size + */ + originSize?: string; + /** + * Specify price for currency + */ + price?: string; + /** + * Remain funds + */ + remainFunds?: string; + /** + * Remain size + */ + remainSize?: string; + /** + * buy or sell + */ + side?: OrderV1Event.SideEnum; + /** + * User-specified order size + */ + size?: string; + /** + * Order Status + */ + status?: OrderV1Event.StatusEnum; + /** + * Symbol + */ + symbol?: string; + /** + * Push time(Nanosecond) + */ + ts?: number; + /** + * Order Type + */ + type?: OrderV1Event.TypeEnum; + /** + * The size before order update + */ + oldSize?: string; + /** + * Actual Fee Type + */ + feeType?: OrderV1Event.FeeTypeEnum; + /** + * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** + */ + liquidity?: OrderV1Event.LiquidityEnum; + /** + * Match Price (when the type is \"match\") + */ + matchPrice?: string; + /** + * Match Size (when the type is \"match\") + */ + matchSize?: string; + /** + * Trade id, it is generated by Matching engine. + */ + tradeId?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderV1Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderV1Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderV1Event { + return plainToInstance(OrderV1Event, jsonObject); + } +} + +export namespace OrderV1Event { + export enum OrderTypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum StatusEnum { + /** + * the order enters the matching system + */ + _NEW = 'new', + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * when taker order executes with orders in the order book, the taker order status is “match” + */ + MATCH = 'match', + /** + * the order is fully executed successfully + */ + DONE = 'done', + } + export enum TypeEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * the message sent when the order is match, 1. When the status is open and the type is match, it is a maker match. 2. When the status is match and the type is match, it is a taker match. + */ + MATCH = 'match', + /** + * The message sent due to the order being modified: STP triggering, partial cancellation of the order. Includes these three situations: 1. When the status is open and the type is update: partial amounts of the order have been canceled, or STP triggers 2. When the status is match and the type is update: STP triggers 3. When the status is done and the type is update: partial amounts of the order have been filled and the unfilled part got canceled, or STP is triggered. + */ + UPDATE = 'update', + /** + * The message sent when the status of the order changes to DONE after the transaction + */ + FILLED = 'filled', + /** + * The message sent when the status of the order changes to DONE due to being canceled + */ + CANCELED = 'canceled', + } + export enum FeeTypeEnum { + /** + * takerFee + */ + TAKERFEE = 'takerFee', + /** + * makerFee + */ + MAKERFEE = 'makerFee', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } +} + +export type OrderV1EventCallback = (topic: string, subject: string, data: OrderV1Event) => void; + +export class OrderV1EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderV1EventCallback; + + constructor(callback: OrderV1EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderV1Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts new file mode 100644 index 00000000..c64b85ea --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -0,0 +1,220 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderV2Event implements Response { + /** + * Cumulative number of cancellations + */ + canceledSize?: string; + /** + * Client Order Id,The ClientOid field is a unique ID created by the user + */ + clientOid?: string; + /** + * Cumulative number of filled + */ + filledSize?: string; + /** + * The unique order id generated by the trading system + */ + orderId?: string; + /** + * Order time(millisecond) + */ + orderTime?: number; + /** + * User-specified order type + */ + orderType?: OrderV2Event.OrderTypeEnum; + /** + * User-specified order size + */ + originSize?: string; + /** + * Price + */ + price?: string; + /** + * Remain funds + */ + remainFunds?: string; + /** + * Remain size + */ + remainSize?: string; + /** + * buy or sell + */ + side?: OrderV2Event.SideEnum; + /** + * User-specified order size + */ + size?: string; + /** + * Order Status + */ + status?: OrderV2Event.StatusEnum; + /** + * Symbol + */ + symbol?: string; + /** + * Push time(Nanosecond) + */ + ts?: number; + /** + * Order Type + */ + type?: OrderV2Event.TypeEnum; + /** + * The size before order update + */ + oldSize?: string; + /** + * Actual Fee Type + */ + feeType?: OrderV2Event.FeeTypeEnum; + /** + * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** + */ + liquidity?: OrderV2Event.LiquidityEnum; + /** + * Match Price (when the type is \"match\") + */ + matchPrice?: string; + /** + * Match Size (when the type is \"match\") + */ + matchSize?: string; + /** + * Trade id, it is generated by Matching engine. + */ + tradeId?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderV2Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderV2Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderV2Event { + return plainToInstance(OrderV2Event, jsonObject); + } +} + +export namespace OrderV2Event { + export enum OrderTypeEnum { + /** + * limit + */ + LIMIT = 'limit', + /** + * market + */ + MARKET = 'market', + } + export enum SideEnum { + /** + * buy + */ + BUY = 'buy', + /** + * sell + */ + SELL = 'sell', + } + export enum StatusEnum { + /** + * the order enters the matching system + */ + _NEW = 'new', + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * when taker order executes with orders in the order book, the taker order status is “match” + */ + MATCH = 'match', + /** + * the order is fully executed successfully + */ + DONE = 'done', + } + export enum TypeEnum { + /** + * the order is in the order book(maker order) + */ + OPEN = 'open', + /** + * the message sent when the order is match, 1. When the status is open and the type is match, it is a maker match. 2. When the status is match and the type is match, it is a taker match. + */ + MATCH = 'match', + /** + * The message sent due to the order being modified: STP triggering, partial cancellation of the order. Includes these three situations: 1. When the status is open and the type is update: partial amounts of the order have been canceled, or STP triggers 2. When the status is match and the type is update: STP triggers 3. When the status is done and the type is update: partial amounts of the order have been filled and the unfilled part got canceled, or STP is triggered. + */ + UPDATE = 'update', + /** + * The message sent when the status of the order changes to DONE after the transaction + */ + FILLED = 'filled', + /** + * The message sent when the status of the order changes to DONE due to being canceled + */ + CANCELED = 'canceled', + /** + * The message sent when the order enters the matching system. When the order has just entered the matching system and has not yet done matching logic with the counterparty, a private message with the message type "received" and the order status "new" will be pushed. + */ + RECEIVED = 'received', + } + export enum FeeTypeEnum { + /** + * takerFee + */ + TAKERFEE = 'takerFee', + /** + * makerFee + */ + MAKERFEE = 'makerFee', + } + export enum LiquidityEnum { + /** + * taker + */ + TAKER = 'taker', + /** + * maker + */ + MAKER = 'maker', + } +} + +export type OrderV2EventCallback = (topic: string, subject: string, data: OrderV2Event) => void; + +export class OrderV2EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderV2EventCallback; + + constructor(callback: OrderV2EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderV2Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts b/sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/spot/spotpublic/api_spot_public.ts b/sdk/node/src/generate/spot/spotpublic/api_spot_public.ts new file mode 100644 index 00000000..9b3ad52c --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/api_spot_public.ts @@ -0,0 +1,272 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { + OrderbookLevel5EventCallbackWrapper, + OrderbookLevel5EventCallback, +} from './model_orderbook_level5_event'; +import { KlinesEventCallbackWrapper, KlinesEventCallback } from './model_klines_event'; +import { TickerEventCallback, TickerEventCallbackWrapper } from './model_ticker_event'; +import { + SymbolSnapshotEventCallback, + SymbolSnapshotEventCallbackWrapper, +} from './model_symbol_snapshot_event'; +import { + OrderbookLevel1EventCallbackWrapper, + OrderbookLevel1EventCallback, +} from './model_orderbook_level1_event'; +import { AllTickersEventCallback, AllTickersEventCallbackWrapper } from './model_all_tickers_event'; +import { + OrderbookIncrementEventCallback, + OrderbookIncrementEventCallbackWrapper, +} from './model_orderbook_increment_event'; +import { TradeEventCallbackWrapper, TradeEventCallback } from './model_trade_event'; +import { + OrderbookLevel50EventCallback, + OrderbookLevel50EventCallbackWrapper, +} from './model_orderbook_level50_event'; +import { + MarketSnapshotEventCallback, + MarketSnapshotEventCallbackWrapper, +} from './model_market_snapshot_event'; +import { WebSocketService } from '@internal/interfaces/websocket'; + +export interface SpotPublicWS { + /** + * allTickers Get All Tickers + * Subscribe to this topic to get the push of all market symbols BBO change. + * push frequency: once every 100ms + */ + allTickers(callback: AllTickersEventCallback): Promise; + + /** + * klines Klines + * Subscribe to this topic to get K-Line data. + * push frequency: real-time + */ + klines(symbol: string, type: string, callback: KlinesEventCallback): Promise; + + /** + * marketSnapshot Market Snapshot + * Subscribe this topic to get the snapshot data of for the entire market. + * push frequency: once every 2s + */ + marketSnapshot(market: string, callback: MarketSnapshotEventCallback): Promise; + + /** + * orderbookIncrement Orderbook - Increment + * The system will return the increment change orderbook data(All depth), A topic supports up to 100 symbols. If there is no change in the market, data will not be pushed + * push frequency: real-time + */ + orderbookIncrement( + symbol: Array, + callback: OrderbookIncrementEventCallback, + ): Promise; + + /** + * orderbookLevel1 Orderbook - Level1 + * The system will return the 1 best ask/bid orders data, A topic supports up to 100 symbols. If there is no change in the market, data will not be pushed + * push frequency: once every 10ms + */ + orderbookLevel1(symbol: Array, callback: OrderbookLevel1EventCallback): Promise; + + /** + * orderbookLevel50 Orderbook - Level50 + * The system will return the 50 best ask/bid orders data, A topic supports up to 100 symbols. If there is no change in the market, data will not be pushed + * push frequency: once every 100ms + */ + orderbookLevel50( + symbol: Array, + callback: OrderbookLevel50EventCallback, + ): Promise; + + /** + * orderbookLevel5 Orderbook - Level5 + * The system will return the 5 best ask/bid orders data,A topic supports up to 100 symbols. If there is no change in the market, data will not be pushed + * push frequency: once every 100ms + */ + orderbookLevel5(symbol: Array, callback: OrderbookLevel5EventCallback): Promise; + + /** + * symbolSnapshot Symbol Snapshot + * Subscribe to get snapshot data for a single symbol. + * push frequency: once every 2s + */ + symbolSnapshot(symbol: string, callback: SymbolSnapshotEventCallback): Promise; + + /** + * ticker Get Ticker + * Subscribe to this topic to get the specified symbol push of BBO changes. + * push frequency: once every 100ms + */ + ticker(symbol: Array, callback: TickerEventCallback): Promise; + + /** + * trade Trade + * Subscribe to this topic to get the matching event data flow of Level 3. A topic supports up to 100 symbols. + * push frequency: real-time + */ + trade(symbol: Array, callback: TradeEventCallback): Promise; + + /** + * Unsubscribe from topics + */ + unSubscribe(id: string): Promise; + + /** + * Start websocket + */ + start(): Promise; + + /** + * Stop websocket + */ + stop(): Promise; +} + +export class SpotPublicWSImpl implements SpotPublicWS { + private wsService: WebSocketService; + + constructor(wsService: WebSocketService) { + this.wsService = wsService; + } + + allTickers(callback: AllTickersEventCallback): Promise { + let topicPrefix = '/market/ticker:all'; + + let args: string[] = []; + + return this.wsService.subscribe( + topicPrefix, + args, + new AllTickersEventCallbackWrapper(callback), + ); + } + + klines(symbol: string, type: string, callback: KlinesEventCallback): Promise { + let topicPrefix = '/market/candles'; + + let args: string[] = [[symbol, type].join('_')]; + + return this.wsService.subscribe( + topicPrefix, + args, + new KlinesEventCallbackWrapper(callback), + ); + } + + marketSnapshot(market: string, callback: MarketSnapshotEventCallback): Promise { + let topicPrefix = '/market/snapshot'; + + let args: string[] = [market]; + + return this.wsService.subscribe( + topicPrefix, + args, + new MarketSnapshotEventCallbackWrapper(callback), + ); + } + + orderbookIncrement( + symbol: Array, + callback: OrderbookIncrementEventCallback, + ): Promise { + let topicPrefix = '/market/level2'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookIncrementEventCallbackWrapper(callback), + ); + } + + orderbookLevel1( + symbol: Array, + callback: OrderbookLevel1EventCallback, + ): Promise { + let topicPrefix = '/spotMarket/level1'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookLevel1EventCallbackWrapper(callback), + ); + } + + orderbookLevel50( + symbol: Array, + callback: OrderbookLevel50EventCallback, + ): Promise { + let topicPrefix = '/market/level2'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookLevel50EventCallbackWrapper(callback), + ); + } + + orderbookLevel5( + symbol: Array, + callback: OrderbookLevel5EventCallback, + ): Promise { + let topicPrefix = '/spotMarket/level2Depth5'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new OrderbookLevel5EventCallbackWrapper(callback), + ); + } + + symbolSnapshot(symbol: string, callback: SymbolSnapshotEventCallback): Promise { + let topicPrefix = '/market/snapshot'; + + let args: string[] = [symbol]; + + return this.wsService.subscribe( + topicPrefix, + args, + new SymbolSnapshotEventCallbackWrapper(callback), + ); + } + + ticker(symbol: Array, callback: TickerEventCallback): Promise { + let topicPrefix = '/market/ticker'; + + let args: string[] = symbol; + + return this.wsService.subscribe( + topicPrefix, + args, + new TickerEventCallbackWrapper(callback), + ); + } + + trade(symbol: Array, callback: TradeEventCallback): Promise { + let topicPrefix = '/market/match'; + + let args: string[] = symbol; + + return this.wsService.subscribe(topicPrefix, args, new TradeEventCallbackWrapper(callback)); + } + + unSubscribe(id: string): Promise { + return this.wsService.unsubscribe(id); + } + + start(): Promise { + return this.wsService.start(); + } + + stop(): Promise { + return this.wsService.stop(); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts new file mode 100644 index 00000000..0a85a3c3 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -0,0 +1,81 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class AllTickersEvent implements Response { + /** + * + */ + bestAsk?: string; + /** + * + */ + bestAskSize?: string; + /** + * + */ + bestBid?: string; + /** + * + */ + bestBidSize?: string; + /** + * + */ + price?: string; + /** + * + */ + sequence?: string; + /** + * + */ + size?: string; + /** + * The matching time of the latest transaction + */ + time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): AllTickersEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(AllTickersEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): AllTickersEvent { + return plainToInstance(AllTickersEvent, jsonObject); + } +} + +export type AllTickersEventCallback = ( + topic: string, + subject: string, + data: AllTickersEvent, +) => void; + +export class AllTickersEventCallbackWrapper implements WebSocketMessageCallback { + callback: AllTickersEventCallback; + + constructor(callback: AllTickersEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new AllTickersEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts new file mode 100644 index 00000000..fdbb7d65 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -0,0 +1,57 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class KlinesEvent implements Response { + /** + * symbol + */ + symbol?: string; + /** + * Start time of the candle cycle,open price,close price, high price,low price,Transaction volume,Transaction amount + */ + candles?: Array; + /** + * now(us) + */ + time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): KlinesEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(KlinesEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): KlinesEvent { + return plainToInstance(KlinesEvent, jsonObject); + } +} + +export type KlinesEventCallback = (topic: string, subject: string, data: KlinesEvent) => void; + +export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { + callback: KlinesEventCallback; + + constructor(callback: KlinesEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new KlinesEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts new file mode 100644 index 00000000..0ef1890a --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -0,0 +1,186 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { MarketSnapshotDataMarketChange4h } from './model_market_snapshot_data_market_change4h'; +import { MarketSnapshotDataMarketChange24h } from './model_market_snapshot_data_market_change24h'; +import { MarketSnapshotDataMarketChange1h } from './model_market_snapshot_data_market_change1h'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class MarketSnapshotData implements Serializable { + /** + * + */ + askSize?: number; + /** + * + */ + averagePrice?: number; + /** + * + */ + baseCurrency?: string; + /** + * + */ + bidSize?: number; + /** + * Trading pair partition: 0.primary partition 1.KuCoin Plus\", example = \"1\" + */ + board?: MarketSnapshotData.BoardEnum; + /** + * + */ + buy?: number; + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + close?: number; + /** + * + */ + datetime?: number; + /** + * + */ + high?: number; + /** + * + */ + lastTradedPrice?: number; + /** + * + */ + low?: number; + /** + * + */ + makerCoefficient?: number; + /** + * + */ + makerFeeRate?: number; + /** + * + */ + marginTrade?: boolean; + /** + * Trading Pair Mark: 0.default 1.ST. 2.NEW\", example = \"1\" + */ + mark?: MarketSnapshotData.MarkEnum; + /** + * + */ + market?: string; + /** + * + */ + marketChange1h?: MarketSnapshotDataMarketChange1h; + /** + * + */ + marketChange24h?: MarketSnapshotDataMarketChange24h; + /** + * + */ + marketChange4h?: MarketSnapshotDataMarketChange4h; + /** + * + */ + markets?: Array; + /** + * + */ + open?: number; + /** + * + */ + quoteCurrency?: string; + /** + * + */ + sell?: number; + /** + * + */ + siteTypes?: Array; + /** + * sorting number + */ + sort?: number; + /** + * + */ + symbol?: string; + /** + * + */ + symbolCode?: string; + /** + * + */ + takerCoefficient?: number; + /** + * + */ + takerFeeRate?: number; + /** + * + */ + trading?: boolean; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): MarketSnapshotData { + const jsonObject = JSON.parse(input); + return plainToInstance(MarketSnapshotData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarketSnapshotData { + return plainToInstance(MarketSnapshotData, jsonObject); + } +} + +export namespace MarketSnapshotData { + export enum BoardEnum { + /** + * primary partition + */ + _0 = 0, + /** + * KuCoin Plus + */ + _1 = 1, + } + export enum MarkEnum { + /** + * default + */ + _0 = 0, + /** + * ST + */ + _1 = 1, + /** + * NEW + */ + _2 = 2, + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts new file mode 100644 index 00000000..5a1e2992 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class MarketSnapshotDataMarketChange1h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): MarketSnapshotDataMarketChange1h { + const jsonObject = JSON.parse(input); + return plainToInstance(MarketSnapshotDataMarketChange1h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange1h { + return plainToInstance(MarketSnapshotDataMarketChange1h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts new file mode 100644 index 00000000..65a234c7 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class MarketSnapshotDataMarketChange24h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): MarketSnapshotDataMarketChange24h { + const jsonObject = JSON.parse(input); + return plainToInstance(MarketSnapshotDataMarketChange24h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange24h { + return plainToInstance(MarketSnapshotDataMarketChange24h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts new file mode 100644 index 00000000..504d0012 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class MarketSnapshotDataMarketChange4h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): MarketSnapshotDataMarketChange4h { + const jsonObject = JSON.parse(input); + return plainToInstance(MarketSnapshotDataMarketChange4h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange4h { + return plainToInstance(MarketSnapshotDataMarketChange4h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts new file mode 100644 index 00000000..3d381c8f --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -0,0 +1,58 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { MarketSnapshotData } from './model_market_snapshot_data'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class MarketSnapshotEvent implements Response { + /** + * + */ + sequence?: string; + /** + * + */ + data?: MarketSnapshotData; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): MarketSnapshotEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(MarketSnapshotEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): MarketSnapshotEvent { + return plainToInstance(MarketSnapshotEvent, jsonObject); + } +} + +export type MarketSnapshotEventCallback = ( + topic: string, + subject: string, + data: MarketSnapshotEvent, +) => void; + +export class MarketSnapshotEventCallbackWrapper implements WebSocketMessageCallback { + callback: MarketSnapshotEventCallback; + + constructor(callback: MarketSnapshotEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new MarketSnapshotEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts new file mode 100644 index 00000000..720e9f1d --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts @@ -0,0 +1,28 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class OrderbookIncrementChanges implements Serializable { + /** + * price,size,sequence + */ + asks?: Array>; + /** + * + */ + bids?: Array>; + + fromJson(input: string): OrderbookIncrementChanges { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookIncrementChanges, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookIncrementChanges { + return plainToInstance(OrderbookIncrementChanges, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts new file mode 100644 index 00000000..5d3c8cb3 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -0,0 +1,70 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { OrderbookIncrementChanges } from './model_orderbook_increment_changes'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookIncrementEvent implements Response { + /** + * + */ + changes?: OrderbookIncrementChanges; + /** + * + */ + sequenceEnd?: number; + /** + * + */ + sequenceStart?: number; + /** + * + */ + symbol?: string; + /** + * milliseconds + */ + time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookIncrementEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookIncrementEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookIncrementEvent { + return plainToInstance(OrderbookIncrementEvent, jsonObject); + } +} + +export type OrderbookIncrementEventCallback = ( + topic: string, + subject: string, + data: OrderbookIncrementEvent, +) => void; + +export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookIncrementEventCallback; + + constructor(callback: OrderbookIncrementEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookIncrementEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts new file mode 100644 index 00000000..d8d74bf1 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookLevel1Event implements Response { + /** + * price, size + */ + asks?: Array; + /** + * + */ + bids?: Array; + /** + * + */ + timestamp?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookLevel1Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel1Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel1Event { + return plainToInstance(OrderbookLevel1Event, jsonObject); + } +} + +export type OrderbookLevel1EventCallback = ( + topic: string, + subject: string, + data: OrderbookLevel1Event, +) => void; + +export class OrderbookLevel1EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookLevel1EventCallback; + + constructor(callback: OrderbookLevel1EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookLevel1Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts new file mode 100644 index 00000000..bca6e97e --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts @@ -0,0 +1,28 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class OrderbookLevel50Changes implements Serializable { + /** + * + */ + asks?: Array>; + /** + * + */ + bids?: Array>; + + fromJson(input: string): OrderbookLevel50Changes { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel50Changes, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel50Changes { + return plainToInstance(OrderbookLevel50Changes, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts new file mode 100644 index 00000000..34e7f884 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -0,0 +1,70 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { OrderbookLevel50Changes } from './model_orderbook_level50_changes'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookLevel50Event implements Response { + /** + * + */ + changes?: OrderbookLevel50Changes; + /** + * + */ + sequenceEnd?: number; + /** + * + */ + sequenceStart?: number; + /** + * + */ + symbol?: string; + /** + * + */ + time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookLevel50Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel50Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel50Event { + return plainToInstance(OrderbookLevel50Event, jsonObject); + } +} + +export type OrderbookLevel50EventCallback = ( + topic: string, + subject: string, + data: OrderbookLevel50Event, +) => void; + +export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookLevel50EventCallback; + + constructor(callback: OrderbookLevel50EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookLevel50Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts new file mode 100644 index 00000000..126b86ee --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class OrderbookLevel5Event implements Response { + /** + * price, size + */ + asks?: Array>; + /** + * + */ + bids?: Array>; + /** + * + */ + timestamp?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): OrderbookLevel5Event { + const jsonObject = JSON.parse(input); + return plainToInstance(OrderbookLevel5Event, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): OrderbookLevel5Event { + return plainToInstance(OrderbookLevel5Event, jsonObject); + } +} + +export type OrderbookLevel5EventCallback = ( + topic: string, + subject: string, + data: OrderbookLevel5Event, +) => void; + +export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCallback { + callback: OrderbookLevel5EventCallback; + + constructor(callback: OrderbookLevel5EventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new OrderbookLevel5Event().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts new file mode 100644 index 00000000..08f9aad8 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts @@ -0,0 +1,186 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { SymbolSnapshotDataMarketChange4h } from './model_symbol_snapshot_data_market_change4h'; +import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { SymbolSnapshotDataMarketChange1h } from './model_symbol_snapshot_data_market_change1h'; +import { SymbolSnapshotDataMarketChange24h } from './model_symbol_snapshot_data_market_change24h'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SymbolSnapshotData implements Serializable { + /** + * + */ + askSize?: number; + /** + * + */ + averagePrice?: number; + /** + * + */ + baseCurrency?: string; + /** + * + */ + bidSize?: number; + /** + * Trading pair partition: 0.primary partition 1.KuCoin Plus\", example = \"1\" + */ + board?: SymbolSnapshotData.BoardEnum; + /** + * + */ + buy?: number; + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + close?: number; + /** + * + */ + datetime?: number; + /** + * + */ + high?: number; + /** + * + */ + lastTradedPrice?: number; + /** + * + */ + low?: number; + /** + * + */ + makerCoefficient?: number; + /** + * + */ + makerFeeRate?: number; + /** + * + */ + marginTrade?: boolean; + /** + * Trading Pair Mark: 0.default 1.ST. 2.NEW\", example = \"1\" + */ + mark?: SymbolSnapshotData.MarkEnum; + /** + * + */ + market?: string; + /** + * + */ + marketChange1h?: SymbolSnapshotDataMarketChange1h; + /** + * + */ + marketChange24h?: SymbolSnapshotDataMarketChange24h; + /** + * + */ + marketChange4h?: SymbolSnapshotDataMarketChange4h; + /** + * + */ + markets?: Array; + /** + * + */ + open?: number; + /** + * + */ + quoteCurrency?: string; + /** + * + */ + sell?: number; + /** + * + */ + siteTypes?: Array; + /** + * sorting number(Pointless) + */ + sort?: number; + /** + * + */ + symbol?: string; + /** + * + */ + symbolCode?: string; + /** + * + */ + takerCoefficient?: number; + /** + * + */ + takerFeeRate?: number; + /** + * + */ + trading?: boolean; + /** + * + */ + vol?: number; + /** + * 24-hour rolling transaction volume, refreshed every 2s + */ + volValue?: number; + + fromJson(input: string): SymbolSnapshotData { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotData { + return plainToInstance(SymbolSnapshotData, jsonObject); + } +} + +export namespace SymbolSnapshotData { + export enum BoardEnum { + /** + * primary partition + */ + _0 = 0, + /** + * KuCoin Plus + */ + _1 = 1, + } + export enum MarkEnum { + /** + * default + */ + _0 = 0, + /** + * ST + */ + _1 = 1, + /** + * NEW + */ + _2 = 2, + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts new file mode 100644 index 00000000..82607174 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SymbolSnapshotDataMarketChange1h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): SymbolSnapshotDataMarketChange1h { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotDataMarketChange1h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange1h { + return plainToInstance(SymbolSnapshotDataMarketChange1h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts new file mode 100644 index 00000000..5bcb1ab1 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SymbolSnapshotDataMarketChange24h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): SymbolSnapshotDataMarketChange24h { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotDataMarketChange24h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange24h { + return plainToInstance(SymbolSnapshotDataMarketChange24h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts new file mode 100644 index 00000000..63c5deb5 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -0,0 +1,50 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Serializable } from '@internal/interfaces/serializable'; +export class SymbolSnapshotDataMarketChange4h + implements Serializable +{ + /** + * + */ + changePrice?: number; + /** + * + */ + changeRate?: number; + /** + * + */ + high?: number; + /** + * + */ + low?: number; + /** + * + */ + open?: number; + /** + * + */ + vol?: number; + /** + * + */ + volValue?: number; + + fromJson(input: string): SymbolSnapshotDataMarketChange4h { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotDataMarketChange4h, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange4h { + return plainToInstance(SymbolSnapshotDataMarketChange4h, jsonObject); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts new file mode 100644 index 00000000..1e473074 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -0,0 +1,58 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { SymbolSnapshotData } from './model_symbol_snapshot_data'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class SymbolSnapshotEvent implements Response { + /** + * + */ + sequence?: string; + /** + * + */ + data?: SymbolSnapshotData; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): SymbolSnapshotEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(SymbolSnapshotEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): SymbolSnapshotEvent { + return plainToInstance(SymbolSnapshotEvent, jsonObject); + } +} + +export type SymbolSnapshotEventCallback = ( + topic: string, + subject: string, + data: SymbolSnapshotEvent, +) => void; + +export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallback { + callback: SymbolSnapshotEventCallback; + + constructor(callback: SymbolSnapshotEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new SymbolSnapshotEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts new file mode 100644 index 00000000..823889e2 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -0,0 +1,77 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class TickerEvent implements Response { + /** + * Sequence number + */ + sequence?: string; + /** + * Last traded price + */ + price?: string; + /** + * Last traded amount + */ + size?: string; + /** + * Best ask price + */ + bestAsk?: string; + /** + * Best ask size + */ + bestAskSize?: string; + /** + * Best bid price + */ + bestBid?: string; + /** + * Best bid size + */ + bestBidSize?: string; + /** + * The matching time of the latest transaction + */ + Time?: number; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): TickerEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(TickerEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): TickerEvent { + return plainToInstance(TickerEvent, jsonObject); + } +} + +export type TickerEventCallback = (topic: string, subject: string, data: TickerEvent) => void; + +export class TickerEventCallbackWrapper implements WebSocketMessageCallback { + callback: TickerEventCallback; + + constructor(callback: TickerEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new TickerEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts new file mode 100644 index 00000000..87c1f346 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -0,0 +1,85 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { WsMessage } from '@model/common'; +import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; +import { Response } from '@internal/interfaces/response'; +export class TradeEvent implements Response { + /** + * + */ + makerOrderId?: string; + /** + * + */ + price?: string; + /** + * + */ + sequence?: string; + /** + * + */ + side?: string; + /** + * + */ + size?: string; + /** + * + */ + symbol?: string; + /** + * + */ + takerOrderId?: string; + /** + * + */ + time?: string; + /** + * + */ + tradeId?: string; + /** + * + */ + type?: string; + /** + * common response + */ + @Exclude() + private commonResponse?: WsMessage; + + setCommonResponse(response: WsMessage): void { + this.commonResponse = response; + } + + fromJson(input: string): TradeEvent { + const jsonObject = JSON.parse(input); + return plainToInstance(TradeEvent, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + fromObject(jsonObject: Object): TradeEvent { + return plainToInstance(TradeEvent, jsonObject); + } +} + +export type TradeEventCallback = (topic: string, subject: string, data: TradeEvent) => void; + +export class TradeEventCallbackWrapper implements WebSocketMessageCallback { + callback: TradeEventCallback; + + constructor(callback: TradeEventCallback) { + this.callback = callback; + } + + onMessage(msg: WsMessage): void { + let event = new TradeEvent().fromObject(msg.rawData); + event.setCommonResponse(msg); + this.callback(msg.topic, msg.subject, event); + } +} diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts new file mode 100644 index 00000000..70de0e96 --- /dev/null +++ b/sdk/node/src/generate/version.ts @@ -0,0 +1,2 @@ +export const SdkVersion = 'v0.1.0-alpha'; +export const SdkGenerateDate = '2025-01-08'; diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.template b/sdk/node/src/generate/viplending/viplending/api_vip_lending.template new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts b/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts new file mode 100644 index 00000000..91eefe45 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts @@ -0,0 +1,36 @@ +import { GetAccountDetailResp } from './model_get_account_detail_resp'; +import { GetAccountsResp } from './model_get_accounts_resp'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('getAccounts request test', () => { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + }); + + test('getAccounts response test', () => { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + }); + test('getAccountDetail request test', () => { + /** + * getAccountDetail + * Get Account Detail + * /api/v1/otc-loan/loan + */ + }); + + test('getAccountDetail response test', () => { + /** + * getAccountDetail + * Get Account Detail + * /api/v1/otc-loan/loan + */ + }); +}); diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts new file mode 100644 index 00000000..113ac41c --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts @@ -0,0 +1,67 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { GetAccountDetailResp } from './model_get_account_detail_resp'; +import { GetAccountsResp } from './model_get_accounts_resp'; + +export interface VIPLendingAPI { + /** + * getAccounts Get Accounts + * Description: Accounts participating in OTC lending, This interface is only for querying accounts currently running OTC lending. + * Documentation: https://www.kucoin.com/docs-new/api-3470278 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 1 | + * +---------------------+------------+ + */ + getAccounts(): Promise; + + /** + * getAccountDetail Get Account Detail + * Description: The following information is only applicable to loans. Get information on off-exchange funding and loans, This endpoint is only for querying accounts that are currently involved in loans. + * Documentation: https://www.kucoin.com/docs-new/api-3470277 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 1 | + * +---------------------+------------+ + */ + getAccountDetail(): Promise; +} + +export class VIPLendingAPIImpl implements VIPLendingAPI { + constructor(private transport: Transport) {} + + getAccounts(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/otc-loan/accounts', + null, + new GetAccountsResp(), + false, + ); + } + + getAccountDetail(): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v1/otc-loan/loan', + null, + new GetAccountDetailResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts new file mode 100644 index 00000000..71fc42f9 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts @@ -0,0 +1,38 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountDetailLtv implements Serializable { + /** + * LTV of Restricted Transfers to Funding Account + */ + transferLtv?: string; + /** + * LTV of Reduce Only (Restricted Open Positions) + */ + onlyClosePosLtv?: string; + /** + * LTV of Delayed Liquidation + */ + delayedLiquidationLtv?: string; + /** + * LTV of Instant Liquidation + */ + instantLiquidationLtv?: string; + /** + * Current LTV + */ + currentLtv?: string; + fromJson(input: string): GetAccountDetailLtv { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountDetailLtv, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountDetailLtv { + return plainToInstance(GetAccountDetailLtv, jsonObject); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts new file mode 100644 index 00000000..7fe5f0b9 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts @@ -0,0 +1,30 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountDetailMargins implements Serializable { + /** + * Margin Currency + */ + marginCcy?: string; + /** + * Maintenance Quantity (Calculated with Margin Coefficient) + */ + marginQty?: string; + /** + * Margin Coefficient return real time margin discount rate to USDT + */ + marginFactor?: string; + fromJson(input: string): GetAccountDetailMargins { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountDetailMargins, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountDetailMargins { + return plainToInstance(GetAccountDetailMargins, jsonObject); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts new file mode 100644 index 00000000..fc3f41ae --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts @@ -0,0 +1,34 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountDetailOrders implements Serializable { + /** + * Loan Orders ID + */ + orderId?: string; + /** + * Principal to Be Repaid + */ + principal?: string; + /** + * Interest to Be Repaid + */ + interest?: string; + /** + * Loan Currency + */ + currency?: string; + fromJson(input: string): GetAccountDetailOrders { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountDetailOrders, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountDetailOrders { + return plainToInstance(GetAccountDetailOrders, jsonObject); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts new file mode 100644 index 00000000..0ec56497 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts @@ -0,0 +1,59 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { GetAccountDetailLtv } from './model_get_account_detail_ltv'; +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAccountDetailOrders } from './model_get_account_detail_orders'; +import { GetAccountDetailMargins } from './model_get_account_detail_margins'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAccountDetailResp implements Response { + /** + * Master UID + */ + parentUid?: string; + /** + * Loan Orders + */ + @Type(() => GetAccountDetailOrders) + orders?: Array; + /** + * + */ + @Type(() => GetAccountDetailLtv) + ltv?: GetAccountDetailLtv; + /** + * Total Margin Amount (USDT) + */ + totalMarginAmount?: string; + /** + * Total Maintenance Margin for Restricted Transfers (USDT) + */ + transferMarginAmount?: string; + /** + * + */ + @Type(() => GetAccountDetailMargins) + margins?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAccountDetailResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountDetailResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountDetailResp { + return plainToInstance(GetAccountDetailResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts new file mode 100644 index 00000000..8dca6b3e --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts @@ -0,0 +1,42 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; +export class GetAccountsData implements Serializable { + /** + * UID + */ + uid?: string; + /** + * Margin Currency + */ + marginCcy?: string; + /** + * Maintenance Quantity (Calculated with Margin Coefficient) + */ + marginQty?: string; + /** + * Margin Coefficient + */ + marginFactor?: string; + /** + * Account Type: TRADE - Trading Account CONTRACT - Futures Account (for Total Futures Equity) + */ + accountType?: string; + /** + * If It Is Master Account + */ + isParent?: boolean; + fromJson(input: string): GetAccountsData { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountsData, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetAccountsData { + return plainToInstance(GetAccountsData, jsonObject); + } +} diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts new file mode 100644 index 00000000..471eb9f2 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { GetAccountsData } from './model_get_accounts_data'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; +export class GetAccountsResp implements Response { + /** + * + */ + @Type(() => GetAccountsData) + data?: Array; + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetAccountsResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetAccountsResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetAccountsResp { + return plainToInstance(GetAccountsResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts new file mode 100644 index 00000000..5fc3820e --- /dev/null +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -0,0 +1,32 @@ +import { Transport } from '@internal/interfaces/transport'; +import { Serializable } from '@internal/interfaces/serializable'; +import { Response } from '@internal/interfaces/response'; +import { ClientOption } from '@model/client_option'; + +export class DefaultTransport implements Transport { + + private readonly option: ClientOption; + private readonly version: String; + + constructor(option: ClientOption, version: String) { + this.option = option; + this.version = version; + } + + call( + domain: string, + isBroker: boolean, + method: string, + path: string, + requestObj: Serializable | null, + responseObj: Response, + requestJson: boolean, + args?: any, + ): Promise> { + return Promise.resolve(undefined); + } + + close(): Promise { + return Promise.resolve(undefined); + } +} diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts new file mode 100644 index 00000000..9168b14b --- /dev/null +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -0,0 +1,38 @@ +import { WebSocketMessageCallback, WebSocketService } from '@internal/interfaces/websocket'; +import { ClientOption } from '@model/client_option'; +import { DomainType } from '@model/constant'; + +export class DefaultWsService implements WebSocketService { + private readonly option: ClientOption; + private readonly domain: DomainType; + private readonly privateChannel: boolean; + private readonly versionString: string; + + constructor( + option: ClientOption, + domain: DomainType, + privateChannel: boolean, + versionString: string, + ) { + this.option = option; + this.domain = domain; + this.privateChannel = privateChannel; + this.versionString = versionString; + } + + start(): Promise { + return Promise.resolve(undefined); + } + + stop(): Promise { + return Promise.resolve(undefined); + } + + subscribe(topic: string, args: string[], callback: WebSocketMessageCallback): Promise { + return Promise.resolve(''); + } + + unsubscribe(id: string): Promise { + return Promise.resolve(undefined); + } +} diff --git a/sdk/node/src/internal/rest/default_rest_impl.ts b/sdk/node/src/internal/rest/default_rest_impl.ts new file mode 100644 index 00000000..8c8e9489 --- /dev/null +++ b/sdk/node/src/internal/rest/default_rest_impl.ts @@ -0,0 +1,74 @@ +import { KucoinRestService } from '@api/api_rest'; +import { AccountService, AccountServiceImpl } from '@generate/service/account_api'; +import { AffiliateService, AffiliateServiceImpl } from '@generate/service/affiliate_api'; +import { BrokerService, BrokerServiceImpl } from '@generate/service/broker_api'; +import { EarnService, EarnServiceImpl } from '@generate/service/earn_api'; +import { FuturesService, FuturesServiceImpl } from '@generate/service/futures_api'; +import { MarginService, MarginServiceImpl } from '@generate/service/margin_api'; +import { SpotService, SpotServiceImpl } from '@generate/service/spot_api'; +import { VIPLendingService, VIPLendingServiceImpl } from '@generate/service/viplending_api'; +import { ClientOption } from '@model/client_option'; +import { SdkVersion } from '@generate/version'; +import { DefaultTransport } from '@internal/infra/default_transport'; + +export class DefaultKucoinRestAPIImpl implements KucoinRestService { + private readonly accountService: AccountService; + private readonly affiliateService: AffiliateService; + private readonly brokerService: BrokerService; + private readonly earnService: EarnService; + private readonly futuresService: FuturesService; + private readonly marginService: MarginService; + private readonly spotService: SpotService; + private readonly vipLendingService: VIPLendingService; + + constructor(options: ClientOption) { + if (!options || !options.transportOption) { + throw new Error('No transport option provided'); + } + + console.info(`SDK version: ${SdkVersion}`); + + const transport = new DefaultTransport(options, SdkVersion); + + this.accountService = new AccountServiceImpl(transport); + this.affiliateService = new AffiliateServiceImpl(transport); + this.brokerService = new BrokerServiceImpl(transport); + this.earnService = new EarnServiceImpl(transport); + this.futuresService = new FuturesServiceImpl(transport); + this.marginService = new MarginServiceImpl(transport); + this.spotService = new SpotServiceImpl(transport); + this.vipLendingService = new VIPLendingServiceImpl(transport); + } + + getAccountService(): AccountService { + return this.accountService; + } + + getAffiliateService(): AffiliateService { + return this.affiliateService; + } + + getBrokerService(): BrokerService { + return this.brokerService; + } + + getEarnService(): EarnService { + return this.earnService; + } + + getFuturesService(): FuturesService { + return this.futuresService; + } + + getMarginService(): MarginService { + return this.marginService; + } + + getSpotService(): SpotService { + return this.spotService; + } + + getVipLendingService(): VIPLendingService { + return this.vipLendingService; + } +} diff --git a/sdk/node/src/internal/ws/default_ws_impl.ts b/sdk/node/src/internal/ws/default_ws_impl.ts new file mode 100644 index 00000000..6a263083 --- /dev/null +++ b/sdk/node/src/internal/ws/default_ws_impl.ts @@ -0,0 +1,61 @@ +import { KucoinWSService } from '@api/api_ws'; +import { ClientOption } from '@model/client_option'; +import { SpotPublicWS, SpotPublicWSImpl } from '@generate/spot/spotpublic/api_spot_public'; +import { DomainType } from '@model/constant'; +import { SpotPrivateWS, SpotPrivateWSImpl } from '@generate/spot/spotprivate/api_spot_private'; +import { + MarginPublicWS, + MarginPublicWSImpl, +} from '@generate/margin/marginpublic/api_margin_public'; +import { + MarginPrivateWS, + MarginPrivateWSImpl, +} from '@generate/margin/marginprivate/api_margin_private'; +import { + FuturesPublicWS, + FuturesPublicWSImpl, +} from '@generate/futures/futurespublic/api_futures_public'; +import { + FuturesPrivateWS, + FuturesPrivateWSImpl, +} from '@generate/futures/futuresprivate/api_futures_private'; +import { DefaultWsService } from '../infra/default_ws_service'; +import { SdkVersion } from '@generate/version'; + +export class KucoinDefaultWsImpl implements KucoinWSService { + private options: ClientOption; + + constructor(options: ClientOption) { + this.options = options; + } + + newSpotPublicWS(): SpotPublicWS { + const wsService = new DefaultWsService(this.options, DomainType.Spot, false, SdkVersion); + return new SpotPublicWSImpl(wsService); + } + + newSpotPrivateWS(): SpotPrivateWS { + const wsService = new DefaultWsService(this.options, DomainType.Spot, true, SdkVersion); + return new SpotPrivateWSImpl(wsService); + } + + newMarginPublicWS(): MarginPublicWS { + const wsService = new DefaultWsService(this.options, DomainType.Spot, false, SdkVersion); + return new MarginPublicWSImpl(wsService); + } + + newMarginPrivateWS(): MarginPrivateWS { + const wsService = new DefaultWsService(this.options, DomainType.Spot, true, SdkVersion); + return new MarginPrivateWSImpl(wsService); + } + + newFuturesPublicWS(): FuturesPublicWS { + const wsService = new DefaultWsService(this.options, DomainType.Futures, false, SdkVersion); + return new FuturesPublicWSImpl(wsService); + } + + newFuturesPrivateWS(): FuturesPrivateWS { + const wsService = new DefaultWsService(this.options, DomainType.Futures, true, SdkVersion); + return new FuturesPrivateWSImpl(wsService); + } +} diff --git a/sdk/node/src/model/client_option.ts b/sdk/node/src/model/client_option.ts index 8e3556d8..6c6cbe4b 100644 --- a/sdk/node/src/model/client_option.ts +++ b/sdk/node/src/model/client_option.ts @@ -4,7 +4,7 @@ import { WebSocketClientOption } from './websocket_option'; /** * ClientOption holds the configuration details for a client including authentication keys, API endpoints, and transport options. */ -interface ClientOption { +export interface ClientOption { /** * Key is the authentication key for the client */ diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index 6d57397a..9e549e8e 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -13,7 +13,8 @@ "paths": { "@model/*": ["src/model/*"], "@internal/*": ["src/internal/*"], - "@generate/*": ["src/generate/*"] + "@generate/*": ["src/generate/*"], + "@api/*": ["src/api/*"] }, "experimentalDecorators": true, "emitDecoratorMetadata": true From b4af07ae5e875b599f028337bd14c8f27f7cf47f Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 8 Jan 2025 16:21:04 +0800 Subject: [PATCH 008/106] feat(nodejs): update api signature --- .../plugin/generator/NodeSdkGenerator.java | 21 ++++-- .../resources/node-sdk/api_entry.mustache | 4 +- .../sdk/plugin/SdkGeneratorTest.java | 6 +- sdk/node/src/api/api_ws.ts | 13 ++-- .../fundingfees/api_funding_fees.test.ts | 16 ++--- .../futures/fundingfees/api_funding_fees.ts | 12 ++-- ...tures_private.ts => ws_futures_private.ts} | 0 ...futures_public.ts => ws_futures_public.ts} | 0 .../futures/market/api_market.test.ts | 8 +-- .../src/generate/futures/market/api_market.ts | 6 +- .../generate/futures/order/api_order.test.ts | 32 +++++----- .../src/generate/futures/order/api_order.ts | 24 +++---- .../futures/positions/api_positions.test.ts | 64 +++++++++---------- .../futures/positions/api_positions.ts | 48 +++++++------- ...margin_private.ts => ws_margin_private.ts} | 0 ...i_margin_public.ts => ws_margin_public.ts} | 0 sdk/node/src/generate/service/account_api.ts | 50 +++++++-------- .../src/generate/service/affiliate_api.ts | 10 +-- sdk/node/src/generate/service/broker_api.ts | 22 +++---- sdk/node/src/generate/service/earn_api.ts | 10 +-- sdk/node/src/generate/service/futures_api.ts | 34 +++++----- sdk/node/src/generate/service/margin_api.ts | 42 ++++++------ sdk/node/src/generate/service/spot_api.ts | 18 +++--- .../src/generate/service/viplending_api.ts | 12 ++-- ...api_spot_private.ts => ws_spot_private.ts} | 0 .../{api_spot_public.ts => ws_spot_public.ts} | 0 sdk/node/src/internal/ws/default_ws_impl.ts | 15 ++--- 27 files changed, 236 insertions(+), 231 deletions(-) rename sdk/node/src/generate/futures/futuresprivate/{api_futures_private.ts => ws_futures_private.ts} (100%) rename sdk/node/src/generate/futures/futurespublic/{api_futures_public.ts => ws_futures_public.ts} (100%) rename sdk/node/src/generate/margin/marginprivate/{api_margin_private.ts => ws_margin_private.ts} (100%) rename sdk/node/src/generate/margin/marginpublic/{api_margin_public.ts => ws_margin_public.ts} (100%) rename sdk/node/src/generate/spot/spotprivate/{api_spot_private.ts => ws_spot_private.ts} (100%) rename sdk/node/src/generate/spot/spotpublic/{api_spot_public.ts => ws_spot_public.ts} (100%) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 93b810c6..e6a83d07 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -148,7 +148,7 @@ public String formatParamName(String name) { @Override public String formatMethodName(String name) { - return camelize(name, LOWERCASE_FIRST_LETTER); + return sanitizeName(name); } @Override @@ -284,18 +284,25 @@ public String modelFileFolder() { @Override public String toApiFilename(String name) { - String apiName; - String api = name.replaceAll("-", "_"); - api = "api_" + underscore(api); - apiName = api; - + String apiName = name.replaceAll("-", "_"); switch (modeSwitch.getMode()) { + case WS: { + apiName = "ws_" + underscore(apiName); + break; + } + case API: + case ENTRY: + case TEST_TEMPLATE: { + apiName = "api_" + underscore(apiName); + break; + } case TEST: case WS_TEST: { - apiName = apiName + ".test"; + apiName = "api_" + underscore(apiName) + ".test"; break; } } + return apiName; } diff --git a/generator/plugin/src/main/resources/node-sdk/api_entry.mustache b/generator/plugin/src/main/resources/node-sdk/api_entry.mustache index 8ed01add..9b166b1e 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_entry.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_entry.mustache @@ -6,10 +6,10 @@ import { Transport } from '@internal/interfaces/transport'; {{{.}}} {{/imports}} -export abstract class {{api_entry_name}} { +export interface {{api_entry_name}} { {{#api_entry_value}} - abstract get{{methodUppercase}}Api(): {{target_service}}; + get{{methodUppercase}}Api(): {{target_service}}; {{/api_entry_value}} } diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 8752805e..2558652c 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,10 +8,10 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-order.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-viplending-viplending.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-viplending.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; - private static final String OUTPUT_DIR = "../../sdk/node/src/generate"; + private static final String OUTPUT_DIR = "./out"; @Test public void launchCodeGenerator() { diff --git a/sdk/node/src/api/api_ws.ts b/sdk/node/src/api/api_ws.ts index 156f126b..9d84c87e 100644 --- a/sdk/node/src/api/api_ws.ts +++ b/sdk/node/src/api/api_ws.ts @@ -1,9 +1,10 @@ -import { SpotPublicWS } from '@generate/spot/spotpublic/api_spot_public'; -import { SpotPrivateWS } from '@generate/spot/spotprivate/api_spot_private'; -import { MarginPublicWS } from '@generate/margin/marginpublic/api_margin_public'; -import { MarginPrivateWS } from '@generate/margin/marginprivate/api_margin_private'; -import { FuturesPublicWS } from '@generate/futures/futurespublic/api_futures_public'; -import { FuturesPrivateWS } from '@generate/futures/futuresprivate/api_futures_private'; +import { SpotPublicWS } from '@generate/spot/spotpublic/ws_spot_public'; +import { SpotPrivateWS } from '@generate/spot/spotprivate/ws_spot_private'; +import { MarginPublicWS } from '@generate/margin/marginpublic/ws_margin_public'; +import { MarginPrivateWS } from '@generate/margin/marginprivate/ws_margin_private'; +import { FuturesPublicWS } from '@generate/futures/futurespublic/ws_futures_public'; +import { FuturesPrivateWS } from '@generate/futures/futuresprivate/ws_futures_private'; + export interface KucoinWSService { /** diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts index 05aa8c65..4de199cc 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -7,9 +7,9 @@ import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getPublicFundingHistory request test', () => { + test('GetPublicFundingHistory request test', () => { /** - * getPublicFundingHistory + * GetPublicFundingHistory * Get Public Funding History * /api/v1/contract/funding-rates */ @@ -22,9 +22,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getPublicFundingHistory response test', () => { + test('GetPublicFundingHistory response test', () => { /** - * getPublicFundingHistory + * GetPublicFundingHistory * Get Public Funding History * /api/v1/contract/funding-rates */ @@ -70,9 +70,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getCurrentFundingRate request test', () => { + test('GetCurrentFundingRate request test', () => { /** - * getCurrentFundingRate + * GetCurrentFundingRate * Get Current Funding Rate * /api/v1/funding-rate/{symbol}/current */ @@ -85,9 +85,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getCurrentFundingRate response test', () => { + test('GetCurrentFundingRate response test', () => { /** - * getCurrentFundingRate + * GetCurrentFundingRate * Get Current Funding Rate * /api/v1/funding-rate/{symbol}/current */ diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts index 206d0455..f8e3ba70 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts @@ -10,7 +10,7 @@ import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; export interface FundingFeesAPI { /** - * getPublicFundingHistory Get Public Funding History + * GetPublicFundingHistory Get Public Funding History * Description: Query the funding rate at each settlement time point within a certain time range of the corresponding contract * Documentation: https://www.kucoin.com/docs-new/api-3470266 * +---------------------+---------+ @@ -23,7 +23,7 @@ export interface FundingFeesAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise; + GetPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise; /** * getPrivateFundingHistory Get Private Funding History @@ -44,7 +44,7 @@ export interface FundingFeesAPI { ): Promise; /** - * getCurrentFundingRate Get Current Funding Rate + * GetCurrentFundingRate Get Current Funding Rate * Description: get Current Funding Rate * Documentation: https://www.kucoin.com/docs-new/api-3470265 * +---------------------+---------+ @@ -57,13 +57,13 @@ export interface FundingFeesAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; + GetCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; } export class FundingFeesAPIImpl implements FundingFeesAPI { constructor(private transport: Transport) {} - getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { + GetPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { return this.transport.call( 'futures', false, @@ -89,7 +89,7 @@ export class FundingFeesAPIImpl implements FundingFeesAPI { ); } - getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { + GetCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts b/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.ts similarity index 100% rename from sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts rename to sdk/node/src/generate/futures/futuresprivate/ws_futures_private.ts diff --git a/sdk/node/src/generate/futures/futurespublic/api_futures_public.ts b/sdk/node/src/generate/futures/futurespublic/ws_futures_public.ts similarity index 100% rename from sdk/node/src/generate/futures/futurespublic/api_futures_public.ts rename to sdk/node/src/generate/futures/futurespublic/ws_futures_public.ts diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts index 4b479b39..fca75cda 100644 --- a/sdk/node/src/generate/futures/market/api_market.test.ts +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -73,17 +73,17 @@ describe('Auto Test', () => { * /api/v1/bullet-public */ }); - test('getAllSymbols request test', () => { + test('GetAllSymbols request test', () => { /** - * getAllSymbols + * GetAllSymbols * Get All Symbols * /api/v1/contracts/active */ }); - test('getAllSymbols response test', () => { + test('GetAllSymbols response test', () => { /** - * getAllSymbols + * GetAllSymbols * Get All Symbols * /api/v1/contracts/active */ diff --git a/sdk/node/src/generate/futures/market/api_market.ts b/sdk/node/src/generate/futures/market/api_market.ts index 198c6d9d..f880a2f0 100644 --- a/sdk/node/src/generate/futures/market/api_market.ts +++ b/sdk/node/src/generate/futures/market/api_market.ts @@ -79,7 +79,7 @@ export interface MarketAPI { getPublicToken(): Promise; /** - * getAllSymbols Get All Symbols + * GetAllSymbols Get All Symbols * Description: Get detailed information of all contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. * Documentation: https://www.kucoin.com/docs-new/api-3470220 * +---------------------+---------+ @@ -92,7 +92,7 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getAllSymbols(): Promise; + GetAllSymbols(): Promise; /** * getSymbol Get Symbol @@ -342,7 +342,7 @@ export class MarketAPIImpl implements MarketAPI { ); } - getAllSymbols(): Promise { + GetAllSymbols(): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts index 72af28c7..7ba7bd8f 100644 --- a/sdk/node/src/generate/futures/order/api_order.test.ts +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -69,9 +69,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getOpenOrderValue request test', () => { + test('GetOpenOrderValue request test', () => { /** - * getOpenOrderValue + * GetOpenOrderValue * Get Open Order Value * /api/v1/openOrderStatistics */ @@ -84,9 +84,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getOpenOrderValue response test', () => { + test('GetOpenOrderValue response test', () => { /** - * getOpenOrderValue + * GetOpenOrderValue * Get Open Order Value * /api/v1/openOrderStatistics */ @@ -193,9 +193,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getOrderList request test', () => { + test('GetOrderList request test', () => { /** - * getOrderList + * GetOrderList * Get Order List * /api/v1/orders */ @@ -209,9 +209,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderList response test', () => { + test('GetOrderList response test', () => { /** - * getOrderList + * GetOrderList * Get Order List * /api/v1/orders */ @@ -414,9 +414,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getRecentClosedOrders request test', () => { + test('GetRecentClosedOrders request test', () => { /** - * getRecentClosedOrders + * GetRecentClosedOrders * Get Recent Closed Orders * /api/v1/recentDoneOrders */ @@ -429,9 +429,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getRecentClosedOrders response test', () => { + test('GetRecentClosedOrders response test', () => { /** - * getRecentClosedOrders + * GetRecentClosedOrders * Get Recent Closed Orders * /api/v1/recentDoneOrders */ @@ -539,9 +539,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getStopOrderList request test', () => { + test('GetStopOrderList request test', () => { /** - * getStopOrderList + * GetStopOrderList * Get Stop Order List * /api/v1/stopOrders */ @@ -555,9 +555,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getStopOrderList response test', () => { + test('GetStopOrderList response test', () => { /** - * getStopOrderList + * GetStopOrderList * Get Stop Order List * /api/v1/stopOrders */ diff --git a/sdk/node/src/generate/futures/order/api_order.ts b/sdk/node/src/generate/futures/order/api_order.ts index 8f5dd44b..5f3ffcc5 100644 --- a/sdk/node/src/generate/futures/order/api_order.ts +++ b/sdk/node/src/generate/futures/order/api_order.ts @@ -56,7 +56,7 @@ export interface OrderAPI { getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * getOpenOrderValue Get Open Order Value + * GetOpenOrderValue Get Open Order Value * Description: You can query this endpoint to get the the total number and value of the all your active orders. * Documentation: https://www.kucoin.com/docs-new/api-3470250 * +---------------------+---------+ @@ -69,7 +69,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getOpenOrderValue(req: GetOpenOrderValueReq): Promise; + GetOpenOrderValue(req: GetOpenOrderValueReq): Promise; /** * getOrderByClientOid Get Order By ClientOid @@ -121,7 +121,7 @@ export interface OrderAPI { cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise; /** - * getOrderList Get Order List + * GetOrderList Get Order List * Description: List your current orders. * Documentation: https://www.kucoin.com/docs-new/api-3470244 * +---------------------+---------+ @@ -134,7 +134,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getOrderList(req: GetOrderListReq): Promise; + GetOrderList(req: GetOrderListReq): Promise; /** * batchCancelOrders Batch Cancel Orders @@ -233,7 +233,7 @@ export interface OrderAPI { addOrderTest(req: AddOrderTestReq): Promise; /** - * getRecentClosedOrders Get Recent Closed Orders + * GetRecentClosedOrders Get Recent Closed Orders * Description: Get a list of recent 1000 closed orders in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. * Documentation: https://www.kucoin.com/docs-new/api-3470246 * +---------------------+---------+ @@ -246,7 +246,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; + GetRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; /** * getRecentTradeHistory Get Recent Trade History @@ -297,7 +297,7 @@ export interface OrderAPI { cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise; /** - * getStopOrderList Get Stop Order List + * GetStopOrderList Get Stop Order List * Description: Get the un-triggered stop orders list. Stop orders that have been triggered can be queried through the general order interface * Documentation: https://www.kucoin.com/docs-new/api-3470247 * +---------------------+---------+ @@ -310,7 +310,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 6 | * +---------------------+---------+ */ - getStopOrderList(req: GetStopOrderListReq): Promise; + GetStopOrderList(req: GetStopOrderListReq): Promise; /** * cancelAllOrdersV3 Cancel All Orders @@ -344,7 +344,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - getOpenOrderValue(req: GetOpenOrderValueReq): Promise { + GetOpenOrderValue(req: GetOpenOrderValueReq): Promise { return this.transport.call( 'futures', false, @@ -392,7 +392,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - getOrderList(req: GetOrderListReq): Promise { + GetOrderList(req: GetOrderListReq): Promise { return this.transport.call( 'futures', false, @@ -476,7 +476,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise { + GetRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise { return this.transport.call( 'futures', false, @@ -524,7 +524,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - getStopOrderList(req: GetStopOrderListReq): Promise { + GetStopOrderList(req: GetStopOrderListReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts index 857c6191..3c152a37 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.test.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -60,9 +60,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getPositionsHistory request test', () => { + test('GetPositionsHistory request test', () => { /** - * getPositionsHistory + * GetPositionsHistory * Get Positions History * /api/v1/history-positions */ @@ -76,9 +76,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getPositionsHistory response test', () => { + test('GetPositionsHistory response test', () => { /** - * getPositionsHistory + * GetPositionsHistory * Get Positions History * /api/v1/history-positions */ @@ -92,9 +92,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getMaxWithdrawMargin request test', () => { + test('GetMaxWithdrawMargin request test', () => { /** - * getMaxWithdrawMargin + * GetMaxWithdrawMargin * Get Max Withdraw Margin * /api/v1/margin/maxWithdrawMargin */ @@ -107,9 +107,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getMaxWithdrawMargin response test', () => { + test('GetMaxWithdrawMargin response test', () => { /** - * getMaxWithdrawMargin + * GetMaxWithdrawMargin * Get Max Withdraw Margin * /api/v1/margin/maxWithdrawMargin */ @@ -122,9 +122,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('removeIsolatedMargin request test', () => { + test('RemoveIsolatedMargin request test', () => { /** - * removeIsolatedMargin + * RemoveIsolatedMargin * Remove Isolated Margin * /api/v1/margin/withdrawMargin */ @@ -137,9 +137,9 @@ describe('Auto Test', () => { console.log(req); }); - test('removeIsolatedMargin response test', () => { + test('RemoveIsolatedMargin response test', () => { /** - * removeIsolatedMargin + * RemoveIsolatedMargin * Remove Isolated Margin * /api/v1/margin/withdrawMargin */ @@ -152,9 +152,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getPositionDetails request test', () => { + test('GetPositionDetails request test', () => { /** - * getPositionDetails + * GetPositionDetails * Get Position Details * /api/v1/position */ @@ -167,9 +167,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getPositionDetails response test', () => { + test('GetPositionDetails response test', () => { /** - * getPositionDetails + * GetPositionDetails * Get Position Details * /api/v1/position */ @@ -213,9 +213,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('addIsolatedMargin request test', () => { + test('AddIsolatedMargin request test', () => { /** - * addIsolatedMargin + * AddIsolatedMargin * Add Isolated Margin * /api/v1/position/margin/deposit-margin */ @@ -228,9 +228,9 @@ describe('Auto Test', () => { console.log(req); }); - test('addIsolatedMargin response test', () => { + test('AddIsolatedMargin response test', () => { /** - * addIsolatedMargin + * AddIsolatedMargin * Add Isolated Margin * /api/v1/position/margin/deposit-margin */ @@ -274,9 +274,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getPositionList request test', () => { + test('GetPositionList request test', () => { /** - * getPositionList + * GetPositionList * Get Position List * /api/v1/positions */ @@ -289,9 +289,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getPositionList response test', () => { + test('GetPositionList response test', () => { /** - * getPositionList + * GetPositionList * Get Position List * /api/v1/positions */ @@ -305,9 +305,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('modifyMarginLeverage request test', () => { + test('ModifyMarginLeverage request test', () => { /** - * modifyMarginLeverage + * ModifyMarginLeverage * Modify Cross Margin Leverage * /api/v2/changeCrossUserLeverage */ @@ -320,9 +320,9 @@ describe('Auto Test', () => { console.log(req); }); - test('modifyMarginLeverage response test', () => { + test('ModifyMarginLeverage response test', () => { /** - * modifyMarginLeverage + * ModifyMarginLeverage * Modify Cross Margin Leverage * /api/v2/changeCrossUserLeverage */ @@ -367,9 +367,9 @@ describe('Auto Test', () => { ); console.log(resp); }); - test('getMaxOpenSize request test', () => { + test('GetMaxOpenSize request test', () => { /** - * getMaxOpenSize + * GetMaxOpenSize * Get Max Open Size * /api/v2/getMaxOpenSize */ @@ -383,9 +383,9 @@ describe('Auto Test', () => { console.log(req); }); - test('getMaxOpenSize response test', () => { + test('GetMaxOpenSize response test', () => { /** - * getMaxOpenSize + * GetMaxOpenSize * Get Max Open Size * /api/v2/getMaxOpenSize */ diff --git a/sdk/node/src/generate/futures/positions/api_positions.ts b/sdk/node/src/generate/futures/positions/api_positions.ts index d9c4a311..ffc0975c 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.ts @@ -50,7 +50,7 @@ export interface PositionsAPI { ): Promise; /** - * getPositionsHistory Get Positions History + * GetPositionsHistory Get Positions History * Description: This interface can query position history information records. * Documentation: https://www.kucoin.com/docs-new/api-3470254 * +---------------------+---------+ @@ -63,10 +63,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionsHistory(req: GetPositionsHistoryReq): Promise; + GetPositionsHistory(req: GetPositionsHistoryReq): Promise; /** - * getMaxWithdrawMargin Get Max Withdraw Margin + * GetMaxWithdrawMargin Get Max Withdraw Margin * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. * Documentation: https://www.kucoin.com/docs-new/api-3470258 * +---------------------+---------+ @@ -79,10 +79,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; + GetMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; /** - * removeIsolatedMargin Remove Isolated Margin + * RemoveIsolatedMargin Remove Isolated Margin * Description: Remove Isolated Margin Manually. * Documentation: https://www.kucoin.com/docs-new/api-3470256 * +---------------------+---------+ @@ -95,10 +95,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; + RemoveIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; /** - * getPositionDetails Get Position Details + * GetPositionDetails Get Position Details * Description: Get the position details of a specified position. * Documentation: https://www.kucoin.com/docs-new/api-3470252 * +---------------------+---------+ @@ -111,7 +111,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionDetails(req: GetPositionDetailsReq): Promise; + GetPositionDetails(req: GetPositionDetailsReq): Promise; /** * @deprecated @@ -131,7 +131,7 @@ export interface PositionsAPI { modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; /** - * addIsolatedMargin Add Isolated Margin + * AddIsolatedMargin Add Isolated Margin * Description: Add Isolated Margin Manually. * Documentation: https://www.kucoin.com/docs-new/api-3470257 * +---------------------+---------+ @@ -144,7 +144,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 4 | * +---------------------+---------+ */ - addIsolatedMargin(req: AddIsolatedMarginReq): Promise; + AddIsolatedMargin(req: AddIsolatedMarginReq): Promise; /** * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit @@ -165,7 +165,7 @@ export interface PositionsAPI { ): Promise; /** - * getPositionList Get Position List + * GetPositionList Get Position List * Description: Get the position details of a specified position. * Documentation: https://www.kucoin.com/docs-new/api-3470253 * +---------------------+---------+ @@ -178,10 +178,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionList(req: GetPositionListReq): Promise; + GetPositionList(req: GetPositionListReq): Promise; /** - * modifyMarginLeverage Modify Cross Margin Leverage + * ModifyMarginLeverage Modify Cross Margin Leverage * Description: This interface can modify the current symbol’s cross-margin leverage multiple. * Documentation: https://www.kucoin.com/docs-new/api-3470261 * +---------------------+---------+ @@ -194,7 +194,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; + ModifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; /** * getCrossMarginLeverage Get Cross Margin Leverage @@ -213,7 +213,7 @@ export interface PositionsAPI { getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise; /** - * getMaxOpenSize Get Max Open Size + * GetMaxOpenSize Get Max Open Size * Description: Get Maximum Open Position Size. * Documentation: https://www.kucoin.com/docs-new/api-3470251 * +---------------------+---------+ @@ -226,7 +226,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; + GetMaxOpenSize(req: GetMaxOpenSizeReq): Promise; /** * switchMarginMode Switch Margin Mode @@ -278,7 +278,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - getPositionsHistory(req: GetPositionsHistoryReq): Promise { + GetPositionsHistory(req: GetPositionsHistoryReq): Promise { return this.transport.call( 'futures', false, @@ -290,7 +290,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { + GetMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { return this.transport.call( 'futures', false, @@ -302,7 +302,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { + RemoveIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, @@ -314,7 +314,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - getPositionDetails(req: GetPositionDetailsReq): Promise { + GetPositionDetails(req: GetPositionDetailsReq): Promise { return this.transport.call( 'futures', false, @@ -338,7 +338,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - addIsolatedMargin(req: AddIsolatedMarginReq): Promise { + AddIsolatedMargin(req: AddIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, @@ -364,7 +364,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - getPositionList(req: GetPositionListReq): Promise { + GetPositionList(req: GetPositionListReq): Promise { return this.transport.call( 'futures', false, @@ -376,7 +376,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { + ModifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { return this.transport.call( 'futures', false, @@ -400,7 +400,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { + GetMaxOpenSize(req: GetMaxOpenSizeReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/margin/marginprivate/api_margin_private.ts b/sdk/node/src/generate/margin/marginprivate/ws_margin_private.ts similarity index 100% rename from sdk/node/src/generate/margin/marginprivate/api_margin_private.ts rename to sdk/node/src/generate/margin/marginprivate/ws_margin_private.ts diff --git a/sdk/node/src/generate/margin/marginpublic/api_margin_public.ts b/sdk/node/src/generate/margin/marginpublic/ws_margin_public.ts similarity index 100% rename from sdk/node/src/generate/margin/marginpublic/api_margin_public.ts rename to sdk/node/src/generate/margin/marginpublic/ws_margin_public.ts diff --git a/sdk/node/src/generate/service/account_api.ts b/sdk/node/src/generate/service/account_api.ts index 9b9e0f64..7c6ccb3c 100644 --- a/sdk/node/src/generate/service/account_api.ts +++ b/sdk/node/src/generate/service/account_api.ts @@ -9,60 +9,60 @@ import { SubAccountAPIImpl, SubAccountAPI } from '@generate/account/subaccount/a import { WithdrawalAPIImpl, WithdrawalAPI } from '@generate/account/withdrawal/api_withdrawal'; import { DepositAPIImpl, DepositAPI } from '@generate/account/deposit/api_deposit'; -export abstract class AccountService { - abstract getAccountApi(): AccountAPI; +export interface AccountService { + getAccountApi(): AccountAPI; - abstract getDepositApi(): DepositAPI; + getDepositApi(): DepositAPI; - abstract getWithdrawalApi(): WithdrawalAPI; + getWithdrawalApi(): WithdrawalAPI; - abstract getFeeApi(): FeeAPI; + getFeeApi(): FeeAPI; - abstract getSubAccountApi(): SubAccountAPI; + getSubAccountApi(): SubAccountAPI; - abstract getTransferApi(): TransferAPI; + getTransferApi(): TransferAPI; } export class AccountServiceImpl implements AccountService { private readonly transport: Transport; - private readonly account: AccountAPI; - private readonly deposit: DepositAPI; - private readonly withdrawal: WithdrawalAPI; - private readonly fee: FeeAPI; - private readonly subAccount: SubAccountAPI; - private readonly transfer: TransferAPI; + private readonly Account: AccountAPI; + private readonly Deposit: DepositAPI; + private readonly Withdrawal: WithdrawalAPI; + private readonly Fee: FeeAPI; + private readonly SubAccount: SubAccountAPI; + private readonly Transfer: TransferAPI; constructor(transport: Transport) { this.transport = transport; - this.account = new AccountAPIImpl(transport); - this.deposit = new DepositAPIImpl(transport); - this.withdrawal = new WithdrawalAPIImpl(transport); - this.fee = new FeeAPIImpl(transport); - this.subAccount = new SubAccountAPIImpl(transport); - this.transfer = new TransferAPIImpl(transport); + this.Account = new AccountAPIImpl(transport); + this.Deposit = new DepositAPIImpl(transport); + this.Withdrawal = new WithdrawalAPIImpl(transport); + this.Fee = new FeeAPIImpl(transport); + this.SubAccount = new SubAccountAPIImpl(transport); + this.Transfer = new TransferAPIImpl(transport); } getAccountApi(): AccountAPI { - return this.account; + return this.Account; } getDepositApi(): DepositAPI { - return this.deposit; + return this.Deposit; } getWithdrawalApi(): WithdrawalAPI { - return this.withdrawal; + return this.Withdrawal; } getFeeApi(): FeeAPI { - return this.fee; + return this.Fee; } getSubAccountApi(): SubAccountAPI { - return this.subAccount; + return this.SubAccount; } getTransferApi(): TransferAPI { - return this.transfer; + return this.Transfer; } } diff --git a/sdk/node/src/generate/service/affiliate_api.ts b/sdk/node/src/generate/service/affiliate_api.ts index 3188958c..1f1b3b64 100644 --- a/sdk/node/src/generate/service/affiliate_api.ts +++ b/sdk/node/src/generate/service/affiliate_api.ts @@ -4,20 +4,20 @@ import { Transport } from '@internal/interfaces/transport'; import { AffiliateAPIImpl, AffiliateAPI } from '@generate/affiliate/affiliate/api_affiliate'; -export abstract class AffiliateService { - abstract getAffiliateApi(): AffiliateAPI; +export interface AffiliateService { + getAffiliateApi(): AffiliateAPI; } export class AffiliateServiceImpl implements AffiliateService { private readonly transport: Transport; - private readonly affiliate: AffiliateAPI; + private readonly Affiliate: AffiliateAPI; constructor(transport: Transport) { this.transport = transport; - this.affiliate = new AffiliateAPIImpl(transport); + this.Affiliate = new AffiliateAPIImpl(transport); } getAffiliateApi(): AffiliateAPI { - return this.affiliate; + return this.Affiliate; } } diff --git a/sdk/node/src/generate/service/broker_api.ts b/sdk/node/src/generate/service/broker_api.ts index ade92be2..4e9e5870 100644 --- a/sdk/node/src/generate/service/broker_api.ts +++ b/sdk/node/src/generate/service/broker_api.ts @@ -2,31 +2,31 @@ import { Transport } from '@internal/interfaces/transport'; -import { APIBrokerAPIImpl, APIBrokerAPI } from '@generate/broker/apibroker/api_a_pi_broker'; -import { NDBrokerAPI, NDBrokerAPIImpl } from '@generate/broker/ndbroker/api_n_d_broker'; +import { NDBrokerAPI, NDBrokerAPIImpl } from '@generate/broker/ndbroker/api_nd_broker'; +import { APIBrokerAPIImpl, APIBrokerAPI } from '@generate/broker/apibroker/api_api_broker'; -export abstract class BrokerService { - abstract getAPIBrokerApi(): APIBrokerAPI; +export interface BrokerService { + getAPIBrokerApi(): APIBrokerAPI; - abstract getNDBrokerApi(): NDBrokerAPI; + getNDBrokerApi(): NDBrokerAPI; } export class BrokerServiceImpl implements BrokerService { private readonly transport: Transport; - private readonly aPIBroker: APIBrokerAPI; - private readonly nDBroker: NDBrokerAPI; + private readonly APIBroker: APIBrokerAPI; + private readonly NDBroker: NDBrokerAPI; constructor(transport: Transport) { this.transport = transport; - this.aPIBroker = new APIBrokerAPIImpl(transport); - this.nDBroker = new NDBrokerAPIImpl(transport); + this.APIBroker = new APIBrokerAPIImpl(transport); + this.NDBroker = new NDBrokerAPIImpl(transport); } getAPIBrokerApi(): APIBrokerAPI { - return this.aPIBroker; + return this.APIBroker; } getNDBrokerApi(): NDBrokerAPI { - return this.nDBroker; + return this.NDBroker; } } diff --git a/sdk/node/src/generate/service/earn_api.ts b/sdk/node/src/generate/service/earn_api.ts index e9da0f87..7f04cac4 100644 --- a/sdk/node/src/generate/service/earn_api.ts +++ b/sdk/node/src/generate/service/earn_api.ts @@ -4,20 +4,20 @@ import { Transport } from '@internal/interfaces/transport'; import { EarnAPIImpl, EarnAPI } from '@generate/earn/earn/api_earn'; -export abstract class EarnService { - abstract getEarnApi(): EarnAPI; +export interface EarnService { + getEarnApi(): EarnAPI; } export class EarnServiceImpl implements EarnService { private readonly transport: Transport; - private readonly earn: EarnAPI; + private readonly Earn: EarnAPI; constructor(transport: Transport) { this.transport = transport; - this.earn = new EarnAPIImpl(transport); + this.Earn = new EarnAPIImpl(transport); } getEarnApi(): EarnAPI { - return this.earn; + return this.Earn; } } diff --git a/sdk/node/src/generate/service/futures_api.ts b/sdk/node/src/generate/service/futures_api.ts index a3fc3492..90289df0 100644 --- a/sdk/node/src/generate/service/futures_api.ts +++ b/sdk/node/src/generate/service/futures_api.ts @@ -7,44 +7,44 @@ import { PositionsAPI, PositionsAPIImpl } from '@generate/futures/positions/api_ import { OrderAPIImpl, OrderAPI } from '@generate/futures/order/api_order'; import { FundingFeesAPIImpl, FundingFeesAPI } from '@generate/futures/fundingfees/api_funding_fees'; -export abstract class FuturesService { - abstract getOrderApi(): OrderAPI; +export interface FuturesService { + getOrderApi(): OrderAPI; - abstract getPositionsApi(): PositionsAPI; + getPositionsApi(): PositionsAPI; - abstract getFundingFeesApi(): FundingFeesAPI; + getFundingFeesApi(): FundingFeesAPI; - abstract getMarketApi(): MarketAPI; + getMarketApi(): MarketAPI; } export class FuturesServiceImpl implements FuturesService { private readonly transport: Transport; - private readonly order: OrderAPI; - private readonly positions: PositionsAPI; - private readonly fundingFees: FundingFeesAPI; - private readonly market: MarketAPI; + private readonly Order: OrderAPI; + private readonly Positions: PositionsAPI; + private readonly FundingFees: FundingFeesAPI; + private readonly Market: MarketAPI; constructor(transport: Transport) { this.transport = transport; - this.order = new OrderAPIImpl(transport); - this.positions = new PositionsAPIImpl(transport); - this.fundingFees = new FundingFeesAPIImpl(transport); - this.market = new MarketAPIImpl(transport); + this.Order = new OrderAPIImpl(transport); + this.Positions = new PositionsAPIImpl(transport); + this.FundingFees = new FundingFeesAPIImpl(transport); + this.Market = new MarketAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.order; + return this.Order; } getPositionsApi(): PositionsAPI { - return this.positions; + return this.Positions; } getFundingFeesApi(): FundingFeesAPI { - return this.fundingFees; + return this.FundingFees; } getMarketApi(): MarketAPI { - return this.market; + return this.Market; } } diff --git a/sdk/node/src/generate/service/margin_api.ts b/sdk/node/src/generate/service/margin_api.ts index e6568da4..b2b81827 100644 --- a/sdk/node/src/generate/service/margin_api.ts +++ b/sdk/node/src/generate/service/margin_api.ts @@ -8,52 +8,52 @@ import { RiskLimitAPIImpl, RiskLimitAPI } from '@generate/margin/risklimit/api_r import { CreditAPI, CreditAPIImpl } from '@generate/margin/credit/api_credit'; import { MarketAPIImpl, MarketAPI } from '@generate/margin/market/api_market'; -export abstract class MarginService { - abstract getOrderApi(): OrderAPI; +export interface MarginService { + getOrderApi(): OrderAPI; - abstract getDebitApi(): DebitAPI; + getDebitApi(): DebitAPI; - abstract getCreditApi(): CreditAPI; + getCreditApi(): CreditAPI; - abstract getMarketApi(): MarketAPI; + getMarketApi(): MarketAPI; - abstract getRiskLimitApi(): RiskLimitAPI; + getRiskLimitApi(): RiskLimitAPI; } export class MarginServiceImpl implements MarginService { private readonly transport: Transport; - private readonly order: OrderAPI; - private readonly debit: DebitAPI; - private readonly credit: CreditAPI; - private readonly market: MarketAPI; - private readonly riskLimit: RiskLimitAPI; + private readonly Order: OrderAPI; + private readonly Debit: DebitAPI; + private readonly Credit: CreditAPI; + private readonly Market: MarketAPI; + private readonly RiskLimit: RiskLimitAPI; constructor(transport: Transport) { this.transport = transport; - this.order = new OrderAPIImpl(transport); - this.debit = new DebitAPIImpl(transport); - this.credit = new CreditAPIImpl(transport); - this.market = new MarketAPIImpl(transport); - this.riskLimit = new RiskLimitAPIImpl(transport); + this.Order = new OrderAPIImpl(transport); + this.Debit = new DebitAPIImpl(transport); + this.Credit = new CreditAPIImpl(transport); + this.Market = new MarketAPIImpl(transport); + this.RiskLimit = new RiskLimitAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.order; + return this.Order; } getDebitApi(): DebitAPI { - return this.debit; + return this.Debit; } getCreditApi(): CreditAPI { - return this.credit; + return this.Credit; } getMarketApi(): MarketAPI { - return this.market; + return this.Market; } getRiskLimitApi(): RiskLimitAPI { - return this.riskLimit; + return this.RiskLimit; } } diff --git a/sdk/node/src/generate/service/spot_api.ts b/sdk/node/src/generate/service/spot_api.ts index e255025c..c55d15c9 100644 --- a/sdk/node/src/generate/service/spot_api.ts +++ b/sdk/node/src/generate/service/spot_api.ts @@ -5,28 +5,28 @@ import { Transport } from '@internal/interfaces/transport'; import { MarketAPIImpl, MarketAPI } from '@generate/spot/market/api_market'; import { OrderAPIImpl, OrderAPI } from '@generate/spot/order/api_order'; -export abstract class SpotService { - abstract getOrderApi(): OrderAPI; +export interface SpotService { + getOrderApi(): OrderAPI; - abstract getMarketApi(): MarketAPI; + getMarketApi(): MarketAPI; } export class SpotServiceImpl implements SpotService { private readonly transport: Transport; - private readonly order: OrderAPI; - private readonly market: MarketAPI; + private readonly Order: OrderAPI; + private readonly Market: MarketAPI; constructor(transport: Transport) { this.transport = transport; - this.order = new OrderAPIImpl(transport); - this.market = new MarketAPIImpl(transport); + this.Order = new OrderAPIImpl(transport); + this.Market = new MarketAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.order; + return this.Order; } getMarketApi(): MarketAPI { - return this.market; + return this.Market; } } diff --git a/sdk/node/src/generate/service/viplending_api.ts b/sdk/node/src/generate/service/viplending_api.ts index a609d254..020e8323 100644 --- a/sdk/node/src/generate/service/viplending_api.ts +++ b/sdk/node/src/generate/service/viplending_api.ts @@ -2,22 +2,22 @@ import { Transport } from '@internal/interfaces/transport'; -import { VIPLendingAPI, VIPLendingAPIImpl } from '@generate/viplending/viplending/api_v_ip_lending'; +import { VIPLendingAPI, VIPLendingAPIImpl } from '@generate/viplending/viplending/api_vip_lending'; -export abstract class VIPLendingService { - abstract getVIPLendingApi(): VIPLendingAPI; +export interface VIPLendingService { + getVIPLendingApi(): VIPLendingAPI; } export class VIPLendingServiceImpl implements VIPLendingService { private readonly transport: Transport; - private readonly vIPLending: VIPLendingAPI; + private readonly VIPLending: VIPLendingAPI; constructor(transport: Transport) { this.transport = transport; - this.vIPLending = new VIPLendingAPIImpl(transport); + this.VIPLending = new VIPLendingAPIImpl(transport); } getVIPLendingApi(): VIPLendingAPI { - return this.vIPLending; + return this.VIPLending; } } diff --git a/sdk/node/src/generate/spot/spotprivate/api_spot_private.ts b/sdk/node/src/generate/spot/spotprivate/ws_spot_private.ts similarity index 100% rename from sdk/node/src/generate/spot/spotprivate/api_spot_private.ts rename to sdk/node/src/generate/spot/spotprivate/ws_spot_private.ts diff --git a/sdk/node/src/generate/spot/spotpublic/api_spot_public.ts b/sdk/node/src/generate/spot/spotpublic/ws_spot_public.ts similarity index 100% rename from sdk/node/src/generate/spot/spotpublic/api_spot_public.ts rename to sdk/node/src/generate/spot/spotpublic/ws_spot_public.ts diff --git a/sdk/node/src/internal/ws/default_ws_impl.ts b/sdk/node/src/internal/ws/default_ws_impl.ts index 6a263083..38a24ce5 100644 --- a/sdk/node/src/internal/ws/default_ws_impl.ts +++ b/sdk/node/src/internal/ws/default_ws_impl.ts @@ -1,24 +1,21 @@ import { KucoinWSService } from '@api/api_ws'; import { ClientOption } from '@model/client_option'; -import { SpotPublicWS, SpotPublicWSImpl } from '@generate/spot/spotpublic/api_spot_public'; +import { SpotPublicWS, SpotPublicWSImpl } from '@generate/spot/spotpublic/ws_spot_public'; import { DomainType } from '@model/constant'; -import { SpotPrivateWS, SpotPrivateWSImpl } from '@generate/spot/spotprivate/api_spot_private'; -import { - MarginPublicWS, - MarginPublicWSImpl, -} from '@generate/margin/marginpublic/api_margin_public'; +import { SpotPrivateWS, SpotPrivateWSImpl } from '@generate/spot/spotprivate/ws_spot_private'; +import { MarginPublicWS, MarginPublicWSImpl } from '@generate/margin/marginpublic/ws_margin_public'; import { MarginPrivateWS, MarginPrivateWSImpl, -} from '@generate/margin/marginprivate/api_margin_private'; +} from '@generate/margin/marginprivate/ws_margin_private'; import { FuturesPublicWS, FuturesPublicWSImpl, -} from '@generate/futures/futurespublic/api_futures_public'; +} from '@generate/futures/futurespublic/ws_futures_public'; import { FuturesPrivateWS, FuturesPrivateWSImpl, -} from '@generate/futures/futuresprivate/api_futures_private'; +} from '@generate/futures/futuresprivate/ws_futures_private'; import { DefaultWsService } from '../infra/default_ws_service'; import { SdkVersion } from '@generate/version'; From a5b91ecc88b53b3909b372b8f621a888a57938b7 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 8 Jan 2025 20:20:02 +0800 Subject: [PATCH 009/106] feat(nodejs): update generator --- .../plugin/generator/NodeSdkGenerator.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index e6a83d07..57086f3f 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -164,12 +164,6 @@ public String formatPackage(String name) { @Override public CodegenProperty fromProperty(String name, Schema p, boolean required) { CodegenProperty prop = super.fromProperty(name, p, required); - String cc = camelize(prop.name, LOWERCASE_FIRST_LETTER); - if (isReservedWord(cc)) { - cc = escapeReservedWord(cc); - } - prop.nameInCamelCase = cc; - if (prop.defaultValue != null && prop.defaultValue.equalsIgnoreCase("undefined")) { prop.defaultValue = null; } @@ -177,22 +171,11 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required) { if (prop.isEnum) { List enums = new ArrayList<>(); - Map builderVars = new HashMap<>(); - List> enumList; if (prop.openApiType.equalsIgnoreCase("array")) { enumList = (List>) prop.mostInnerItems.vendorExtensions.get("x-api-enum"); - - // list[XX.TypeEnum] - builderVars.put("prefix", "list["); - builderVars.put("suffix", "." + prop.enumName + "]"); - } else { enumList = (List>) prop.vendorExtensions.get("x-api-enum"); - - // XX.TypeEnum - builderVars.put("prefix", ""); - builderVars.put("suffix", "." + prop.datatypeWithEnum); } @@ -232,8 +215,6 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required) { prop.allowableValues.put("values", values); prop.vendorExtensions.put("x-enum-varnames", names); prop.vendorExtensions.put("x-enum-descriptions", description); - prop.vendorExtensions.put("x-enum-builder-vars", builderVars); - prop.vendorExtensions.put("x-enums", enums); } From 6669a5abf2b34470d5524aa620885cbe7c70eda1 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 9 Jan 2025 10:36:27 +0800 Subject: [PATCH 010/106] feat(nodejs): update style --- Dockerfile | 2 +- Makefile | 6 +++--- generator/plugin/src/main/resources/node-sdk/model.mustache | 2 ++ .../plugin/src/main/resources/node-sdk/model_ws.mustache | 3 +++ sdk/node/src/api/client.ts | 4 ++-- .../generate/account/account/model_get_account_info_resp.ts | 1 + .../generate/account/account/model_get_apikey_info_resp.ts | 1 + .../account/model_get_cross_margin_account_accounts.ts | 1 + .../account/account/model_get_cross_margin_account_req.ts | 1 + .../account/account/model_get_cross_margin_account_resp.ts | 1 + .../account/account/model_get_futures_account_req.ts | 1 + .../account/account/model_get_futures_account_resp.ts | 1 + .../account/account/model_get_futures_ledger_data_list.ts | 1 + .../account/account/model_get_futures_ledger_req.ts | 1 + .../account/account/model_get_futures_ledger_resp.ts | 1 + .../account/model_get_isolated_margin_account_assets.ts | 1 + .../model_get_isolated_margin_account_assets_base_asset.ts | 1 + .../model_get_isolated_margin_account_assets_quote_asset.ts | 1 + ...odel_get_isolated_margin_account_detail_v1_base_asset.ts | 1 + ...del_get_isolated_margin_account_detail_v1_quote_asset.ts | 1 + .../model_get_isolated_margin_account_detail_v1_req.ts | 1 + .../model_get_isolated_margin_account_detail_v1_resp.ts | 1 + .../model_get_isolated_margin_account_list_v1_assets.ts | 1 + ...get_isolated_margin_account_list_v1_assets_base_asset.ts | 1 + ...et_isolated_margin_account_list_v1_assets_quote_asset.ts | 1 + .../model_get_isolated_margin_account_list_v1_req.ts | 1 + .../model_get_isolated_margin_account_list_v1_resp.ts | 1 + .../account/model_get_isolated_margin_account_req.ts | 1 + .../account/model_get_isolated_margin_account_resp.ts | 1 + .../account/model_get_margin_account_detail_accounts.ts | 1 + .../account/account/model_get_margin_account_detail_resp.ts | 1 + .../account/account/model_get_margin_hf_ledger_data.ts | 1 + .../account/account/model_get_margin_hf_ledger_req.ts | 1 + .../account/account/model_get_margin_hf_ledger_resp.ts | 1 + .../account/account/model_get_spot_account_detail_req.ts | 1 + .../account/account/model_get_spot_account_detail_resp.ts | 1 + .../account/account/model_get_spot_account_list_data.ts | 1 + .../account/account/model_get_spot_account_list_req.ts | 1 + .../account/account/model_get_spot_account_list_resp.ts | 1 + .../account/account/model_get_spot_account_type_resp.ts | 1 + .../account/account/model_get_spot_hf_ledger_data.ts | 1 + .../account/account/model_get_spot_hf_ledger_req.ts | 1 + .../account/account/model_get_spot_hf_ledger_resp.ts | 1 + .../generate/account/account/model_get_spot_ledger_items.ts | 1 + .../generate/account/account/model_get_spot_ledger_req.ts | 1 + .../generate/account/account/model_get_spot_ledger_resp.ts | 1 + .../account/deposit/model_add_deposit_address_v1_req.ts | 1 + .../account/deposit/model_add_deposit_address_v1_resp.ts | 1 + .../account/deposit/model_add_deposit_address_v3_req.ts | 1 + .../account/deposit/model_add_deposit_address_v3_resp.ts | 1 + .../account/deposit/model_get_deposit_address_v1_req.ts | 1 + .../account/deposit/model_get_deposit_address_v1_resp.ts | 1 + .../account/deposit/model_get_deposit_address_v2_data.ts | 1 + .../account/deposit/model_get_deposit_address_v2_req.ts | 1 + .../account/deposit/model_get_deposit_address_v2_resp.ts | 1 + .../account/deposit/model_get_deposit_address_v3_data.ts | 1 + .../account/deposit/model_get_deposit_address_v3_req.ts | 1 + .../account/deposit/model_get_deposit_address_v3_resp.ts | 1 + .../account/deposit/model_get_deposit_history_items.ts | 1 + .../account/deposit/model_get_deposit_history_old_items.ts | 1 + .../account/deposit/model_get_deposit_history_old_req.ts | 1 + .../account/deposit/model_get_deposit_history_old_resp.ts | 1 + .../account/deposit/model_get_deposit_history_req.ts | 1 + .../account/deposit/model_get_deposit_history_resp.ts | 1 + .../src/generate/account/fee/model_get_basic_fee_req.ts | 1 + .../src/generate/account/fee/model_get_basic_fee_resp.ts | 1 + .../account/fee/model_get_futures_actual_fee_req.ts | 1 + .../account/fee/model_get_futures_actual_fee_resp.ts | 1 + .../generate/account/fee/model_get_spot_actual_fee_data.ts | 1 + .../generate/account/fee/model_get_spot_actual_fee_req.ts | 1 + .../generate/account/fee/model_get_spot_actual_fee_resp.ts | 1 + .../account/subaccount/model_add_sub_account_api_req.ts | 1 + .../account/subaccount/model_add_sub_account_api_resp.ts | 1 + .../model_add_sub_account_futures_permission_req.ts | 1 + .../model_add_sub_account_futures_permission_resp.ts | 1 + .../model_add_sub_account_margin_permission_req.ts | 1 + .../model_add_sub_account_margin_permission_resp.ts | 1 + .../account/subaccount/model_add_sub_account_req.ts | 1 + .../account/subaccount/model_add_sub_account_resp.ts | 1 + .../account/subaccount/model_delete_sub_account_api_req.ts | 1 + .../account/subaccount/model_delete_sub_account_api_resp.ts | 1 + .../model_get_futures_sub_account_list_v2_accounts.ts | 1 + .../subaccount/model_get_futures_sub_account_list_v2_req.ts | 1 + .../model_get_futures_sub_account_list_v2_resp.ts | 1 + .../model_get_futures_sub_account_list_v2_summary.ts | 1 + .../model_get_spot_sub_account_detail_main_accounts.ts | 1 + .../model_get_spot_sub_account_detail_margin_accounts.ts | 1 + .../subaccount/model_get_spot_sub_account_detail_req.ts | 1 + .../subaccount/model_get_spot_sub_account_detail_resp.ts | 1 + .../model_get_spot_sub_account_detail_trade_accounts.ts | 1 + .../subaccount/model_get_spot_sub_account_list_v1_data.ts | 1 + ...model_get_spot_sub_account_list_v1_data_main_accounts.ts | 1 + ...del_get_spot_sub_account_list_v1_data_margin_accounts.ts | 1 + ...odel_get_spot_sub_account_list_v1_data_trade_accounts.ts | 1 + .../subaccount/model_get_spot_sub_account_list_v1_resp.ts | 1 + .../subaccount/model_get_spot_sub_account_list_v2_items.ts | 1 + ...odel_get_spot_sub_account_list_v2_items_main_accounts.ts | 1 + ...el_get_spot_sub_account_list_v2_items_margin_accounts.ts | 1 + ...del_get_spot_sub_account_list_v2_items_trade_accounts.ts | 1 + .../subaccount/model_get_spot_sub_account_list_v2_req.ts | 1 + .../subaccount/model_get_spot_sub_account_list_v2_resp.ts | 1 + .../model_get_spot_sub_accounts_summary_v1_data.ts | 1 + .../model_get_spot_sub_accounts_summary_v1_resp.ts | 1 + .../model_get_spot_sub_accounts_summary_v2_items.ts | 1 + .../model_get_spot_sub_accounts_summary_v2_req.ts | 1 + .../model_get_spot_sub_accounts_summary_v2_resp.ts | 1 + .../subaccount/model_get_sub_account_api_list_data.ts | 1 + .../subaccount/model_get_sub_account_api_list_req.ts | 1 + .../subaccount/model_get_sub_account_api_list_resp.ts | 1 + .../account/subaccount/model_modify_sub_account_api_req.ts | 1 + .../account/subaccount/model_modify_sub_account_api_resp.ts | 1 + .../generate/account/transfer/model_flex_transfer_req.ts | 1 + .../generate/account/transfer/model_flex_transfer_resp.ts | 1 + .../transfer/model_futures_account_transfer_in_req.ts | 1 + .../transfer/model_futures_account_transfer_in_resp.ts | 1 + .../transfer/model_futures_account_transfer_out_req.ts | 1 + .../transfer/model_futures_account_transfer_out_resp.ts | 1 + .../model_get_futures_account_transfer_out_ledger_items.ts | 1 + .../model_get_futures_account_transfer_out_ledger_req.ts | 1 + .../model_get_futures_account_transfer_out_ledger_resp.ts | 1 + .../account/transfer/model_get_transfer_quotas_req.ts | 1 + .../account/transfer/model_get_transfer_quotas_resp.ts | 1 + .../generate/account/transfer/model_inner_transfer_req.ts | 1 + .../generate/account/transfer/model_inner_transfer_resp.ts | 1 + .../account/transfer/model_sub_account_transfer_req.ts | 1 + .../account/transfer/model_sub_account_transfer_resp.ts | 1 + .../account/withdrawal/model_cancel_withdrawal_req.ts | 1 + .../account/withdrawal/model_cancel_withdrawal_resp.ts | 1 + .../withdrawal/model_get_withdrawal_history_items.ts | 1 + .../withdrawal/model_get_withdrawal_history_old_items.ts | 1 + .../withdrawal/model_get_withdrawal_history_old_req.ts | 1 + .../withdrawal/model_get_withdrawal_history_old_resp.ts | 1 + .../account/withdrawal/model_get_withdrawal_history_req.ts | 1 + .../account/withdrawal/model_get_withdrawal_history_resp.ts | 1 + .../account/withdrawal/model_get_withdrawal_quotas_req.ts | 1 + .../account/withdrawal/model_get_withdrawal_quotas_resp.ts | 1 + .../generate/account/withdrawal/model_withdrawal_v1_req.ts | 1 + .../generate/account/withdrawal/model_withdrawal_v1_resp.ts | 1 + .../generate/account/withdrawal/model_withdrawal_v3_req.ts | 1 + .../generate/account/withdrawal/model_withdrawal_v3_resp.ts | 1 + .../generate/affiliate/affiliate/model_get_account_ltv.ts | 1 + .../affiliate/affiliate/model_get_account_margins.ts | 1 + .../affiliate/affiliate/model_get_account_orders.ts | 1 + .../generate/affiliate/affiliate/model_get_account_resp.ts | 1 + .../src/generate/broker/apibroker/model_get_rebase_req.ts | 1 + .../src/generate/broker/apibroker/model_get_rebase_resp.ts | 1 + .../broker/ndbroker/model_add_sub_account_api_req.ts | 1 + .../broker/ndbroker/model_add_sub_account_api_resp.ts | 1 + .../generate/broker/ndbroker/model_add_sub_account_req.ts | 1 + .../generate/broker/ndbroker/model_add_sub_account_resp.ts | 1 + .../broker/ndbroker/model_delete_sub_account_api_req.ts | 1 + .../broker/ndbroker/model_delete_sub_account_api_resp.ts | 1 + .../generate/broker/ndbroker/model_get_broker_info_req.ts | 1 + .../generate/broker/ndbroker/model_get_broker_info_resp.ts | 1 + .../broker/ndbroker/model_get_deposit_detail_req.ts | 1 + .../broker/ndbroker/model_get_deposit_detail_resp.ts | 1 + .../generate/broker/ndbroker/model_get_deposit_list_data.ts | 1 + .../generate/broker/ndbroker/model_get_deposit_list_req.ts | 1 + .../generate/broker/ndbroker/model_get_deposit_list_resp.ts | 1 + .../src/generate/broker/ndbroker/model_get_rebase_req.ts | 1 + .../src/generate/broker/ndbroker/model_get_rebase_resp.ts | 1 + .../broker/ndbroker/model_get_sub_account_api_data.ts | 1 + .../broker/ndbroker/model_get_sub_account_api_req.ts | 1 + .../broker/ndbroker/model_get_sub_account_api_resp.ts | 1 + .../generate/broker/ndbroker/model_get_sub_account_items.ts | 1 + .../generate/broker/ndbroker/model_get_sub_account_req.ts | 1 + .../generate/broker/ndbroker/model_get_sub_account_resp.ts | 1 + .../broker/ndbroker/model_get_transfer_history_req.ts | 1 + .../broker/ndbroker/model_get_transfer_history_resp.ts | 1 + .../broker/ndbroker/model_get_withdraw_detail_req.ts | 1 + .../broker/ndbroker/model_get_withdraw_detail_resp.ts | 1 + .../broker/ndbroker/model_modify_sub_account_api_req.ts | 1 + .../broker/ndbroker/model_modify_sub_account_api_resp.ts | 1 + sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts | 1 + .../src/generate/broker/ndbroker/model_transfer_resp.ts | 1 + .../generate/earn/earn/model_get_account_holding_items.ts | 1 + .../src/generate/earn/earn/model_get_account_holding_req.ts | 1 + .../generate/earn/earn/model_get_account_holding_resp.ts | 1 + .../earn/earn/model_get_eth_staking_products_data.ts | 1 + .../earn/earn/model_get_eth_staking_products_req.ts | 1 + .../earn/earn/model_get_eth_staking_products_resp.ts | 1 + .../earn/earn/model_get_kcs_staking_products_data.ts | 1 + .../earn/earn/model_get_kcs_staking_products_req.ts | 1 + .../earn/earn/model_get_kcs_staking_products_resp.ts | 1 + .../generate/earn/earn/model_get_promotion_products_data.ts | 1 + .../generate/earn/earn/model_get_promotion_products_req.ts | 1 + .../generate/earn/earn/model_get_promotion_products_resp.ts | 1 + .../src/generate/earn/earn/model_get_redeem_preview_req.ts | 1 + .../src/generate/earn/earn/model_get_redeem_preview_resp.ts | 1 + .../generate/earn/earn/model_get_savings_products_data.ts | 1 + .../generate/earn/earn/model_get_savings_products_req.ts | 1 + .../generate/earn/earn/model_get_savings_products_resp.ts | 1 + .../generate/earn/earn/model_get_staking_products_data.ts | 1 + .../generate/earn/earn/model_get_staking_products_req.ts | 1 + .../generate/earn/earn/model_get_staking_products_resp.ts | 1 + sdk/node/src/generate/earn/earn/model_purchase_req.ts | 1 + sdk/node/src/generate/earn/earn/model_purchase_resp.ts | 1 + sdk/node/src/generate/earn/earn/model_redeem_req.ts | 1 + sdk/node/src/generate/earn/earn/model_redeem_resp.ts | 1 + .../fundingfees/model_get_current_funding_rate_req.ts | 1 + .../fundingfees/model_get_current_funding_rate_resp.ts | 1 + .../model_get_private_funding_history_data_list.ts | 1 + .../fundingfees/model_get_private_funding_history_req.ts | 1 + .../fundingfees/model_get_private_funding_history_resp.ts | 1 + .../fundingfees/model_get_public_funding_history_data.ts | 1 + .../fundingfees/model_get_public_funding_history_req.ts | 1 + .../fundingfees/model_get_public_funding_history_resp.ts | 1 + .../futures/futuresprivate/model_all_order_event.ts | 2 ++ .../futures/futuresprivate/model_all_position_event.ts | 2 ++ .../generate/futures/futuresprivate/model_balance_event.ts | 2 ++ .../futuresprivate/model_cross_leverage_data_value.ts | 2 ++ .../futures/futuresprivate/model_cross_leverage_event.ts | 1 + .../futures/futuresprivate/model_margin_mode_event.ts | 2 ++ .../generate/futures/futuresprivate/model_order_event.ts | 2 ++ .../generate/futures/futuresprivate/model_position_event.ts | 2 ++ .../futures/futuresprivate/model_stop_orders_event.ts | 2 ++ .../futures/futurespublic/model_announcement_event.ts | 2 ++ .../generate/futures/futurespublic/model_execution_event.ts | 2 ++ .../futures/futurespublic/model_instrument_event.ts | 2 ++ .../generate/futures/futurespublic/model_klines_event.ts | 2 ++ .../futurespublic/model_orderbook_increment_event.ts | 2 ++ .../futures/futurespublic/model_orderbook_level50_event.ts | 2 ++ .../futures/futurespublic/model_orderbook_level5_event.ts | 2 ++ .../futures/futurespublic/model_symbol_snapshot_event.ts | 2 ++ .../generate/futures/futurespublic/model_ticker_v1_event.ts | 2 ++ .../generate/futures/futurespublic/model_ticker_v2_event.ts | 2 ++ .../src/generate/futures/market/model_get24hr_stats_resp.ts | 1 + .../generate/futures/market/model_get_all_symbols_data.ts | 1 + .../generate/futures/market/model_get_all_symbols_resp.ts | 1 + .../generate/futures/market/model_get_all_tickers_data.ts | 1 + .../generate/futures/market/model_get_all_tickers_resp.ts | 1 + .../futures/market/model_get_full_order_book_req.ts | 1 + .../futures/market/model_get_full_order_book_resp.ts | 1 + .../market/model_get_interest_rate_index_data_list.ts | 1 + .../futures/market/model_get_interest_rate_index_req.ts | 1 + .../futures/market/model_get_interest_rate_index_resp.ts | 1 + .../src/generate/futures/market/model_get_klines_req.ts | 1 + .../src/generate/futures/market/model_get_klines_resp.ts | 1 + .../src/generate/futures/market/model_get_mark_price_req.ts | 1 + .../generate/futures/market/model_get_mark_price_resp.ts | 1 + .../futures/market/model_get_part_order_book_req.ts | 1 + .../futures/market/model_get_part_order_book_resp.ts | 1 + .../futures/market/model_get_premium_index_data_list.ts | 1 + .../generate/futures/market/model_get_premium_index_req.ts | 1 + .../generate/futures/market/model_get_premium_index_resp.ts | 1 + .../market/model_get_private_token_instance_servers.ts | 1 + .../generate/futures/market/model_get_private_token_resp.ts | 1 + .../market/model_get_public_token_instance_servers.ts | 1 + .../generate/futures/market/model_get_public_token_resp.ts | 1 + .../generate/futures/market/model_get_server_time_resp.ts | 1 + .../futures/market/model_get_service_status_resp.ts | 1 + .../futures/market/model_get_spot_index_price_data_list.ts | 1 + ...model_get_spot_index_price_data_list_decomposion_list.ts | 1 + .../futures/market/model_get_spot_index_price_req.ts | 1 + .../futures/market/model_get_spot_index_price_resp.ts | 1 + .../src/generate/futures/market/model_get_symbol_req.ts | 1 + .../src/generate/futures/market/model_get_symbol_resp.ts | 1 + .../src/generate/futures/market/model_get_ticker_req.ts | 1 + .../src/generate/futures/market/model_get_ticker_resp.ts | 1 + .../generate/futures/market/model_get_trade_history_data.ts | 1 + .../generate/futures/market/model_get_trade_history_req.ts | 1 + .../generate/futures/market/model_get_trade_history_resp.ts | 1 + sdk/node/src/generate/futures/order/model_add_order_req.ts | 1 + sdk/node/src/generate/futures/order/model_add_order_resp.ts | 1 + .../src/generate/futures/order/model_add_order_test_req.ts | 1 + .../src/generate/futures/order/model_add_order_test_resp.ts | 1 + .../src/generate/futures/order/model_add_tpsl_order_req.ts | 1 + .../src/generate/futures/order/model_add_tpsl_order_resp.ts | 1 + .../generate/futures/order/model_batch_add_orders_data.ts | 1 + .../generate/futures/order/model_batch_add_orders_item.ts | 1 + .../generate/futures/order/model_batch_add_orders_req.ts | 1 + .../generate/futures/order/model_batch_add_orders_resp.ts | 1 + .../order/model_batch_cancel_orders_client_oids_list.ts | 1 + .../futures/order/model_batch_cancel_orders_data.ts | 1 + .../generate/futures/order/model_batch_cancel_orders_req.ts | 1 + .../futures/order/model_batch_cancel_orders_resp.ts | 1 + .../futures/order/model_cancel_all_orders_v1_req.ts | 1 + .../futures/order/model_cancel_all_orders_v1_resp.ts | 1 + .../futures/order/model_cancel_all_orders_v3_req.ts | 1 + .../futures/order/model_cancel_all_orders_v3_resp.ts | 1 + .../futures/order/model_cancel_all_stop_orders_req.ts | 1 + .../futures/order/model_cancel_all_stop_orders_resp.ts | 1 + .../futures/order/model_cancel_order_by_client_oid_req.ts | 1 + .../futures/order/model_cancel_order_by_client_oid_resp.ts | 1 + .../generate/futures/order/model_cancel_order_by_id_req.ts | 1 + .../generate/futures/order/model_cancel_order_by_id_resp.ts | 1 + .../futures/order/model_get_open_order_value_req.ts | 1 + .../futures/order/model_get_open_order_value_resp.ts | 1 + .../futures/order/model_get_order_by_client_oid_req.ts | 1 + .../futures/order/model_get_order_by_client_oid_resp.ts | 1 + .../futures/order/model_get_order_by_order_id_req.ts | 1 + .../futures/order/model_get_order_by_order_id_resp.ts | 1 + .../generate/futures/order/model_get_order_list_items.ts | 1 + .../src/generate/futures/order/model_get_order_list_req.ts | 1 + .../src/generate/futures/order/model_get_order_list_resp.ts | 1 + .../futures/order/model_get_recent_closed_orders_data.ts | 1 + .../futures/order/model_get_recent_closed_orders_req.ts | 1 + .../futures/order/model_get_recent_closed_orders_resp.ts | 1 + .../futures/order/model_get_recent_trade_history_data.ts | 1 + .../futures/order/model_get_recent_trade_history_req.ts | 1 + .../futures/order/model_get_recent_trade_history_resp.ts | 1 + .../futures/order/model_get_stop_order_list_items.ts | 1 + .../generate/futures/order/model_get_stop_order_list_req.ts | 1 + .../futures/order/model_get_stop_order_list_resp.ts | 1 + .../generate/futures/order/model_get_trade_history_items.ts | 1 + .../generate/futures/order/model_get_trade_history_req.ts | 1 + .../generate/futures/order/model_get_trade_history_resp.ts | 1 + .../futures/positions/model_add_isolated_margin_req.ts | 1 + .../futures/positions/model_add_isolated_margin_resp.ts | 1 + .../positions/model_get_cross_margin_leverage_req.ts | 1 + .../positions/model_get_cross_margin_leverage_resp.ts | 1 + .../positions/model_get_isolated_margin_risk_limit_data.ts | 1 + .../positions/model_get_isolated_margin_risk_limit_req.ts | 1 + .../positions/model_get_isolated_margin_risk_limit_resp.ts | 1 + .../generate/futures/positions/model_get_margin_mode_req.ts | 1 + .../futures/positions/model_get_margin_mode_resp.ts | 1 + .../futures/positions/model_get_max_open_size_req.ts | 1 + .../futures/positions/model_get_max_open_size_resp.ts | 1 + .../futures/positions/model_get_max_withdraw_margin_req.ts | 1 + .../futures/positions/model_get_max_withdraw_margin_resp.ts | 1 + .../futures/positions/model_get_position_details_req.ts | 1 + .../futures/positions/model_get_position_details_resp.ts | 1 + .../futures/positions/model_get_position_list_data.ts | 1 + .../futures/positions/model_get_position_list_req.ts | 1 + .../futures/positions/model_get_position_list_resp.ts | 1 + .../futures/positions/model_get_positions_history_items.ts | 1 + .../futures/positions/model_get_positions_history_req.ts | 1 + .../futures/positions/model_get_positions_history_resp.ts | 1 + .../positions/model_modify_auto_deposit_status_req.ts | 1 + .../positions/model_modify_auto_deposit_status_resp.ts | 1 + .../positions/model_modify_isolated_margin_risk_limt_req.ts | 1 + .../model_modify_isolated_margin_risk_limt_resp.ts | 1 + .../futures/positions/model_modify_margin_leverage_req.ts | 1 + .../futures/positions/model_modify_margin_leverage_resp.ts | 1 + .../futures/positions/model_remove_isolated_margin_req.ts | 1 + .../futures/positions/model_remove_isolated_margin_resp.ts | 1 + .../futures/positions/model_switch_margin_mode_req.ts | 1 + .../futures/positions/model_switch_margin_mode_resp.ts | 1 + .../generate/margin/credit/model_get_loan_market_data.ts | 1 + .../credit/model_get_loan_market_interest_rate_data.ts | 1 + .../credit/model_get_loan_market_interest_rate_req.ts | 1 + .../credit/model_get_loan_market_interest_rate_resp.ts | 1 + .../src/generate/margin/credit/model_get_loan_market_req.ts | 1 + .../generate/margin/credit/model_get_loan_market_resp.ts | 1 + .../margin/credit/model_get_purchase_orders_items.ts | 1 + .../generate/margin/credit/model_get_purchase_orders_req.ts | 1 + .../margin/credit/model_get_purchase_orders_resp.ts | 1 + .../generate/margin/credit/model_get_redeem_orders_items.ts | 1 + .../generate/margin/credit/model_get_redeem_orders_req.ts | 1 + .../generate/margin/credit/model_get_redeem_orders_resp.ts | 1 + .../src/generate/margin/credit/model_modify_purchase_req.ts | 1 + .../generate/margin/credit/model_modify_purchase_resp.ts | 1 + sdk/node/src/generate/margin/credit/model_purchase_req.ts | 1 + sdk/node/src/generate/margin/credit/model_purchase_resp.ts | 1 + sdk/node/src/generate/margin/credit/model_redeem_req.ts | 1 + sdk/node/src/generate/margin/credit/model_redeem_resp.ts | 1 + sdk/node/src/generate/margin/debit/model_borrow_req.ts | 1 + sdk/node/src/generate/margin/debit/model_borrow_resp.ts | 1 + .../generate/margin/debit/model_get_borrow_history_items.ts | 1 + .../generate/margin/debit/model_get_borrow_history_req.ts | 1 + .../generate/margin/debit/model_get_borrow_history_resp.ts | 1 + .../margin/debit/model_get_interest_history_items.ts | 1 + .../generate/margin/debit/model_get_interest_history_req.ts | 1 + .../margin/debit/model_get_interest_history_resp.ts | 1 + .../generate/margin/debit/model_get_repay_history_items.ts | 1 + .../generate/margin/debit/model_get_repay_history_req.ts | 1 + .../generate/margin/debit/model_get_repay_history_resp.ts | 1 + .../src/generate/margin/debit/model_modify_leverage_req.ts | 1 + .../src/generate/margin/debit/model_modify_leverage_resp.ts | 1 + sdk/node/src/generate/margin/debit/model_repay_req.ts | 1 + sdk/node/src/generate/margin/debit/model_repay_resp.ts | 1 + .../model_cross_margin_position_asset_list_value.ts | 2 ++ .../marginprivate/model_cross_margin_position_event.ts | 2 ++ .../model_isolated_margin_position_change_assets_value.ts | 2 ++ .../marginprivate/model_isolated_margin_position_event.ts | 2 ++ .../generate/margin/marginpublic/model_index_price_event.ts | 2 ++ .../generate/margin/marginpublic/model_mark_price_event.ts | 2 ++ .../margin/market/model_get_cross_margin_symbols_items.ts | 1 + .../margin/market/model_get_cross_margin_symbols_req.ts | 1 + .../margin/market/model_get_cross_margin_symbols_resp.ts | 1 + .../src/generate/margin/market/model_get_etf_info_data.ts | 1 + .../src/generate/margin/market/model_get_etf_info_req.ts | 1 + .../src/generate/margin/market/model_get_etf_info_resp.ts | 1 + .../margin/market/model_get_isolated_margin_symbols_data.ts | 1 + .../margin/market/model_get_isolated_margin_symbols_resp.ts | 1 + .../generate/margin/market/model_get_margin_config_resp.ts | 1 + .../margin/market/model_get_mark_price_detail_req.ts | 1 + .../margin/market/model_get_mark_price_detail_resp.ts | 1 + .../margin/market/model_get_mark_price_list_data.ts | 1 + .../margin/market/model_get_mark_price_list_resp.ts | 1 + sdk/node/src/generate/margin/order/model_add_order_req.ts | 1 + sdk/node/src/generate/margin/order/model_add_order_resp.ts | 1 + .../src/generate/margin/order/model_add_order_test_req.ts | 1 + .../src/generate/margin/order/model_add_order_test_resp.ts | 1 + .../generate/margin/order/model_add_order_test_v1_req.ts | 1 + .../generate/margin/order/model_add_order_test_v1_resp.ts | 1 + .../src/generate/margin/order/model_add_order_v1_req.ts | 1 + .../src/generate/margin/order/model_add_order_v1_resp.ts | 1 + .../margin/order/model_cancel_all_orders_by_symbol_req.ts | 1 + .../margin/order/model_cancel_all_orders_by_symbol_resp.ts | 1 + .../margin/order/model_cancel_order_by_client_oid_req.ts | 1 + .../margin/order/model_cancel_order_by_client_oid_resp.ts | 1 + .../margin/order/model_cancel_order_by_order_id_req.ts | 1 + .../margin/order/model_cancel_order_by_order_id_resp.ts | 1 + .../generate/margin/order/model_get_closed_orders_items.ts | 1 + .../generate/margin/order/model_get_closed_orders_req.ts | 1 + .../generate/margin/order/model_get_closed_orders_resp.ts | 1 + .../src/generate/margin/order/model_get_open_orders_data.ts | 1 + .../src/generate/margin/order/model_get_open_orders_req.ts | 1 + .../src/generate/margin/order/model_get_open_orders_resp.ts | 1 + .../margin/order/model_get_order_by_client_oid_req.ts | 1 + .../margin/order/model_get_order_by_client_oid_resp.ts | 1 + .../margin/order/model_get_order_by_order_id_req.ts | 1 + .../margin/order/model_get_order_by_order_id_resp.ts | 1 + .../margin/order/model_get_symbols_with_open_order_req.ts | 1 + .../margin/order/model_get_symbols_with_open_order_resp.ts | 1 + .../generate/margin/order/model_get_trade_history_items.ts | 1 + .../generate/margin/order/model_get_trade_history_req.ts | 1 + .../generate/margin/order/model_get_trade_history_resp.ts | 1 + .../margin/risklimit/model_get_margin_risk_limit_data.ts | 1 + .../margin/risklimit/model_get_margin_risk_limit_req.ts | 1 + .../margin/risklimit/model_get_margin_risk_limit_resp.ts | 1 + .../src/generate/spot/market/model_get24hr_stats_req.ts | 1 + .../src/generate/spot/market/model_get24hr_stats_resp.ts | 1 + .../generate/spot/market/model_get_all_currencies_data.ts | 1 + .../spot/market/model_get_all_currencies_data_chains.ts | 1 + .../generate/spot/market/model_get_all_currencies_resp.ts | 1 + .../src/generate/spot/market/model_get_all_symbols_data.ts | 1 + .../src/generate/spot/market/model_get_all_symbols_req.ts | 1 + .../src/generate/spot/market/model_get_all_symbols_resp.ts | 1 + .../src/generate/spot/market/model_get_all_tickers_resp.ts | 1 + .../generate/spot/market/model_get_all_tickers_ticker.ts | 1 + .../generate/spot/market/model_get_announcements_items.ts | 1 + .../src/generate/spot/market/model_get_announcements_req.ts | 1 + .../generate/spot/market/model_get_announcements_resp.ts | 1 + .../src/generate/spot/market/model_get_currency_chains.ts | 1 + sdk/node/src/generate/spot/market/model_get_currency_req.ts | 1 + .../src/generate/spot/market/model_get_currency_resp.ts | 1 + .../src/generate/spot/market/model_get_fiat_price_req.ts | 1 + .../src/generate/spot/market/model_get_fiat_price_resp.ts | 1 + .../generate/spot/market/model_get_full_order_book_req.ts | 1 + .../generate/spot/market/model_get_full_order_book_resp.ts | 1 + sdk/node/src/generate/spot/market/model_get_klines_req.ts | 1 + sdk/node/src/generate/spot/market/model_get_klines_resp.ts | 1 + .../src/generate/spot/market/model_get_market_list_resp.ts | 1 + .../generate/spot/market/model_get_part_order_book_req.ts | 1 + .../generate/spot/market/model_get_part_order_book_resp.ts | 1 + .../spot/market/model_get_private_token_instance_servers.ts | 1 + .../generate/spot/market/model_get_private_token_resp.ts | 1 + .../spot/market/model_get_public_token_instance_servers.ts | 1 + .../src/generate/spot/market/model_get_public_token_resp.ts | 1 + .../src/generate/spot/market/model_get_server_time_resp.ts | 1 + .../generate/spot/market/model_get_service_status_resp.ts | 1 + sdk/node/src/generate/spot/market/model_get_symbol_req.ts | 1 + sdk/node/src/generate/spot/market/model_get_symbol_resp.ts | 1 + sdk/node/src/generate/spot/market/model_get_ticker_req.ts | 1 + sdk/node/src/generate/spot/market/model_get_ticker_resp.ts | 1 + .../generate/spot/market/model_get_trade_history_data.ts | 1 + .../src/generate/spot/market/model_get_trade_history_req.ts | 1 + .../generate/spot/market/model_get_trade_history_resp.ts | 1 + sdk/node/src/generate/spot/order/model_add_oco_order_req.ts | 1 + .../src/generate/spot/order/model_add_oco_order_resp.ts | 1 + sdk/node/src/generate/spot/order/model_add_order_old_req.ts | 1 + .../src/generate/spot/order/model_add_order_old_resp.ts | 1 + sdk/node/src/generate/spot/order/model_add_order_req.ts | 1 + sdk/node/src/generate/spot/order/model_add_order_resp.ts | 1 + .../src/generate/spot/order/model_add_order_sync_req.ts | 1 + .../src/generate/spot/order/model_add_order_sync_resp.ts | 1 + .../src/generate/spot/order/model_add_order_test_old_req.ts | 1 + .../generate/spot/order/model_add_order_test_old_resp.ts | 1 + .../src/generate/spot/order/model_add_order_test_req.ts | 1 + .../src/generate/spot/order/model_add_order_test_resp.ts | 1 + .../src/generate/spot/order/model_add_stop_order_req.ts | 1 + .../src/generate/spot/order/model_add_stop_order_resp.ts | 1 + .../src/generate/spot/order/model_batch_add_orders_data.ts | 1 + .../generate/spot/order/model_batch_add_orders_old_data.ts | 1 + .../spot/order/model_batch_add_orders_old_order_list.ts | 1 + .../generate/spot/order/model_batch_add_orders_old_req.ts | 1 + .../generate/spot/order/model_batch_add_orders_old_resp.ts | 1 + .../spot/order/model_batch_add_orders_order_list.ts | 1 + .../src/generate/spot/order/model_batch_add_orders_req.ts | 1 + .../src/generate/spot/order/model_batch_add_orders_resp.ts | 1 + .../generate/spot/order/model_batch_add_orders_sync_data.ts | 1 + .../spot/order/model_batch_add_orders_sync_order_list.ts | 1 + .../generate/spot/order/model_batch_add_orders_sync_req.ts | 1 + .../generate/spot/order/model_batch_add_orders_sync_resp.ts | 1 + .../spot/order/model_batch_cancel_oco_orders_req.ts | 1 + .../spot/order/model_batch_cancel_oco_orders_resp.ts | 1 + .../generate/spot/order/model_batch_cancel_order_old_req.ts | 1 + .../spot/order/model_batch_cancel_order_old_resp.ts | 1 + .../spot/order/model_batch_cancel_stop_order_req.ts | 1 + .../spot/order/model_batch_cancel_stop_order_resp.ts | 1 + .../spot/order/model_cancel_all_orders_by_symbol_req.ts | 1 + .../spot/order/model_cancel_all_orders_by_symbol_resp.ts | 1 + .../spot/order/model_cancel_all_orders_failed_symbols.ts | 1 + .../src/generate/spot/order/model_cancel_all_orders_resp.ts | 1 + .../spot/order/model_cancel_oco_order_by_client_oid_req.ts | 1 + .../spot/order/model_cancel_oco_order_by_client_oid_resp.ts | 1 + .../spot/order/model_cancel_oco_order_by_order_id_req.ts | 1 + .../spot/order/model_cancel_oco_order_by_order_id_resp.ts | 1 + .../spot/order/model_cancel_order_by_client_oid_old_req.ts | 1 + .../spot/order/model_cancel_order_by_client_oid_old_resp.ts | 1 + .../spot/order/model_cancel_order_by_client_oid_req.ts | 1 + .../spot/order/model_cancel_order_by_client_oid_resp.ts | 1 + .../spot/order/model_cancel_order_by_client_oid_sync_req.ts | 1 + .../order/model_cancel_order_by_client_oid_sync_resp.ts | 1 + .../spot/order/model_cancel_order_by_order_id_old_req.ts | 1 + .../spot/order/model_cancel_order_by_order_id_old_resp.ts | 1 + .../spot/order/model_cancel_order_by_order_id_req.ts | 1 + .../spot/order/model_cancel_order_by_order_id_resp.ts | 1 + .../spot/order/model_cancel_order_by_order_id_sync_req.ts | 1 + .../spot/order/model_cancel_order_by_order_id_sync_resp.ts | 1 + .../generate/spot/order/model_cancel_partial_order_req.ts | 1 + .../generate/spot/order/model_cancel_partial_order_resp.ts | 1 + .../spot/order/model_cancel_stop_order_by_client_oid_req.ts | 1 + .../order/model_cancel_stop_order_by_client_oid_resp.ts | 1 + .../spot/order/model_cancel_stop_order_by_order_id_req.ts | 1 + .../spot/order/model_cancel_stop_order_by_order_id_resp.ts | 1 + .../generate/spot/order/model_get_closed_orders_items.ts | 1 + .../src/generate/spot/order/model_get_closed_orders_req.ts | 1 + .../src/generate/spot/order/model_get_closed_orders_resp.ts | 1 + sdk/node/src/generate/spot/order/model_get_dcp_resp.ts | 1 + .../spot/order/model_get_oco_order_by_client_oid_req.ts | 1 + .../spot/order/model_get_oco_order_by_client_oid_resp.ts | 1 + .../spot/order/model_get_oco_order_by_order_id_req.ts | 1 + .../spot/order/model_get_oco_order_by_order_id_resp.ts | 1 + .../order/model_get_oco_order_detail_by_order_id_orders.ts | 1 + .../order/model_get_oco_order_detail_by_order_id_req.ts | 1 + .../order/model_get_oco_order_detail_by_order_id_resp.ts | 1 + .../generate/spot/order/model_get_oco_order_list_items.ts | 1 + .../src/generate/spot/order/model_get_oco_order_list_req.ts | 1 + .../generate/spot/order/model_get_oco_order_list_resp.ts | 1 + .../src/generate/spot/order/model_get_open_orders_data.ts | 1 + .../src/generate/spot/order/model_get_open_orders_req.ts | 1 + .../src/generate/spot/order/model_get_open_orders_resp.ts | 1 + .../spot/order/model_get_order_by_client_oid_old_req.ts | 1 + .../spot/order/model_get_order_by_client_oid_old_resp.ts | 1 + .../spot/order/model_get_order_by_client_oid_req.ts | 1 + .../spot/order/model_get_order_by_client_oid_resp.ts | 1 + .../spot/order/model_get_order_by_order_id_old_req.ts | 1 + .../spot/order/model_get_order_by_order_id_old_resp.ts | 1 + .../generate/spot/order/model_get_order_by_order_id_req.ts | 1 + .../generate/spot/order/model_get_order_by_order_id_resp.ts | 1 + .../generate/spot/order/model_get_orders_list_old_items.ts | 1 + .../generate/spot/order/model_get_orders_list_old_req.ts | 1 + .../generate/spot/order/model_get_orders_list_old_resp.ts | 1 + .../spot/order/model_get_recent_orders_list_old_data.ts | 1 + .../spot/order/model_get_recent_orders_list_old_req.ts | 1 + .../spot/order/model_get_recent_orders_list_old_resp.ts | 1 + .../spot/order/model_get_recent_trade_history_old_data.ts | 1 + .../spot/order/model_get_recent_trade_history_old_req.ts | 1 + .../spot/order/model_get_recent_trade_history_old_resp.ts | 1 + .../spot/order/model_get_stop_order_by_client_oid_data.ts | 1 + .../spot/order/model_get_stop_order_by_client_oid_req.ts | 1 + .../spot/order/model_get_stop_order_by_client_oid_resp.ts | 1 + .../spot/order/model_get_stop_order_by_order_id_req.ts | 1 + .../spot/order/model_get_stop_order_by_order_id_resp.ts | 1 + .../generate/spot/order/model_get_stop_orders_list_items.ts | 1 + .../generate/spot/order/model_get_stop_orders_list_req.ts | 1 + .../generate/spot/order/model_get_stop_orders_list_resp.ts | 1 + .../spot/order/model_get_symbols_with_open_order_resp.ts | 1 + .../generate/spot/order/model_get_trade_history_items.ts | 1 + .../spot/order/model_get_trade_history_old_items.ts | 1 + .../generate/spot/order/model_get_trade_history_old_req.ts | 1 + .../generate/spot/order/model_get_trade_history_old_resp.ts | 1 + .../src/generate/spot/order/model_get_trade_history_req.ts | 1 + .../src/generate/spot/order/model_get_trade_history_resp.ts | 1 + sdk/node/src/generate/spot/order/model_modify_order_req.ts | 1 + sdk/node/src/generate/spot/order/model_modify_order_resp.ts | 1 + sdk/node/src/generate/spot/order/model_set_dcp_req.ts | 1 + sdk/node/src/generate/spot/order/model_set_dcp_resp.ts | 1 + .../src/generate/spot/spotprivate/model_account_event.ts | 2 ++ .../spot/spotprivate/model_account_relation_context.ts | 2 ++ .../src/generate/spot/spotprivate/model_order_v1_event.ts | 2 ++ .../src/generate/spot/spotprivate/model_order_v2_event.ts | 2 ++ .../src/generate/spot/spotpublic/model_all_tickers_event.ts | 2 ++ sdk/node/src/generate/spot/spotpublic/model_klines_event.ts | 2 ++ .../generate/spot/spotpublic/model_market_snapshot_data.ts | 2 ++ .../model_market_snapshot_data_market_change1h.ts | 2 ++ .../model_market_snapshot_data_market_change24h.ts | 2 ++ .../model_market_snapshot_data_market_change4h.ts | 2 ++ .../generate/spot/spotpublic/model_market_snapshot_event.ts | 2 ++ .../spot/spotpublic/model_orderbook_increment_changes.ts | 2 ++ .../spot/spotpublic/model_orderbook_increment_event.ts | 2 ++ .../spot/spotpublic/model_orderbook_level1_event.ts | 2 ++ .../spot/spotpublic/model_orderbook_level50_changes.ts | 2 ++ .../spot/spotpublic/model_orderbook_level50_event.ts | 2 ++ .../spot/spotpublic/model_orderbook_level5_event.ts | 2 ++ .../generate/spot/spotpublic/model_symbol_snapshot_data.ts | 2 ++ .../model_symbol_snapshot_data_market_change1h.ts | 2 ++ .../model_symbol_snapshot_data_market_change24h.ts | 2 ++ .../model_symbol_snapshot_data_market_change4h.ts | 2 ++ .../generate/spot/spotpublic/model_symbol_snapshot_event.ts | 2 ++ sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts | 2 ++ sdk/node/src/generate/spot/spotpublic/model_trade_event.ts | 2 ++ sdk/node/src/generate/version.ts | 2 +- .../viplending/viplending/model_get_account_detail_ltv.ts | 1 + .../viplending/model_get_account_detail_margins.ts | 1 + .../viplending/model_get_account_detail_orders.ts | 1 + .../viplending/viplending/model_get_account_detail_resp.ts | 1 + .../viplending/viplending/model_get_accounts_data.ts | 1 + .../viplending/viplending/model_get_accounts_resp.ts | 1 + sdk/node/src/internal/ws/default_ws_impl.ts | 2 +- 603 files changed, 657 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index e322e739..e7643e11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ ENV PATH="$GOPATH/bin:$PATH" ENV GO_POST_PROCESS_FILE="/usr/local/go/bin/gofmt -w" ENV PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i" -ENV TS_POST_PROCESS_FILE="/usr/bin/prettier --write" +ENV TS_POST_PROCESS_FILE="/usr/bin/prettier --write --semi --single-quote --tab-width 4 --trailing-comma all --bracket-spacing --arrow-parens always --end-of-line lf --print-width 100" ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Makefile b/Makefile index 4893f318..507d4e48 100644 --- a/Makefile +++ b/Makefile @@ -90,9 +90,9 @@ $(SUBDIRS): .PHONY: generate generate: setup-logs - $(call generate-postman) - $(call generate-code,golang,/pkg/generate) - $(call generate-code,python,/kucoin_universal_sdk/generate) +# $(call generate-postman) +# $(call generate-code,golang,/pkg/generate) +# $(call generate-code,python,/kucoin_universal_sdk/generate) $(call generate-code,node,/src/generate,v0.1.0-alpha) .PHONY: gen-postman diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index d1c97e37..205ab961 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -7,10 +7,12 @@ {{#vendorExtensions.x-response-model}} import { RestResponse } from '@model/common'; import {Response} from '@internal/interfaces/response'; + export class {{classname}} implements Response<{{classname}}, RestResponse> { {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; + export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-response-model}} {{#vars}} diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 141ba88c..c6497012 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -8,10 +8,12 @@ import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; {{#vendorExtensions.x-response-model}} import { Response } from '@internal/interfaces/response'; + export class {{classname}} implements Response<{{classname}}, WsMessage>{ {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; + export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-response-model}} @@ -60,6 +62,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, jsonObject); } diff --git a/sdk/node/src/api/client.ts b/sdk/node/src/api/client.ts index 645d853a..f9c99204 100644 --- a/sdk/node/src/api/client.ts +++ b/sdk/node/src/api/client.ts @@ -69,8 +69,8 @@ export interface Client { * DefaultClient provides the default implementation of the Client interface. */ export class DefaultClient implements Client { - private restImpl: KucoinRestService; - private wsImpl: KucoinWSService; + private readonly restImpl: KucoinRestService; + private readonly wsImpl: KucoinWSService; constructor(op: ClientOption) { this.restImpl = new DefaultKucoinRestAPIImpl(op); diff --git a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts index b9552073..30abaec0 100644 --- a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAccountInfoResp implements Response { /** * User VIP level diff --git a/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts index 01440d30..4496ffa1 100644 --- a/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetApikeyInfoResp implements Response { /** * Remarks diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts index 578dac4c..5e25b2e8 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCrossMarginAccountAccounts implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts index b153f0c6..404652a6 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCrossMarginAccountReq implements Serializable { /** * quote currency, currently only supports USDT, KCS, BTC, USDT as default diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts index ca5baf3a..1f4a9196 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetCrossMarginAccountAccounts } from './model_get_cross_margin_account_accounts'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetCrossMarginAccountResp implements Response { diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts index 884993c9..02d8bca7 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesAccountReq implements Serializable { /** * Currecny, Default XBT diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts index f9ceee00..fc7d700c 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFuturesAccountResp implements Response { /** * Account equity = marginBalance + Unrealised PNL diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts index d45bd6f4..d29be871 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesLedgerDataList implements Serializable { /** * ledger time diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts index ab1c5c94..86b4c42e 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesLedgerReq implements Serializable { /** * Currency of transaction history, XBT or USDT diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts index 07d556e3..9f13abd2 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetFuturesLedgerDataList } from './model_get_futures_ledger_data_list'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFuturesLedgerResp implements Response { /** * diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts index b3848c95..f5ffebd8 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts @@ -4,6 +4,7 @@ import { GetIsolatedMarginAccountAssetsBaseAsset } from './model_get_isolated_ma import { GetIsolatedMarginAccountAssetsQuoteAsset } from './model_get_isolated_margin_account_assets_quote_asset'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountAssets implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts index e265d4e5..bd124427 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountAssetsBaseAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts index 978133bf..b7914eb8 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountAssetsQuoteAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts index da21b8a7..633da7e0 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountDetailV1BaseAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts index 2af81dba..218aadcd 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountDetailV1QuoteAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts index c099aa82..cac8794d 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountDetailV1Req implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts index d6f42c83..0183fc5f 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts @@ -5,6 +5,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetIsolatedMarginAccountDetailV1QuoteAsset } from './model_get_isolated_margin_account_detail_v1_quote_asset'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetIsolatedMarginAccountDetailV1Resp implements Response { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts index b1e954f7..de1bbc56 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts @@ -4,6 +4,7 @@ import { GetIsolatedMarginAccountListV1AssetsBaseAsset } from './model_get_isola import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { GetIsolatedMarginAccountListV1AssetsQuoteAsset } from './model_get_isolated_margin_account_list_v1_assets_quote_asset'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountListV1Assets implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts index a0ca8f1a..45928686 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountListV1AssetsBaseAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts index 01d8d827..2294cc98 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountListV1AssetsQuoteAsset implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts index a42f5ccc..268bf4e5 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountListV1Req implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts index ba2053c6..c57e325b 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetIsolatedMarginAccountListV1Assets } from './model_get_isolated_margin_account_list_v1_assets'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetIsolatedMarginAccountListV1Resp implements Response { diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts index aea8b4ba..12dbe92e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginAccountReq implements Serializable { /** * For isolated trading pairs, query all without passing diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts index b67e6ac0..9e6444d7 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts @@ -4,6 +4,7 @@ import { GetIsolatedMarginAccountAssets } from './model_get_isolated_margin_acco import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetIsolatedMarginAccountResp implements Response { diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts index 5b1fae6d..562fc00b 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginAccountDetailAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts index e3067063..68896e22 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetMarginAccountDetailAccounts } from './model_get_margin_account_detail_accounts'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarginAccountDetailResp implements Response { diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts index 507d22b3..ddc2e58b 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginHFLedgerData implements Serializable { /** * diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts index 167e8f1d..be97ed2e 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginHFLedgerReq implements Serializable { /** * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts index d9ecd149..f410d4b9 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetMarginHFLedgerData } from './model_get_margin_hf_ledger_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarginHFLedgerResp implements Response { /** * diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts index 3886a620..41a1b1f2 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotAccountDetailReq implements Serializable { /** * Path parameter. Account ID diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts index b657ef89..16d50b1e 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotAccountDetailResp implements Response { /** * The currency of the account diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts index ed47319c..633b6d81 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotAccountListData implements Serializable { /** * Account ID diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts index f12d23e9..d1fd69f3 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotAccountListReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts index 0f9622a1..bf793392 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotAccountListData } from './model_get_spot_account_list_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotAccountListResp implements Response { /** * diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts index 8aa7a56d..86fec351 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotAccountTypeResp implements Response { /** * Spot account type. True means the current user is a high-frequency spot user, False means the current user is a low-frequency spot user diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts index 941c96ea..c4e3bd3d 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotHFLedgerData implements Serializable { /** * Unique id diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts index 15f64fa4..996d6ad6 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotHFLedgerReq implements Serializable { /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts index 114082fc..e2a84b7b 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotHFLedgerData } from './model_get_spot_hf_ledger_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotHFLedgerResp implements Response { /** * diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts index 7230be7b..0e4a2865 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotLedgerItems implements Serializable { /** * unique id diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts index edbf13f7..a7296c45 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotLedgerReq implements Serializable { /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts index 39f931e6..828d4328 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts @@ -4,6 +4,7 @@ import { GetSpotLedgerItems } from './model_get_spot_ledger_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotLedgerResp implements Response { /** * current page diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts index cfe07df0..bd98624d 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddDepositAddressV1Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts index 47b5cfc1..6047a386 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddDepositAddressV1Resp implements Response { /** * Deposit address diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts index 4defb7e4..76e3bcd2 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddDepositAddressV3Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts index bcf8279b..23325681 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddDepositAddressV3Resp implements Response { /** * Deposit address diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts index 8bf4cd89..e6a72e22 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositAddressV1Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts index 2a702fa5..7849a82b 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositAddressV1Resp implements Response { /** * Deposit address diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts index 505a954a..d863fb03 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositAddressV2Data implements Serializable { /** * Deposit address diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts index 2cb0dfb1..e65a3315 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositAddressV2Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts index 9884eda2..47fa7306 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetDepositAddressV2Data } from './model_get_deposit_address_v2_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositAddressV2Resp implements Response { /** * diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts index b4555f45..0525c6b3 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositAddressV3Data implements Serializable { /** * Deposit address diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts index f738d93e..0c06578e 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositAddressV3Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts index 66a3cb3c..69290517 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts @@ -4,6 +4,7 @@ import { GetDepositAddressV3Data } from './model_get_deposit_address_v3_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositAddressV3Resp implements Response { /** * diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts index 02dcd415..106fc9f7 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositHistoryItems implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts index 7891ba8f..f480b247 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositHistoryOldItems implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts index a4c45d9d..b0af0119 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositHistoryOldReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts index a0ef4169..e757081d 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetDepositHistoryOldItems } from './model_get_deposit_history_old_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositHistoryOldResp implements Response { /** * current page diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts index 5e30ea29..55da1edd 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositHistoryReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts index fb68e251..df4ac8dc 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts @@ -4,6 +4,7 @@ import { GetDepositHistoryItems } from './model_get_deposit_history_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositHistoryResp implements Response { /** * current page diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts index 9d9f956f..ce07fd9c 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetBasicFeeReq implements Serializable { /** * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts index f17de2d2..96f1a199 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetBasicFeeResp implements Response { /** * Base taker fee rate diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts index 488eaf04..5a0cc0d9 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesActualFeeReq implements Serializable { /** * Trading pair diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts index bc93d093..5ca66b76 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFuturesActualFeeResp implements Response { /** * The unique identity of the trading pair and will not change even if the trading pair is renamed diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts index f254426f..65b806f3 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotActualFeeData implements Serializable { /** * The unique identity of the trading pair and will not change even if the trading pair is renamed diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts index 0b0fbcdb..75710c45 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotActualFeeReq implements Serializable { /** * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts index 2e44329c..626af49a 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotActualFeeData } from './model_get_spot_actual_fee_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotActualFeeResp implements Response { /** * diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts index 6c957121..5e634cc5 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountApiReq implements Serializable { /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts index 07e87b25..21a3de1e 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountApiResp implements Response { /** * Sub-account name diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts index 4b6c7c06..2537ee56 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountFuturesPermissionReq implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts index 4763645c..65344f1b 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountFuturesPermissionResp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts index d46bdc89..8db73f32 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountMarginPermissionReq implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts index 0e4f47ea..71a41e18 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountMarginPermissionResp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts index 1d491f7c..2cbe0317 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountReq implements Serializable { /** * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts index 27ee1bf1..22027ef1 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountResp implements Response { /** * Sub-account UID diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts index 41cfca83..af4f66f4 100644 --- a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class DeleteSubAccountApiReq implements Serializable { /** * API-Key diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts index ac1885cf..a20fc0ce 100644 --- a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class DeleteSubAccountApiResp implements Response { /** * The username of a sub-user. diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts index f44f6858..be788aff 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesSubAccountListV2Accounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts index cd6a28cb..3ce816b8 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesSubAccountListV2Req implements Serializable { /** * Currecny, Default XBT diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts index 96953d18..4a498b44 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts @@ -5,6 +5,7 @@ import { GetFuturesSubAccountListV2Summary } from './model_get_futures_sub_accou import { GetFuturesSubAccountListV2Accounts } from './model_get_futures_sub_account_list_v2_accounts'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFuturesSubAccountListV2Resp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts index 1e59585c..c0a8a0c8 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesSubAccountListV2Summary implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts index e7b06b81..cacea672 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountDetailMainAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts index 91aa554b..3254e7be 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountDetailMarginAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts index f0debc96..e8a0a53f 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountDetailReq implements Serializable { /** * the userID of a sub-account. diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts index e2973b68..cd79dd96 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts @@ -6,6 +6,7 @@ import { GetSpotSubAccountDetailMainAccounts } from './model_get_spot_sub_accoun import { GetSpotSubAccountDetailTradeAccounts } from './model_get_spot_sub_account_detail_trade_accounts'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotSubAccountDetailResp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts index 3a142c4e..95e88cd6 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountDetailTradeAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts index 985b1650..705e40ab 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts @@ -5,6 +5,7 @@ import { GetSpotSubAccountListV1DataMainAccounts } from './model_get_spot_sub_ac import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { GetSpotSubAccountListV1DataTradeAccounts } from './model_get_spot_sub_account_list_v1_data_trade_accounts'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV1Data implements Serializable { /** * The user ID of the sub-user. diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts index 23778ae3..09f03b04 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV1DataMainAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts index 96cacf00..63377668 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV1DataMarginAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts index 545ab049..b02416bf 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV1DataTradeAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts index 6fa5c58d..4f2b63cd 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts @@ -4,6 +4,7 @@ import { GetSpotSubAccountListV1Data } from './model_get_spot_sub_account_list_v import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotSubAccountListV1Resp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts index 60731cbc..13e7e788 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts @@ -5,6 +5,7 @@ import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { GetSpotSubAccountListV2ItemsMainAccounts } from './model_get_spot_sub_account_list_v2_items_main_accounts'; import { GetSpotSubAccountListV2ItemsTradeAccounts } from './model_get_spot_sub_account_list_v2_items_trade_accounts'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV2Items implements Serializable { /** * The user ID of the sub-user. diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts index 85a6a02e..0d5c148a 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV2ItemsMainAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts index e9a70669..df1089c5 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV2ItemsMarginAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts index fc6b248e..cc5cc2ed 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV2ItemsTradeAccounts implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts index bac23891..a121d858 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountListV2Req implements Serializable { /** * Current request page. Default is 1 diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts index 1fa69017..03bb0901 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotSubAccountListV2Items } from './model_get_spot_sub_account_list_v2_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotSubAccountListV2Resp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts index 9a827a3b..e9ae8e97 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountsSummaryV1Data implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts index 566dbba2..3bc06283 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotSubAccountsSummaryV1Data } from './model_get_spot_sub_accounts_summary_v1_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotSubAccountsSummaryV1Resp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts index 77423189..9a8734da 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountsSummaryV2Items implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts index 31d69001..69434973 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotSubAccountsSummaryV2Req implements Serializable { diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts index ca357bf4..cd81bcb6 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotSubAccountsSummaryV2Items } from './model_get_spot_sub_accounts_summary_v2_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotSubAccountsSummaryV2Resp implements Response { diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts index ab656c17..f56b6969 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountApiListData implements Serializable { /** * Sub Name diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts index c51f7db1..1118d6e6 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountApiListReq implements Serializable { /** * API-Key diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts index 3a44bbcc..5d66cd7b 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSubAccountApiListData } from './model_get_sub_account_api_list_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSubAccountApiListResp implements Response { /** * diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts index 1b2e1d96..5b0d6a8b 100644 --- a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifySubAccountApiReq implements Serializable { /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts index dc83a073..db7967a2 100644 --- a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifySubAccountApiResp implements Response { /** * Sub-account name diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts index 911cb3e5..61ecff24 100644 --- a/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class FlexTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts index a071cebc..66d444ef 100644 --- a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class FlexTransferResp implements Response { /** * Transfer order ID diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts index 0e2f5dfe..66c8a0ed 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class FuturesAccountTransferInReq implements Serializable { /** * Currency, including XBT,USDT... diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts index d247c89c..e0a71706 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class FuturesAccountTransferInResp implements Response { diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts index 77275035..6fe25ec2 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class FuturesAccountTransferOutReq implements Serializable { /** * Currency, including XBT,USDT... diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts index aac12e5b..e4f50c3a 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class FuturesAccountTransferOutResp implements Response { diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts index 5ad5a26c..66e52165 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesAccountTransferOutLedgerItems implements Serializable { diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts index a5fad696..175b8a74 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFuturesAccountTransferOutLedgerReq implements Serializable { diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts index 31a6aabd..44e09cac 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetFuturesAccountTransferOutLedgerItems } from './model_get_futures_account_transfer_out_ledger_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFuturesAccountTransferOutLedgerResp implements Response { diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts index 492539ab..06d9f29d 100644 --- a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTransferQuotasReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts index 72ef60da..e91ad599 100644 --- a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTransferQuotasResp implements Response { /** * Currency diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts index 592c3341..6796c55b 100644 --- a/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class InnerTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts index 272dfff0..bf323dd4 100644 --- a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class InnerTransferResp implements Response { /** * Transfer order ID diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts index b6493dcd..fe8a2415 100644 --- a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class SubAccountTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts index e9ed3f5f..3d1ec6ec 100644 --- a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class SubAccountTransferResp implements Response { /** * Transfer order ID diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts index 5cd8e74d..91c7c0fa 100644 --- a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelWithdrawalReq implements Serializable { /** * Path parameter, a unique ID for a withdrawalId diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts index ecd861eb..eeec9938 100644 --- a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelWithdrawalResp implements Response { /** * diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts index 1dbfd2cf..467f4c36 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawalHistoryItems implements Serializable { /** * Unique id diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts index c5050787..2da91e14 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawalHistoryOldItems implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts index 3b99889d..a2a7cfb5 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawalHistoryOldReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts index 2465c331..e84987df 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetWithdrawalHistoryOldItems } from './model_get_withdrawal_history_old_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetWithdrawalHistoryOldResp implements Response { diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts index 0fe505a3..fd442c2f 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawalHistoryReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts index 2115a93e..97ef9489 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetWithdrawalHistoryItems } from './model_get_withdrawal_history_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetWithdrawalHistoryResp implements Response { /** * current page diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts index f39266e4..c890cfd8 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawalQuotasReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts index fa20d858..8ffbe06b 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetWithdrawalQuotasResp implements Response { /** * diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts index 1d859a43..117c313f 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class WithdrawalV1Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts index e892577e..1f50e778 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class WithdrawalV1Resp implements Response { /** * Withdrawal id, a unique ID for a withdrawal diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts index 8f278411..d047f788 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class WithdrawalV3Req implements Serializable { /** * currency diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts index e55a678d..a6105ff8 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class WithdrawalV3Resp implements Response { /** * Withdrawal id, a unique ID for a withdrawal diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts index 6f4fe2d3..97e9e724 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountLtv implements Serializable { /** * LTV of Restricted Transfers to Funding Account diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts index b160193b..9b7546c6 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountMargins implements Serializable { /** * Margin Currency diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts index bb752937..9ffd7b30 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountOrders implements Serializable { /** * Loan Orders ID diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts index e90e2063..0bb86062 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts @@ -6,6 +6,7 @@ import { GetAccountLtv } from './model_get_account_ltv'; import { GetAccountOrders } from './model_get_account_orders'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAccountResp implements Response { /** * Master account UID diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts index eebeae51..02b6759b 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRebaseReq implements Serializable { /** * Start time, for example: 20240610 diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts index cf09f43f..15bda1f7 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRebaseResp implements Response { /** * Rebate order file (link is valid for 1 day) diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts index ca4992d6..d523aa72 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountApiReq implements Serializable { /** * Subaccount UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts index 53d8119a..1e518b1b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountApiResp implements Response { /** * Sub-Account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts index a640976d..45ad37fd 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddSubAccountReq implements Serializable { /** * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts index 0b48121d..40c68485 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddSubAccountResp implements Response { /** * Sub-Account name diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts index dd4958da..12e95335 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class DeleteSubAccountAPIReq implements Serializable { /** * Sub-account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts index 8c8f0bf7..11d82c8c 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class DeleteSubAccountAPIResp implements Response { /** * diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts index 59868ab5..0b261aa5 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetBrokerInfoReq implements Serializable { /** * Start time, for example: 20230110 diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts index aec66d99..000f4e5e 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetBrokerInfoResp implements Response { /** * Number of sub-accounts created diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts index 65e8dea8..3ede4127 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositDetailReq implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts index 9a7f43da..dd57e284 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositDetailResp implements Response { /** * chain id of currency diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts index fb466f65..aa7e2953 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositListData implements Serializable { /** * deposit uid diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts index 94f118a9..6ffac8a2 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetDepositListReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts index 8346827c..938d412e 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetDepositListData } from './model_get_deposit_list_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDepositListResp implements Response { /** * diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts index eebeae51..02b6759b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRebaseReq implements Serializable { /** * Start time, for example: 20240610 diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts index cf09f43f..15bda1f7 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRebaseResp implements Response { /** * Rebate order file (link is valid for 1 day) diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts index 3acc2682..92bca2f9 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountAPIData implements Serializable { /** * Sub-Account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts index fb21278f..a445ca15 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountAPIReq implements Serializable { /** * Sub-account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts index 1cd23774..5d5a1bd7 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSubAccountAPIData } from './model_get_sub_account_api_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSubAccountAPIResp implements Response { /** * diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts index 623fa7fd..62a368f6 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountItems implements Serializable { /** * Sub-account name diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts index 4311ced1..de548bb2 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSubAccountReq implements Serializable { /** * Sub-account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts index 13dd291d..8b88679a 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts @@ -4,6 +4,7 @@ import { GetSubAccountItems } from './model_get_sub_account_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSubAccountResp implements Response { /** * Current page diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts index e7547425..6e2a16c5 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTransferHistoryReq implements Serializable { /** * Transfer Order ID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts index bcf688fc..069f073c 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTransferHistoryResp implements Response { /** * Transfer Order ID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts index 57a9d841..4399d659 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetWithdrawDetailReq implements Serializable { /** * Withdrawal ID diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts index 671c34b8..4780bcd0 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetWithdrawDetailResp implements Response { /** * Withdrawal ID diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts index ed5743cb..8292c3e4 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifySubAccountApiReq implements Serializable { /** * Subaccount UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts index e81fc2ed..b6947b8b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifySubAccountApiResp implements Response { /** * Sub-Account UID diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts index 4e514467..b9859ba7 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class TransferReq implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts index e9a29c9b..5d66da71 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class TransferResp implements Response { /** * diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts index 06652ba3..f6b6f682 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountHoldingItems implements Serializable { /** * Holding ID diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts index 605179dd..41b13ede 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountHoldingReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts index 6fae942c..4d6a2966 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAccountHoldingItems } from './model_get_account_holding_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAccountHoldingResp implements Response { /** * total number diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts index cfc73135..541200cd 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetETHStakingProductsData implements Serializable { /** * Product ID diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts index 680c49f9..ede916b8 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetETHStakingProductsReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts index e9abf6ca..6dd3fc00 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts @@ -4,6 +4,7 @@ import { GetETHStakingProductsData } from './model_get_eth_staking_products_data import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetETHStakingProductsResp implements Response { diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts index 38aec228..d4dba527 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetKcsStakingProductsData implements Serializable { /** * Product ID diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts index 551933e8..c8f0fdff 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetKcsStakingProductsReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts index 19657db4..a04c058e 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts @@ -4,6 +4,7 @@ import { GetKcsStakingProductsData } from './model_get_kcs_staking_products_data import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetKcsStakingProductsResp implements Response { diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts index 3882e829..a79d0a0e 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPromotionProductsData implements Serializable { /** * Product ID diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts index 95775acf..2e936051 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPromotionProductsReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts index ff63c6c3..aa68c278 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts @@ -4,6 +4,7 @@ import { GetPromotionProductsData } from './model_get_promotion_products_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPromotionProductsResp implements Response { /** * diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts index f58b612b..0b3f0d84 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRedeemPreviewReq implements Serializable { /** * Holding ID diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts index 9069b706..401de697 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRedeemPreviewResp implements Response { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts index 52610bd6..5fa47c1f 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSavingsProductsData implements Serializable { /** * Product ID diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts index 96903a37..a5c17d9b 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSavingsProductsReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts index cf2d5000..17af8c1f 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSavingsProductsData } from './model_get_savings_products_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSavingsProductsResp implements Response { /** * diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts index dc81adb0..656ab8d0 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStakingProductsData implements Serializable { /** * Product ID diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts index 9cdf0586..b6ffa373 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStakingProductsReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts index 5b0191bc..6ab9a0bc 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetStakingProductsData } from './model_get_staking_products_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetStakingProductsResp implements Response { /** * diff --git a/sdk/node/src/generate/earn/earn/model_purchase_req.ts b/sdk/node/src/generate/earn/earn/model_purchase_req.ts index 30fb7c37..67e29c8f 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_req.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class PurchaseReq implements Serializable { /** * Product Id diff --git a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts index 3dac2b7e..900c23c2 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class PurchaseResp implements Response { /** * Holding ID diff --git a/sdk/node/src/generate/earn/earn/model_redeem_req.ts b/sdk/node/src/generate/earn/earn/model_redeem_req.ts index 99c4bbdd..2e579d7e 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_req.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class RedeemReq implements Serializable { /** * Holding ID diff --git a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts index cb8dfeac..fb19a941 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class RedeemResp implements Response { /** * Redemption order ID diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts index 0684a869..badc3542 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCurrentFundingRateReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts index 87180a2a..c7775431 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetCurrentFundingRateResp implements Response { diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts index b0811281..93db81bb 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPrivateFundingHistoryDataList implements Serializable { diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts index 1d12ef13..651aa624 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPrivateFundingHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts index cdf61bbd..65a32cb6 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPrivateFundingHistoryDataList } from './model_get_private_funding_history_data_list'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPrivateFundingHistoryResp implements Response { diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts index fe179d1d..81100516 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPublicFundingHistoryData implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts index 6fe2eac2..38c6de9b 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPublicFundingHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts index d8c2909b..c39c99f5 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts @@ -4,6 +4,7 @@ import { GetPublicFundingHistoryData } from './model_get_public_funding_history_ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPublicFundingHistoryResp implements Response { diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index 604e4aa0..595d6834 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class AllOrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) @@ -111,6 +112,7 @@ export class AllOrderEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): AllOrderEvent { return plainToInstance(AllOrderEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index 55ea31a4..af45c589 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class AllPositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) @@ -207,6 +208,7 @@ export class AllPositionEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): AllPositionEvent { return plainToInstance(AllPositionEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index 0ce90a78..c065a230 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class BalanceEvent implements Response { /** * Margin of the cross margin position @@ -83,6 +84,7 @@ export class BalanceEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): BalanceEvent { return plainToInstance(BalanceEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts index c51e3135..82239507 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class CrossLeverageDataValue implements Serializable { /** * @@ -18,6 +19,7 @@ export class CrossLeverageDataValue implements Serializable { /** * diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index de22f36d..b763b088 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class MarginModeEvent implements Response { /** * The SYMBOL is the key with value \"CROSS\" or \"ISOLATED\" @@ -27,6 +28,7 @@ export class MarginModeEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarginModeEvent { return plainToInstance(MarginModeEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index d4def339..8e27eb44 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class OrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) @@ -111,6 +112,7 @@ export class OrderEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): OrderEvent { return plainToInstance(OrderEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index 4abf6624..beddedd6 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class PositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) @@ -207,6 +208,7 @@ export class PositionEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): PositionEvent { return plainToInstance(PositionEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index baac0d2d..1ca624d3 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class StopOrdersEvent implements Response { /** * @@ -75,6 +76,7 @@ export class StopOrdersEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): StopOrdersEvent { return plainToInstance(StopOrdersEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index a6474a61..8d79b49b 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class AnnouncementEvent implements Response { /** * Symbol @@ -39,6 +40,7 @@ export class AnnouncementEvent implements Response toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): AnnouncementEvent { return plainToInstance(AnnouncementEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index 35116dd9..f14f5a4d 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class ExecutionEvent implements Response { /** * @@ -59,6 +60,7 @@ export class ExecutionEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): ExecutionEvent { return plainToInstance(ExecutionEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index aff82160..6d2a3a1c 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class InstrumentEvent implements Response { /** * Granularity (predicted funding rate: 1-min granularity: 60000; Funding rate: 8-hours granularity: 28800000. ) @@ -43,6 +44,7 @@ export class InstrumentEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): InstrumentEvent { return plainToInstance(InstrumentEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index 2bc0b27d..fc21bbe0 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class KlinesEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) @@ -35,6 +36,7 @@ export class KlinesEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): KlinesEvent { return plainToInstance(KlinesEvent, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index e5b6ade4..030f7caf 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class OrderbookIncrementEvent implements Response { /** * @@ -35,6 +36,7 @@ export class OrderbookIncrementEvent implements Response { /** * @@ -43,6 +44,7 @@ export class OrderbookLevel50Event implements Response { /** * @@ -43,6 +44,7 @@ export class OrderbookLevel5Event implements Response { /** * @@ -63,6 +64,7 @@ export class SymbolSnapshotEvent implements Response { /** * @@ -67,6 +68,7 @@ export class TickerV1Event implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): TickerV1Event { return plainToInstance(TickerV1Event, jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index fd518f2b..6aec3b7a 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class TickerV2Event implements Response { /** * @@ -51,6 +52,7 @@ export class TickerV2Event implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): TickerV2Event { return plainToInstance(TickerV2Event, jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts index 75a71327..55e8dd25 100644 --- a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class Get24hrStatsResp implements Response { /** * 24-hour platform Futures trading volume. Unit is USD diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts index 3a3ad0c6..bf8bf4c3 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllSymbolsData implements Serializable { /** * Symbol diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts index d0b410ad..b8d25262 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts @@ -4,6 +4,7 @@ import { GetAllSymbolsData } from './model_get_all_symbols_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAllSymbolsResp implements Response { /** * the list of all contracts diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts index b5b94094..113d09d6 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllTickersData implements Serializable { /** * Sequence number, used to judge whether the messages pushed by Websocket is continuous. diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts index dfb0136d..c0a81276 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAllTickersData } from './model_get_all_tickers_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAllTickersResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts index 484bc5b3..697e0fc7 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFullOrderBookReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts index fb1529d8..91872bca 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFullOrderBookResp implements Response { /** * Sequence number diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts index bd4e466e..57fe8c82 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetInterestRateIndexDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts index 3368ceac..abeb0a18 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetInterestRateIndexReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts index 8c4ff22c..48f6d221 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetInterestRateIndexDataList } from './model_get_interest_rate_index_data_list'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetInterestRateIndexResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_klines_req.ts b/sdk/node/src/generate/futures/market/model_get_klines_req.ts index c97dc321..288c4125 100644 --- a/sdk/node/src/generate/futures/market/model_get_klines_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_klines_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetKlinesReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts index 68c156a0..2dfd22cd 100644 --- a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetKlinesResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts index 515e18f0..b8d6d3fe 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarkPriceReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts index c0c88857..b2ff6072 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarkPriceResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts index df50e6dd..defa296f 100644 --- a/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPartOrderBookReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts index dbba6de5..22f72875 100644 --- a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPartOrderBookResp implements Response { /** * Sequence number diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts index 95b9bdaa..1215bdd2 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPremiumIndexDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts index d64a7ce2..75c9507c 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPremiumIndexReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts index 7429044a..eec6e5fe 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts @@ -4,6 +4,7 @@ import { GetPremiumIndexDataList } from './model_get_premium_index_data_list'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPremiumIndexResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts index 40190529..16ef0aa4 100644 --- a/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts +++ b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPrivateTokenInstanceServers implements Serializable { diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts index 66c91797..94e29ad6 100644 --- a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPrivateTokenResp implements Response { /** * The token required to establish a websocket connection diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts index c8671c1c..fbbfb66e 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPublicTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts index 557b3e34..d5a8e4ba 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPublicTokenResp implements Response { /** * The token required to establish a websocket connection diff --git a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts index 65ad2ca0..5f8d3cd2 100644 --- a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetServerTimeResp implements Response { /** * ServerTime(millisecond) diff --git a/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts index 5eec6fbe..ee3559c5 100644 --- a/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetServiceStatusResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts index 4d279130..1b709605 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts @@ -3,6 +3,7 @@ import { GetSpotIndexPriceDataListDecomposionList } from './model_get_spot_index_price_data_list_decomposion_list'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotIndexPriceDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts index 20147fef..0dd85367 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotIndexPriceDataListDecomposionList implements Serializable { diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts index 47d52fcb..6c77019a 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSpotIndexPriceReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts index 3e47cb01..83379784 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetSpotIndexPriceDataList } from './model_get_spot_index_price_data_list'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSpotIndexPriceResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_req.ts b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts index 3560f7dc..31fbcd55 100644 --- a/sdk/node/src/generate/futures/market/model_get_symbol_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSymbolReq implements Serializable { /** * Path Parameter. Symbol of the contract diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts index ad5c48fc..4a0de0d3 100644 --- a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSymbolResp implements Response { /** * Symbol diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts index 0ce82707..d2fde2b6 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTickerReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts index a4db9ea7..7f5faf91 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTickerResp implements Response { /** * Sequence number, used to judge whether the messages pushed by Websocket is continuous. diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts index 757bd4c1..352f2cbb 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryData implements Serializable { /** * Sequence number diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts index 8b9dc8ef..0ad93366 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts index 2e10640a..848b3051 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetTradeHistoryData } from './model_get_trade_history_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/order/model_add_order_req.ts b/sdk/node/src/generate/futures/order/model_add_order_req.ts index 23fc2d6b..f7c7dc81 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) diff --git a/sdk/node/src/generate/futures/order/model_add_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_resp.ts index de72a007..59355ba7 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts index b0cd31a6..b7f8846c 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderTestReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts index c6cd3a89..b5954e58 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts index acbe5cf8..bb7dd9a7 100644 --- a/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddTPSLOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts index eb702e85..ae19fe4e 100644 --- a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddTPSLOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts index 8df4b71f..536bfe4e 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts index da62a0d4..671030e1 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersItem implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts index 7b939128..795f6499 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts @@ -3,6 +3,7 @@ import { BatchAddOrdersItem } from './model_batch_add_orders_item'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersReq implements Serializable { /** * diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts index cf7ed011..7feae7dc 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { BatchAddOrdersData } from './model_batch_add_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchAddOrdersResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts index f32f80b9..eeced0f0 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelOrdersClientOidsList implements Serializable { diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts index b1be0315..73f46c06 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelOrdersData implements Serializable { /** * diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts index 7f574978..476cc011 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts @@ -3,6 +3,7 @@ import { BatchCancelOrdersClientOidsList } from './model_batch_cancel_orders_client_oids_list'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelOrdersReq implements Serializable { /** * the list of orderId diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts index 11b2133c..4684393d 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { BatchCancelOrdersData } from './model_batch_cancel_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchCancelOrdersResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts index 97f93475..2bc18832 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllOrdersV1Req implements Serializable { /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts index 164ad346..34c685f5 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllOrdersV1Resp implements Response { /** * Unique ID of the cancelled order diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts index b9845f1f..8c94c221 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllOrdersV3Req implements Serializable { /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts index 028ff08a..1d6023c5 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllOrdersV3Resp implements Response { /** * Unique ID of the cancelled order diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts index 53622d2d..4719c0da 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllStopOrdersReq implements Serializable { /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts index 243d1027..2fdf9d1c 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllStopOrdersResp implements Response { /** * Unique ID of the cancelled order diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts index 0cf42585..1da767ba 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByClientOidReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts index 84e88720..701ff2b1 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts index cd929f51..abe471e1 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByIdReq implements Serializable { /** * diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts index effa9c9a..cdfb190c 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByIdResp implements Response { /** * The orderId that is to be canceled diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts index a1011d29..8f3e155e 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOpenOrderValueReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts index 04785883..631392cd 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOpenOrderValueResp implements Response { /** * Total number of the unexecuted buy orders diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts index 42d2baff..6e6697c5 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByClientOidReq implements Serializable { /** * The user self-defined order id. diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts index 94dd7176..08044ffa 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByClientOidResp implements Response { /** * Order ID diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts index d2b44bbc..36fd4ff6 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance, Expose } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByOrderIdReq implements Serializable { /** * diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts index 034b132e..65bcc836 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByOrderIdResp implements Response { /** * Order ID diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts index afb5aa05..b28853c5 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderListItems implements Serializable { /** * Order ID diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts index f72e9eeb..de81407d 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderListReq implements Serializable { /** * active or done, done as default. Only list orders for a specific status diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts index 60ca0e22..94306ffd 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetOrderListItems } from './model_get_order_list_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderListResp implements Response { /** * Current request page, The default currentPage is 1 diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts index 43dfc1e3..46d10cad 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentClosedOrdersData implements Serializable { /** * Order ID diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts index a444f450..ee12fedb 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentClosedOrdersReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts index acdbc222..5ba63feb 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetRecentClosedOrdersData } from './model_get_recent_closed_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRecentClosedOrdersResp implements Response { diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts index 5a9c336d..bc2720e5 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentTradeHistoryData implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts index 0e263e7f..79634593 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentTradeHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts index 79d07384..64d0d0ac 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetRecentTradeHistoryData } from './model_get_recent_trade_history_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRecentTradeHistoryResp implements Response { diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts index a7dcd533..a94edb0e 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrderListItems implements Serializable { /** * Order ID diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts index e7179db1..70934678 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrderListReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts index 816fac44..75f06d94 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetStopOrderListItems } from './model_get_stop_order_list_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetStopOrderListResp implements Response { /** * Current request page, The default currentPage is 1 diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts index 6ee167b9..8e626e14 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryItems implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts index 6fcc6e79..be80d32b 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryReq implements Serializable { /** * List fills for a specific order only (If you specify orderId, other parameters can be ignored) diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts index 435579f0..f7f71c90 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts @@ -4,6 +4,7 @@ import { GetTradeHistoryItems } from './model_get_trade_history_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts index b8bb5486..470ebc19 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts index eca667f1..72eab813 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddIsolatedMarginResp implements Response { /** * Position ID diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts index 8628e8b1..3483b1eb 100644 --- a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCrossMarginLeverageReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts index 34637519..aa2f1a9c 100644 --- a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetCrossMarginLeverageResp implements Response { diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts index a52faea0..8de593ae 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginRiskLimitData implements Serializable { diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts index fe7eb922..a04e77c9 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginRiskLimitReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts index 97f7604e..5fc03958 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetIsolatedMarginRiskLimitData } from './model_get_isolated_margin_risk_limit_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetIsolatedMarginRiskLimitResp implements Response { diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts index cf6a270f..5e47f587 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginModeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts index d66e976a..4c823e2e 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarginModeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts index 36a87645..71e785ca 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMaxOpenSizeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts index 545f0265..96a2729f 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMaxOpenSizeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts index 7d2f0f6f..3cf5efbb 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMaxWithdrawMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts index bc8c55bb..bd4bf161 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMaxWithdrawMarginResp implements Response { /** * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts index d44b9bd7..0c844d74 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPositionDetailsReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts index 3c64c660..e967b269 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPositionDetailsResp implements Response { /** * Position ID diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts index 6076c9ef..2c8f18a1 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPositionListData implements Serializable { /** * Position ID diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts index 1a165255..2229ffbd 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPositionListReq implements Serializable { /** * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts index fdc8595c..95a60d3e 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts @@ -4,6 +4,7 @@ import { GetPositionListData } from './model_get_position_list_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPositionListResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts index 4c7ff41a..4ca51143 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPositionsHistoryItems implements Serializable { /** * Close ID diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts index 10d6b321..32bcbba7 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPositionsHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts index 061557e7..33451504 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPositionsHistoryItems } from './model_get_positions_history_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPositionsHistoryResp implements Response { /** * Current page number diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts index e67fbe63..176d45b8 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyAutoDepositStatusReq implements Serializable { /** * Symbol of the contract diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts index a6709b92..6038bbb2 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyAutoDepositStatusResp implements Response { diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts index 1d818b97..21e522a1 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyIsolatedMarginRiskLimtReq implements Serializable { diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts index 2921ae5e..c4489c03 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyIsolatedMarginRiskLimtResp implements Response { diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts index b650c881..f517060a 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyMarginLeverageReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts index a80ef95e..ad7417ab 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyMarginLeverageResp implements Response { /** * diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts index 55530a9d..f79475a4 100644 --- a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class RemoveIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts index 6adcfe63..231486a1 100644 --- a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class RemoveIsolatedMarginResp implements Response { /** * The size of the position deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts index 698a50d4..828534d3 100644 --- a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class SwitchMarginModeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts index 50724ae3..b2942d09 100644 --- a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class SwitchMarginModeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts index d786ab72..5df48d68 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetLoanMarketData implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts index ed5161e9..f27a81cc 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetLoanMarketInterestRateData implements Serializable { /** * Time: YYYYMMDDHH00 diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts index f1a44cc3..21e7d5d2 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetLoanMarketInterestRateReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts index cfe41526..fc5ab7c7 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetLoanMarketInterestRateData } from './model_get_loan_market_interest_rate_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetLoanMarketInterestRateResp implements Response { diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts index 835344cb..ec29c4e6 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetLoanMarketReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts index 231f580a..a8431196 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetLoanMarketData } from './model_get_loan_market_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetLoanMarketResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts index 787be66e..45c4f86a 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPurchaseOrdersItems implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts index fe9a4b38..1190eead 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPurchaseOrdersReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts index 77706f15..4277197e 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPurchaseOrdersItems } from './model_get_purchase_orders_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPurchaseOrdersResp implements Response { /** * Current Page diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts index 8f7a1c6c..b52a2afa 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRedeemOrdersItems implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts index 01da9297..8511ae8b 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRedeemOrdersReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts index da457196..5e9f8d62 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetRedeemOrdersItems } from './model_get_redeem_orders_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRedeemOrdersResp implements Response { /** * Current Page diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts index aeedd0b2..33028580 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyPurchaseReq implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts index 056ee7ec..56611125 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyPurchaseResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/credit/model_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_purchase_req.ts index ca638345..7c44ae72 100644 --- a/sdk/node/src/generate/margin/credit/model_purchase_req.ts +++ b/sdk/node/src/generate/margin/credit/model_purchase_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class PurchaseReq implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts index 97817140..6c33d6b2 100644 --- a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class PurchaseResp implements Response { /** * Purchase order id diff --git a/sdk/node/src/generate/margin/credit/model_redeem_req.ts b/sdk/node/src/generate/margin/credit/model_redeem_req.ts index ed6892a4..682813b6 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_req.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class RedeemReq implements Serializable { /** * Currency diff --git a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts index b105894a..014b8480 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class RedeemResp implements Response { /** * Redeem order id diff --git a/sdk/node/src/generate/margin/debit/model_borrow_req.ts b/sdk/node/src/generate/margin/debit/model_borrow_req.ts index d7701a81..7683fee8 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_req.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BorrowReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts index 99a0e3e4..34f2a69c 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BorrowResp implements Response { /** * Borrow Order Id diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts index 472d8cbd..1633b88b 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetBorrowHistoryItems implements Serializable { /** * Borrow Order Id diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts index bb058abf..f902fbcd 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetBorrowHistoryReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts index 4ae4eca1..04320776 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetBorrowHistoryItems } from './model_get_borrow_history_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetBorrowHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts index cbefd435..8ff8f829 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetInterestHistoryItems implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts index 2fb791c5..325dd493 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetInterestHistoryReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts index 7f605745..7d2ef93d 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetInterestHistoryItems } from './model_get_interest_history_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetInterestHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts index 26b2c0df..55f3f384 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRepayHistoryItems implements Serializable { /** * Repay Order Id diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts index b22e2a26..1786f77f 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRepayHistoryReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts index 382af4cb..3afc55f3 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts @@ -4,6 +4,7 @@ import { GetRepayHistoryItems } from './model_get_repay_history_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRepayHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts index 429849b2..b282b8ed 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyLeverageReq implements Serializable { /** * symbol, mandatory for isolated margin account diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts index f0f53369..433e582b 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyLeverageResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/debit/model_repay_req.ts b/sdk/node/src/generate/margin/debit/model_repay_req.ts index abf812d4..699c9a4e 100644 --- a/sdk/node/src/generate/margin/debit/model_repay_req.ts +++ b/sdk/node/src/generate/margin/debit/model_repay_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class RepayReq implements Serializable { /** * currency diff --git a/sdk/node/src/generate/margin/debit/model_repay_resp.ts b/sdk/node/src/generate/margin/debit/model_repay_resp.ts index c4a37a13..1f6fc38a 100644 --- a/sdk/node/src/generate/margin/debit/model_repay_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_repay_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class RepayResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts index c3ce80b3..9a96493f 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class CrossMarginPositionAssetListValue implements Serializable { @@ -28,6 +29,7 @@ export class CrossMarginPositionAssetListValue toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): CrossMarginPositionAssetListValue { return plainToInstance(CrossMarginPositionAssetListValue, jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index 42d035d2..1d635c51 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -5,6 +5,7 @@ import { CrossMarginPositionAssetListValue } from './model_cross_margin_position import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class CrossMarginPositionEvent implements Response { /** * Debt ratio @@ -56,6 +57,7 @@ export class CrossMarginPositionEvent implements Response { @@ -32,6 +33,7 @@ export class IsolatedMarginPositionChangeAssetsValue toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): IsolatedMarginPositionChangeAssetsValue { return plainToInstance(IsolatedMarginPositionChangeAssetsValue, jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index de23d06b..c553b9f9 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -5,6 +5,7 @@ import { IsolatedMarginPositionChangeAssetsValue } from './model_isolated_margin import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class IsolatedMarginPositionEvent implements Response { @@ -50,6 +51,7 @@ export class IsolatedMarginPositionEvent toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): IsolatedMarginPositionEvent { return plainToInstance(IsolatedMarginPositionEvent, jsonObject); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index 4232f8bd..604ae763 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class IndexPriceEvent implements Response { /** * @@ -39,6 +40,7 @@ export class IndexPriceEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): IndexPriceEvent { return plainToInstance(IndexPriceEvent, jsonObject); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index b84d16a7..61cfaeef 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class MarkPriceEvent implements Response { /** * @@ -39,6 +40,7 @@ export class MarkPriceEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarkPriceEvent { return plainToInstance(MarkPriceEvent, jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts index b0e2f08a..1007b7a7 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCrossMarginSymbolsItems implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts index 1fa3625f..b4968921 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCrossMarginSymbolsReq implements Serializable { /** * If not provided, all cross margin symbol will be queried. If provided, only the specified symbol will be queried. diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts index c039593d..e6adcd05 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts @@ -4,6 +4,7 @@ import { GetCrossMarginSymbolsItems } from './model_get_cross_margin_symbols_ite import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetCrossMarginSymbolsResp implements Response { diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts index 9f5eb8b6..1f4b3721 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetETFInfoData implements Serializable { /** * ETF Currency diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts index 2a3d313a..f530b7bc 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetETFInfoReq implements Serializable { /** * ETF Currency, if empty query all currencies diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts index 85c74899..069bf92e 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetETFInfoData } from './model_get_etf_info_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetETFInfoResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts index edd45cc2..2e06ed8f 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetIsolatedMarginSymbolsData implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts index 48f31b9d..d2d8cdbc 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetIsolatedMarginSymbolsData } from './model_get_isolated_margin_symbols_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetIsolatedMarginSymbolsResp implements Response { diff --git a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts index daea13e2..c3709f0f 100644 --- a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarginConfigResp implements Response { /** * Available currencies for margin trade diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts index 99d11d87..b5d7449b 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarkPriceDetailReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts index d9b47389..5ee60fbd 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarkPriceDetailResp implements Response { /** * symbol diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts index 98e75981..92ff4e93 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarkPriceListData implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts index 999fd883..ce048c0c 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetMarkPriceListData } from './model_get_mark_price_list_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarkPriceListResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/order/model_add_order_req.ts b/sdk/node/src/generate/margin/order/model_add_order_req.ts index 11b11ac3..13d04d85 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/margin/order/model_add_order_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_resp.ts index be401709..6b018c7c 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts index 676329d6..028fa68e 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderTestReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts index a5141dc7..26675704 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts index cc764b34..5434f916 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderTestV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts index 68705a05..d4cc54ef 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderTestV1Resp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts index afd68210..b76cae10 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts index 4195aaac..3586742b 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderV1Resp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts index 1aaa4f47..5a2fad3f 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllOrdersBySymbolReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts index 33fc3a72..dc0a5cc4 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllOrdersBySymbolResp implements Response { diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts index c715c9d1..0e56abe1 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts index 431f3f4e..7a0bc0f5 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts index 715c3bf5..626aa327 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts index f6b43376..0bf7fe6a 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByOrderIdResp implements Response { /** * order id diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts index 612806f6..832b34ce 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetClosedOrdersItems implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts index d5c696ff..c05e9b59 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetClosedOrdersReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts index b3e6ed36..5f498d89 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetClosedOrdersItems } from './model_get_closed_orders_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetClosedOrdersResp implements Response { /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts index db53811f..edfbf48b 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOpenOrdersData implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts index ba2de958..485d2b48 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOpenOrdersReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts index 3e80bc6c..a2fa339a 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetOpenOrdersData } from './model_get_open_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOpenOrdersResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts index 18d40759..50921149 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByClientOidReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts index 46b92a32..7d28b357 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByClientOidResp implements Response { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts index c823c0ca..aab18cad 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByOrderIdReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts index 31ccb6ee..ee701ff1 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByOrderIdResp implements Response { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts index 3ed2e478..50205a9e 100644 --- a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSymbolsWithOpenOrderReq implements Serializable { /** * Cross Margin: MARGIN_TRADE, Isolated Margin: MARGIN_ISOLATED_TRADE diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts index 2eb945bf..e10a62b7 100644 --- a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSymbolsWithOpenOrderResp implements Response { diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts index 6c6387f9..c0a111e1 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryItems implements Serializable { /** * Id of transaction detail diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts index a00fb26b..345f370a 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts index 8620360e..480c788d 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts @@ -4,6 +4,7 @@ import { GetTradeHistoryItems } from './model_get_trade_history_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts index be338656..5ab940db 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginRiskLimitData implements Serializable { /** * Time stamp diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts index df125fab..a41d1178 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetMarginRiskLimitReq implements Serializable { /** * true-isolated, false-cross diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts index e6f2c7dc..6e242f3d 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetMarginRiskLimitData } from './model_get_margin_risk_limit_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarginRiskLimitResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts index 3e033cd4..fbf992b1 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class Get24hrStatsReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts index 6ab9a292..fcd41bb1 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class Get24hrStatsResp implements Response { /** * timestamp diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts index 8a335bf7..02351cf6 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts @@ -3,6 +3,7 @@ import { GetAllCurrenciesDataChains } from './model_get_all_currencies_data_chains'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllCurrenciesData implements Serializable { /** * A unique currency code that will never change diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts index 6bfe3623..715f11e0 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllCurrenciesDataChains implements Serializable { /** * chain name of currency diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts index 315fd290..55378a3d 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAllCurrenciesData } from './model_get_all_currencies_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAllCurrenciesResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts index ad1cc6c1..79b7ebf3 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllSymbolsData implements Serializable { /** * unique code of a symbol, it would not change after renaming diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts index 10466c88..98149e74 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllSymbolsReq implements Serializable { /** * [The trading market](https://www.kucoin.com/docs-new/api-222921786) diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts index 23aa741a..92ac9639 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts @@ -4,6 +4,7 @@ import { GetAllSymbolsData } from './model_get_all_symbols_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAllSymbolsResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts index 08d18f59..dd3f023a 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAllTickersTicker } from './model_get_all_tickers_ticker'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAllTickersResp implements Response { /** * timestamp diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts index e50527ab..b24c753c 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAllTickersTicker implements Serializable { /** * Symbol diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts index f8bbe2a4..40f945d3 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAnnouncementsItems implements Serializable { /** * Announcement ID diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts index 652f04af..790910b3 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAnnouncementsReq implements Serializable { /** * page number diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts index bb92b2da..5e10babd 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAnnouncementsItems } from './model_get_announcements_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAnnouncementsResp implements Response { /** * Total Number diff --git a/sdk/node/src/generate/spot/market/model_get_currency_chains.ts b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts index 8a9c5b63..81df0cd0 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCurrencyChains implements Serializable { /** * chain name of currency diff --git a/sdk/node/src/generate/spot/market/model_get_currency_req.ts b/sdk/node/src/generate/spot/market/model_get_currency_req.ts index 0d14e989..fd79c952 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetCurrencyReq implements Serializable { /** * Path parameter, Currency diff --git a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts index 7b0764df..707e841a 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetCurrencyChains } from './model_get_currency_chains'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetCurrencyResp implements Response { /** * A unique currency code that will never change diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts index d87803cd..6ff28c0a 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFiatPriceReq implements Serializable { /** * Ticker symbol of a base currency,eg.USD,EUR. Default is USD diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts index 4c495cb4..0e73700e 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance, Expose } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFiatPriceResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts index 3957e801..55c1f38e 100644 --- a/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetFullOrderBookReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts index 5faf70ae..ff2ee5f2 100644 --- a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetFullOrderBookResp implements Response { /** * Timestamp(millisecond) diff --git a/sdk/node/src/generate/spot/market/model_get_klines_req.ts b/sdk/node/src/generate/spot/market/model_get_klines_req.ts index 89e8f0f8..43226606 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetKlinesReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts index 9633279d..8735e287 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetKlinesResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts index 19fc9949..0d6d229b 100644 --- a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetMarketListResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts index 7f47b0d3..26d00184 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPartOrderBookReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts index 2d295434..a4c111f7 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPartOrderBookResp implements Response { /** * Timestamp(millisecond) diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts index 40190529..16ef0aa4 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPrivateTokenInstanceServers implements Serializable { diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts index 66c91797..94e29ad6 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPrivateTokenResp implements Response { /** * The token required to establish a websocket connection diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts index c8671c1c..fbbfb66e 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetPublicTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts index 557b3e34..d5a8e4ba 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetPublicTokenResp implements Response { /** * The token required to establish a websocket connection diff --git a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts index 65ad2ca0..5f8d3cd2 100644 --- a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetServerTimeResp implements Response { /** * ServerTime(millisecond) diff --git a/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts index 7fbe3eb1..6a3aa498 100644 --- a/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetServiceStatusResp implements Response { /** * Status of service: open:normal transaction, close:Stop Trading/Maintenance, cancelonly:can only cancel the order but not place order diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_req.ts b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts index 2c6ca179..be7c84cf 100644 --- a/sdk/node/src/generate/spot/market/model_get_symbol_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetSymbolReq implements Serializable { /** * Path parameter, Symbol diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts index 00625a48..5a7e28ff 100644 --- a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSymbolResp implements Response { /** * unique code of a symbol, it would not change after renaming diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts index f0117b08..6220fedc 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTickerReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts index 63d5ab83..c390f06c 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTickerResp implements Response { /** * timestamp diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts index 66632449..fea277d9 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryData implements Serializable { /** * Sequence number diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts index 0be60980..c4db12eb 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts index 2e10640a..848b3051 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetTradeHistoryData } from './model_get_trade_history_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts index 596835e0..35ab481b 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOcoOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts index 645531f0..726d97e8 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOcoOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts index 18b87555..ef9d8568 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts index 0e988713..f329f769 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderOldResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_order_req.ts b/sdk/node/src/generate/spot/order/model_add_order_req.ts index 62b5b23b..8fda5173 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_resp.ts index de72a007..59355ba7 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts index a53a593a..ea65a040 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderSyncReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts index bbfe7e63..0a0e1793 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderSyncResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts index 322b6966..ea1fd890 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderTestOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts index cdde62d9..8f2eedf6 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderTestOldResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts index 36d6c1b6..b0bdbb24 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddOrderTestReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts index c6cd3a89..b5954e58 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts index 590bffde..44640fc8 100644 --- a/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class AddStopOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts index aa602da7..b9674f54 100644 --- a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class AddStopOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts index a4fa32bb..95b1dcd2 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts index d8174b9a..5c840879 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersOldData implements Serializable { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts index 613c6780..3c5a6afb 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersOldOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts index 9edf5ed5..5a3a06aa 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts @@ -3,6 +3,7 @@ import { BatchAddOrdersOldOrderList } from './model_batch_add_orders_old_order_list'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersOldReq implements Serializable { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts index d59b07e2..d70c8051 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts @@ -4,6 +4,7 @@ import { BatchAddOrdersOldData } from './model_batch_add_orders_old_data'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchAddOrdersOldResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts index 878abc79..876a6a59 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts index 9b1971cd..62d58969 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts @@ -3,6 +3,7 @@ import { BatchAddOrdersOrderList } from './model_batch_add_orders_order_list'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersReq implements Serializable { /** * Order List diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts index cf7ed011..7feae7dc 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { BatchAddOrdersData } from './model_batch_add_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchAddOrdersResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts index 9d6cc062..3adee5b6 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersSyncData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts index 8992f80b..51564b3e 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersSyncOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts index 8b6032b5..7cc243fc 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts @@ -3,6 +3,7 @@ import { BatchAddOrdersSyncOrderList } from './model_batch_add_orders_sync_order_list'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchAddOrdersSyncReq implements Serializable { /** * Order List diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts index fb8fab60..e4d5311c 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { BatchAddOrdersSyncData } from './model_batch_add_orders_sync_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchAddOrdersSyncResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts index 34544438..cbbdcf9f 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelOcoOrdersReq implements Serializable { /** * Specify the order id, there can be multiple orders, separated by commas. If not passed, all oco orders will be canceled by default. diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts index c80ca58b..655d4b3e 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchCancelOcoOrdersResp implements Response { /** * List of two order IDs related to the canceled OCO order diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts index bdc56f1e..2a97e1a7 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelOrderOldReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts index 9685692d..405aa9cb 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchCancelOrderOldResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts index 9abfb49e..d5bbd04e 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class BatchCancelStopOrderReq implements Serializable { /** * Cancel the open order for the specified symbol diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts index d895ed6c..63590182 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class BatchCancelStopOrderResp implements Response { /** * order id array diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts index a848bb43..5076d77d 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllOrdersBySymbolReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts index 33fc3a72..dc0a5cc4 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllOrdersBySymbolResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts index 2a2d2839..a6d09f29 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelAllOrdersFailedSymbols implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts index 191dbfbc..e1a1435e 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { CancelAllOrdersFailedSymbols } from './model_cancel_all_orders_failed_symbols'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelAllOrdersResp implements Response { /** * The Symbols Successfully cancelled diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts index 3d30522b..8eaeee39 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOcoOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts index 2168897a..029d67a8 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOcoOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts index 2d2a1664..4003b981 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOcoOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts index 497ad81e..940bf35c 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOcoOrderByOrderIdResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts index c72fbc76..9fbca2fe 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByClientOidOldReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts index 1c6ded8a..feb11ff9 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByClientOidOldResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts index c715c9d1..0e56abe1 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts index 431f3f4e..7a0bc0f5 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts index 24642b0e..2bf66673 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByClientOidSyncReq implements Serializable { /** * Client Order Id,unique identifier created by the user diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts index c635ef52..fe36fb77 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByClientOidSyncResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts index 66d1f6b2..013f93ce 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByOrderIdOldReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts index ff599efe..3af4ed58 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByOrderIdOldResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts index 715c3bf5..626aa327 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts index f6b43376..0bf7fe6a 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByOrderIdResp implements Response { /** * order id diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts index 9b19dcf5..26636bca 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelOrderByOrderIdSyncReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts index 36c149b0..367c4805 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelOrderByOrderIdSyncResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts index c062db26..c5c7a6c5 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelPartialOrderReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts index 5a64500a..27e964bd 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelPartialOrderResp implements Response { /** * order id diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts index 0f764bea..cb1e0ef1 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelStopOrderByClientOidReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts index b6eda59a..fab971c6 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelStopOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts index cbb334ee..262f63cf 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class CancelStopOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts index 7ec76514..51c70b40 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class CancelStopOrderByOrderIdResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts index 1c2e4634..e62e8b2c 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetClosedOrdersItems implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts index b9c90643..e40d2ca1 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetClosedOrdersReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts index b3e6ed36..5f498d89 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetClosedOrdersItems } from './model_get_closed_orders_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetClosedOrdersResp implements Response { /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. diff --git a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts index f8dbaee5..455dc80a 100644 --- a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetDCPResp implements Response { /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400 diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts index 6cafa030..f04db087 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts index 18b5d39b..d4ca84c3 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOcoOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts index 4ececba4..16e1aab4 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts index d996624f..90f254f0 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOcoOrderByOrderIdResp implements Response { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts index 6dd07971..0aafc1d7 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderDetailByOrderIdOrders implements Serializable { diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts index 8c305e2e..41663732 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderDetailByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts index 21faab8c..44f65758 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetOcoOrderDetailByOrderIdOrders } from './model_get_oco_order_detail_by_order_id_orders'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOcoOrderDetailByOrderIdResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts index 746589bf..7cccf031 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderListItems implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts index 665bab53..3fb35f15 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOcoOrderListReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts index cdc1c41d..6ee03d1c 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts @@ -4,6 +4,7 @@ import { GetOcoOrderListItems } from './model_get_oco_order_list_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOcoOrderListResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts index 3279ba35..de1dee6a 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOpenOrdersData implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts index f628fe02..3adf9aad 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOpenOrdersReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts index 3e80bc6c..a2fa339a 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetOpenOrdersData } from './model_get_open_orders_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOpenOrdersResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts index 55066102..a804e02c 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByClientOidOldReq implements Serializable { /** * Unique order id created by users to identify their orders diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts index 89685295..0bbefd25 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByClientOidOldResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts index 18d40759..50921149 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByClientOidReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts index 4edcecdc..11c23687 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByClientOidResp implements Response { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts index c07de168..5c4f1103 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByOrderIdOldReq implements Serializable { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts index 9acfc8db..194cbf99 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByOrderIdOldResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts index c823c0ca..aab18cad 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrderByOrderIdReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts index 750d9929..a91402a3 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrderByOrderIdResp implements Response { /** * The unique order id generated by the trading system diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts index 28bab27f..53129cda 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrdersListOldItems implements Serializable { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts index 5c5f3b8b..d63e0ea2 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetOrdersListOldReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts index 7cb4f708..3ff636bc 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts @@ -4,6 +4,7 @@ import { GetOrdersListOldItems } from './model_get_orders_list_old_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetOrdersListOldResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts index 19a95158..455c03ec 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentOrdersListOldData implements Serializable { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts index 6bef2096..192693bb 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentOrdersListOldReq implements Serializable { /** * Current request page. diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts index f0c64c3a..cbc98631 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetRecentOrdersListOldData } from './model_get_recent_orders_list_old_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRecentOrdersListOldResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts index e2b3215c..f4cc4aa5 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentTradeHistoryOldData implements Serializable { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts index dffec6dc..267668fd 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetRecentTradeHistoryOldReq implements Serializable { /** * Current request page. diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts index d7ea292b..f5059d50 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetRecentTradeHistoryOldData } from './model_get_recent_trade_history_old_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetRecentTradeHistoryOldResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts index 3376be87..acc557be 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrderByClientOidData implements Serializable { /** * Order ID, the ID of an order. diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts index f12679ae..99508937 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrderByClientOidReq implements Serializable { /** * The client order id diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts index e728fa98..ee6e9c2c 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts @@ -4,6 +4,7 @@ import { GetStopOrderByClientOidData } from './model_get_stop_order_by_client_oi import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetStopOrderByClientOidResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts index e16961f0..00d90a72 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts @@ -3,6 +3,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrderByOrderIdReq implements Serializable { /** * The order id diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts index 65994fc7..f29c4dab 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetStopOrderByOrderIdResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts index b50886a9..0cc9bffd 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrdersListItems implements Serializable { /** * Order ID, the ID of an order. diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts index 8b8b8dbd..b9564558 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetStopOrdersListReq implements Serializable { /** * Only list orders for a specific symbol diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts index 84e64270..d5556617 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetStopOrdersListItems } from './model_get_stop_orders_list_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetStopOrdersListResp implements Response { /** * current page id diff --git a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts index 4f42ca50..f1350780 100644 --- a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetSymbolsWithOpenOrderResp implements Response { diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts index d140561a..6ba1705e 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryItems implements Serializable { /** * Id of transaction detail diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts index e27b1820..6d3be2ad 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryOldItems implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts index ad8c5d8e..633f2985 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryOldReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts index 6b1e05b1..b55cb7fe 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetTradeHistoryOldItems } from './model_get_trade_history_old_items'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryOldResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts index a6abbe19..3f025677 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetTradeHistoryReq implements Serializable { /** * symbol diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts index 8620360e..480c788d 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts @@ -4,6 +4,7 @@ import { GetTradeHistoryItems } from './model_get_trade_history_items'; import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetTradeHistoryResp implements Response { /** * diff --git a/sdk/node/src/generate/spot/order/model_modify_order_req.ts b/sdk/node/src/generate/spot/order/model_modify_order_req.ts index f6e2055e..0eaa89e9 100644 --- a/sdk/node/src/generate/spot/order/model_modify_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_modify_order_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class ModifyOrderReq implements Serializable { /** * The old client order id,orderId and clientOid must choose one diff --git a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts index 6854db90..aab129fa 100644 --- a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class ModifyOrderResp implements Response { /** * The new order id diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts index 48e952a1..996950ea 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class SetDCPReq implements Serializable { /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts index c033d084..9a71a364 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts @@ -3,6 +3,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class SetDCPResp implements Response { /** * System current time (in seconds) diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 9435cbc5..27146e34 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -5,6 +5,7 @@ import { AccountRelationContext } from './model_account_relation_context'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class AccountEvent implements Response { /** * Account ID @@ -68,6 +69,7 @@ export class AccountEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): AccountEvent { return plainToInstance(AccountEvent, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts index 0e61e6ff..a7216762 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class AccountRelationContext implements Serializable { /** * @@ -22,6 +23,7 @@ export class AccountRelationContext implements Serializable { /** * Cumulative number of cancellations @@ -111,6 +112,7 @@ export class OrderV1Event implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): OrderV1Event { return plainToInstance(OrderV1Event, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index c64b85ea..ecc35b2a 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class OrderV2Event implements Response { /** * Cumulative number of cancellations @@ -111,6 +112,7 @@ export class OrderV2Event implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): OrderV2Event { return plainToInstance(OrderV2Event, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index 0a85a3c3..dae179cd 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class AllTickersEvent implements Response { /** * @@ -55,6 +56,7 @@ export class AllTickersEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): AllTickersEvent { return plainToInstance(AllTickersEvent, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index fdbb7d65..f1278b37 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class KlinesEvent implements Response { /** * symbol @@ -35,6 +36,7 @@ export class KlinesEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): KlinesEvent { return plainToInstance(KlinesEvent, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts index 0ef1890a..605e9f6c 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -7,6 +7,7 @@ import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class MarketSnapshotData implements Serializable { /** * @@ -153,6 +154,7 @@ export class MarketSnapshotData implements Serializable { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarketSnapshotData { return plainToInstance(MarketSnapshotData, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts index 5a1e2992..e0ea1620 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class MarketSnapshotDataMarketChange1h implements Serializable { @@ -44,6 +45,7 @@ export class MarketSnapshotDataMarketChange1h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange1h { return plainToInstance(MarketSnapshotDataMarketChange1h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts index 65a234c7..acc29186 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class MarketSnapshotDataMarketChange24h implements Serializable { @@ -44,6 +45,7 @@ export class MarketSnapshotDataMarketChange24h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange24h { return plainToInstance(MarketSnapshotDataMarketChange24h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts index 504d0012..b6aef68c 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class MarketSnapshotDataMarketChange4h implements Serializable { @@ -44,6 +45,7 @@ export class MarketSnapshotDataMarketChange4h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): MarketSnapshotDataMarketChange4h { return plainToInstance(MarketSnapshotDataMarketChange4h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index 3d381c8f..aabe0944 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -5,6 +5,7 @@ import { MarketSnapshotData } from './model_market_snapshot_data'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class MarketSnapshotEvent implements Response { /** * @@ -32,6 +33,7 @@ export class MarketSnapshotEvent implements Response { /** * price,size,sequence @@ -22,6 +23,7 @@ export class OrderbookIncrementChanges implements Serializable { /** * @@ -44,6 +45,7 @@ export class OrderbookIncrementEvent implements Response { /** * price, size @@ -35,6 +36,7 @@ export class OrderbookLevel1Event implements Response { /** * @@ -22,6 +23,7 @@ export class OrderbookLevel50Changes implements Serializable { /** * @@ -44,6 +45,7 @@ export class OrderbookLevel50Event implements Response { /** * price, size @@ -35,6 +36,7 @@ export class OrderbookLevel5Event implements Response { /** * @@ -153,6 +154,7 @@ export class SymbolSnapshotData implements Serializable { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): SymbolSnapshotData { return plainToInstance(SymbolSnapshotData, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts index 82607174..a3dcedd4 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class SymbolSnapshotDataMarketChange1h implements Serializable { @@ -44,6 +45,7 @@ export class SymbolSnapshotDataMarketChange1h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange1h { return plainToInstance(SymbolSnapshotDataMarketChange1h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts index 5bcb1ab1..5c95a9cd 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class SymbolSnapshotDataMarketChange24h implements Serializable { @@ -44,6 +45,7 @@ export class SymbolSnapshotDataMarketChange24h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange24h { return plainToInstance(SymbolSnapshotDataMarketChange24h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts index 63c5deb5..3fe9c8f2 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -4,6 +4,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; + export class SymbolSnapshotDataMarketChange4h implements Serializable { @@ -44,6 +45,7 @@ export class SymbolSnapshotDataMarketChange4h toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange4h { return plainToInstance(SymbolSnapshotDataMarketChange4h, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index 1e473074..f05b2cf7 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -5,6 +5,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class SymbolSnapshotEvent implements Response { /** * @@ -32,6 +33,7 @@ export class SymbolSnapshotEvent implements Response { /** * Sequence number @@ -55,6 +56,7 @@ export class TickerEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): TickerEvent { return plainToInstance(TickerEvent, jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index 87c1f346..bea96b4f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -4,6 +4,7 @@ import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Response } from '@internal/interfaces/response'; + export class TradeEvent implements Response { /** * @@ -63,6 +64,7 @@ export class TradeEvent implements Response { toJson(): string { return JSON.stringify(instanceToPlain(this)); } + fromObject(jsonObject: Object): TradeEvent { return plainToInstance(TradeEvent, jsonObject); } diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 70de0e96..291eeda2 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-08'; +export const SdkGenerateDate = '2025-01-09'; diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts index 71fc42f9..a0c29c53 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountDetailLtv implements Serializable { /** * LTV of Restricted Transfers to Funding Account diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts index 7fe5f0b9..f109e8b8 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountDetailMargins implements Serializable { /** * Margin Currency diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts index fc3f41ae..0c5c14b3 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountDetailOrders implements Serializable { /** * Loan Orders ID diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts index 0ec56497..462d4912 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts @@ -6,6 +6,7 @@ import { GetAccountDetailOrders } from './model_get_account_detail_orders'; import { GetAccountDetailMargins } from './model_get_account_detail_margins'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAccountDetailResp implements Response { /** * Master UID diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts index 8dca6b3e..01a69125 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts @@ -2,6 +2,7 @@ import { instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; + export class GetAccountsData implements Serializable { /** * UID diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts index 471eb9f2..da6fd238 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts @@ -4,6 +4,7 @@ import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transform import { GetAccountsData } from './model_get_accounts_data'; import { RestResponse } from '@model/common'; import { Response } from '@internal/interfaces/response'; + export class GetAccountsResp implements Response { /** * diff --git a/sdk/node/src/internal/ws/default_ws_impl.ts b/sdk/node/src/internal/ws/default_ws_impl.ts index 38a24ce5..173dfcb0 100644 --- a/sdk/node/src/internal/ws/default_ws_impl.ts +++ b/sdk/node/src/internal/ws/default_ws_impl.ts @@ -20,7 +20,7 @@ import { DefaultWsService } from '../infra/default_ws_service'; import { SdkVersion } from '@generate/version'; export class KucoinDefaultWsImpl implements KucoinWSService { - private options: ClientOption; + private readonly options: ClientOption; constructor(options: ClientOption) { this.options = options; From cb7aa2cabb1530959f301f4ad15ad3bcf418a656 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 9 Jan 2025 10:51:47 +0800 Subject: [PATCH 011/106] feat(nodejs): update model style --- .../src/main/resources/node-sdk/model.mustache | 8 ++++---- .../src/main/resources/node-sdk/model_ws.mustache | 12 ++++++------ .../account/account/model_get_account_info_resp.ts | 1 + .../account/account/model_get_apikey_info_resp.ts | 1 + .../model_get_cross_margin_account_accounts.ts | 1 + .../account/model_get_cross_margin_account_resp.ts | 1 + .../account/model_get_futures_account_resp.ts | 1 + .../account/model_get_futures_ledger_data_list.ts | 1 + .../account/account/model_get_futures_ledger_resp.ts | 1 + .../model_get_isolated_margin_account_assets.ts | 1 + ..._get_isolated_margin_account_assets_base_asset.ts | 1 + ...get_isolated_margin_account_assets_quote_asset.ts | 1 + ...t_isolated_margin_account_detail_v1_base_asset.ts | 1 + ..._isolated_margin_account_detail_v1_quote_asset.ts | 1 + ...del_get_isolated_margin_account_detail_v1_resp.ts | 1 + ...del_get_isolated_margin_account_list_v1_assets.ts | 1 + ...lated_margin_account_list_v1_assets_base_asset.ts | 1 + ...ated_margin_account_list_v1_assets_quote_asset.ts | 1 + ...model_get_isolated_margin_account_list_v1_resp.ts | 1 + .../model_get_isolated_margin_account_resp.ts | 1 + .../model_get_margin_account_detail_accounts.ts | 1 + .../account/model_get_margin_account_detail_resp.ts | 1 + .../account/model_get_margin_hf_ledger_data.ts | 1 + .../account/model_get_margin_hf_ledger_resp.ts | 1 + .../account/model_get_spot_account_detail_resp.ts | 1 + .../account/model_get_spot_account_list_data.ts | 1 + .../account/model_get_spot_account_list_resp.ts | 1 + .../account/model_get_spot_account_type_resp.ts | 1 + .../account/account/model_get_spot_hf_ledger_data.ts | 1 + .../account/account/model_get_spot_hf_ledger_resp.ts | 1 + .../account/account/model_get_spot_ledger_items.ts | 1 + .../account/account/model_get_spot_ledger_resp.ts | 1 + .../deposit/model_add_deposit_address_v1_resp.ts | 1 + .../deposit/model_add_deposit_address_v3_resp.ts | 1 + .../deposit/model_get_deposit_address_v1_resp.ts | 1 + .../deposit/model_get_deposit_address_v2_data.ts | 1 + .../deposit/model_get_deposit_address_v2_resp.ts | 1 + .../deposit/model_get_deposit_address_v3_data.ts | 1 + .../deposit/model_get_deposit_address_v3_resp.ts | 1 + .../deposit/model_get_deposit_history_items.ts | 1 + .../deposit/model_get_deposit_history_old_items.ts | 1 + .../deposit/model_get_deposit_history_old_resp.ts | 1 + .../deposit/model_get_deposit_history_resp.ts | 1 + .../generate/account/fee/model_get_basic_fee_resp.ts | 1 + .../account/fee/model_get_futures_actual_fee_resp.ts | 1 + .../account/fee/model_get_spot_actual_fee_data.ts | 1 + .../account/fee/model_get_spot_actual_fee_resp.ts | 1 + .../subaccount/model_add_sub_account_api_resp.ts | 1 + .../model_add_sub_account_futures_permission_resp.ts | 1 + .../model_add_sub_account_margin_permission_resp.ts | 1 + .../account/subaccount/model_add_sub_account_resp.ts | 1 + .../subaccount/model_delete_sub_account_api_resp.ts | 1 + ...model_get_futures_sub_account_list_v2_accounts.ts | 1 + .../model_get_futures_sub_account_list_v2_resp.ts | 1 + .../model_get_futures_sub_account_list_v2_summary.ts | 1 + ...odel_get_spot_sub_account_detail_main_accounts.ts | 1 + ...el_get_spot_sub_account_detail_margin_accounts.ts | 1 + .../model_get_spot_sub_account_detail_resp.ts | 1 + ...del_get_spot_sub_account_detail_trade_accounts.ts | 1 + .../model_get_spot_sub_account_list_v1_data.ts | 1 + ...et_spot_sub_account_list_v1_data_main_accounts.ts | 1 + ..._spot_sub_account_list_v1_data_margin_accounts.ts | 1 + ...t_spot_sub_account_list_v1_data_trade_accounts.ts | 1 + .../model_get_spot_sub_account_list_v1_resp.ts | 1 + .../model_get_spot_sub_account_list_v2_items.ts | 1 + ...t_spot_sub_account_list_v2_items_main_accounts.ts | 1 + ...spot_sub_account_list_v2_items_margin_accounts.ts | 1 + ..._spot_sub_account_list_v2_items_trade_accounts.ts | 1 + .../model_get_spot_sub_account_list_v2_resp.ts | 1 + .../model_get_spot_sub_accounts_summary_v1_data.ts | 1 + .../model_get_spot_sub_accounts_summary_v1_resp.ts | 1 + .../model_get_spot_sub_accounts_summary_v2_items.ts | 1 + .../model_get_spot_sub_accounts_summary_v2_resp.ts | 1 + .../model_get_sub_account_api_list_data.ts | 1 + .../model_get_sub_account_api_list_resp.ts | 1 + .../subaccount/model_modify_sub_account_api_resp.ts | 1 + .../account/transfer/model_flex_transfer_resp.ts | 1 + .../model_futures_account_transfer_in_resp.ts | 1 + .../model_futures_account_transfer_out_resp.ts | 1 + ..._get_futures_account_transfer_out_ledger_items.ts | 1 + ...l_get_futures_account_transfer_out_ledger_resp.ts | 1 + .../transfer/model_get_transfer_quotas_resp.ts | 1 + .../account/transfer/model_inner_transfer_resp.ts | 1 + .../transfer/model_sub_account_transfer_resp.ts | 1 + .../withdrawal/model_cancel_withdrawal_resp.ts | 1 + .../withdrawal/model_get_withdrawal_history_items.ts | 1 + .../model_get_withdrawal_history_old_items.ts | 1 + .../model_get_withdrawal_history_old_resp.ts | 1 + .../withdrawal/model_get_withdrawal_history_resp.ts | 1 + .../withdrawal/model_get_withdrawal_quotas_resp.ts | 1 + .../account/withdrawal/model_withdrawal_v1_resp.ts | 1 + .../account/withdrawal/model_withdrawal_v3_resp.ts | 1 + .../affiliate/affiliate/model_get_account_ltv.ts | 1 + .../affiliate/affiliate/model_get_account_margins.ts | 1 + .../affiliate/affiliate/model_get_account_orders.ts | 1 + .../affiliate/affiliate/model_get_account_resp.ts | 1 + .../broker/apibroker/model_get_rebase_resp.ts | 1 + .../ndbroker/model_add_sub_account_api_resp.ts | 1 + .../broker/ndbroker/model_add_sub_account_resp.ts | 1 + .../ndbroker/model_delete_sub_account_api_resp.ts | 1 + .../broker/ndbroker/model_get_broker_info_resp.ts | 1 + .../broker/ndbroker/model_get_deposit_detail_resp.ts | 1 + .../broker/ndbroker/model_get_deposit_list_data.ts | 1 + .../broker/ndbroker/model_get_deposit_list_resp.ts | 1 + .../broker/ndbroker/model_get_rebase_resp.ts | 1 + .../ndbroker/model_get_sub_account_api_data.ts | 1 + .../ndbroker/model_get_sub_account_api_resp.ts | 1 + .../broker/ndbroker/model_get_sub_account_items.ts | 1 + .../broker/ndbroker/model_get_sub_account_resp.ts | 1 + .../ndbroker/model_get_transfer_history_resp.ts | 1 + .../ndbroker/model_get_withdraw_detail_resp.ts | 1 + .../ndbroker/model_modify_sub_account_api_resp.ts | 1 + .../generate/broker/ndbroker/model_transfer_resp.ts | 1 + .../earn/earn/model_get_account_holding_items.ts | 1 + .../earn/earn/model_get_account_holding_resp.ts | 1 + .../earn/earn/model_get_eth_staking_products_data.ts | 1 + .../earn/earn/model_get_eth_staking_products_resp.ts | 1 + .../earn/earn/model_get_kcs_staking_products_data.ts | 1 + .../earn/earn/model_get_kcs_staking_products_resp.ts | 1 + .../earn/earn/model_get_promotion_products_data.ts | 1 + .../earn/earn/model_get_promotion_products_resp.ts | 1 + .../earn/earn/model_get_redeem_preview_resp.ts | 1 + .../earn/earn/model_get_savings_products_data.ts | 1 + .../earn/earn/model_get_savings_products_resp.ts | 1 + .../earn/earn/model_get_staking_products_data.ts | 1 + .../earn/earn/model_get_staking_products_resp.ts | 1 + .../src/generate/earn/earn/model_purchase_resp.ts | 1 + sdk/node/src/generate/earn/earn/model_redeem_resp.ts | 1 + .../model_get_current_funding_rate_resp.ts | 1 + .../model_get_private_funding_history_data_list.ts | 1 + .../model_get_private_funding_history_resp.ts | 1 + .../model_get_public_funding_history_data.ts | 1 + .../model_get_public_funding_history_resp.ts | 1 + .../futures/futuresprivate/model_all_order_event.ts | 5 ++--- .../futuresprivate/model_all_position_event.ts | 5 ++--- .../futures/futuresprivate/model_balance_event.ts | 5 ++--- .../futuresprivate/model_cross_leverage_event.ts | 5 ++--- .../futuresprivate/model_margin_mode_event.ts | 5 ++--- .../futures/futuresprivate/model_order_event.ts | 5 ++--- .../futures/futuresprivate/model_position_event.ts | 5 ++--- .../futuresprivate/model_stop_orders_event.ts | 5 ++--- .../futurespublic/model_announcement_event.ts | 5 ++--- .../futures/futurespublic/model_execution_event.ts | 5 ++--- .../futures/futurespublic/model_instrument_event.ts | 5 ++--- .../futures/futurespublic/model_klines_event.ts | 5 ++--- .../futurespublic/model_orderbook_increment_event.ts | 5 ++--- .../futurespublic/model_orderbook_level50_event.ts | 5 ++--- .../futurespublic/model_orderbook_level5_event.ts | 5 ++--- .../futurespublic/model_symbol_snapshot_event.ts | 5 ++--- .../futures/futurespublic/model_ticker_v1_event.ts | 5 ++--- .../futures/futurespublic/model_ticker_v2_event.ts | 5 ++--- .../futures/market/model_get24hr_stats_resp.ts | 1 + .../futures/market/model_get_all_symbols_data.ts | 1 + .../futures/market/model_get_all_symbols_resp.ts | 1 + .../futures/market/model_get_all_tickers_data.ts | 1 + .../futures/market/model_get_all_tickers_resp.ts | 1 + .../futures/market/model_get_full_order_book_resp.ts | 1 + .../model_get_interest_rate_index_data_list.ts | 1 + .../market/model_get_interest_rate_index_resp.ts | 1 + .../generate/futures/market/model_get_klines_resp.ts | 1 + .../futures/market/model_get_mark_price_resp.ts | 1 + .../futures/market/model_get_part_order_book_resp.ts | 1 + .../market/model_get_premium_index_data_list.ts | 1 + .../futures/market/model_get_premium_index_resp.ts | 1 + .../model_get_private_token_instance_servers.ts | 1 + .../futures/market/model_get_private_token_resp.ts | 1 + .../model_get_public_token_instance_servers.ts | 1 + .../futures/market/model_get_public_token_resp.ts | 1 + .../futures/market/model_get_server_time_resp.ts | 1 + .../futures/market/model_get_service_status_resp.ts | 1 + .../market/model_get_spot_index_price_data_list.ts | 1 + ...et_spot_index_price_data_list_decomposion_list.ts | 1 + .../market/model_get_spot_index_price_resp.ts | 1 + .../generate/futures/market/model_get_symbol_resp.ts | 1 + .../generate/futures/market/model_get_ticker_resp.ts | 1 + .../futures/market/model_get_trade_history_data.ts | 1 + .../futures/market/model_get_trade_history_resp.ts | 1 + .../generate/futures/order/model_add_order_resp.ts | 1 + .../futures/order/model_add_order_test_resp.ts | 1 + .../futures/order/model_add_tpsl_order_resp.ts | 1 + .../futures/order/model_batch_add_orders_data.ts | 1 + .../futures/order/model_batch_add_orders_resp.ts | 1 + .../futures/order/model_batch_cancel_orders_data.ts | 1 + .../futures/order/model_batch_cancel_orders_resp.ts | 1 + .../futures/order/model_cancel_all_orders_v1_resp.ts | 1 + .../futures/order/model_cancel_all_orders_v3_resp.ts | 1 + .../order/model_cancel_all_stop_orders_resp.ts | 1 + .../order/model_cancel_order_by_client_oid_resp.ts | 1 + .../futures/order/model_cancel_order_by_id_resp.ts | 1 + .../futures/order/model_get_open_order_value_resp.ts | 1 + .../order/model_get_order_by_client_oid_resp.ts | 1 + .../order/model_get_order_by_order_id_resp.ts | 1 + .../futures/order/model_get_order_list_items.ts | 1 + .../futures/order/model_get_order_list_resp.ts | 1 + .../order/model_get_recent_closed_orders_data.ts | 1 + .../order/model_get_recent_closed_orders_resp.ts | 1 + .../order/model_get_recent_trade_history_data.ts | 1 + .../order/model_get_recent_trade_history_resp.ts | 1 + .../futures/order/model_get_stop_order_list_items.ts | 1 + .../futures/order/model_get_stop_order_list_resp.ts | 1 + .../futures/order/model_get_trade_history_items.ts | 1 + .../futures/order/model_get_trade_history_resp.ts | 1 + .../positions/model_add_isolated_margin_resp.ts | 1 + .../model_get_cross_margin_leverage_resp.ts | 1 + .../model_get_isolated_margin_risk_limit_data.ts | 1 + .../model_get_isolated_margin_risk_limit_resp.ts | 1 + .../futures/positions/model_get_margin_mode_resp.ts | 1 + .../positions/model_get_max_open_size_resp.ts | 1 + .../positions/model_get_max_withdraw_margin_resp.ts | 1 + .../positions/model_get_position_details_resp.ts | 1 + .../positions/model_get_position_list_data.ts | 1 + .../positions/model_get_position_list_resp.ts | 1 + .../positions/model_get_positions_history_items.ts | 1 + .../positions/model_get_positions_history_resp.ts | 1 + .../model_modify_auto_deposit_status_resp.ts | 1 + .../model_modify_isolated_margin_risk_limt_resp.ts | 1 + .../positions/model_modify_margin_leverage_resp.ts | 1 + .../positions/model_remove_isolated_margin_resp.ts | 1 + .../positions/model_switch_margin_mode_resp.ts | 1 + .../margin/credit/model_get_loan_market_data.ts | 1 + .../model_get_loan_market_interest_rate_data.ts | 1 + .../model_get_loan_market_interest_rate_resp.ts | 1 + .../margin/credit/model_get_loan_market_resp.ts | 1 + .../margin/credit/model_get_purchase_orders_items.ts | 1 + .../margin/credit/model_get_purchase_orders_resp.ts | 1 + .../margin/credit/model_get_redeem_orders_items.ts | 1 + .../margin/credit/model_get_redeem_orders_resp.ts | 1 + .../margin/credit/model_modify_purchase_resp.ts | 1 + .../generate/margin/credit/model_purchase_resp.ts | 1 + .../src/generate/margin/credit/model_redeem_resp.ts | 1 + .../src/generate/margin/debit/model_borrow_resp.ts | 1 + .../margin/debit/model_get_borrow_history_items.ts | 1 + .../margin/debit/model_get_borrow_history_resp.ts | 1 + .../margin/debit/model_get_interest_history_items.ts | 1 + .../margin/debit/model_get_interest_history_resp.ts | 1 + .../margin/debit/model_get_repay_history_items.ts | 1 + .../margin/debit/model_get_repay_history_resp.ts | 1 + .../margin/debit/model_modify_leverage_resp.ts | 1 + .../src/generate/margin/debit/model_repay_resp.ts | 1 + .../model_cross_margin_position_event.ts | 5 ++--- .../model_isolated_margin_position_event.ts | 5 ++--- .../margin/marginpublic/model_index_price_event.ts | 5 ++--- .../margin/marginpublic/model_mark_price_event.ts | 5 ++--- .../market/model_get_cross_margin_symbols_items.ts | 1 + .../market/model_get_cross_margin_symbols_resp.ts | 1 + .../margin/market/model_get_etf_info_data.ts | 1 + .../margin/market/model_get_etf_info_resp.ts | 1 + .../market/model_get_isolated_margin_symbols_data.ts | 1 + .../market/model_get_isolated_margin_symbols_resp.ts | 1 + .../margin/market/model_get_margin_config_resp.ts | 1 + .../market/model_get_mark_price_detail_resp.ts | 1 + .../margin/market/model_get_mark_price_list_data.ts | 1 + .../margin/market/model_get_mark_price_list_resp.ts | 1 + .../generate/margin/order/model_add_order_resp.ts | 1 + .../margin/order/model_add_order_test_resp.ts | 1 + .../margin/order/model_add_order_test_v1_resp.ts | 1 + .../generate/margin/order/model_add_order_v1_resp.ts | 1 + .../order/model_cancel_all_orders_by_symbol_resp.ts | 1 + .../order/model_cancel_order_by_client_oid_resp.ts | 1 + .../order/model_cancel_order_by_order_id_resp.ts | 1 + .../margin/order/model_get_closed_orders_items.ts | 1 + .../margin/order/model_get_closed_orders_resp.ts | 1 + .../margin/order/model_get_open_orders_data.ts | 1 + .../margin/order/model_get_open_orders_resp.ts | 1 + .../order/model_get_order_by_client_oid_resp.ts | 1 + .../margin/order/model_get_order_by_order_id_resp.ts | 1 + .../order/model_get_symbols_with_open_order_resp.ts | 1 + .../margin/order/model_get_trade_history_items.ts | 1 + .../margin/order/model_get_trade_history_resp.ts | 1 + .../risklimit/model_get_margin_risk_limit_data.ts | 1 + .../risklimit/model_get_margin_risk_limit_resp.ts | 1 + .../generate/spot/market/model_get24hr_stats_resp.ts | 1 + .../spot/market/model_get_all_currencies_data.ts | 1 + .../market/model_get_all_currencies_data_chains.ts | 1 + .../spot/market/model_get_all_currencies_resp.ts | 1 + .../spot/market/model_get_all_symbols_data.ts | 1 + .../spot/market/model_get_all_symbols_resp.ts | 1 + .../spot/market/model_get_all_tickers_resp.ts | 1 + .../spot/market/model_get_all_tickers_ticker.ts | 1 + .../spot/market/model_get_announcements_items.ts | 1 + .../spot/market/model_get_announcements_resp.ts | 1 + .../spot/market/model_get_currency_chains.ts | 1 + .../generate/spot/market/model_get_currency_resp.ts | 1 + .../spot/market/model_get_fiat_price_resp.ts | 1 + .../spot/market/model_get_full_order_book_resp.ts | 1 + .../generate/spot/market/model_get_klines_resp.ts | 1 + .../spot/market/model_get_market_list_resp.ts | 1 + .../spot/market/model_get_part_order_book_resp.ts | 1 + .../model_get_private_token_instance_servers.ts | 1 + .../spot/market/model_get_private_token_resp.ts | 1 + .../model_get_public_token_instance_servers.ts | 1 + .../spot/market/model_get_public_token_resp.ts | 1 + .../spot/market/model_get_server_time_resp.ts | 1 + .../spot/market/model_get_service_status_resp.ts | 1 + .../generate/spot/market/model_get_symbol_resp.ts | 1 + .../generate/spot/market/model_get_ticker_resp.ts | 1 + .../spot/market/model_get_trade_history_data.ts | 1 + .../spot/market/model_get_trade_history_resp.ts | 1 + .../generate/spot/order/model_add_oco_order_resp.ts | 1 + .../generate/spot/order/model_add_order_old_resp.ts | 1 + .../src/generate/spot/order/model_add_order_resp.ts | 1 + .../generate/spot/order/model_add_order_sync_resp.ts | 1 + .../spot/order/model_add_order_test_old_resp.ts | 1 + .../generate/spot/order/model_add_order_test_resp.ts | 1 + .../generate/spot/order/model_add_stop_order_resp.ts | 1 + .../spot/order/model_batch_add_orders_data.ts | 1 + .../spot/order/model_batch_add_orders_old_data.ts | 1 + .../spot/order/model_batch_add_orders_old_resp.ts | 1 + .../spot/order/model_batch_add_orders_resp.ts | 1 + .../spot/order/model_batch_add_orders_sync_data.ts | 1 + .../spot/order/model_batch_add_orders_sync_resp.ts | 1 + .../spot/order/model_batch_cancel_oco_orders_resp.ts | 1 + .../spot/order/model_batch_cancel_order_old_resp.ts | 1 + .../spot/order/model_batch_cancel_stop_order_resp.ts | 1 + .../order/model_cancel_all_orders_by_symbol_resp.ts | 1 + .../order/model_cancel_all_orders_failed_symbols.ts | 1 + .../spot/order/model_cancel_all_orders_resp.ts | 1 + .../model_cancel_oco_order_by_client_oid_resp.ts | 1 + .../order/model_cancel_oco_order_by_order_id_resp.ts | 1 + .../model_cancel_order_by_client_oid_old_resp.ts | 1 + .../order/model_cancel_order_by_client_oid_resp.ts | 1 + .../model_cancel_order_by_client_oid_sync_resp.ts | 1 + .../order/model_cancel_order_by_order_id_old_resp.ts | 1 + .../order/model_cancel_order_by_order_id_resp.ts | 1 + .../model_cancel_order_by_order_id_sync_resp.ts | 1 + .../spot/order/model_cancel_partial_order_resp.ts | 1 + .../model_cancel_stop_order_by_client_oid_resp.ts | 1 + .../model_cancel_stop_order_by_order_id_resp.ts | 1 + .../spot/order/model_get_closed_orders_items.ts | 1 + .../spot/order/model_get_closed_orders_resp.ts | 1 + .../src/generate/spot/order/model_get_dcp_resp.ts | 1 + .../order/model_get_oco_order_by_client_oid_resp.ts | 1 + .../order/model_get_oco_order_by_order_id_resp.ts | 1 + .../model_get_oco_order_detail_by_order_id_orders.ts | 1 + .../model_get_oco_order_detail_by_order_id_resp.ts | 1 + .../spot/order/model_get_oco_order_list_items.ts | 1 + .../spot/order/model_get_oco_order_list_resp.ts | 1 + .../spot/order/model_get_open_orders_data.ts | 1 + .../spot/order/model_get_open_orders_resp.ts | 1 + .../order/model_get_order_by_client_oid_old_resp.ts | 1 + .../spot/order/model_get_order_by_client_oid_resp.ts | 1 + .../order/model_get_order_by_order_id_old_resp.ts | 1 + .../spot/order/model_get_order_by_order_id_resp.ts | 1 + .../spot/order/model_get_orders_list_old_items.ts | 1 + .../spot/order/model_get_orders_list_old_resp.ts | 1 + .../order/model_get_recent_orders_list_old_data.ts | 1 + .../order/model_get_recent_orders_list_old_resp.ts | 1 + .../order/model_get_recent_trade_history_old_data.ts | 1 + .../order/model_get_recent_trade_history_old_resp.ts | 1 + .../order/model_get_stop_order_by_client_oid_data.ts | 1 + .../order/model_get_stop_order_by_client_oid_resp.ts | 1 + .../order/model_get_stop_order_by_order_id_resp.ts | 1 + .../spot/order/model_get_stop_orders_list_items.ts | 1 + .../spot/order/model_get_stop_orders_list_resp.ts | 1 + .../order/model_get_symbols_with_open_order_resp.ts | 1 + .../spot/order/model_get_trade_history_items.ts | 1 + .../spot/order/model_get_trade_history_old_items.ts | 1 + .../spot/order/model_get_trade_history_old_resp.ts | 1 + .../spot/order/model_get_trade_history_resp.ts | 1 + .../generate/spot/order/model_modify_order_resp.ts | 1 + .../src/generate/spot/order/model_set_dcp_resp.ts | 1 + .../generate/spot/spotprivate/model_account_event.ts | 5 ++--- .../spot/spotprivate/model_order_v1_event.ts | 5 ++--- .../spot/spotprivate/model_order_v2_event.ts | 5 ++--- .../spot/spotpublic/model_all_tickers_event.ts | 5 ++--- .../generate/spot/spotpublic/model_klines_event.ts | 5 ++--- .../spot/spotpublic/model_market_snapshot_event.ts | 5 ++--- .../spotpublic/model_orderbook_increment_event.ts | 5 ++--- .../spot/spotpublic/model_orderbook_level1_event.ts | 5 ++--- .../spot/spotpublic/model_orderbook_level50_event.ts | 5 ++--- .../spot/spotpublic/model_orderbook_level5_event.ts | 5 ++--- .../spot/spotpublic/model_symbol_snapshot_event.ts | 5 ++--- .../generate/spot/spotpublic/model_ticker_event.ts | 5 ++--- .../generate/spot/spotpublic/model_trade_event.ts | 5 ++--- .../viplending/model_get_account_detail_ltv.ts | 1 + .../viplending/model_get_account_detail_margins.ts | 1 + .../viplending/model_get_account_detail_orders.ts | 1 + .../viplending/model_get_account_detail_resp.ts | 1 + .../viplending/viplending/model_get_accounts_data.ts | 1 + .../viplending/viplending/model_get_accounts_resp.ts | 1 + 380 files changed, 423 insertions(+), 115 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index 205ab961..a1856e64 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -30,6 +30,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-typed}} {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; {{/vars}} + {{#vendorExtensions.x-response-model}} /** * common response @@ -54,10 +55,10 @@ export class {{classname}} implements Serializable<{{classname}}>{ fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, {data : jsonObject}); } + {{/vendorExtensions.x-original-response}} {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-request-model}} - /** * Creates a new instance of the `{{classname}}` class. * The builder pattern allows step-by-step construction of a `{{classname}}` object. @@ -97,6 +98,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, {items: jsonObject}); } + {{/vendorExtensions.x-request-raw-array}} {{/vendorExtensions.x-request-model}} {{^vendorExtensions.x-original-response}} @@ -113,9 +115,9 @@ export class {{classname}} implements Serializable<{{classname}}>{ fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, jsonObject); } + {{/vendorExtensions.x-request-raw-array}} {{/vendorExtensions.x-original-response}} - } {{#hasEnums}} @@ -135,7 +137,6 @@ export namespace {{classname}} { } {{/hasEnums}} - {{#vendorExtensions.x-request-model}} export class {{classname}}Builder { obj :{{classname}} = new {{classname}}() @@ -155,6 +156,5 @@ export class {{classname}}Builder { } {{/vendorExtensions.x-request-model}} - {{/model}} {{/models}} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index c6497012..7e3cb5fc 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -26,6 +26,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-use-base-name}} {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; {{/vars}} + {{#vendorExtensions.x-response-model}} /** * common response @@ -36,9 +37,9 @@ export class {{classname}} implements Serializable<{{classname}}>{ setCommonResponse(response: WsMessage): void { this.commonResponse = response; } + {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { const jsonObject = JSON.parse(input) return plainToInstance( {{classname}}, {data : jsonObject}); @@ -51,9 +52,9 @@ export class {{classname}} implements Serializable<{{classname}}>{ fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, {data : jsonObject}); } + {{/vendorExtensions.x-original-response}} {{^vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { const jsonObject = JSON.parse(input) return plainToInstance( {{classname}}, jsonObject); @@ -66,6 +67,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ fromObject(jsonObject: Object): {{classname}} { return plainToInstance( {{classname}}, jsonObject); } + {{/vendorExtensions.x-original-response}} } @@ -90,9 +92,7 @@ export namespace {{classname}} { export type {{classname}}Callback = (topic: string, subject: string, data: {{classname}}) => void; export class {{classname}}CallbackWrapper implements WebSocketMessageCallback { - callback: {{classname}}Callback; - - constructor(callback: {{classname}}Callback) { + constructor(private callback: {{classname}}Callback) { this.callback = callback; } @@ -104,4 +104,4 @@ export class {{classname}}CallbackWrapper implements WebSocketMessageCallback { } {{/vendorExtensions.x-response-model}} {{/model}} -{{/models}} +{{/models}} \ No newline at end of file diff --git a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts index 30abaec0..e808e307 100644 --- a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts @@ -53,6 +53,7 @@ export class GetAccountInfoResp implements Response GetCrossMarginAccountAccounts) accounts?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts index fc7d700c..c82ccc61 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts @@ -41,6 +41,7 @@ export class GetFuturesAccountResp implements Response GetIsolatedMarginAccountAssetsQuoteAsset) quoteAsset?: GetIsolatedMarginAccountAssetsQuoteAsset; + fromJson(input: string): GetIsolatedMarginAccountAssets { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountAssets, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts index bd124427..e5772397 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts @@ -38,6 +38,7 @@ export class GetIsolatedMarginAccountAssetsBaseAsset * The user\'s remaining maximum loan amount */ maxBorrowSize?: string; + fromJson(input: string): GetIsolatedMarginAccountAssetsBaseAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountAssetsBaseAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts index b7914eb8..eea675c1 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts @@ -38,6 +38,7 @@ export class GetIsolatedMarginAccountAssetsQuoteAsset * The user\'s remaining maximum loan amount */ maxBorrowSize?: string; + fromJson(input: string): GetIsolatedMarginAccountAssetsQuoteAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountAssetsQuoteAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts index 633da7e0..93fec048 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts @@ -34,6 +34,7 @@ export class GetIsolatedMarginAccountDetailV1BaseAsset * */ borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountDetailV1BaseAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountDetailV1BaseAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts index 218aadcd..32360058 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts @@ -34,6 +34,7 @@ export class GetIsolatedMarginAccountDetailV1QuoteAsset * */ borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountDetailV1QuoteAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountDetailV1QuoteAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts index 0183fc5f..e43989df 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts @@ -31,6 +31,7 @@ export class GetIsolatedMarginAccountDetailV1Resp */ @Type(() => GetIsolatedMarginAccountDetailV1QuoteAsset) quoteAsset?: GetIsolatedMarginAccountDetailV1QuoteAsset; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts index de1bbc56..8b813726 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts @@ -30,6 +30,7 @@ export class GetIsolatedMarginAccountListV1Assets */ @Type(() => GetIsolatedMarginAccountListV1AssetsQuoteAsset) quoteAsset?: GetIsolatedMarginAccountListV1AssetsQuoteAsset; + fromJson(input: string): GetIsolatedMarginAccountListV1Assets { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountListV1Assets, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts index 45928686..6251c734 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts @@ -34,6 +34,7 @@ export class GetIsolatedMarginAccountListV1AssetsBaseAsset * */ borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountListV1AssetsBaseAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountListV1AssetsBaseAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts index 2294cc98..eae6889f 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts @@ -34,6 +34,7 @@ export class GetIsolatedMarginAccountListV1AssetsQuoteAsset * */ borrowableAmount?: string; + fromJson(input: string): GetIsolatedMarginAccountListV1AssetsQuoteAsset { const jsonObject = JSON.parse(input); return plainToInstance(GetIsolatedMarginAccountListV1AssetsQuoteAsset, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts index c57e325b..5e21a96e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts @@ -21,6 +21,7 @@ export class GetIsolatedMarginAccountListV1Resp */ @Type(() => GetIsolatedMarginAccountListV1Assets) assets?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts index 9e6444d7..1d34904b 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_resp.ts @@ -25,6 +25,7 @@ export class GetIsolatedMarginAccountResp */ @Type(() => GetIsolatedMarginAccountAssets) assets?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts index 562fc00b..4d8fd427 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts @@ -30,6 +30,7 @@ export class GetMarginAccountDetailAccounts * Available size to borrow */ maxBorrowSize?: string; + fromJson(input: string): GetMarginAccountDetailAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetMarginAccountDetailAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts index 68896e22..f694db43 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts @@ -17,6 +17,7 @@ export class GetMarginAccountDetailResp */ @Type(() => GetMarginAccountDetailAccounts) accounts?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts index ddc2e58b..17f24560 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts @@ -48,6 +48,7 @@ export class GetMarginHFLedgerData implements Serializable GetMarginHFLedgerData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts index 16d50b1e..b0e06153 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts @@ -21,6 +21,7 @@ export class GetSpotAccountDetailResp implements Response GetSpotAccountListData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts index 86fec351..f1bf544c 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts @@ -9,6 +9,7 @@ export class GetSpotAccountTypeResp implements Response { * Core transaction parameter */ context?: string; + fromJson(input: string): GetSpotHFLedgerData { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotHFLedgerData, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts index e2a84b7b..e3f600ee 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts @@ -11,6 +11,7 @@ export class GetSpotHFLedgerResp implements Response GetSpotHFLedgerData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts index 0e4a2865..bdd918a2 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts @@ -44,6 +44,7 @@ export class GetSpotLedgerItems implements Serializable { * Business related information such as order ID, serial No., etc. */ context?: string; + fromJson(input: string): GetSpotLedgerItems { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotLedgerItems, jsonObject); diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts index 828d4328..e1d0e783 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts @@ -27,6 +27,7 @@ export class GetSpotLedgerResp implements Response GetSpotLedgerItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts index 6047a386..d33c3d0d 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts @@ -29,6 +29,7 @@ export class AddDepositAddressV1Resp implements Response GetDepositAddressV2Data) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts index 0525c6b3..b4acc504 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts @@ -36,6 +36,7 @@ export class GetDepositAddressV3Data implements Serializable GetDepositAddressV3Data) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts index 106fc9f7..094cf3fc 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts @@ -56,6 +56,7 @@ export class GetDepositHistoryItems implements Serializable GetDepositHistoryOldItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts index df4ac8dc..bd476878 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts @@ -27,6 +27,7 @@ export class GetDepositHistoryResp implements Response GetDepositHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts index 96f1a199..fbca3bd8 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts @@ -13,6 +13,7 @@ export class GetBasicFeeResp implements Response * Base maker fee rate */ makerFeeRate?: string; + /** * common response */ diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts index 5ca66b76..f26ff86d 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts @@ -17,6 +17,7 @@ export class GetFuturesActualFeeResp implements Response * Actual maker fee rate of the symbol */ makerFeeRate?: string; + fromJson(input: string): GetSpotActualFeeData { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotActualFeeData, jsonObject); diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts index 626af49a..68826b5d 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts @@ -11,6 +11,7 @@ export class GetSpotActualFeeResp implements Response GetSpotActualFeeData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts index 21a3de1e..58eeab7b 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts @@ -41,6 +41,7 @@ export class AddSubAccountApiResp implements Response GetFuturesSubAccountListV2Accounts) accounts?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts index c0a8a0c8..ce67cc85 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts @@ -38,6 +38,7 @@ export class GetFuturesSubAccountListV2Summary * */ currency?: string; + fromJson(input: string): GetFuturesSubAccountListV2Summary { const jsonObject = JSON.parse(input); return plainToInstance(GetFuturesSubAccountListV2Summary, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts index cacea672..3cde49a1 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountDetailMainAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountDetailMainAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountDetailMainAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts index 3254e7be..4b7053c6 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountDetailMarginAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountDetailMarginAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountDetailMarginAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts index cd79dd96..db58594a 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts @@ -37,6 +37,7 @@ export class GetSpotSubAccountDetailResp * This param is deprecated and only valid for some old users */ tradeHFAccounts?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts index 95e88cd6..24f4c5a1 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountDetailTradeAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountDetailTradeAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountDetailTradeAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts index 705e40ab..205adb4e 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts @@ -34,6 +34,7 @@ export class GetSpotSubAccountListV1Data implements Serializable; + fromJson(input: string): GetSpotSubAccountListV1Data { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV1Data, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts index 09f03b04..87f8b663 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV1DataMainAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataMainAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV1DataMainAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts index 63377668..65db2ea6 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV1DataMarginAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataMarginAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV1DataMarginAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts index b02416bf..383a2b37 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV1DataTradeAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV1DataTradeAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV1DataTradeAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts index 4f2b63cd..6dbb3af2 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts @@ -13,6 +13,7 @@ export class GetSpotSubAccountListV1Resp */ @Type(() => GetSpotSubAccountListV1Data) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts index 13e7e788..e43a3c75 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts @@ -34,6 +34,7 @@ export class GetSpotSubAccountListV2Items implements Serializable; + fromJson(input: string): GetSpotSubAccountListV2Items { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV2Items, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts index 0d5c148a..d08fe610 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV2ItemsMainAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsMainAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV2ItemsMainAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts index df1089c5..2fc857b1 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV2ItemsMarginAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsMarginAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV2ItemsMarginAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts index cc5cc2ed..207a3d74 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts @@ -38,6 +38,7 @@ export class GetSpotSubAccountListV2ItemsTradeAccounts * */ tag?: string; + fromJson(input: string): GetSpotSubAccountListV2ItemsTradeAccounts { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountListV2ItemsTradeAccounts, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts index 03bb0901..a3762da3 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts @@ -29,6 +29,7 @@ export class GetSpotSubAccountListV2Resp */ @Type(() => GetSpotSubAccountListV2Items) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts index e9ae8e97..0a551455 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts @@ -30,6 +30,7 @@ export class GetSpotSubAccountsSummaryV1Data * Sub-account Permission */ access?: string; + fromJson(input: string): GetSpotSubAccountsSummaryV1Data { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountsSummaryV1Data, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts index 3bc06283..170eefb1 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts @@ -13,6 +13,7 @@ export class GetSpotSubAccountsSummaryV1Resp */ @Type(() => GetSpotSubAccountsSummaryV1Data) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts index 9a8734da..5be764b3 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts @@ -50,6 +50,7 @@ export class GetSpotSubAccountsSummaryV2Items * */ hostedStatus?: string; + fromJson(input: string): GetSpotSubAccountsSummaryV2Items { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotSubAccountsSummaryV2Items, jsonObject); diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts index cd81bcb6..e4b395fc 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts @@ -29,6 +29,7 @@ export class GetSpotSubAccountsSummaryV2Resp */ @Type(() => GetSpotSubAccountsSummaryV2Items) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts index f56b6969..b5206854 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts @@ -40,6 +40,7 @@ export class GetSubAccountApiListData implements Serializable GetSubAccountApiListData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts index db7967a2..73a12611 100644 --- a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts @@ -21,6 +21,7 @@ export class ModifySubAccountApiResp implements Response GetFuturesAccountTransferOutLedgerItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts index e91ad599..dd977e47 100644 --- a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts @@ -25,6 +25,7 @@ export class GetTransferQuotasResp implements Response GetWithdrawalHistoryOldItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts index 97ef9489..20398475 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts @@ -27,6 +27,7 @@ export class GetWithdrawalHistoryResp implements Response GetWithdrawalHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts index 8ffbe06b..4b5577d2 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts @@ -69,6 +69,7 @@ export class GetWithdrawalQuotasResp implements Response { * Current LTV */ currentLtv?: string; + fromJson(input: string): GetAccountLtv { const jsonObject = JSON.parse(input); return plainToInstance(GetAccountLtv, jsonObject); diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts index 9b7546c6..f649d96e 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts @@ -16,6 +16,7 @@ export class GetAccountMargins implements Serializable { * Margin Coefficient return real time margin discount rate to USDT */ marginFactor?: string; + fromJson(input: string): GetAccountMargins { const jsonObject = JSON.parse(input); return plainToInstance(GetAccountMargins, jsonObject); diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts index 9ffd7b30..e551a87f 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts @@ -20,6 +20,7 @@ export class GetAccountOrders implements Serializable { * Interest to Be Repaid */ interest?: string; + fromJson(input: string): GetAccountOrders { const jsonObject = JSON.parse(input); return plainToInstance(GetAccountOrders, jsonObject); diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts index 0bb86062..5ad3ab43 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts @@ -35,6 +35,7 @@ export class GetAccountResp implements Response { */ @Type(() => GetAccountMargins) margins?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts index 15bda1f7..3e68723e 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts @@ -9,6 +9,7 @@ export class GetRebaseResp implements Response { * Rebate order file (link is valid for 1 day) */ url?: string; + /** * common response */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts index 1e518b1b..1e2e5c3d 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts @@ -37,6 +37,7 @@ export class AddSubAccountApiResp implements Response { * Update time of the database record */ updatedAt?: number; + fromJson(input: string): GetDepositListData { const jsonObject = JSON.parse(input); return plainToInstance(GetDepositListData, jsonObject); diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts index 938d412e..9261deb6 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts @@ -11,6 +11,7 @@ export class GetDepositListResp implements Response GetDepositListData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts index 15bda1f7..3e68723e 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts @@ -9,6 +9,7 @@ export class GetRebaseResp implements Response { * Rebate order file (link is valid for 1 day) */ url?: string; + /** * common response */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts index 92bca2f9..9cea5ef2 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts @@ -32,6 +32,7 @@ export class GetSubAccountAPIData implements Serializable * Creation time, unix timestamp (milliseconds) */ createdAt?: number; + fromJson(input: string): GetSubAccountAPIData { const jsonObject = JSON.parse(input); return plainToInstance(GetSubAccountAPIData, jsonObject); diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts index 5d5a1bd7..87a9d782 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts @@ -11,6 +11,7 @@ export class GetSubAccountAPIResp implements Response GetSubAccountAPIData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts index 62a368f6..a49df64b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts @@ -20,6 +20,7 @@ export class GetSubAccountItems implements Serializable { * Sub-account VIP level */ level?: number; + fromJson(input: string): GetSubAccountItems { const jsonObject = JSON.parse(input); return plainToInstance(GetSubAccountItems, jsonObject); diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts index 8b88679a..356468a8 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts @@ -27,6 +27,7 @@ export class GetSubAccountResp implements Response GetSubAccountItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts index 069f073c..554dd731 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts @@ -53,6 +53,7 @@ export class GetTransferHistoryResp implements Response { * */ orderId?: string; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts index f6b6f682..645ad0df 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts @@ -68,6 +68,7 @@ export class GetAccountHoldingItems implements Serializable GetETHStakingProductsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts index d4dba527..8e23206a 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts @@ -96,6 +96,7 @@ export class GetKcsStakingProductsData implements Serializable GetKcsStakingProductsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts index a79d0a0e..44f76831 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts @@ -96,6 +96,7 @@ export class GetPromotionProductsData implements Serializable GetPromotionProductsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts index 401de697..f580be89 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts @@ -33,6 +33,7 @@ export class GetRedeemPreviewResp implements Response GetSavingsProductsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts index 656ab8d0..e22a145c 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts @@ -96,6 +96,7 @@ export class GetStakingProductsData implements Serializable GetStakingProductsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts index 900c23c2..29dddfbb 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts @@ -13,6 +13,7 @@ export class PurchaseResp implements Response { * Subscription order ID */ orderTxId?: string; + /** * common response */ diff --git a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts index fb19a941..788a8aec 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts @@ -21,6 +21,7 @@ export class RedeemResp implements Response { * Redemption amount */ amount?: string; + /** * common response */ diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts index c7775431..b4b33d29 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts @@ -35,6 +35,7 @@ export class GetCurrentFundingRateResp * Minimum Funding Rate */ fundingRateFloor?: number; + /** * common response */ diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts index 93db81bb..5362e0e5 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts @@ -50,6 +50,7 @@ export class GetPrivateFundingHistoryDataList * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ marginMode?: GetPrivateFundingHistoryDataList.MarginModeEnum; + fromJson(input: string): GetPrivateFundingHistoryDataList { const jsonObject = JSON.parse(input); return plainToInstance(GetPrivateFundingHistoryDataList, jsonObject); diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts index 65a32cb6..65dacdc4 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts @@ -17,6 +17,7 @@ export class GetPrivateFundingHistoryResp * Whether there are more pages */ hasMore?: boolean; + /** * common response */ diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts index 81100516..591ed0f7 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts @@ -16,6 +16,7 @@ export class GetPublicFundingHistoryData implements Serializable GetPublicFundingHistoryData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index 595d6834..bbf8f5df 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -94,6 +94,7 @@ export class AllOrderEvent implements Response { * normal order or liquid order */ tradeType?: AllOrderEvent.TradeTypeEnum; + /** * common response */ @@ -220,9 +221,7 @@ export namespace AllOrderEvent { export type AllOrderEventCallback = (topic: string, subject: string, data: AllOrderEvent) => void; export class AllOrderEventCallbackWrapper implements WebSocketMessageCallback { - callback: AllOrderEventCallback; - - constructor(callback: AllOrderEventCallback) { + constructor(private callback: AllOrderEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index af45c589..cad60b8a 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -190,6 +190,7 @@ export class AllPositionEvent implements Response { * Adjustment isolated margin risk limit level failure reason */ msg?: string; + /** * common response */ @@ -240,9 +241,7 @@ export type AllPositionEventCallback = ( ) => void; export class AllPositionEventCallbackWrapper implements WebSocketMessageCallback { - callback: AllPositionEventCallback; - - constructor(callback: AllPositionEventCallback) { + constructor(private callback: AllPositionEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index c065a230..dabe1c32 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -66,6 +66,7 @@ export class BalanceEvent implements Response { * Last modified time */ timestamp?: string; + /** * common response */ @@ -93,9 +94,7 @@ export class BalanceEvent implements Response { export type BalanceEventCallback = (topic: string, subject: string, data: BalanceEvent) => void; export class BalanceEventCallbackWrapper implements WebSocketMessageCallback { - callback: BalanceEventCallback; - - constructor(callback: BalanceEventCallback) { + constructor(private callback: BalanceEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index 2c52bd60..19b6797f 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -11,6 +11,7 @@ export class CrossLeverageEvent implements Response void; export class CrossLeverageEventCallbackWrapper implements WebSocketMessageCallback { - callback: CrossLeverageEventCallback; - - constructor(callback: CrossLeverageEventCallback) { + constructor(private callback: CrossLeverageEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index b763b088..1b921375 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -10,6 +10,7 @@ export class MarginModeEvent implements Response { * The SYMBOL is the key with value \"CROSS\" or \"ISOLATED\" */ SYMBOL?: string; + /** * common response */ @@ -41,9 +42,7 @@ export type MarginModeEventCallback = ( ) => void; export class MarginModeEventCallbackWrapper implements WebSocketMessageCallback { - callback: MarginModeEventCallback; - - constructor(callback: MarginModeEventCallback) { + constructor(private callback: MarginModeEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index 8e27eb44..f0059d1a 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -94,6 +94,7 @@ export class OrderEvent implements Response { * normal order or liquid order */ tradeType?: OrderEvent.TradeTypeEnum; + /** * common response */ @@ -220,9 +221,7 @@ export namespace OrderEvent { export type OrderEventCallback = (topic: string, subject: string, data: OrderEvent) => void; export class OrderEventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderEventCallback; - - constructor(callback: OrderEventCallback) { + constructor(private callback: OrderEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index beddedd6..f7f3010e 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -190,6 +190,7 @@ export class PositionEvent implements Response { * Adjustment isolated margin risk limit level failure reason */ msg?: string; + /** * common response */ @@ -236,9 +237,7 @@ export namespace PositionEvent { export type PositionEventCallback = (topic: string, subject: string, data: PositionEvent) => void; export class PositionEventCallbackWrapper implements WebSocketMessageCallback { - callback: PositionEventCallback; - - constructor(callback: PositionEventCallback) { + constructor(private callback: PositionEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index 1ca624d3..6c18a4d7 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -58,6 +58,7 @@ export class StopOrdersEvent implements Response { * Order Type */ type?: StopOrdersEvent.TypeEnum; + /** * common response */ @@ -142,9 +143,7 @@ export type StopOrdersEventCallback = ( ) => void; export class StopOrdersEventCallbackWrapper implements WebSocketMessageCallback { - callback: StopOrdersEventCallback; - - constructor(callback: StopOrdersEventCallback) { + constructor(private callback: StopOrdersEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index 8d79b49b..99fe2669 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -22,6 +22,7 @@ export class AnnouncementEvent implements Response * */ timestamp?: number; + /** * common response */ @@ -53,9 +54,7 @@ export type AnnouncementEventCallback = ( ) => void; export class AnnouncementEventCallbackWrapper implements WebSocketMessageCallback { - callback: AnnouncementEventCallback; - - constructor(callback: AnnouncementEventCallback) { + constructor(private callback: AnnouncementEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index f14f5a4d..cf2ddde3 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -42,6 +42,7 @@ export class ExecutionEvent implements Response { * */ ts?: number; + /** * common response */ @@ -69,9 +70,7 @@ export class ExecutionEvent implements Response { export type ExecutionEventCallback = (topic: string, subject: string, data: ExecutionEvent) => void; export class ExecutionEventCallbackWrapper implements WebSocketMessageCallback { - callback: ExecutionEventCallback; - - constructor(callback: ExecutionEventCallback) { + constructor(private callback: ExecutionEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index 6d2a3a1c..d1a945da 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -26,6 +26,7 @@ export class InstrumentEvent implements Response { * */ indexPrice?: number; + /** * common response */ @@ -57,9 +58,7 @@ export type InstrumentEventCallback = ( ) => void; export class InstrumentEventCallbackWrapper implements WebSocketMessageCallback { - callback: InstrumentEventCallback; - - constructor(callback: InstrumentEventCallback) { + constructor(private callback: InstrumentEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index fc21bbe0..39023f04 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -18,6 +18,7 @@ export class KlinesEvent implements Response { * timestamp(ms) */ time?: number; + /** * common response */ @@ -45,9 +46,7 @@ export class KlinesEvent implements Response { export type KlinesEventCallback = (topic: string, subject: string, data: KlinesEvent) => void; export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { - callback: KlinesEventCallback; - - constructor(callback: KlinesEventCallback) { + constructor(private callback: KlinesEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index 030f7caf..a827b589 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -18,6 +18,7 @@ export class OrderbookIncrementEvent implements Response void; export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookIncrementEventCallback; - - constructor(callback: OrderbookIncrementEventCallback) { + constructor(private callback: OrderbookIncrementEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts index 19e8b2f0..68215c13 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -26,6 +26,7 @@ export class OrderbookLevel50Event implements Response>; + /** * common response */ @@ -57,9 +58,7 @@ export type OrderbookLevel50EventCallback = ( ) => void; export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookLevel50EventCallback; - - constructor(callback: OrderbookLevel50EventCallback) { + constructor(private callback: OrderbookLevel50EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts index d1b1f244..7475b8df 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -26,6 +26,7 @@ export class OrderbookLevel5Event implements Response>; + /** * common response */ @@ -57,9 +58,7 @@ export type OrderbookLevel5EventCallback = ( ) => void; export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookLevel5EventCallback; - - constructor(callback: OrderbookLevel5EventCallback) { + constructor(private callback: OrderbookLevel5EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts index a1d5117b..c4e37523 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -46,6 +46,7 @@ export class SymbolSnapshotEvent implements Response void; export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallback { - callback: SymbolSnapshotEventCallback; - - constructor(callback: SymbolSnapshotEventCallback) { + constructor(private callback: SymbolSnapshotEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts index 84700b93..e5e9bc73 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -50,6 +50,7 @@ export class TickerV1Event implements Response { * */ ts?: number; + /** * common response */ @@ -77,9 +78,7 @@ export class TickerV1Event implements Response { export type TickerV1EventCallback = (topic: string, subject: string, data: TickerV1Event) => void; export class TickerV1EventCallbackWrapper implements WebSocketMessageCallback { - callback: TickerV1EventCallback; - - constructor(callback: TickerV1EventCallback) { + constructor(private callback: TickerV1EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index 6aec3b7a..4db2ed61 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -34,6 +34,7 @@ export class TickerV2Event implements Response { * */ ts?: number; + /** * common response */ @@ -61,9 +62,7 @@ export class TickerV2Event implements Response { export type TickerV2EventCallback = (topic: string, subject: string, data: TickerV2Event) => void; export class TickerV2EventCallbackWrapper implements WebSocketMessageCallback { - callback: TickerV2EventCallback; - - constructor(callback: TickerV2EventCallback) { + constructor(private callback: TickerV2EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts index 55e8dd25..91770044 100644 --- a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts @@ -9,6 +9,7 @@ export class Get24hrStatsResp implements Response { * Whether support Cross Margin */ supportCross?: boolean; + fromJson(input: string): GetAllSymbolsData { const jsonObject = JSON.parse(input); return plainToInstance(GetAllSymbolsData, jsonObject); diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts index b8d25262..10e4f4b9 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts @@ -11,6 +11,7 @@ export class GetAllSymbolsResp implements Response GetAllSymbolsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts index 113d09d6..877dfed3 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts @@ -48,6 +48,7 @@ export class GetAllTickersData implements Serializable { * Filled time(nanosecond) */ ts?: number; + fromJson(input: string): GetAllTickersData { const jsonObject = JSON.parse(input); return plainToInstance(GetAllTickersData, jsonObject); diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts index c0a81276..7f94ee57 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts @@ -11,6 +11,7 @@ export class GetAllTickersResp implements Response GetAllTickersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts index 91872bca..f1649104 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts @@ -25,6 +25,7 @@ export class GetFullOrderBookResp implements Response { * */ data?: Array>; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts index b2ff6072..dc8071a7 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts @@ -25,6 +25,7 @@ export class GetMarkPriceResp implements Response GetPrivateTokenInstanceServers) instanceServers?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts index fbbfb66e..3e21b605 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts @@ -24,6 +24,7 @@ export class GetPublicTokenInstanceServers implements Serializable GetPublicTokenInstanceServers) instanceServers?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts index 5f8d3cd2..a609a161 100644 --- a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts @@ -9,6 +9,7 @@ export class GetServerTimeResp implements Response GetSpotIndexPriceDataListDecomposionList) decomposionList?: Array; + fromJson(input: string): GetSpotIndexPriceDataList { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotIndexPriceDataList, jsonObject); diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts index 0dd85367..8dae5c7a 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts @@ -18,6 +18,7 @@ export class GetSpotIndexPriceDataListDecomposionList * Weight */ weight?: number; + fromJson(input: string): GetSpotIndexPriceDataListDecomposionList { const jsonObject = JSON.parse(input); return plainToInstance(GetSpotIndexPriceDataListDecomposionList, jsonObject); diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts index 83379784..75c4b05c 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts @@ -15,6 +15,7 @@ export class GetSpotIndexPriceResp implements Response { * Whether support Cross Margin */ supportCross?: boolean; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts index 7f5faf91..8bf079f3 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts @@ -49,6 +49,7 @@ export class GetTickerResp implements Response { * Filled time(nanosecond) */ ts?: number; + /** * common response */ diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts index 352f2cbb..70528653 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts @@ -40,6 +40,7 @@ export class GetTradeHistoryData implements Serializable { * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. */ side?: GetTradeHistoryData.SideEnum; + fromJson(input: string): GetTradeHistoryData { const jsonObject = JSON.parse(input); return plainToInstance(GetTradeHistoryData, jsonObject); diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts index 848b3051..be1b821e 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts @@ -11,6 +11,7 @@ export class GetTradeHistoryResp implements Response GetTradeHistoryData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_add_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_resp.ts index 59355ba7..b221e43d 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_resp.ts @@ -13,6 +13,7 @@ export class AddOrderResp implements Response { * The user self-defined order id. */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts index b5954e58..9eae886c 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts @@ -13,6 +13,7 @@ export class AddOrderTestResp implements Response { * */ msg?: string; + fromJson(input: string): BatchAddOrdersData { const jsonObject = JSON.parse(input); return plainToInstance(BatchAddOrdersData, jsonObject); diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts index 7feae7dc..a9a3d8e5 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts @@ -11,6 +11,7 @@ export class BatchAddOrdersResp implements Response BatchAddOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts index 73f46c06..02bf708d 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts @@ -20,6 +20,7 @@ export class BatchCancelOrdersData implements Serializable BatchCancelOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts index 34c685f5..5cac2bef 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts @@ -9,6 +9,7 @@ export class CancelAllOrdersV1Resp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts index 1d6023c5..d636e07e 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts @@ -9,6 +9,7 @@ export class CancelAllOrdersV3Resp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts index 2fdf9d1c..ff785297 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts @@ -9,6 +9,7 @@ export class CancelAllStopOrdersResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts index 701ff2b1..f9efd6f8 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts @@ -11,6 +11,7 @@ export class CancelOrderByClientOidResp * */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts index cdfb190c..a5478a89 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts @@ -9,6 +9,7 @@ export class CancelOrderByIdResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts index 631392cd..22206e93 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts @@ -25,6 +25,7 @@ export class GetOpenOrderValueResp implements Response { * A mark to reduce the position size only */ reduceOnly?: boolean; + fromJson(input: string): GetOrderListItems { const jsonObject = JSON.parse(input); return plainToInstance(GetOrderListItems, jsonObject); diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts index 94306ffd..7b17af71 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts @@ -27,6 +27,7 @@ export class GetOrderListResp implements Response GetOrderListItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts index 46d10cad..dbd1fad9 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts @@ -156,6 +156,7 @@ export class GetRecentClosedOrdersData implements Serializable GetRecentClosedOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts index bc2720e5..e4b4eb91 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts @@ -100,6 +100,7 @@ export class GetRecentTradeHistoryData implements Serializable GetRecentTradeHistoryData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts index a94edb0e..ef89b8f6 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts @@ -156,6 +156,7 @@ export class GetStopOrderListItems implements Serializable GetStopOrderListItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts index 8e626e14..6d0a7cde 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts @@ -100,6 +100,7 @@ export class GetTradeHistoryItems implements Serializable * Time the order created */ createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { const jsonObject = JSON.parse(input); return plainToInstance(GetTradeHistoryItems, jsonObject); diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts index f7f71c90..ca880aee 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts @@ -27,6 +27,7 @@ export class GetTradeHistoryResp implements Response GetTradeHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts index 72eab813..1140ab32 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts @@ -153,6 +153,7 @@ export class AddIsolatedMarginResp implements Response GetIsolatedMarginRiskLimitData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts index 4c823e2e..0ce2f2ec 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts @@ -13,6 +13,7 @@ export class GetMarginModeResp implements Response { * Maintenance margin rate **Only applicable to Isolated Margin** */ maintainMargin?: number; + fromJson(input: string): GetPositionListData { const jsonObject = JSON.parse(input); return plainToInstance(GetPositionListData, jsonObject); diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts index 95a60d3e..dfa77a56 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts @@ -11,6 +11,7 @@ export class GetPositionListResp implements Response GetPositionListData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts index 4ca51143..5f76069a 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts @@ -68,6 +68,7 @@ export class GetPositionsHistoryItems implements Serializable GetPositionsHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts index 6038bbb2..d53a4408 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts @@ -11,6 +11,7 @@ export class ModifyAutoDepositStatusResp * */ data?: boolean; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts index c4489c03..ed84f474 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts @@ -11,6 +11,7 @@ export class ModifyIsolatedMarginRiskLimtResp * To adjust the level will cancel the open order, the response can only indicate whether the submit of the adjustment request is successful or not. */ data?: boolean; + /** * common response */ diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts index ad7417ab..cb4a2b60 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts @@ -13,6 +13,7 @@ export class ModifyMarginLeverageResp implements Response { * Whether to allow automatic purchase: true: on, false: off */ autoPurchaseEnable?: boolean; + fromJson(input: string): GetLoanMarketData { const jsonObject = JSON.parse(input); return plainToInstance(GetLoanMarketData, jsonObject); diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts index f27a81cc..f0c31ead 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts @@ -12,6 +12,7 @@ export class GetLoanMarketInterestRateData implements Serializable GetLoanMarketInterestRateData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts index a8431196..3ac1c372 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts @@ -11,6 +11,7 @@ export class GetLoanMarketResp implements Response GetLoanMarketData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts index 45c4f86a..56e3b58d 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts @@ -36,6 +36,7 @@ export class GetPurchaseOrdersItems implements Serializable GetPurchaseOrdersItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts index b52a2afa..043c4da7 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts @@ -32,6 +32,7 @@ export class GetRedeemOrdersItems implements Serializable * Status: DONE-completed; PENDING-settling */ status?: string; + fromJson(input: string): GetRedeemOrdersItems { const jsonObject = JSON.parse(input); return plainToInstance(GetRedeemOrdersItems, jsonObject); diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts index 5e9f8d62..21afb32f 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts @@ -27,6 +27,7 @@ export class GetRedeemOrdersResp implements Response GetRedeemOrdersItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts index 56611125..5d2d0613 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts @@ -9,6 +9,7 @@ export class ModifyPurchaseResp implements Response { * Purchase order id */ orderNo?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts index 014b8480..ddb5758f 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts @@ -9,6 +9,7 @@ export class RedeemResp implements Response { * Redeem order id */ orderNo?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts index 34f2a69c..4ac95607 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts @@ -13,6 +13,7 @@ export class BorrowResp implements Response { * Actual borrowed amount */ actualSize?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts index 1633b88b..1e8cb5be 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts @@ -32,6 +32,7 @@ export class GetBorrowHistoryItems implements Serializable GetBorrowHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts index 8ff8f829..5561d2d7 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts @@ -20,6 +20,7 @@ export class GetInterestHistoryItems implements Serializable GetInterestHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts index 55f3f384..f1994acc 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts @@ -36,6 +36,7 @@ export class GetRepayHistoryItems implements Serializable * Repayment time */ createdTime?: number; + fromJson(input: string): GetRepayHistoryItems { const jsonObject = JSON.parse(input); return plainToInstance(GetRepayHistoryItems, jsonObject); diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts index 3afc55f3..26de1e19 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts @@ -31,6 +31,7 @@ export class GetRepayHistoryResp implements Response GetRepayHistoryItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts index 433e582b..978bb674 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts @@ -9,6 +9,7 @@ export class ModifyLeverageResp implements Response { * Actual repay amount */ actualSize?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index 1d635c51..b1bb68e8 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -39,6 +39,7 @@ export class CrossMarginPositionEvent implements Response void; export class CrossMarginPositionEventCallbackWrapper implements WebSocketMessageCallback { - callback: CrossMarginPositionEventCallback; - - constructor(callback: CrossMarginPositionEventCallback) { + constructor(private callback: CrossMarginPositionEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index c553b9f9..4cdade00 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -33,6 +33,7 @@ export class IsolatedMarginPositionEvent * */ timestamp?: number; + /** * common response */ @@ -135,9 +136,7 @@ export type IsolatedMarginPositionEventCallback = ( ) => void; export class IsolatedMarginPositionEventCallbackWrapper implements WebSocketMessageCallback { - callback: IsolatedMarginPositionEventCallback; - - constructor(callback: IsolatedMarginPositionEventCallback) { + constructor(private callback: IsolatedMarginPositionEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index 604ae763..c10a1e08 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -22,6 +22,7 @@ export class IndexPriceEvent implements Response { * */ value?: number; + /** * common response */ @@ -53,9 +54,7 @@ export type IndexPriceEventCallback = ( ) => void; export class IndexPriceEventCallbackWrapper implements WebSocketMessageCallback { - callback: IndexPriceEventCallback; - - constructor(callback: IndexPriceEventCallback) { + constructor(private callback: IndexPriceEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index 61cfaeef..8296e675 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -22,6 +22,7 @@ export class MarkPriceEvent implements Response { * */ value?: number; + /** * common response */ @@ -49,9 +50,7 @@ export class MarkPriceEvent implements Response { export type MarkPriceEventCallback = (topic: string, subject: string, data: MarkPriceEvent) => void; export class MarkPriceEventCallbackWrapper implements WebSocketMessageCallback { - callback: MarkPriceEventCallback; - - constructor(callback: MarkPriceEventCallback) { + constructor(private callback: MarkPriceEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts index 1007b7a7..385b0f8a 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts @@ -68,6 +68,7 @@ export class GetCrossMarginSymbolsItems implements Serializable GetCrossMarginSymbolsItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts index 1f4b3721..5609697f 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts @@ -28,6 +28,7 @@ export class GetETFInfoData implements Serializable { * Basket information */ basket?: string; + fromJson(input: string): GetETFInfoData { const jsonObject = JSON.parse(input); return plainToInstance(GetETFInfoData, jsonObject); diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts index 069bf92e..e619e9b2 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts @@ -11,6 +11,7 @@ export class GetETFInfoResp implements Response { */ @Type(() => GetETFInfoData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts index 2e06ed8f..f8e6969e 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts @@ -60,6 +60,7 @@ export class GetIsolatedMarginSymbolsData implements Serializable GetIsolatedMarginSymbolsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts index c3709f0f..e9fbde9a 100644 --- a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts @@ -21,6 +21,7 @@ export class GetMarginConfigResp implements Response * Mark price */ value?: number; + fromJson(input: string): GetMarkPriceListData { const jsonObject = JSON.parse(input); return plainToInstance(GetMarkPriceListData, jsonObject); diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts index ce048c0c..06f258b8 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts @@ -11,6 +11,7 @@ export class GetMarkPriceListResp implements Response GetMarkPriceListData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_resp.ts index 6b018c7c..12eb4916 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_resp.ts @@ -21,6 +21,7 @@ export class AddOrderResp implements Response { * The user self-defined order id. */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts index 26675704..bd4372be 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts @@ -21,6 +21,7 @@ export class AddOrderTestResp implements Response { * This return value is invalid */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts index dc0a5cc4..5a30007d 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts @@ -11,6 +11,7 @@ export class CancelAllOrdersBySymbolResp * */ data?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts index 7a0bc0f5..c60feabd 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts @@ -11,6 +11,7 @@ export class CancelOrderByClientOidResp * Client Order Id,unique identifier created by the user */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts index 0bf7fe6a..2f00ebd7 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts @@ -9,6 +9,7 @@ export class CancelOrderByOrderIdResp implements Response * Order status: true-The status of the order isactive; false-The status of the order is done */ active?: boolean; + fromJson(input: string): GetClosedOrdersItems { const jsonObject = JSON.parse(input); return plainToInstance(GetClosedOrdersItems, jsonObject); diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts index 5f498d89..dce47df4 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts @@ -15,6 +15,7 @@ export class GetClosedOrdersResp implements Response GetClosedOrdersItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts index edfbf48b..d1364d5f 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts @@ -152,6 +152,7 @@ export class GetOpenOrdersData implements Serializable { * Order status: true-The status of the order isactive; false-The status of the order is done */ active?: boolean; + fromJson(input: string): GetOpenOrdersData { const jsonObject = JSON.parse(input); return plainToInstance(GetOpenOrdersData, jsonObject); diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts index a2fa339a..fda90ac5 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts @@ -11,6 +11,7 @@ export class GetOpenOrdersResp implements Response GetOpenOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts index 7d28b357..d0e18bf1 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts @@ -153,6 +153,7 @@ export class GetOrderByClientOidResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts index c0a111e1..ef06cab8 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts @@ -84,6 +84,7 @@ export class GetTradeHistoryItems implements Serializable * */ createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { const jsonObject = JSON.parse(input); return plainToInstance(GetTradeHistoryItems, jsonObject); diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts index 480c788d..f970c961 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts @@ -15,6 +15,7 @@ export class GetTradeHistoryResp implements Response GetMarginRiskLimitData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts index fcd41bb1..411fa7e8 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts @@ -69,6 +69,7 @@ export class Get24hrStatsResp implements Response */ @Type(() => GetAllCurrenciesDataChains) chains?: Array; + fromJson(input: string): GetAllCurrenciesData { const jsonObject = JSON.parse(input); return plainToInstance(GetAllCurrenciesData, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts index 715f11e0..0b36fa7b 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts @@ -76,6 +76,7 @@ export class GetAllCurrenciesDataChains implements Serializable GetAllCurrenciesData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts index 79b7ebf3..18776c5b 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts @@ -88,6 +88,7 @@ export class GetAllSymbolsData implements Serializable { * Whether it is an [Special Treatment](https://www.kucoin.com/legal/special-treatment) symbol */ st?: boolean; + fromJson(input: string): GetAllSymbolsData { const jsonObject = JSON.parse(input); return plainToInstance(GetAllSymbolsData, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts index 92ac9639..ebcad026 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts @@ -11,6 +11,7 @@ export class GetAllSymbolsResp implements Response GetAllSymbolsData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts index dd3f023a..9c9f43c1 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts @@ -15,6 +15,7 @@ export class GetAllTickersResp implements Response GetAllTickersTicker) ticker?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts index b24c753c..8e912e00 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts @@ -76,6 +76,7 @@ export class GetAllTickersTicker implements Serializable { * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ makerCoefficient?: GetAllTickersTicker.MakerCoefficientEnum; + fromJson(input: string): GetAllTickersTicker { const jsonObject = JSON.parse(input); return plainToInstance(GetAllTickersTicker, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts index 40f945d3..47feb856 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts @@ -32,6 +32,7 @@ export class GetAnnouncementsItems implements Serializable { * chain id of currency */ chainId?: string; + fromJson(input: string): GetCurrencyChains { const jsonObject = JSON.parse(input); return plainToInstance(GetCurrencyChains, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts index 707e841a..025defd7 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts @@ -43,6 +43,7 @@ export class GetCurrencyResp implements Response */ @Type(() => GetCurrencyChains) chains?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts index 0e73700e..635acdf7 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts @@ -3591,6 +3591,7 @@ export class GetFiatPriceResp implements Response>; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts index 8735e287..546b19e1 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts @@ -9,6 +9,7 @@ export class GetKlinesResp implements Response { * */ data?: Array>; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts index 0d6d229b..0292fb6f 100644 --- a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts @@ -9,6 +9,7 @@ export class GetMarketListResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts index a4c111f7..39226a19 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts @@ -21,6 +21,7 @@ export class GetPartOrderBookResp implements Response>; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts index 16ef0aa4..0fe801bb 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts @@ -26,6 +26,7 @@ export class GetPrivateTokenInstanceServers * Heartbeat timeout(millisecond) */ pingTimeout?: number; + fromJson(input: string): GetPrivateTokenInstanceServers { const jsonObject = JSON.parse(input); return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts index 94e29ad6..c63fb8eb 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts @@ -15,6 +15,7 @@ export class GetPrivateTokenResp implements Response GetPrivateTokenInstanceServers) instanceServers?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts index fbbfb66e..3e21b605 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts @@ -24,6 +24,7 @@ export class GetPublicTokenInstanceServers implements Serializable GetPublicTokenInstanceServers) instanceServers?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts index 5f8d3cd2..a609a161 100644 --- a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts @@ -9,6 +9,7 @@ export class GetServerTimeResp implements Response { * */ st?: boolean; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts index c390f06c..ff818da2 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts @@ -37,6 +37,7 @@ export class GetTickerResp implements Response { * Best ask size */ bestAskSize?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts index fea277d9..d49b4904 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts @@ -24,6 +24,7 @@ export class GetTradeHistoryData implements Serializable { * Filled timestamp(nanosecond) */ time?: number; + fromJson(input: string): GetTradeHistoryData { const jsonObject = JSON.parse(input); return plainToInstance(GetTradeHistoryData, jsonObject); diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts index 848b3051..be1b821e 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts @@ -11,6 +11,7 @@ export class GetTradeHistoryResp implements Response GetTradeHistoryData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts index 726d97e8..64679f8b 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts @@ -9,6 +9,7 @@ export class AddOcoOrderResp implements Response * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ orderId?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts index f329f769..d9fbb7de 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts @@ -9,6 +9,7 @@ export class AddOrderOldResp implements Response * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ orderId?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_resp.ts index 59355ba7..b221e43d 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_resp.ts @@ -13,6 +13,7 @@ export class AddOrderResp implements Response { * The user self-defined order id. */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts index 0a0e1793..424ac2df 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts @@ -41,6 +41,7 @@ export class AddOrderSyncResp implements Response { * error message */ failMsg?: string; + fromJson(input: string): BatchAddOrdersData { const jsonObject = JSON.parse(input); return plainToInstance(BatchAddOrdersData, jsonObject); diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts index 5c840879..4a4b63a6 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts @@ -88,6 +88,7 @@ export class BatchAddOrdersOldData implements Serializable BatchAddOrdersOldData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts index 7feae7dc..a9a3d8e5 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts @@ -11,6 +11,7 @@ export class BatchAddOrdersResp implements Response BatchAddOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts index 3adee5b6..aba65d09 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts @@ -48,6 +48,7 @@ export class BatchAddOrdersSyncData implements Serializable BatchAddOrdersSyncData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts index 655d4b3e..ae5a137a 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts @@ -9,6 +9,7 @@ export class BatchCancelOcoOrdersResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts index 405aa9cb..3b0d6e26 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts @@ -9,6 +9,7 @@ export class BatchCancelOrderOldResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts index 63590182..d5f6d527 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts @@ -9,6 +9,7 @@ export class BatchCancelStopOrderResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts index dc0a5cc4..5a30007d 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts @@ -11,6 +11,7 @@ export class CancelAllOrdersBySymbolResp * */ data?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts index a6d09f29..3ec1cde6 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts @@ -12,6 +12,7 @@ export class CancelAllOrdersFailedSymbols implements Serializable CancelAllOrdersFailedSymbols) failedSymbols?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts index 029d67a8..f4527fd6 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts @@ -11,6 +11,7 @@ export class CancelOcoOrderByClientOidResp * List of two order IDs related to the canceled OCO order */ cancelledOrderIds?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts index 940bf35c..2cdd167c 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts @@ -11,6 +11,7 @@ export class CancelOcoOrderByOrderIdResp * List of two order IDs related to the canceled OCO order */ cancelledOrderIds?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts index feb11ff9..a28e5c69 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts @@ -19,6 +19,7 @@ export class CancelOrderByClientOidOldResp * */ cancelledOcoOrderIds?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts index 7a0bc0f5..c60feabd 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts @@ -11,6 +11,7 @@ export class CancelOrderByClientOidResp * Client Order Id,unique identifier created by the user */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts index fe36fb77..38a4e54b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts @@ -31,6 +31,7 @@ export class CancelOrderByClientOidSyncResp * Order Status. open:order is active; done:order has been completed */ status?: CancelOrderByClientOidSyncResp.StatusEnum; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts index 3af4ed58..78f6306d 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts @@ -11,6 +11,7 @@ export class CancelOrderByOrderIdOldResp * */ cancelledOrderIds?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts index 0bf7fe6a..2f00ebd7 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts @@ -9,6 +9,7 @@ export class CancelOrderByOrderIdResp implements Response; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts index e62e8b2c..6cce9a2f 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts @@ -140,6 +140,7 @@ export class GetClosedOrdersItems implements Serializable * Order status: true-The status of the order isactive; false-The status of the order is done */ active?: boolean; + fromJson(input: string): GetClosedOrdersItems { const jsonObject = JSON.parse(input); return plainToInstance(GetClosedOrdersItems, jsonObject); diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts index 5f498d89..dce47df4 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts @@ -15,6 +15,7 @@ export class GetClosedOrdersResp implements Response GetClosedOrdersItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts index 455dc80a..e8a74087 100644 --- a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts @@ -21,6 +21,7 @@ export class GetDCPResp implements Response { * Trigger cancellation time (in seconds) */ triggerTime?: number; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts index d4ca84c3..ae4a05f4 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts @@ -27,6 +27,7 @@ export class GetOcoOrderByClientOidResp * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ status?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts index 90f254f0..c4ddcc62 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts @@ -25,6 +25,7 @@ export class GetOcoOrderByOrderIdResp implements Response GetOcoOrderDetailByOrderIdOrders) orders?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts index 7cccf031..7335c6c1 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts @@ -24,6 +24,7 @@ export class GetOcoOrderListItems implements Serializable * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ status?: GetOcoOrderListItems.StatusEnum; + fromJson(input: string): GetOcoOrderListItems { const jsonObject = JSON.parse(input); return plainToInstance(GetOcoOrderListItems, jsonObject); diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts index 6ee03d1c..f5179f75 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts @@ -27,6 +27,7 @@ export class GetOcoOrderListResp implements Response GetOcoOrderListItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts index de1dee6a..52c42fbe 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts @@ -140,6 +140,7 @@ export class GetOpenOrdersData implements Serializable { * Order status: true-The status of the order isactive; false-The status of the order is done */ active?: boolean; + fromJson(input: string): GetOpenOrdersData { const jsonObject = JSON.parse(input); return plainToInstance(GetOpenOrdersData, jsonObject); diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts index a2fa339a..fda90ac5 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts @@ -11,6 +11,7 @@ export class GetOpenOrdersResp implements Response GetOpenOrdersData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts index 0bbefd25..eb4f3493 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts @@ -127,6 +127,7 @@ export class GetOrderByClientOidOldResp * */ tradeType?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts index 11c23687..fa017706 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts @@ -141,6 +141,7 @@ export class GetOrderByClientOidResp implements Response GetOrdersListOldItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts index 455c03ec..29bb61ef 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts @@ -124,6 +124,7 @@ export class GetRecentOrdersListOldData implements Serializable GetRecentOrdersListOldData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts index f4cc4aa5..e612b4d9 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts @@ -72,6 +72,7 @@ export class GetRecentTradeHistoryOldData implements Serializable GetRecentTradeHistoryOldData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts index acc557be..474c0f1f 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts @@ -128,6 +128,7 @@ export class GetStopOrderByClientOidData implements Serializable GetStopOrderByClientOidData) data?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts index f29c4dab..0ce24288 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts @@ -131,6 +131,7 @@ export class GetStopOrderByOrderIdResp * Time of place a stop order, accurate to nanoseconds */ orderTime?: number; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts index 0cc9bffd..38bbda0f 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts @@ -128,6 +128,7 @@ export class GetStopOrdersListItems implements Serializable GetStopOrdersListItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts index f1350780..2657b9ff 100644 --- a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts @@ -11,6 +11,7 @@ export class GetSymbolsWithOpenOrderResp * The symbol that has active orders */ symbols?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts index 6ba1705e..40f21dbf 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts @@ -84,6 +84,7 @@ export class GetTradeHistoryItems implements Serializable * */ createdAt?: number; + fromJson(input: string): GetTradeHistoryItems { const jsonObject = JSON.parse(input); return plainToInstance(GetTradeHistoryItems, jsonObject); diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts index 6d3be2ad..71786b00 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts @@ -72,6 +72,7 @@ export class GetTradeHistoryOldItems implements Serializable GetTradeHistoryOldItems) items?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts index 480c788d..f970c961 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts @@ -15,6 +15,7 @@ export class GetTradeHistoryResp implements Response * The original client order id */ clientOid?: string; + /** * common response */ diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts index 9a71a364..d2eab184 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts @@ -13,6 +13,7 @@ export class SetDCPResp implements Response { * Trigger cancellation time (in seconds) */ triggerTime?: number; + /** * common response */ diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 27146e34..0e0abe58 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -51,6 +51,7 @@ export class AccountEvent implements Response { * Total balance = available + hold */ total?: string; + /** * common response */ @@ -78,9 +79,7 @@ export class AccountEvent implements Response { export type AccountEventCallback = (topic: string, subject: string, data: AccountEvent) => void; export class AccountEventCallbackWrapper implements WebSocketMessageCallback { - callback: AccountEventCallback; - - constructor(callback: AccountEventCallback) { + constructor(private callback: AccountEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts index 7d5c3721..4e74857b 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -94,6 +94,7 @@ export class OrderV1Event implements Response { * Trade id, it is generated by Matching engine. */ tradeId?: string; + /** * common response */ @@ -204,9 +205,7 @@ export namespace OrderV1Event { export type OrderV1EventCallback = (topic: string, subject: string, data: OrderV1Event) => void; export class OrderV1EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderV1EventCallback; - - constructor(callback: OrderV1EventCallback) { + constructor(private callback: OrderV1EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index ecc35b2a..6cf0cd44 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -94,6 +94,7 @@ export class OrderV2Event implements Response { * Trade id, it is generated by Matching engine. */ tradeId?: string; + /** * common response */ @@ -208,9 +209,7 @@ export namespace OrderV2Event { export type OrderV2EventCallback = (topic: string, subject: string, data: OrderV2Event) => void; export class OrderV2EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderV2EventCallback; - - constructor(callback: OrderV2EventCallback) { + constructor(private callback: OrderV2EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index dae179cd..30fe8895 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -38,6 +38,7 @@ export class AllTickersEvent implements Response { * The matching time of the latest transaction */ time?: number; + /** * common response */ @@ -69,9 +70,7 @@ export type AllTickersEventCallback = ( ) => void; export class AllTickersEventCallbackWrapper implements WebSocketMessageCallback { - callback: AllTickersEventCallback; - - constructor(callback: AllTickersEventCallback) { + constructor(private callback: AllTickersEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index f1278b37..8c917d7b 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -18,6 +18,7 @@ export class KlinesEvent implements Response { * now(us) */ time?: number; + /** * common response */ @@ -45,9 +46,7 @@ export class KlinesEvent implements Response { export type KlinesEventCallback = (topic: string, subject: string, data: KlinesEvent) => void; export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { - callback: KlinesEventCallback; - - constructor(callback: KlinesEventCallback) { + constructor(private callback: KlinesEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index aabe0944..a119671a 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -15,6 +15,7 @@ export class MarketSnapshotEvent implements Response void; export class MarketSnapshotEventCallbackWrapper implements WebSocketMessageCallback { - callback: MarketSnapshotEventCallback; - - constructor(callback: MarketSnapshotEventCallback) { + constructor(private callback: MarketSnapshotEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index 0b59d292..11c562b3 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -27,6 +27,7 @@ export class OrderbookIncrementEvent implements Response void; export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookIncrementEventCallback; - - constructor(callback: OrderbookIncrementEventCallback) { + constructor(private callback: OrderbookIncrementEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts index 458a3bbf..45c706f1 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -18,6 +18,7 @@ export class OrderbookLevel1Event implements Response void; export class OrderbookLevel1EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookLevel1EventCallback; - - constructor(callback: OrderbookLevel1EventCallback) { + constructor(private callback: OrderbookLevel1EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index 5baed508..b20f9f7f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -27,6 +27,7 @@ export class OrderbookLevel50Event implements Response void; export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookLevel50EventCallback; - - constructor(callback: OrderbookLevel50EventCallback) { + constructor(private callback: OrderbookLevel50EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts index ac035e3c..8aa3c57a 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -18,6 +18,7 @@ export class OrderbookLevel5Event implements Response void; export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCallback { - callback: OrderbookLevel5EventCallback; - - constructor(callback: OrderbookLevel5EventCallback) { + constructor(private callback: OrderbookLevel5EventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index f05b2cf7..f6af42c3 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -15,6 +15,7 @@ export class SymbolSnapshotEvent implements Response void; export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallback { - callback: SymbolSnapshotEventCallback; - - constructor(callback: SymbolSnapshotEventCallback) { + constructor(private callback: SymbolSnapshotEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts index caaf4f0a..4783b183 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -38,6 +38,7 @@ export class TickerEvent implements Response { * The matching time of the latest transaction */ Time?: number; + /** * common response */ @@ -65,9 +66,7 @@ export class TickerEvent implements Response { export type TickerEventCallback = (topic: string, subject: string, data: TickerEvent) => void; export class TickerEventCallbackWrapper implements WebSocketMessageCallback { - callback: TickerEventCallback; - - constructor(callback: TickerEventCallback) { + constructor(private callback: TickerEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index bea96b4f..5863a148 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -46,6 +46,7 @@ export class TradeEvent implements Response { * */ type?: string; + /** * common response */ @@ -73,9 +74,7 @@ export class TradeEvent implements Response { export type TradeEventCallback = (topic: string, subject: string, data: TradeEvent) => void; export class TradeEventCallbackWrapper implements WebSocketMessageCallback { - callback: TradeEventCallback; - - constructor(callback: TradeEventCallback) { + constructor(private callback: TradeEventCallback) { this.callback = callback; } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts index a0c29c53..21acdbcf 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts @@ -24,6 +24,7 @@ export class GetAccountDetailLtv implements Serializable { * Current LTV */ currentLtv?: string; + fromJson(input: string): GetAccountDetailLtv { const jsonObject = JSON.parse(input); return plainToInstance(GetAccountDetailLtv, jsonObject); diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts index f109e8b8..035f0220 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts @@ -16,6 +16,7 @@ export class GetAccountDetailMargins implements Serializable GetAccountDetailMargins) margins?: Array; + /** * common response */ diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts index 01a69125..e9836644 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts @@ -28,6 +28,7 @@ export class GetAccountsData implements Serializable { * If It Is Master Account */ isParent?: boolean; + fromJson(input: string): GetAccountsData { const jsonObject = JSON.parse(input); return plainToInstance(GetAccountsData, jsonObject); diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts index da6fd238..88e94ab3 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts @@ -11,6 +11,7 @@ export class GetAccountsResp implements Response */ @Type(() => GetAccountsData) data?: Array; + /** * common response */ From ec2d056aa92115a5754aef6c7501dd1dc8e4fc4a Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 9 Jan 2025 11:56:38 +0800 Subject: [PATCH 012/106] feat(nodejs): update ws style --- generator/plugin/src/main/resources/node-sdk/model_ws.mustache | 2 +- .../futures/futuresprivate/model_cross_leverage_data_value.ts | 2 -- .../model_cross_margin_position_asset_list_value.ts | 2 -- .../model_isolated_margin_position_change_assets_value.ts | 2 -- .../generate/spot/spotprivate/model_account_relation_context.ts | 2 -- .../src/generate/spot/spotpublic/model_market_snapshot_data.ts | 2 -- .../spotpublic/model_market_snapshot_data_market_change1h.ts | 2 -- .../spotpublic/model_market_snapshot_data_market_change24h.ts | 2 -- .../spotpublic/model_market_snapshot_data_market_change4h.ts | 2 -- .../spot/spotpublic/model_orderbook_increment_changes.ts | 2 -- .../generate/spot/spotpublic/model_orderbook_level50_changes.ts | 2 -- .../src/generate/spot/spotpublic/model_symbol_snapshot_data.ts | 2 -- .../spotpublic/model_symbol_snapshot_data_market_change1h.ts | 2 -- .../spotpublic/model_symbol_snapshot_data_market_change24h.ts | 2 -- .../spotpublic/model_symbol_snapshot_data_market_change4h.ts | 2 -- 15 files changed, 1 insertion(+), 29 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 7e3cb5fc..26653f1b 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -4,9 +4,9 @@ {{#vendorExtensions.x-imports}} {{{.}}} {{/vendorExtensions.x-imports}} +{{#vendorExtensions.x-response-model}} import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -{{#vendorExtensions.x-response-model}} import { Response } from '@internal/interfaces/response'; export class {{classname}} implements Response<{{classname}}, WsMessage>{ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts index 82239507..8d742c7c 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class CrossLeverageDataValue implements Serializable { diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts index 9a96493f..4af50a1c 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class CrossMarginPositionAssetListValue diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts index 57611539..b87409bd 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class IsolatedMarginPositionChangeAssetsValue diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts index a7216762..312fa2e2 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class AccountRelationContext implements Serializable { diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts index 605e9f6c..a6b30754 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -4,8 +4,6 @@ import { MarketSnapshotDataMarketChange4h } from './model_market_snapshot_data_m import { MarketSnapshotDataMarketChange24h } from './model_market_snapshot_data_market_change24h'; import { MarketSnapshotDataMarketChange1h } from './model_market_snapshot_data_market_change1h'; import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class MarketSnapshotData implements Serializable { diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts index e0ea1620..884545e0 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class MarketSnapshotDataMarketChange1h diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts index acc29186..ac602617 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class MarketSnapshotDataMarketChange24h diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts index b6aef68c..823a39a1 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class MarketSnapshotDataMarketChange4h diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts index 851fd204..d4d6a822 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class OrderbookIncrementChanges implements Serializable { diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts index 43cbca53..4c916975 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class OrderbookLevel50Changes implements Serializable { diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts index 059e5fda..ba123da4 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts @@ -4,8 +4,6 @@ import { SymbolSnapshotDataMarketChange4h } from './model_symbol_snapshot_data_m import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { SymbolSnapshotDataMarketChange1h } from './model_symbol_snapshot_data_market_change1h'; import { SymbolSnapshotDataMarketChange24h } from './model_symbol_snapshot_data_market_change24h'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class SymbolSnapshotData implements Serializable { diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts index a3dcedd4..11ac384c 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class SymbolSnapshotDataMarketChange1h diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts index 5c95a9cd..bb47fcd8 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class SymbolSnapshotDataMarketChange24h diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts index 3fe9c8f2..ac2b6143 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -1,8 +1,6 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { instanceToPlain, plainToInstance } from 'class-transformer'; -import { WsMessage } from '@model/common'; -import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; import { Serializable } from '@internal/interfaces/serializable'; export class SymbolSnapshotDataMarketChange4h From 2e8da131ab50056d6be895a54c6236d5b9bbede5 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 9 Jan 2025 15:33:36 +0800 Subject: [PATCH 013/106] feat(nodejs): update interface --- sdk/node/src/internal/interfaces/response.ts | 5 ++--- sdk/node/src/internal/interfaces/serializable.ts | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sdk/node/src/internal/interfaces/response.ts b/sdk/node/src/internal/interfaces/response.ts index 65f2759a..c3d0b73a 100644 --- a/sdk/node/src/internal/interfaces/response.ts +++ b/sdk/node/src/internal/interfaces/response.ts @@ -1,12 +1,11 @@ import { Serializable } from '@internal/interfaces/serializable'; /** - * Abstract class Response * Represents a response handler with a method to set common response data. */ -export abstract class Response extends Serializable { +export interface Response extends Serializable { /** * Set common response data. */ - abstract setCommonResponse(response: R): void; + setCommonResponse(response: R): void; } diff --git a/sdk/node/src/internal/interfaces/serializable.ts b/sdk/node/src/internal/interfaces/serializable.ts index cd1b3c3f..4610ff83 100644 --- a/sdk/node/src/internal/interfaces/serializable.ts +++ b/sdk/node/src/internal/interfaces/serializable.ts @@ -1,19 +1,19 @@ /** - * An abstract base class for serializable objects. + * The interface for serializable objects. */ -export abstract class Serializable { +export interface Serializable { /** * Parses a JSON string and populates the object's properties. */ - abstract fromJson(input: string): T; + fromJson(input: string): T; /** * Converts the current object into a JSON string. */ - abstract toJson(): string; + toJson(): string; /** * Populates the object's properties. */ - abstract fromObject(jsonObject: Object): T; + fromObject(jsonObject: Object): T; } From 8a664947cfdb33a64664080d041dcdfd5d306b32 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 9 Jan 2025 21:10:29 +0800 Subject: [PATCH 014/106] feat(nodejs): update model --- .../plugin/generator/NodeSdkGenerator.java | 21 +- .../main/resources/node-sdk/api_test.mustache | 8 +- .../resources/node-sdk/api_ws_test.mustache | 24 + .../main/resources/node-sdk/model_ws.mustache | 2 +- sdk/node/jest.config.js | 1 + .../account/account/api_account.test.ts | 110 +++-- .../account/deposit/api_deposit.test.ts | 70 +-- .../src/generate/account/fee/api_fee.test.ts | 30 +- .../subaccount/api_sub_account.test.ts | 110 +++-- .../account/transfer/api_transfer.test.ts | 70 +-- .../account/withdrawal/api_withdrawal.test.ts | 60 ++- .../broker/apibroker/api_api_broker.test.ts | 10 +- .../broker/ndbroker/api_nd_broker.test.ts | 130 +++-- .../src/generate/earn/earn/api_earn.test.ts | 90 ++-- .../fundingfees/api_funding_fees.test.ts | 30 +- .../api_futures_private.test.ts | 0 .../futuresprivate/model_all_order_event.ts | 2 +- .../model_all_position_event.ts | 2 +- .../futuresprivate/model_balance_event.ts | 2 +- .../model_cross_leverage_event.ts | 2 +- .../futuresprivate/model_margin_mode_event.ts | 2 +- .../futuresprivate/model_order_event.ts | 2 +- .../futuresprivate/model_position_event.ts | 2 +- .../futuresprivate/model_stop_orders_event.ts | 2 +- .../futuresprivate/ws_futures_private.test.ts | 140 ++++++ .../futurespublic/api_futures_public.test.ts | 0 .../futurespublic/model_announcement_event.ts | 2 +- .../futurespublic/model_execution_event.ts | 2 +- .../futurespublic/model_instrument_event.ts | 2 +- .../futurespublic/model_klines_event.ts | 2 +- .../model_orderbook_increment_event.ts | 2 +- .../model_orderbook_level50_event.ts | 2 +- .../model_orderbook_level5_event.ts | 2 +- .../model_symbol_snapshot_event.ts | 2 +- .../futurespublic/model_ticker_v1_event.ts | 2 +- .../futurespublic/model_ticker_v2_event.ts | 2 +- .../futurespublic/ws_futures_public.test.ts | 174 +++++++ .../futures/market/api_market.test.ts | 100 ++-- .../generate/futures/order/api_order.test.ts | 180 ++++--- .../futures/positions/api_positions.test.ts | 140 +++--- .../generate/margin/credit/api_credit.test.ts | 70 +-- .../generate/margin/debit/api_debit.test.ts | 60 ++- .../marginprivate/api_margin_private.test.ts | 0 .../model_cross_margin_position_event.ts | 2 +- .../model_isolated_margin_position_event.ts | 2 +- .../marginprivate/ws_margin_private.test.ts | 38 ++ .../marginpublic/api_margin_public.test.ts | 0 .../marginpublic/model_index_price_event.ts | 2 +- .../marginpublic/model_mark_price_event.ts | 2 +- .../marginpublic/ws_margin_public.test.ts | 38 ++ .../generate/margin/market/api_market.test.ts | 30 +- .../generate/margin/order/api_order.test.ts | 130 +++-- .../margin/risklimit/api_risk_limit.test.ts | 10 +- .../generate/spot/market/api_market.test.ts | 110 +++-- .../src/generate/spot/order/api_order.test.ts | 450 +++++++++++------- .../spot/spotprivate/api_spot_private.test.ts | 0 .../spot/spotprivate/model_account_event.ts | 2 +- .../spot/spotprivate/model_order_v1_event.ts | 2 +- .../spot/spotprivate/model_order_v2_event.ts | 2 +- .../spot/spotprivate/ws_spot_private.test.ts | 55 +++ .../spot/spotpublic/api_spot_public.test.ts | 0 .../spotpublic/model_all_tickers_event.ts | 2 +- .../spot/spotpublic/model_klines_event.ts | 2 +- .../spotpublic/model_market_snapshot_event.ts | 2 +- .../model_orderbook_increment_event.ts | 2 +- .../model_orderbook_level1_event.ts | 2 +- .../model_orderbook_level50_event.ts | 2 +- .../model_orderbook_level5_event.ts | 2 +- .../spotpublic/model_symbol_snapshot_event.ts | 2 +- .../spot/spotpublic/model_ticker_event.ts | 2 +- .../spot/spotpublic/model_trade_event.ts | 2 +- .../spot/spotpublic/ws_spot_public.test.ts | 174 +++++++ sdk/node/src/model/common.ts | 23 +- 73 files changed, 1904 insertions(+), 854 deletions(-) delete mode 100644 sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts delete mode 100644 sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts delete mode 100644 sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts delete mode 100644 sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts delete mode 100644 sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts delete mode 100644 sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 57086f3f..3f93d405 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -26,7 +26,6 @@ import java.util.*; import java.util.stream.Collectors; -import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.underscore; @@ -277,11 +276,14 @@ public String toApiFilename(String name) { apiName = "api_" + underscore(apiName); break; } - case TEST: - case WS_TEST: { + case TEST: { apiName = "api_" + underscore(apiName) + ".test"; break; } + case WS_TEST: { + apiName = "ws_" + underscore(apiName) + ".test"; + break; + } } return apiName; @@ -337,15 +339,10 @@ private void generateApiImport(Meta meta, boolean req, Map } case WS_TEST: { -// String suffix = "event"; -// imports.add(generateImport(meta.getService().toLowerCase(), -// toModelFilename(meta.getMethod()) + "_" + suffix, -// formatService(meta.getMethod() + camelize(suffix)))); -// -// if ((((Map) meta.getOtherProperties().getParas().getType()).containsKey("array"))) { -// imports.add(generateImportSimple("typing", "List")); -// } - + String suffix = "event"; + String fileName = "./" + toModelFilename(meta.getMethod()) + "_" + suffix; + String service = formatService(meta.getMethod() + camelize(suffix)); + imports.computeIfAbsent(fileName, ImportModel::new).component.add(service); break; } case ENTRY: { diff --git a/generator/plugin/src/main/resources/node-sdk/api_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_test.mustache index a8ec46c0..03ec88ea 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_test.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_test.mustache @@ -31,9 +31,11 @@ describe('Auto Test', ()=> { let data = "{{{vendorExtensions.x-response-example}}}"; let commonResp = RestResponse.fromJson(data); let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(); - resp = resp.fromObject(commonResp.data ) - expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); - console.log(resp); + resp = resp.fromObject(commonResp.data) + if (commonResp.data !== null) { + expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); + console.log(resp); + } {{/hasParams}} }) {{/operation}} diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache index e69de29b..b3d678f3 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache @@ -0,0 +1,24 @@ +{{#imports}} + {{{.}}} +{{/imports}} +import { WsMessage } from '@model/common'; + +describe('Auto Test', ()=> { +{{#operations}} + {{#operation}} + test('{{vendorExtensions.x-meta.method}} response test', ()=> { + /** + * {{vendorExtensions.x-meta.method}} + * {{summary}} + * {{path}} + */ + let data = "{{{vendorExtensions.x-response-example}}}"; + let commonResp = WsMessage.fromJson(data); + let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); + console.log(resp); + }) + {{/operation}} +{{/operations}} +}) \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 26653f1b..db31aab2 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -97,7 +97,7 @@ export class {{classname}}CallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = (new {{classname}}()).fromObject(msg.rawData) + let event = (new {{classname}}()).fromObject(msg.data) event.setCommonResponse(msg) this.callback(msg.topic, msg.subject, event) } diff --git a/sdk/node/jest.config.js b/sdk/node/jest.config.js index 34680eed..d52d99c7 100644 --- a/sdk/node/jest.config.js +++ b/sdk/node/jest.config.js @@ -4,6 +4,7 @@ const { pathsToModuleNameMapper } = require('ts-jest'); module.exports = { preset: 'ts-jest', testEnvironment: 'node', + setupFiles: ['reflect-metadata'], transform: { '^.+\\.ts$': 'ts-jest', }, diff --git a/sdk/node/src/generate/account/account/api_account.test.ts b/sdk/node/src/generate/account/account/api_account.test.ts index 7eff14a9..185c3806 100644 --- a/sdk/node/src/generate/account/account/api_account.test.ts +++ b/sdk/node/src/generate/account/account/api_account.test.ts @@ -53,10 +53,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFuturesAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotAccountDetail request test', () => { /** @@ -84,10 +86,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotAccountDetailResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotAccountList request test', () => { /** @@ -115,10 +119,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotAccountListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotLedger request test', () => { /** @@ -147,10 +153,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotLedgerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotHFLedger request test', () => { /** @@ -179,10 +187,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotHFLedgerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotAccountType request test', () => { /** @@ -225,10 +235,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetIsolatedMarginAccountDetailV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getIsolatedMarginAccountListV1 request test', () => { /** @@ -256,10 +268,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetIsolatedMarginAccountListV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarginAccountDetail request test', () => { /** @@ -303,10 +317,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFuturesLedgerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getApikeyInfo request test', () => { /** @@ -365,10 +381,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMarginHFLedgerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getIsolatedMarginAccount request test', () => { /** @@ -397,10 +415,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetIsolatedMarginAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getCrossMarginAccount request test', () => { /** @@ -428,9 +448,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetCrossMarginAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/account/deposit/api_deposit.test.ts b/sdk/node/src/generate/account/deposit/api_deposit.test.ts index 5e011957..a25c037b 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.test.ts +++ b/sdk/node/src/generate/account/deposit/api_deposit.test.ts @@ -41,10 +41,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositAddressV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addDepositAddressV1 request test', () => { /** @@ -72,10 +74,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddDepositAddressV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDepositHistory request test', () => { /** @@ -104,10 +108,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDepositHistoryOld request test', () => { /** @@ -136,10 +142,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositHistoryOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDepositAddressV2 request test', () => { /** @@ -167,10 +175,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositAddressV2Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addDepositAddressV3 request test', () => { /** @@ -198,10 +208,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddDepositAddressV3Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDepositAddressV3 request test', () => { /** @@ -230,9 +242,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositAddressV3Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/account/fee/api_fee.test.ts b/sdk/node/src/generate/account/fee/api_fee.test.ts index c8a113cc..a9e78cb1 100644 --- a/sdk/node/src/generate/account/fee/api_fee.test.ts +++ b/sdk/node/src/generate/account/fee/api_fee.test.ts @@ -33,10 +33,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetBasicFeeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotActualFee request test', () => { /** @@ -64,10 +66,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotActualFeeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getFuturesActualFee request test', () => { /** @@ -95,9 +99,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFuturesActualFeeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts index 010d6d95..a53dd3e2 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts @@ -51,10 +51,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFuturesSubAccountListV2Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotSubAccountListV1 request test', () => { /** @@ -97,10 +99,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotSubAccountDetailResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('deleteSubAccountApi request test', () => { /** @@ -129,10 +133,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new DeleteSubAccountApiResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSubAccountApiList request test', () => { /** @@ -160,10 +166,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSubAccountApiListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccountApi request test', () => { /** @@ -192,10 +200,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountApiResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('modifySubAccountApi request test', () => { /** @@ -224,10 +234,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifySubAccountApiResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotSubAccountsSummaryV1 request test', () => { /** @@ -270,10 +282,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotSubAccountListV2Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccount request test', () => { /** @@ -302,10 +316,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotSubAccountsSummaryV2 request test', () => { /** @@ -333,10 +349,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotSubAccountsSummaryV2Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccountFuturesPermission request test', () => { /** @@ -363,10 +381,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountFuturesPermissionResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccountMarginPermission request test', () => { /** @@ -393,9 +413,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountMarginPermissionResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/account/transfer/api_transfer.test.ts b/sdk/node/src/generate/account/transfer/api_transfer.test.ts index 2f8392e2..df21292d 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.test.ts +++ b/sdk/node/src/generate/account/transfer/api_transfer.test.ts @@ -41,10 +41,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTransferQuotasResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('futuresAccountTransferIn request test', () => { /** @@ -71,10 +73,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new FuturesAccountTransferInResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getFuturesAccountTransferOutLedger request test', () => { /** @@ -103,10 +107,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFuturesAccountTransferOutLedgerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('innerTransfer request test', () => { /** @@ -134,10 +140,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new InnerTransferResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('subAccountTransfer request test', () => { /** @@ -165,10 +173,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new SubAccountTransferResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('flexTransfer request test', () => { /** @@ -197,10 +207,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new FlexTransferResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('futuresAccountTransferOut request test', () => { /** @@ -228,9 +240,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new FuturesAccountTransferOutResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts index 1e926a45..4671957e 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts @@ -40,10 +40,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetWithdrawalHistoryOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getWithdrawalHistory request test', () => { /** @@ -72,10 +74,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetWithdrawalHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('withdrawalV1 request test', () => { /** @@ -103,10 +107,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new WithdrawalV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getWithdrawalQuotas request test', () => { /** @@ -134,10 +140,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetWithdrawalQuotasResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelWithdrawal request test', () => { /** @@ -164,10 +172,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelWithdrawalResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('withdrawalV3 request test', () => { /** @@ -195,9 +205,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new WithdrawalV3Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts index d870c4d5..c039de48 100644 --- a/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts @@ -29,9 +29,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRebaseResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts index ff4be5e4..4e3d2b7e 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts @@ -54,10 +54,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('deleteSubAccountAPI request test', () => { /** @@ -84,10 +86,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new DeleteSubAccountAPIResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSubAccountAPI request test', () => { /** @@ -115,10 +119,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSubAccountAPIResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccountApi request test', () => { /** @@ -147,10 +153,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountApiResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSubAccount request test', () => { /** @@ -178,10 +186,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSubAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addSubAccount request test', () => { /** @@ -209,10 +219,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddSubAccountResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('modifySubAccountApi request test', () => { /** @@ -241,10 +253,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifySubAccountApiResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getBrokerInfo request test', () => { /** @@ -272,10 +286,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetBrokerInfoResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRebase request test', () => { /** @@ -303,10 +319,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRebaseResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('transfer request test', () => { /** @@ -335,10 +353,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new TransferResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDepositDetail request test', () => { /** @@ -366,10 +386,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetDepositDetailResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getTransferHistory request test', () => { /** @@ -397,10 +419,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTransferHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getWithdrawDetail request test', () => { /** @@ -428,9 +452,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetWithdrawDetailResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/earn/earn/api_earn.test.ts b/sdk/node/src/generate/earn/earn/api_earn.test.ts index 10c8ee79..52335bfa 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.test.ts +++ b/sdk/node/src/generate/earn/earn/api_earn.test.ts @@ -45,10 +45,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetETHStakingProductsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getAccountHolding request test', () => { /** @@ -77,10 +79,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetAccountHoldingResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getKcsStakingProducts request test', () => { /** @@ -108,10 +112,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetKcsStakingProductsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('redeem request test', () => { /** @@ -140,10 +146,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new RedeemResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('purchase request test', () => { /** @@ -171,10 +179,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new PurchaseResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPromotionProducts request test', () => { /** @@ -202,10 +212,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPromotionProductsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRedeemPreview request test', () => { /** @@ -233,10 +245,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRedeemPreviewResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSavingsProducts request test', () => { /** @@ -264,10 +278,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSavingsProductsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getStakingProducts request test', () => { /** @@ -295,9 +311,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetStakingProductsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts index 4de199cc..07ed6e03 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -33,10 +33,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPublicFundingHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPrivateFundingHistory request test', () => { /** @@ -65,10 +67,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPrivateFundingHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetCurrentFundingRate request test', () => { /** @@ -96,9 +100,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetCurrentFundingRateResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts b/sdk/node/src/generate/futures/futuresprivate/api_futures_private.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index bbf8f5df..629073f1 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -226,7 +226,7 @@ export class AllOrderEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new AllOrderEvent().fromObject(msg.rawData); + let event = new AllOrderEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index cad60b8a..b68fe861 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -246,7 +246,7 @@ export class AllPositionEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new AllPositionEvent().fromObject(msg.rawData); + let event = new AllPositionEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index dabe1c32..5510006d 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -99,7 +99,7 @@ export class BalanceEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new BalanceEvent().fromObject(msg.rawData); + let event = new BalanceEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index 19b6797f..2771741a 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -48,7 +48,7 @@ export class CrossLeverageEventCallbackWrapper implements WebSocketMessageCallba } onMessage(msg: WsMessage): void { - let event = new CrossLeverageEvent().fromObject(msg.rawData); + let event = new CrossLeverageEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index 1b921375..479cdf56 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -47,7 +47,7 @@ export class MarginModeEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new MarginModeEvent().fromObject(msg.rawData); + let event = new MarginModeEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index f0059d1a..58edcb75 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -226,7 +226,7 @@ export class OrderEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderEvent().fromObject(msg.rawData); + let event = new OrderEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index f7f3010e..3f5409d3 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -242,7 +242,7 @@ export class PositionEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new PositionEvent().fromObject(msg.rawData); + let event = new PositionEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index 6c18a4d7..bd4e902e 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -148,7 +148,7 @@ export class StopOrdersEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new StopOrdersEvent().fromObject(msg.rawData); + let event = new StopOrdersEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts b/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts new file mode 100644 index 00000000..640feb70 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts @@ -0,0 +1,140 @@ +import { MarginModeEvent } from './model_margin_mode_event'; +import { BalanceEvent } from './model_balance_event'; +import { PositionEvent } from './model_position_event'; +import { StopOrdersEvent } from './model_stop_orders_event'; +import { CrossLeverageEvent } from './model_cross_leverage_event'; +import { AllPositionEvent } from './model_all_position_event'; +import { OrderEvent } from './model_order_event'; +import { AllOrderEvent } from './model_all_order_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('allOrder response test', () => { + /** + * allOrder + * All Order change pushes. + * /allOrder/contractMarket/tradeOrders + */ + let data = + '{"topic":"/contractMarket/tradeOrders:XBTUSDTM","type":"message","subject":"symbolOrderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"symbol":"XBTUSDTM","side":"buy","canceledSize":"0","orderId":"247899236673269761","liquidity":"maker","marginMode":"ISOLATED","type":"open","orderTime":1731916985768138917,"size":"1","filledSize":"0","price":"91670","remainSize":"1","status":"open","ts":1731916985789000000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new AllOrderEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('allPosition response test', () => { + /** + * allPosition + * All symbol position change events push + * /allPosition/contract/positionAll + */ + let data = + '{"topic":"/contract/position:XBTUSDTM","type":"message","data":{"symbol":"XBTUSDTM","maintMarginReq":0.005,"riskLimit":500000,"realLeverage":4.9685590767,"crossMode":false,"delevPercentage":0.10,"openingTimestamp":1731916913097,"autoDeposit":true,"currentTimestamp":1731924561514,"currentQty":1,"currentCost":91.5306,"currentComm":0.09179284,"unrealisedCost":91.6945,"realisedCost":-0.07210716,"isOpen":true,"markPrice":91839.79,"markValue":91.83979,"posCost":91.6945,"posCross":0,"posInit":18.3389,"posComm":0.06602004,"posLoss":0,"posMargin":18.40492004,"posFunding":0,"posMaint":0.5634627025,"maintMargin":18.55021004,"avgEntryPrice":91694.5,"liquidationPrice":73853.0426625,"bankruptPrice":73355.6,"settleCurrency":"USDT","changeReason":"positionChange","riskLimitLevel":2,"realisedGrossCost":-0.1639,"realisedGrossPnl":0.1639,"realisedPnl":0.07210716,"unrealisedPnl":0.14529,"unrealisedPnlPcnt":0.0016,"unrealisedRoePcnt":0.0079,"leverage":4.9685590767,"marginMode":"ISOLATED","positionSide":"BOTH"},"subject":"position.change","userId":"633559791e1cbc0001f319bc","channelType":"private"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new AllPositionEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('balance response test', () => { + /** + * balance + * the balance change push + * /balance/contractAccount/wallet + */ + let data = + '{"topic":"/contractAccount/wallet","type":"message","subject":"walletBalance.change","id":"673b0bb925b4bc0001fadfef","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"crossPosMargin":"0","isolatedOrderMargin":"18.1188","holdBalance":"0","equity":"81.273621258","version":"1337","availableBalance":"26.144281178","isolatedPosMargin":"36.80984008","walletBalance":"81.072921258","isolatedFundingFeeMargin":"0","crossUnPnl":"0","totalCrossMargin":"26.144281178","currency":"USDT","isolatedUnPnl":"0.2007","crossOrderMargin":"0","timestamp":"1731916996764"}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new BalanceEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('crossLeverage response test', () => { + /** + * crossLeverage + * the leverage change push + * /crossLeverage/contract/crossLeverage + */ + let data = + '{"topic":"/contract/crossLeverage","type":"message","data":{"ETHUSDTM":{"leverage":"8"}},"subject":"user.config","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new CrossLeverageEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('marginMode response test', () => { + /** + * marginMode + * the margin mode change + * /marginMode/contract/marginMode + */ + let data = + '{"topic":"/contract/marginMode","type":"message","data":{"ETHUSDTM":"ISOLATED"},"subject":"user.config","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new MarginModeEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('order response test', () => { + /** + * order + * Order change pushes. + * /order/contractMarket/tradeOrders:_symbol_ + */ + let data = + '{"topic":"/contractMarket/tradeOrders:XBTUSDTM","type":"message","subject":"symbolOrderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"symbol":"XBTUSDTM","side":"buy","canceledSize":"0","orderId":"247899236673269761","liquidity":"maker","marginMode":"ISOLATED","type":"open","orderTime":1731916985768138917,"size":"1","filledSize":"0","price":"91670","remainSize":"1","status":"open","ts":1731916985789000000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('position response test', () => { + /** + * position + * the position change events push + * /position/contract/position:_symbol_ + */ + let data = + '{"topic":"/contract/position:XBTUSDTM","type":"message","data":{"symbol":"XBTUSDTM","maintMarginReq":0.005,"riskLimit":500000,"realLeverage":4.9685590767,"crossMode":false,"delevPercentage":0.10,"openingTimestamp":1731916913097,"autoDeposit":true,"currentTimestamp":1731924561514,"currentQty":1,"currentCost":91.5306,"currentComm":0.09179284,"unrealisedCost":91.6945,"realisedCost":-0.07210716,"isOpen":true,"markPrice":91839.79,"markValue":91.83979,"posCost":91.6945,"posCross":0,"posInit":18.3389,"posComm":0.06602004,"posLoss":0,"posMargin":18.40492004,"posFunding":0,"posMaint":0.5634627025,"maintMargin":18.55021004,"avgEntryPrice":91694.5,"liquidationPrice":73853.0426625,"bankruptPrice":73355.6,"settleCurrency":"USDT","changeReason":"positionChange","riskLimitLevel":2,"realisedGrossCost":-0.1639,"realisedGrossPnl":0.1639,"realisedPnl":0.07210716,"unrealisedPnl":0.14529,"unrealisedPnlPcnt":0.0016,"unrealisedRoePcnt":0.0079,"leverage":4.9685590767,"marginMode":"ISOLATED","positionSide":"BOTH"},"subject":"position.change","userId":"633559791e1cbc0001f319bc","channelType":"private"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new PositionEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('stopOrders response test', () => { + /** + * stopOrders + * stop order change pushes. + * /stopOrders/contractMarket/advancedOrders + */ + let data = + '{"topic":"/contractMarket/advancedOrders","type":"message","data":{"createdAt":1730194206837,"marginMode":"ISOLATED","orderId":"240673378116083712","orderPrice":"0.1","orderType":"stop","side":"buy","size":1,"stop":"down","stopPrice":"1000","stopPriceType":"TP","symbol":"XBTUSDTM","ts":1730194206843133000,"type":"open"},"subject":"stopOrder","id":"6720ab1ea52a9b0001734392","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new StopOrdersEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts b/sdk/node/src/generate/futures/futurespublic/api_futures_public.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index 99fe2669..58f809be 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -59,7 +59,7 @@ export class AnnouncementEventCallbackWrapper implements WebSocketMessageCallbac } onMessage(msg: WsMessage): void { - let event = new AnnouncementEvent().fromObject(msg.rawData); + let event = new AnnouncementEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index cf2ddde3..c81da20c 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -75,7 +75,7 @@ export class ExecutionEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new ExecutionEvent().fromObject(msg.rawData); + let event = new ExecutionEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index d1a945da..0205e8e8 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -63,7 +63,7 @@ export class InstrumentEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new InstrumentEvent().fromObject(msg.rawData); + let event = new InstrumentEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index 39023f04..5872a4e6 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -51,7 +51,7 @@ export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new KlinesEvent().fromObject(msg.rawData); + let event = new KlinesEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index a827b589..5d60dd26 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -55,7 +55,7 @@ export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageC } onMessage(msg: WsMessage): void { - let event = new OrderbookIncrementEvent().fromObject(msg.rawData); + let event = new OrderbookIncrementEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts index 68215c13..3f05fc72 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -63,7 +63,7 @@ export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCal } onMessage(msg: WsMessage): void { - let event = new OrderbookLevel50Event().fromObject(msg.rawData); + let event = new OrderbookLevel50Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts index 7475b8df..cb9fd59a 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -63,7 +63,7 @@ export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCall } onMessage(msg: WsMessage): void { - let event = new OrderbookLevel5Event().fromObject(msg.rawData); + let event = new OrderbookLevel5Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts index c4e37523..117b3379 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -83,7 +83,7 @@ export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallb } onMessage(msg: WsMessage): void { - let event = new SymbolSnapshotEvent().fromObject(msg.rawData); + let event = new SymbolSnapshotEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts index e5e9bc73..828f492e 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -83,7 +83,7 @@ export class TickerV1EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerV1Event().fromObject(msg.rawData); + let event = new TickerV1Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index 4db2ed61..f0dd5bcb 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -67,7 +67,7 @@ export class TickerV2EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerV2Event().fromObject(msg.rawData); + let event = new TickerV2Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts b/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts new file mode 100644 index 00000000..fb5687c9 --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts @@ -0,0 +1,174 @@ +import { OrderbookLevel5Event } from './model_orderbook_level5_event'; +import { KlinesEvent } from './model_klines_event'; +import { TickerV2Event } from './model_ticker_v2_event'; +import { SymbolSnapshotEvent } from './model_symbol_snapshot_event'; +import { OrderbookIncrementEvent } from './model_orderbook_increment_event'; +import { TickerV1Event } from './model_ticker_v1_event'; +import { OrderbookLevel50Event } from './model_orderbook_level50_event'; +import { ExecutionEvent } from './model_execution_event'; +import { InstrumentEvent } from './model_instrument_event'; +import { AnnouncementEvent } from './model_announcement_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('announcement response test', () => { + /** + * announcement + * announcement + * /announcement/contract/announcement:_symbol_ + */ + let data = + '{"topic":"/contract/announcement","subject":"funding.begin","data":{"symbol":"XBTUSDTM","fundingTime":1551770400000,"fundingRate":-0.002966,"timestamp":1551770400000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new AnnouncementEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('execution response test', () => { + /** + * execution + * Match execution data. + * /execution/contractMarket/execution:_symbol_ + */ + let data = + '{"topic":"/contractMarket/execution:XBTUSDTM","type":"message","subject":"match","sn":1794100537695,"data":{"symbol":"XBTUSDTM","sequence":1794100537695,"side":"buy","size":2,"price":"90503.9","takerOrderId":"247822202957807616","makerOrderId":"247822167163555840","tradeId":"1794100537695","ts":1731898619520000000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new ExecutionEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('instrument response test', () => { + /** + * instrument + * instrument + * /instrument/contract/instrument:_symbol_ + */ + let data = + '{"topic":"/contract/instrument:XBTUSDTM","type":"message","subject":"mark.index.price","data":{"markPrice":90445.02,"indexPrice":90445.02,"granularity":1000,"timestamp":1731899129000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new InstrumentEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('klines response test', () => { + /** + * klines + * Klines + * /klines/contractMarket/limitCandle:_symbol___type_ + */ + let data = + '{"topic":"/contractMarket/limitCandle:XBTUSDTM_1min","type":"message","data":{"symbol":"XBTUSDTM","candles":["1731898200","90638.6","90638.6","90638.6","90638.6","21.0","21"],"time":1731898208357},"subject":"candle.stick"}'; + let commonResp = WsMessage.fromJson(data); + let resp = new KlinesEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookIncrement response test', () => { + /** + * orderbookIncrement + * Orderbook - Increment + * /orderbookIncrement/contractMarket/level2:_symbol_ + */ + let data = + '{"topic":"/contractMarket/level2:XBTUSDTM","type":"message","subject":"level2","sn":1709400450243,"data":{"sequence":1709400450243,"change":"90631.2,sell,2","timestamp":1731897467182}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookIncrementEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookLevel50 response test', () => { + /** + * orderbookLevel50 + * Orderbook - Level50 + * /orderbookLevel50/contractMarket/level2Depth50:_symbol_ + */ + let data = + '{"topic":"/contractMarket/level2Depth50:XBTUSDTM","type":"message","subject":"level2","sn":1731680249700,"data":{"bids":[["89778.6",1534],["89778.2",54]],"sequence":1709294490099,"timestamp":1731680249700,"ts":1731680249700,"asks":[["89778.7",854],["89779.2",4]]}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookLevel50Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookLevel5 response test', () => { + /** + * orderbookLevel5 + * Orderbook - Level5 + * /orderbookLevel5/contractMarket/level2Depth5:_symbol_ + */ + let data = + '{"topic":"/contractMarket/level2Depth5:XBTUSDTM","type":"message","subject":"level2","sn":1731680019100,"data":{"bids":[["89720.9",513],["89720.8",12],["89718.6",113],["89718.4",19],["89718.3",7]],"sequence":1709294294670,"timestamp":1731680019100,"ts":1731680019100,"asks":[["89721",906],["89721.1",203],["89721.4",113],["89723.2",113],["89725.4",113]]}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookLevel5Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('symbolSnapshot response test', () => { + /** + * symbolSnapshot + * Symbol Snapshot + * /symbolSnapshot/contractMarket/snapshot:_symbol_ + */ + let data = + '{"topic":"/contractMarket/snapshot:XBTUSDTM","type":"message","subject":"snapshot.24h","id":"673ab3fff4088b0001664f41","data":{"highPrice":91512.8,"lastPrice":90326.7,"lowPrice":88747.8,"price24HoursBefore":89880.4,"priceChg":446.3,"priceChgPct":0.0049,"symbol":"XBTUSDTM","ts":1731900415023929239,"turnover":526928331.0482177734,"volume":5834.46}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new SymbolSnapshotEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('tickerV1 response test', () => { + /** + * tickerV1 + * Get Ticker(not recommended) + * /tickerV1/contractMarket/ticker:_symbol_ + */ + let data = + '{"topic":"/contractMarket/ticker:XBTUSDTM","type":"message","subject":"ticker","sn":1793133570931,"data":{"symbol":"XBTUSDTM","sequence":1793133570931,"side":"sell","size":1,"price":"90147.7","bestBidSize":2186,"bestBidPrice":"90147.7","bestAskPrice":"90147.8","tradeId":"1793133570931","bestAskSize":275,"ts":1731679215637000000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new TickerV1Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('tickerV2 response test', () => { + /** + * tickerV2 + * Get Ticker V2 + * /tickerV2/contractMarket/tickerV2:_symbol_ + */ + let data = + '{"topic":"/contractMarket/tickerV2:XBTUSDTM","type":"message","subject":"tickerV2","sn":1709284589209,"data":{"symbol":"XBTUSDTM","sequence":1709284589209,"bestBidSize":713,"bestBidPrice":"88987.4","bestAskPrice":"88987.5","bestAskSize":1037,"ts":1731665526461000000}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new TickerV2Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts index fca75cda..d0d5d61e 100644 --- a/sdk/node/src/generate/futures/market/api_market.test.ts +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -114,10 +114,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSymbolResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSpotIndexPrice request test', () => { /** @@ -146,10 +148,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSpotIndexPriceResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getInterestRateIndex request test', () => { /** @@ -178,10 +182,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetInterestRateIndexResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getKlines request test', () => { /** @@ -210,10 +216,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetKlinesResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPartOrderBook request test', () => { /** @@ -241,10 +249,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPartOrderBookResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getFullOrderBook request test', () => { /** @@ -272,10 +282,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFullOrderBookResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarkPrice request test', () => { /** @@ -303,10 +315,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMarkPriceResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPremiumIndex request test', () => { /** @@ -335,10 +349,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPremiumIndexResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getServiceStatus request test', () => { /** @@ -381,10 +397,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTickerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getServerTime request test', () => { /** @@ -427,10 +445,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('get24hrStats request test', () => { /** diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts index 7ba7bd8f..1fb7eff1 100644 --- a/sdk/node/src/generate/futures/order/api_order.test.ts +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -64,10 +64,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetOpenOrderValue request test', () => { /** @@ -95,10 +97,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOpenOrderValueResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByClientOid request test', () => { /** @@ -126,10 +130,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByClientOid request test', () => { /** @@ -157,10 +163,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelAllOrdersV1 request test', () => { /** @@ -188,10 +196,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelAllOrdersV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetOrderList request test', () => { /** @@ -220,10 +230,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchCancelOrders request test', () => { /** @@ -251,10 +263,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchCancelOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchAddOrders request test', () => { /** @@ -283,10 +297,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchAddOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderById request test', () => { /** @@ -314,10 +330,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByOrderId request test', () => { /** @@ -345,10 +363,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrder request test', () => { /** @@ -377,10 +397,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderTest request test', () => { /** @@ -409,10 +431,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetRecentClosedOrders request test', () => { /** @@ -440,10 +464,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRecentClosedOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRecentTradeHistory request test', () => { /** @@ -471,10 +497,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRecentTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addTPSLOrder request test', () => { /** @@ -503,10 +531,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddTPSLOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelAllStopOrders request test', () => { /** @@ -534,10 +564,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelAllStopOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetStopOrderList request test', () => { /** @@ -566,10 +598,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetStopOrderListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelAllOrdersV3 request test', () => { /** @@ -597,9 +631,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelAllOrdersV3Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts index 3c152a37..99c58835 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.test.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -55,10 +55,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetIsolatedMarginRiskLimitResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetPositionsHistory request test', () => { /** @@ -87,10 +89,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPositionsHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetMaxWithdrawMargin request test', () => { /** @@ -117,10 +121,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMaxWithdrawMarginResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('RemoveIsolatedMargin request test', () => { /** @@ -147,10 +153,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new RemoveIsolatedMarginResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetPositionDetails request test', () => { /** @@ -178,10 +186,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPositionDetailsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('modifyAutoDepositStatus request test', () => { /** @@ -208,10 +218,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyAutoDepositStatusResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('AddIsolatedMargin request test', () => { /** @@ -239,10 +251,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddIsolatedMarginResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('modifyIsolatedMarginRiskLimt request test', () => { /** @@ -269,10 +283,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyIsolatedMarginRiskLimtResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetPositionList request test', () => { /** @@ -300,10 +316,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPositionListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('ModifyMarginLeverage request test', () => { /** @@ -331,10 +349,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyMarginLeverageResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getCrossMarginLeverage request test', () => { /** @@ -362,10 +382,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetCrossMarginLeverageResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('GetMaxOpenSize request test', () => { /** @@ -394,10 +416,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMaxOpenSizeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('switchMarginMode request test', () => { /** @@ -425,10 +449,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new SwitchMarginModeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarginMode request test', () => { /** @@ -456,9 +482,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMarginModeResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/margin/credit/api_credit.test.ts b/sdk/node/src/generate/margin/credit/api_credit.test.ts index 416e12fa..ef5842e0 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.test.ts +++ b/sdk/node/src/generate/margin/credit/api_credit.test.ts @@ -41,10 +41,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyPurchaseResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getLoanMarket request test', () => { /** @@ -72,10 +74,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetLoanMarketResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getLoanMarketInterestRate request test', () => { /** @@ -103,10 +107,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetLoanMarketInterestRateResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPurchaseOrders request test', () => { /** @@ -135,10 +141,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPurchaseOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('purchase request test', () => { /** @@ -166,10 +174,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new PurchaseResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRedeemOrders request test', () => { /** @@ -198,10 +208,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRedeemOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('redeem request test', () => { /** @@ -230,9 +242,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new RedeemResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/margin/debit/api_debit.test.ts b/sdk/node/src/generate/margin/debit/api_debit.test.ts index 2ad643fb..d997074a 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.test.ts +++ b/sdk/node/src/generate/margin/debit/api_debit.test.ts @@ -40,10 +40,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetBorrowHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('borrow request test', () => { /** @@ -72,10 +74,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BorrowResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getInterestHistory request test', () => { /** @@ -104,10 +108,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetInterestHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRepayHistory request test', () => { /** @@ -136,10 +142,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRepayHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('repay request test', () => { /** @@ -167,10 +175,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new RepayResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('modifyLeverage request test', () => { /** @@ -197,9 +207,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyLeverageResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts b/sdk/node/src/generate/margin/marginprivate/api_margin_private.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index b1bb68e8..95d4e8b0 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -105,7 +105,7 @@ export class CrossMarginPositionEventCallbackWrapper implements WebSocketMessage } onMessage(msg: WsMessage): void { - let event = new CrossMarginPositionEvent().fromObject(msg.rawData); + let event = new CrossMarginPositionEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index 4cdade00..520cfced 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -141,7 +141,7 @@ export class IsolatedMarginPositionEventCallbackWrapper implements WebSocketMess } onMessage(msg: WsMessage): void { - let event = new IsolatedMarginPositionEvent().fromObject(msg.rawData); + let event = new IsolatedMarginPositionEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts b/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts new file mode 100644 index 00000000..a9aa164d --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts @@ -0,0 +1,38 @@ +import { CrossMarginPositionEvent } from './model_cross_margin_position_event'; +import { IsolatedMarginPositionEvent } from './model_isolated_margin_position_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('crossMarginPosition response test', () => { + /** + * crossMarginPosition + * Get Cross Margin Position change + * /crossMarginPosition/margin/position + */ + let data = + '{"topic":"/margin/position","subject":"debt.ratio","type":"message","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"debtRatio":0,"totalAsset":0.00052431772284080000000,"marginCoefficientTotalAsset":"0.0005243177228408","totalDebt":"0","assetList":{"BTC":{"total":"0.00002","available":"0","hold":"0.00002"},"USDT":{"total":"33.68855864","available":"15.01916691","hold":"18.66939173"}},"debtList":{"BTC":"0","USDT":"0"},"timestamp":1729912435657}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new CrossMarginPositionEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('isolatedMarginPosition response test', () => { + /** + * isolatedMarginPosition + * Get Isolated Margin Position change + * /isolatedMarginPosition/margin/isolatedPosition:_symbol_ + */ + let data = + '{"topic":"/margin/isolatedPosition:BTC-USDT","subject":"positionChange","type":"message","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"tag":"BTC-USDT","status":"DEBT","statusBizType":"DEFAULT_DEBT","accumulatedPrincipal":"5.01","changeAssets":{"BTC":{"total":"0.00043478","hold":"0","liabilityPrincipal":"0","liabilityInterest":"0"},"USDT":{"total":"0.98092004","hold":"0","liabilityPrincipal":"26","liabilityInterest":"0.00025644"}},"timestamp":1730121097742}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new IsolatedMarginPositionEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts b/sdk/node/src/generate/margin/marginpublic/api_margin_public.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index c10a1e08..362b80e6 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -59,7 +59,7 @@ export class IndexPriceEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new IndexPriceEvent().fromObject(msg.rawData); + let event = new IndexPriceEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index 8296e675..9817570c 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -55,7 +55,7 @@ export class MarkPriceEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new MarkPriceEvent().fromObject(msg.rawData); + let event = new MarkPriceEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts b/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts new file mode 100644 index 00000000..ef0c7590 --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts @@ -0,0 +1,38 @@ +import { IndexPriceEvent } from './model_index_price_event'; +import { MarkPriceEvent } from './model_mark_price_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('indexPrice response test', () => { + /** + * indexPrice + * Index Price + * /indexPrice/indicator/index:_symbol_,_symbol_ + */ + let data = + '{"id":"5c24c5da03aa673885cd67a0","type":"message","topic":"/indicator/index:USDT-BTC","subject":"tick","data":{"symbol":"USDT-BTC","granularity":5000,"timestamp":1551770400000,"value":0.0001092}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new IndexPriceEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('markPrice response test', () => { + /** + * markPrice + * Mark Price + * /markPrice/indicator/markPrice:_symbol_,_symbol_ + */ + let data = + '{"id":"5c24c5da03aa673885cd67aa","type":"message","topic":"/indicator/markPrice:USDT-BTC","subject":"tick","data":{"symbol":"USDT-BTC","granularity":5000,"timestamp":1551770400000,"value":0.0001093}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new MarkPriceEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/margin/market/api_market.test.ts b/sdk/node/src/generate/margin/market/api_market.test.ts index 89bd3f23..1a9b9843 100644 --- a/sdk/node/src/generate/margin/market/api_market.test.ts +++ b/sdk/node/src/generate/margin/market/api_market.test.ts @@ -66,10 +66,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMarkPriceDetailResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getETFInfo request test', () => { /** @@ -97,10 +99,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetETFInfoResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getCrossMarginSymbols request test', () => { /** @@ -128,10 +132,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetCrossMarginSymbolsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarkPriceList request test', () => { /** diff --git a/sdk/node/src/generate/margin/order/api_order.test.ts b/sdk/node/src/generate/margin/order/api_order.test.ts index 9f84c351..2a355ace 100644 --- a/sdk/node/src/generate/margin/order/api_order.test.ts +++ b/sdk/node/src/generate/margin/order/api_order.test.ts @@ -54,10 +54,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderTestV1 request test', () => { /** @@ -86,10 +88,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderTestV1Resp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getTradeHistory request test', () => { /** @@ -118,10 +122,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSymbolsWithOpenOrder request test', () => { /** @@ -149,10 +155,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSymbolsWithOpenOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrder request test', () => { /** @@ -181,10 +189,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderTest request test', () => { /** @@ -213,10 +223,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOpenOrders request test', () => { /** @@ -244,10 +256,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOpenOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByClientOid request test', () => { /** @@ -274,10 +288,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByClientOid request test', () => { /** @@ -305,10 +321,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelAllOrdersBySymbol request test', () => { /** @@ -335,10 +353,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelAllOrdersBySymbolResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getClosedOrders request test', () => { /** @@ -367,10 +387,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetClosedOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByOrderId request test', () => { /** @@ -397,10 +419,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByOrderId request test', () => { /** @@ -428,9 +452,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts index 2ce8c453..77c7fd67 100644 --- a/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts @@ -29,9 +29,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetMarginRiskLimitResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/spot/market/api_market.test.ts b/sdk/node/src/generate/spot/market/api_market.test.ts index a1696a82..ec24fe4c 100644 --- a/sdk/node/src/generate/spot/market/api_market.test.ts +++ b/sdk/node/src/generate/spot/market/api_market.test.ts @@ -102,10 +102,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetKlinesResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getTradeHistory request test', () => { /** @@ -133,10 +135,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getTicker request test', () => { /** @@ -164,10 +168,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTickerResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getPartOrderBook request test', () => { /** @@ -195,10 +201,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetPartOrderBookResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('get24hrStats request test', () => { /** @@ -226,10 +234,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new Get24hrStatsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarketList request test', () => { /** @@ -272,10 +282,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFiatPriceResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getServiceStatus request test', () => { /** @@ -333,10 +345,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetAllSymbolsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSymbol request test', () => { /** @@ -364,10 +378,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetSymbolResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getAnnouncements request test', () => { /** @@ -396,10 +412,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetAnnouncementsResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getCurrency request test', () => { /** @@ -427,10 +445,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetCurrencyResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getAllCurrencies request test', () => { /** @@ -473,9 +493,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetFullOrderBookResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/spot/order/api_order.test.ts b/sdk/node/src/generate/spot/order/api_order.test.ts index cf29ccd2..b51d0e56 100644 --- a/sdk/node/src/generate/spot/order/api_order.test.ts +++ b/sdk/node/src/generate/spot/order/api_order.test.ts @@ -121,10 +121,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getTradeHistory request test', () => { /** @@ -153,10 +155,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOpenOrders request test', () => { /** @@ -184,10 +188,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOpenOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getSymbolsWithOpenOrder request test', () => { /** @@ -231,10 +237,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new ModifyOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelAllOrders request test', () => { /** @@ -278,10 +286,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelPartialOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByClientOid request test', () => { /** @@ -308,10 +318,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByClientOid request test', () => { /** @@ -339,10 +351,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('setDCP request test', () => { /** @@ -369,10 +383,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new SetDCPResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getDCP request test', () => { /** @@ -414,10 +430,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelAllOrdersBySymbolResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getClosedOrders request test', () => { /** @@ -446,10 +464,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetClosedOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchAddOrders request test', () => { /** @@ -478,10 +498,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchAddOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchAddOrdersSync request test', () => { /** @@ -510,10 +532,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchAddOrdersSyncResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByOrderId request test', () => { /** @@ -541,10 +565,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByOrderId request test', () => { /** @@ -572,10 +598,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrder request test', () => { /** @@ -604,10 +632,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByClientOidSync request test', () => { /** @@ -635,10 +665,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByClientOidSyncResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByOrderIdSync request test', () => { /** @@ -666,10 +698,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByOrderIdSyncResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderSync request test', () => { /** @@ -698,10 +732,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderSyncResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderTest request test', () => { /** @@ -730,10 +766,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRecentTradeHistoryOld request test', () => { /** @@ -761,10 +799,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRecentTradeHistoryOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getRecentOrdersListOld request test', () => { /** @@ -792,10 +832,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetRecentOrdersListOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByClientOidOld request test', () => { /** @@ -823,10 +865,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByClientOidOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByClientOidOld request test', () => { /** @@ -854,10 +898,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByClientOidOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchCancelOrderOld request test', () => { /** @@ -885,10 +931,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchCancelOrderOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrdersListOld request test', () => { /** @@ -917,10 +965,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrdersListOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchAddOrdersOld request test', () => { /** @@ -949,10 +999,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchAddOrdersOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOrderByOrderIdOld request test', () => { /** @@ -980,10 +1032,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOrderByOrderIdOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOrderByOrderIdOld request test', () => { /** @@ -1011,10 +1065,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOrderByOrderIdOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderOld request test', () => { /** @@ -1043,10 +1099,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOrderTestOld request test', () => { /** @@ -1075,10 +1133,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOrderTestOldResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchCancelStopOrder request test', () => { /** @@ -1107,10 +1167,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchCancelStopOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelStopOrderByClientOid request test', () => { /** @@ -1138,10 +1200,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelStopOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getStopOrdersList request test', () => { /** @@ -1170,10 +1234,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetStopOrdersListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelStopOrderByOrderId request test', () => { /** @@ -1201,10 +1267,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelStopOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getStopOrderByOrderId request test', () => { /** @@ -1232,10 +1300,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetStopOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addStopOrder request test', () => { /** @@ -1264,10 +1334,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddStopOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getStopOrderByClientOid request test', () => { /** @@ -1296,10 +1368,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetStopOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOcoOrderByClientOid request test', () => { /** @@ -1327,10 +1401,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOcoOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOcoOrderByClientOid request test', () => { /** @@ -1358,10 +1434,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOcoOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOcoOrderDetailByOrderId request test', () => { /** @@ -1389,10 +1467,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOcoOrderDetailByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('cancelOcoOrderByOrderId request test', () => { /** @@ -1420,10 +1500,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new CancelOcoOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOcoOrderByOrderId request test', () => { /** @@ -1451,10 +1533,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOcoOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('addOcoOrder request test', () => { /** @@ -1482,10 +1566,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new AddOcoOrderResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('batchCancelOcoOrders request test', () => { /** @@ -1514,10 +1600,12 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new BatchCancelOcoOrdersResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getOcoOrderList request test', () => { /** @@ -1546,9 +1634,11 @@ describe('Auto Test', () => { let commonResp = RestResponse.fromJson(data); let resp = new GetOcoOrderListResp(); resp = resp.fromObject(commonResp.data); - expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(resp); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); }); diff --git a/sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts b/sdk/node/src/generate/spot/spotprivate/api_spot_private.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 0e0abe58..fb69594b 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -84,7 +84,7 @@ export class AccountEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new AccountEvent().fromObject(msg.rawData); + let event = new AccountEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts index 4e74857b..cbf2b49b 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -210,7 +210,7 @@ export class OrderV1EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderV1Event().fromObject(msg.rawData); + let event = new OrderV1Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index 6cf0cd44..be74e34d 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -214,7 +214,7 @@ export class OrderV2EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderV2Event().fromObject(msg.rawData); + let event = new OrderV2Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts b/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts new file mode 100644 index 00000000..4d7f7069 --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts @@ -0,0 +1,55 @@ +import { OrderV2Event } from './model_order_v2_event'; +import { AccountEvent } from './model_account_event'; +import { OrderV1Event } from './model_order_v1_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('account response test', () => { + /** + * account + * Get Account Balance + * /account/account/balance + */ + let data = + '{"topic":"/account/balance","type":"message","subject":"account.balance","id":"354689988084000","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"accountId":"548674591753","currency":"USDT","total":"21.133773386762","available":"20.132773386762","hold":"1.001","availableChange":"-0.5005","holdChange":"0.5005","relationContext":{"symbol":"BTC-USDT","orderId":"6721d0632db25b0007071fdc"},"relationEvent":"trade.hold","relationEventId":"354689988084000","time":"1730269283892"}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new AccountEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderV1 response test', () => { + /** + * orderV1 + * Get Order(V1) + * /orderV1/spotMarket/tradeOrders + */ + let data = + '{"topic":"/spotMarket/tradeOrdersV2","type":"message","subject":"orderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"canceledSize":"0","clientOid":"5c52e11203aa677f33e493fb","filledSize":"0","orderId":"6720ecd9ec71f4000747731a","orderTime":1730211033305,"orderType":"limit","originSize":"0.00001","price":"50000","remainSize":"0.00001","side":"buy","size":"0.00001","status":"open","symbol":"BTC-USDT","ts":1730211033335000000,"type":"open"}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderV1Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderV2 response test', () => { + /** + * orderV2 + * Get Order(V2) + * /orderV2/spotMarket/tradeOrdersV2 + */ + let data = + '{"topic":"/spotMarket/tradeOrdersV2","type":"message","subject":"orderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"clientOid":"5c52e11203aa677f33e493fc","orderId":"6720da3fa30a360007f5f832","orderTime":1730206271588,"orderType":"market","originSize":"0.00001","side":"buy","status":"new","symbol":"BTC-USDT","ts":1730206271616000000,"type":"received"}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderV2Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts b/sdk/node/src/generate/spot/spotpublic/api_spot_public.test.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index 30fe8895..a3ecedf4 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -75,7 +75,7 @@ export class AllTickersEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new AllTickersEvent().fromObject(msg.rawData); + let event = new AllTickersEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index 8c917d7b..5ddc2fc9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -51,7 +51,7 @@ export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new KlinesEvent().fromObject(msg.rawData); + let event = new KlinesEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index a119671a..f499d54f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -52,7 +52,7 @@ export class MarketSnapshotEventCallbackWrapper implements WebSocketMessageCallb } onMessage(msg: WsMessage): void { - let event = new MarketSnapshotEvent().fromObject(msg.rawData); + let event = new MarketSnapshotEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index 11c562b3..d145b9e7 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -64,7 +64,7 @@ export class OrderbookIncrementEventCallbackWrapper implements WebSocketMessageC } onMessage(msg: WsMessage): void { - let event = new OrderbookIncrementEvent().fromObject(msg.rawData); + let event = new OrderbookIncrementEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts index 45c706f1..1620fa34 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -55,7 +55,7 @@ export class OrderbookLevel1EventCallbackWrapper implements WebSocketMessageCall } onMessage(msg: WsMessage): void { - let event = new OrderbookLevel1Event().fromObject(msg.rawData); + let event = new OrderbookLevel1Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index b20f9f7f..af99b53d 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -64,7 +64,7 @@ export class OrderbookLevel50EventCallbackWrapper implements WebSocketMessageCal } onMessage(msg: WsMessage): void { - let event = new OrderbookLevel50Event().fromObject(msg.rawData); + let event = new OrderbookLevel50Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts index 8aa3c57a..9490ce00 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -55,7 +55,7 @@ export class OrderbookLevel5EventCallbackWrapper implements WebSocketMessageCall } onMessage(msg: WsMessage): void { - let event = new OrderbookLevel5Event().fromObject(msg.rawData); + let event = new OrderbookLevel5Event().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index f6af42c3..4d5bdb84 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -52,7 +52,7 @@ export class SymbolSnapshotEventCallbackWrapper implements WebSocketMessageCallb } onMessage(msg: WsMessage): void { - let event = new SymbolSnapshotEvent().fromObject(msg.rawData); + let event = new SymbolSnapshotEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts index 4783b183..b6764ce2 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -71,7 +71,7 @@ export class TickerEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerEvent().fromObject(msg.rawData); + let event = new TickerEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index 5863a148..58141e9e 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -79,7 +79,7 @@ export class TradeEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TradeEvent().fromObject(msg.rawData); + let event = new TradeEvent().fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts b/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts new file mode 100644 index 00000000..0db49a8a --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts @@ -0,0 +1,174 @@ +import { OrderbookLevel5Event } from './model_orderbook_level5_event'; +import { KlinesEvent } from './model_klines_event'; +import { TickerEvent } from './model_ticker_event'; +import { SymbolSnapshotEvent } from './model_symbol_snapshot_event'; +import { OrderbookLevel1Event } from './model_orderbook_level1_event'; +import { AllTickersEvent } from './model_all_tickers_event'; +import { OrderbookIncrementEvent } from './model_orderbook_increment_event'; +import { TradeEvent } from './model_trade_event'; +import { OrderbookLevel50Event } from './model_orderbook_level50_event'; +import { MarketSnapshotEvent } from './model_market_snapshot_event'; +import { WsMessage } from '@model/common'; + +describe('Auto Test', () => { + test('allTickers response test', () => { + /** + * allTickers + * Get All Tickers + * /allTickers/market/ticker:all + */ + let data = + '{"topic":"/market/ticker:all","type":"message","subject":"BTC-USDT","data":{"bestAsk":"67218.7","bestAskSize":"1.92318539","bestBid":"67218.6","bestBidSize":"0.01045638","price":"67220","sequence":"14691455768","size":"0.00004316","time":1729757723612}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new AllTickersEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('klines response test', () => { + /** + * klines + * Klines + * /klines/market/candles:_symbol___type_ + */ + let data = + '{"topic":"/market/candles:BTC-USDT_1hour","type":"message","subject":"trade.candles.update","data":{"symbol":"BTC-USDT","candles":["1729839600","67644.9","67437.6","67724.8","67243.8","44.88321441","3027558.991928447"],"time":1729842192785164840}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new KlinesEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('marketSnapshot response test', () => { + /** + * marketSnapshot + * Market Snapshot + * /marketSnapshot/market/snapshot:_market_ + */ + let data = + '{"topic":"/market/snapshot:BTC","type":"message","subject":"trade.snapshot","data":{"sequence":"1729785948015","data":{"askSize":1375.1096,"averagePrice":0.00000262,"baseCurrency":"CHR","bidSize":152.0912,"board":0,"buy":0.00000263,"changePrice":0.00000005300000000000,"changeRate":0.0200,"close":0.000002698,"datetime":1729785948008,"high":0.00000274600000000000,"lastTradedPrice":0.000002698,"low":0.00000255800000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":false,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00000000900000000000,"changeRate":-0.0033,"high":0.00000270700000000000,"low":0.00000264200000000000,"open":0.00000270700000000000,"vol":27.10350000000000000000,"volValue":0.00007185015660000000},"marketChange24h":{"changePrice":0.00000005300000000000,"changeRate":0.0200,"high":0.00000274600000000000,"low":0.00000255800000000000,"open":0.00000264500000000000,"vol":6824.94800000000000000000,"volValue":0.01789509649520000000},"marketChange4h":{"changePrice":0.00000000600000000000,"changeRate":0.0022,"high":0.00000270700000000000,"low":0.00000264200000000000,"open":0.00000269200000000000,"vol":92.69020000000000000000,"volValue":0.00024903875740000000},"markets":["BTC","DePIN","Layer 1"],"open":0.00000264500000000000,"quoteCurrency":"BTC","sell":0.000002695,"siteTypes":["global"],"sort":100,"symbol":"CHR-BTC","symbolCode":"CHR-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":6824.94800000000000000000,"volValue":0.01789509649520000000}}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new MarketSnapshotEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookIncrement response test', () => { + /** + * orderbookIncrement + * Orderbook - Increment + * /orderbookIncrement/market/level2:_symbol_,_symbol_ + */ + let data = + '{"topic":"/market/level2:BTC-USDT","type":"message","subject":"trade.l2update","data":{"changes":{"asks":[["67993.3","1.21427407","14701689783"]],"bids":[]},"sequenceEnd":14701689783,"sequenceStart":14701689783,"symbol":"BTC-USDT","time":1729816425625}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookIncrementEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookLevel1 response test', () => { + /** + * orderbookLevel1 + * Orderbook - Level1 + * /orderbookLevel1/spotMarket/level1:_symbol_,_symbol_ + */ + let data = + '{"topic":"/spotMarket/level1:BTC-USDT","type":"message","subject":"level1","data":{"asks":["68145.8","0.51987471"],"bids":["68145.7","1.29267802"],"timestamp":1729816058766}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookLevel1Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookLevel50 response test', () => { + /** + * orderbookLevel50 + * Orderbook - Level50 + * /orderbookLevel50/market/level2:_symbol_,_symbol_ + */ + let data = + '{"topic":"/spotMarket/level2Depth50:BTC-USDT","type":"message","subject":"level2","data":{"asks":[["95964.3","0.08168874"],["95967.9","0.00985094"],["95969.9","0.00078081"],["95971.2","0.10016039"],["95971.3","0.12531139"],["95971.7","0.00291"],["95971.9","0.10271829"],["95973.3","0.00021"],["95974.7","0.10271829"],["95976.9","0.03095177"],["95977","0.10271829"],["95978.7","0.00022411"],["95979.1","0.00023017"],["95981","0.00022008"],["95981.2","0.14330324"],["95982.3","0.27922082"],["95982.5","0.02302674"],["95983.8","0.00011035"],["95985","0.00104222"],["95985.1","0.00021808"],["95985.5","0.211127"],["95986.2","0.09690904"],["95986.3","0.31261"],["95986.9","0.09225037"],["95987","0.01042013"],["95990.5","0.12712438"],["95990.6","0.0916115"],["95992.2","0.279"],["95992.7","0.00521084"],["95995.2","0.00033"],["95999.1","0.02973561"],["96001.1","0.083825"],["96002.6","0.01900906"],["96002.7","0.00041665"],["96002.8","0.12531139"],["96002.9","0.279"],["96004.8","0.02081884"],["96006.3","0.00065542"],["96008.5","0.00033166"],["96011","0.08776246"],["96012.5","0.279"],["96013.3","0.00066666"],["96013.9","0.26097183"],["96014","0.01087009"],["96017","0.06248892"],["96017.1","0.20829641"],["96022","0.00107066"],["96022.1","0.279"],["96022.9","0.0006499"],["96024.6","0.00104131"]],"bids":[["95964.2","1.35483359"],["95964.1","0.01117492"],["95962.1","0.0062"],["95961.8","0.03081549"],["95961.7","0.10271829"],["95958.5","0.04681571"],["95958.4","0.05177498"],["95958.2","0.00155911"],["95957.8","0.10271829"],["95954.7","0.16312181"],["95954.6","0.44102109"],["95952.6","0.10271829"],["95951.3","0.0062"],["95951","0.17075141"],["95950.9","0.279"],["95949.5","0.13567811"],["95949.2","0.05177498"],["95948.3","0.10271829"],["95947.2","0.04634798"],["95944.7","0.10271829"],["95944.2","0.05177498"],["95942.3","0.26028569"],["95942.2","0.10271829"],["95940.6","0.12531139"],["95940.2","0.43349327"],["95938.3","0.01041604"],["95937.4","0.04957577"],["95937.2","0.00305"],["95936.3","0.10271829"],["95934","0.05177498"],["95931.9","0.03394093"],["95931.8","0.10271829"],["95930","0.01041814"],["95927.9","0.10271829"],["95927","0.13312774"],["95926.9","0.33077498"],["95924.9","0.10271829"],["95924","0.00180915"],["95923.8","0.00022434"],["95919.6","0.00021854"],["95919.1","0.01471872"],["95919","0.05177498"],["95918.1","0.00001889"],["95917.8","0.1521089"],["95917.5","0.00010962"],["95916.2","0.00021958"],["95915.5","0.12531139"],["95915.3","0.279"],["95913.6","0.01739249"],["95913.5","0.05177498"]],"timestamp":1733124805073}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookLevel50Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('orderbookLevel5 response test', () => { + /** + * orderbookLevel5 + * Orderbook - Level5 + * /orderbookLevel5/spotMarket/level2Depth5:_symbol_,_symbol_ + */ + let data = + '{"topic":"/spotMarket/level2Depth5:BTC-USDT","type":"message","subject":"level2","data":{"asks":[["67996.7","1.14213262"],["67996.8","0.21748212"],["67996.9","0.1503747"],["67997","0.11446863"],["67997.1","0.14842782"]],"bids":[["67996.6","0.37969491"],["67995.3","0.20779746"],["67994.5","0.00047785"],["67993.4","0.405"],["67993.3","0.13528566"]],"timestamp":1729822226746}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new OrderbookLevel5Event(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('symbolSnapshot response test', () => { + /** + * symbolSnapshot + * Symbol Snapshot + * /symbolSnapshot/market/snapshot:_symbol_ + */ + let data = + '{"topic":"/market/snapshot:BTC-USDT","type":"message","subject":"trade.snapshot","data":{"sequence":"14691517895","data":{"askSize":1.15955795,"averagePrice":66867.89967612,"baseCurrency":"BTC","bidSize":0.81772627,"board":1,"buy":67158.1,"changePrice":315.20000000000000000000,"changeRate":0.0047,"close":67158.1,"datetime":1729758286011,"high":67611.80000000000000000000,"lastTradedPrice":67158.1,"low":65257.10000000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"USDS","marketChange1h":{"changePrice":-102.10000000000000000000,"changeRate":-0.0015,"high":67310.60000000000000000000,"low":67051.80000000000000000000,"open":67260.20000000000000000000,"vol":53.73698081000000000000,"volValue":3609965.13819127700000000000},"marketChange24h":{"changePrice":315.20000000000000000000,"changeRate":0.0047,"high":67611.80000000000000000000,"low":65257.10000000000000000000,"open":66842.90000000000000000000,"vol":2227.69895852000000000000,"volValue":147972941.07857507300000000000},"marketChange4h":{"changePrice":-166.30000000000000000000,"changeRate":-0.0024,"high":67476.60000000000000000000,"low":67051.80000000000000000000,"open":67324.40000000000000000000,"vol":173.76971188000000000000,"volValue":11695949.43841656500000000000},"markets":["USDS","PoW"],"open":66842.90000000000000000000,"quoteCurrency":"USDT","sell":67158.2,"siteTypes":["turkey","thailand","global"],"sort":100,"symbol":"BTC-USDT","symbolCode":"BTC-USDT","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2227.69895852000000000000,"volValue":147972941.07857507300000000000}}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new SymbolSnapshotEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('ticker response test', () => { + /** + * ticker + * Get Ticker + * /ticker/market/ticker:_symbol_,_symbol_ + */ + let data = + '{"type":"message","topic":"/market/ticker:BTC-USDT","subject":"trade.ticker","data":{"sequence":"1545896668986","price":"0.08","size":"0.011","bestAsk":"0.08","bestAskSize":"0.18","bestBid":"0.049","bestBidSize":"0.036","Time":1704873323416}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new TickerEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); + test('trade response test', () => { + /** + * trade + * Trade + * /trade/market/match:_symbol_,_symbol_ + */ + let data = + '{"topic":"/market/match:BTC-USDT","type":"message","subject":"trade.l3match","data":{"makerOrderId":"671b5007389355000701b1d3","price":"67523","sequence":"11067996711960577","side":"buy","size":"0.003","symbol":"BTC-USDT","takerOrderId":"671b50161777ff00074c168d","time":"1729843222921000000","tradeId":"11067996711960577","type":"match"}}'; + let commonResp = WsMessage.fromJson(data); + let resp = new TradeEvent(); + resp = resp.fromObject(commonResp.data); + expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(resp); + }); +}); diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index 24b9c580..74f3d0ab 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -63,19 +63,19 @@ export function checkRestResponseError(resp: RestResponse): Error | null { /** * WsMessage represents a message between the WebSocket client and server. */ -export interface WsMessage { +export class WsMessage { /** * A unique identifier for the message */ - id: string; + id?: string; /** * The type of the message (e.g., WelcomeMessage) */ - type: string; + type?: string; /** * Sequence number to track the order of messages */ - sn: number; + sn?: number; /** * The topic or channel the message is associated with */ @@ -87,13 +87,22 @@ export interface WsMessage { /** * Indicates if the message belongs to a private channel */ - privateChannel: boolean; + privateChannel?: boolean; /** * Specifies whether the message is a response */ - response: boolean; + response?: boolean; /** * Raw JSON payload containing additional message data */ - rawData: any; + data: any; + + constructor() { + this.topic = ''; + this.subject = ''; + } + + static fromJson(json: string): WsMessage { + return plainToInstance(WsMessage, JSON.parse(json)); + } } From 9ed296df5b848adad8b5658e385233f69fb2482e Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 10 Jan 2025 15:09:46 +0800 Subject: [PATCH 015/106] feat(nodejs): add api template --- .../plugin/generator/NodeSdkGenerator.java | 3 + .../node-sdk/api_test_template.mustache | 38 + .../sdk/plugin/SdkGeneratorTest.java | 4 +- .../account/account/api_account.template | 270 ++++ .../account/account/api_account.template.ts | 176 +++ .../account/deposit/api_deposit.template | 138 ++ .../src/generate/account/fee/api_fee.template | 56 + .../subaccount/api_sub_account.template | 226 +++ .../account/transfer/api_transfer.template | 137 ++ .../withdrawal/api_withdrawal.template | 121 ++ .../affiliate/api_affiliate.template | 25 + .../broker/apibroker/api_api_broker.template | 23 + .../broker/ndbroker/api_nd_broker.template | 262 ++++ .../src/generate/earn/earn/api_earn.template | 157 +++ .../fundingfees/api_funding_fees.template | 60 + .../futures/market/api_market.template | 331 +++++ .../generate/futures/order/api_order.template | 371 +++++ .../futures/positions/api_positions.template | 307 +++++ .../margin/credit/api_credit.template | 121 ++ .../generate/margin/debit/api_debit.template | 116 ++ .../margin/market/api_market.template | 95 ++ .../generate/margin/order/api_order.template | 290 ++++ .../margin/risklimit/api_risk_limit.template | 23 + .../generate/spot/market/api_market.template | 1216 +++++++++++++++++ .../generate/spot/order/api_order.template | 935 +++++++++++++ sdk/node/src/generate/version.ts | 2 +- .../viplending/api_vip_lending.template | 37 + 27 files changed, 5537 insertions(+), 3 deletions(-) create mode 100644 sdk/node/src/generate/account/account/api_account.template.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 3f93d405..78b537f9 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -411,8 +411,11 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List reqName.equalsIgnoreCase((String) m.get("importPath"))). forEach(m -> op.vendorExtensions.put("x-request-model", m.getModel())); + allModels.stream().filter(m -> responseName.equalsIgnoreCase((String) m.get("importPath"))). + forEach(m -> op.vendorExtensions.put("x-response-model", m.getModel())); break; } } diff --git a/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache b/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache index e69de29b..5e02adfb 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache @@ -0,0 +1,38 @@ +{{#imports}} +{{{.}}} +{{/imports}} + +describe('Auto Test', ()=> { + let api: {{classname}}; + + beforeAll(()=> { + api = ?? + }); +{{#operations}} + {{#operation}} + test('{{vendorExtensions.x-meta.method}} request test', ()=> { + /** + * {{vendorExtensions.x-meta.method}} + * {{summary}} + * {{path}} + */ + {{#hasParams}} + let builder = {{vendorExtensions.x-meta.methodServiceFmt}}Req.builder(); + {{#vendorExtensions.x-request-model}} + builder{{#vars}}.set{{nameInPascalCase}}(?){{/vars}}; + {{/vendorExtensions.x-request-model}} + let req = builder.build(); + {{/hasParams}} + let resp = api.{{vendorExtensions.x-meta.method}}({{#hasParams}}req{{/hasParams}}); + return resp.then(result => { + {{#vendorExtensions.x-response-model}} + {{#vars}} + expect(result.{{name}}).toEqual(expect.anything()); + {{/vars}} + {{/vendorExtensions.x-response-model}} + }); + }) + + {{/operation}} +{{/operations}} +}) \ No newline at end of file diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 2558652c..86b9d75f 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,8 +8,8 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-viplending-viplending.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-viplending.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-account.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; diff --git a/sdk/node/src/generate/account/account/api_account.template b/sdk/node/src/generate/account/account/api_account.template index e69de29b..8cda5c02 100644 --- a/sdk/node/src/generate/account/account/api_account.template +++ b/sdk/node/src/generate/account/account/api_account.template @@ -0,0 +1,270 @@ + +describe('Auto Test', ()=> { + let api: AccountAPI; + + beforeAll(()=> { + api = ?? + }); + test('getFuturesAccount request test', ()=> { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let builder = GetFuturesAccountReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getFuturesAccount(req); + return resp.then(result => { + expect(result.accountEquity).toEqual(expect.anything()); + expect(result.unrealisedPNL).toEqual(expect.anything()); + expect(result.marginBalance).toEqual(expect.anything()); + expect(result.positionMargin).toEqual(expect.anything()); + expect(result.orderMargin).toEqual(expect.anything()); + expect(result.frozenFunds).toEqual(expect.anything()); + expect(result.availableBalance).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.riskRatio).toEqual(expect.anything()); + }); + }) + + test('getSpotAccountDetail request test', ()=> { + /** + * getSpotAccountDetail + * Get Account Detail - Spot + * /api/v1/accounts/{accountId} + */ + let builder = GetSpotAccountDetailReq.builder(); + builder.setAccountId(?); + let req = builder.build(); + let resp = api.getSpotAccountDetail(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.balance).toEqual(expect.anything()); + expect(result.available).toEqual(expect.anything()); + expect(result.holds).toEqual(expect.anything()); + }); + }) + + test('getSpotAccountList request test', ()=> { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let builder = GetSpotAccountListReq.builder(); + builder.setCurrency(?).setType(?); + let req = builder.build(); + let resp = api.getSpotAccountList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSpotLedger request test', ()=> { + /** + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers + */ + let builder = GetSpotLedgerReq.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getSpotLedger(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getSpotHFLedger request test', ()=> { + /** + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers + */ + let builder = GetSpotHFLedgerReq.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getSpotHFLedger(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSpotAccountType request test', ()=> { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + let resp = api.getSpotAccountType(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getIsolatedMarginAccountDetailV1 request test', ()=> { + /** + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} + */ + let builder = GetIsolatedMarginAccountDetailV1Req.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getIsolatedMarginAccountDetailV1(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.baseAsset).toEqual(expect.anything()); + expect(result.quoteAsset).toEqual(expect.anything()); + }); + }) + + test('getIsolatedMarginAccountListV1 request test', ()=> { + /** + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts + */ + let builder = GetIsolatedMarginAccountListV1Req.builder(); + builder.setBalanceCurrency(?); + let req = builder.build(); + let resp = api.getIsolatedMarginAccountListV1(req); + return resp.then(result => { + expect(result.totalConversionBalance).toEqual(expect.anything()); + expect(result.liabilityConversionBalance).toEqual(expect.anything()); + expect(result.assets).toEqual(expect.anything()); + }); + }) + + test('getMarginAccountDetail request test', ()=> { + /** + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account + */ + let resp = api.getMarginAccountDetail(); + return resp.then(result => { + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + }); + }) + + test('getFuturesLedger request test', ()=> { + /** + * getFuturesLedger + * Get Account Ledgers - Futures + * /api/v1/transaction-history + */ + let builder = GetFuturesLedgerReq.builder(); + builder.setCurrency(?).setType(?).setOffset(?).setForward(?).setMaxCount(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getFuturesLedger(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + }); + }) + + test('getApikeyInfo request test', ()=> { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + let resp = api.getApikeyInfo(); + return resp.then(result => { + expect(result.remark).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.isMaster).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + }); + }) + + test('getAccountInfo request test', ()=> { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + let resp = api.getAccountInfo(); + return resp.then(result => { + expect(result.level).toEqual(expect.anything()); + expect(result.subQuantity).toEqual(expect.anything()); + expect(result.spotSubQuantity).toEqual(expect.anything()); + expect(result.marginSubQuantity).toEqual(expect.anything()); + expect(result.futuresSubQuantity).toEqual(expect.anything()); + expect(result.optionSubQuantity).toEqual(expect.anything()); + expect(result.maxSubQuantity).toEqual(expect.anything()); + expect(result.maxDefaultSubQuantity).toEqual(expect.anything()); + expect(result.maxSpotSubQuantity).toEqual(expect.anything()); + expect(result.maxMarginSubQuantity).toEqual(expect.anything()); + expect(result.maxFuturesSubQuantity).toEqual(expect.anything()); + expect(result.maxOptionSubQuantity).toEqual(expect.anything()); + }); + }) + + test('getMarginHFLedger request test', ()=> { + /** + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers + */ + let builder = GetMarginHFLedgerReq.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getMarginHFLedger(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getIsolatedMarginAccount request test', ()=> { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let builder = GetIsolatedMarginAccountReq.builder(); + builder.setSymbol(?).setQuoteCurrency(?).setQueryType(?); + let req = builder.build(); + let resp = api.getIsolatedMarginAccount(req); + return resp.then(result => { + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.timestamp).toEqual(expect.anything()); + expect(result.assets).toEqual(expect.anything()); + }); + }) + + test('getCrossMarginAccount request test', ()=> { + /** + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts + */ + let builder = GetCrossMarginAccountReq.builder(); + builder.setQuoteCurrency(?).setQueryType(?); + let req = builder.build(); + let resp = api.getCrossMarginAccount(req); + return resp.then(result => { + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/account/api_account.template.ts b/sdk/node/src/generate/account/account/api_account.template.ts new file mode 100644 index 00000000..b7edd9be --- /dev/null +++ b/sdk/node/src/generate/account/account/api_account.template.ts @@ -0,0 +1,176 @@ + +describe('Auto Test', ()=> { + let api: AccountAPI; + + beforeAll(()=> { + api = ?? + }); + test('getFuturesAccount request test', ()=> { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let builder = GetFuturesAccount.builder(); + builder.setCurrency(?) + let req = builder.Build() + let resp = this.api.getFuturesAccount(req) + }) + + test('getSpotAccountDetail request test', ()=> { + /** + * getSpotAccountDetail + * Get Account Detail - Spot + * /api/v1/accounts/{accountId} + */ + let builder = GetSpotAccountDetail.builder(); + builder.setAccountId(?) + let req = builder.Build() + let resp = this.api.getSpotAccountDetail(req) + }) + + test('getSpotAccountList request test', ()=> { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let builder = GetSpotAccountList.builder(); + builder.setCurrency(?).setType(?) + let req = builder.Build() + let resp = this.api.getSpotAccountList(req) + }) + + test('getSpotLedger request test', ()=> { + /** + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers + */ + let builder = GetSpotLedger.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?) + let req = builder.Build() + let resp = this.api.getSpotLedger(req) + }) + + test('getSpotHFLedger request test', ()=> { + /** + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers + */ + let builder = GetSpotHFLedger.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?) + let req = builder.Build() + let resp = this.api.getSpotHFLedger(req) + }) + + test('getSpotAccountType request test', ()=> { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + let resp = this.api.getSpotAccountType() + }) + + test('getIsolatedMarginAccountDetailV1 request test', ()=> { + /** + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} + */ + let builder = GetIsolatedMarginAccountDetailV1.builder(); + builder.setSymbol(?) + let req = builder.Build() + let resp = this.api.getIsolatedMarginAccountDetailV1(req) + }) + + test('getIsolatedMarginAccountListV1 request test', ()=> { + /** + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts + */ + let builder = GetIsolatedMarginAccountListV1.builder(); + builder.setBalanceCurrency(?) + let req = builder.Build() + let resp = this.api.getIsolatedMarginAccountListV1(req) + }) + + test('getMarginAccountDetail request test', ()=> { + /** + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account + */ + let resp = this.api.getMarginAccountDetail() + }) + + test('getFuturesLedger request test', ()=> { + /** + * getFuturesLedger + * Get Account Ledgers - Futures + * /api/v1/transaction-history + */ + let builder = GetFuturesLedger.builder(); + builder.setCurrency(?).setType(?).setOffset(?).setForward(?).setMaxCount(?).setStartAt(?).setEndAt(?) + let req = builder.Build() + let resp = this.api.getFuturesLedger(req) + }) + + test('getApikeyInfo request test', ()=> { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + let resp = this.api.getApikeyInfo() + }) + + test('getAccountInfo request test', ()=> { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + let resp = this.api.getAccountInfo() + }) + + test('getMarginHFLedger request test', ()=> { + /** + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers + */ + let builder = GetMarginHFLedger.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?) + let req = builder.Build() + let resp = this.api.getMarginHFLedger(req) + }) + + test('getIsolatedMarginAccount request test', ()=> { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let builder = GetIsolatedMarginAccount.builder(); + builder.setSymbol(?).setQuoteCurrency(?).setQueryType(?) + let req = builder.Build() + let resp = this.api.getIsolatedMarginAccount(req) + }) + + test('getCrossMarginAccount request test', ()=> { + /** + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts + */ + let builder = GetCrossMarginAccount.builder(); + builder.setQuoteCurrency(?).setQueryType(?) + let req = builder.Build() + let resp = this.api.getCrossMarginAccount(req) + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/deposit/api_deposit.template b/sdk/node/src/generate/account/deposit/api_deposit.template index e69de29b..66ccd556 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.template +++ b/sdk/node/src/generate/account/deposit/api_deposit.template @@ -0,0 +1,138 @@ + +describe('Auto Test', ()=> { + let api: DepositAPI; + + beforeAll(()=> { + api = ?? + }); + test('getDepositAddressV1 request test', ()=> { + /** + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses + */ + let builder = GetDepositAddressV1Req.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.getDepositAddressV1(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.contractAddress).toEqual(expect.anything()); + }); + }) + + test('addDepositAddressV1 request test', ()=> { + /** + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses + */ + let builder = AddDepositAddressV1Req.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.addDepositAddressV1(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + }); + }) + + test('getDepositHistory request test', ()=> { + /** + * getDepositHistory + * Get Deposit History + * /api/v1/deposits + */ + let builder = GetDepositHistoryReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getDepositHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getDepositHistoryOld request test', ()=> { + /** + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits + */ + let builder = GetDepositHistoryOldReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getDepositHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getDepositAddressV2 request test', ()=> { + /** + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses + */ + let builder = GetDepositAddressV2Req.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getDepositAddressV2(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('addDepositAddressV3 request test', ()=> { + /** + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create + */ + let builder = AddDepositAddressV3Req.builder(); + builder.setCurrency(?).setChain(?).setTo(?).setAmount(?); + let req = builder.build(); + let resp = api.addDepositAddressV3(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.expirationDate).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.chainName).toEqual(expect.anything()); + }); + }) + + test('getDepositAddressV3 request test', ()=> { + /** + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses + */ + let builder = GetDepositAddressV3Req.builder(); + builder.setCurrency(?).setAmount(?).setChain(?); + let req = builder.build(); + let resp = api.getDepositAddressV3(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/fee/api_fee.template b/sdk/node/src/generate/account/fee/api_fee.template index e69de29b..1ff5b3e1 100644 --- a/sdk/node/src/generate/account/fee/api_fee.template +++ b/sdk/node/src/generate/account/fee/api_fee.template @@ -0,0 +1,56 @@ + +describe('Auto Test', ()=> { + let api: FeeAPI; + + beforeAll(()=> { + api = ?? + }); + test('getBasicFee request test', ()=> { + /** + * getBasicFee + * Get Basic Fee - Spot/Margin + * /api/v1/base-fee + */ + let builder = GetBasicFeeReq.builder(); + builder.setCurrencyType(?); + let req = builder.build(); + let resp = api.getBasicFee(req); + return resp.then(result => { + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + }); + }) + + test('getSpotActualFee request test', ()=> { + /** + * getSpotActualFee + * Get Actual Fee - Spot/Margin + * /api/v1/trade-fees + */ + let builder = GetSpotActualFeeReq.builder(); + builder.setSymbols(?); + let req = builder.build(); + let resp = api.getSpotActualFee(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getFuturesActualFee request test', ()=> { + /** + * getFuturesActualFee + * Get Actual Fee - Futures + * /api/v1/trade-fees + */ + let builder = GetFuturesActualFeeReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getFuturesActualFee(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.template b/sdk/node/src/generate/account/subaccount/api_sub_account.template index e69de29b..cb1623ce 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.template +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.template @@ -0,0 +1,226 @@ + +describe('Auto Test', ()=> { + let api: SubAccountAPI; + + beforeAll(()=> { + api = ?? + }); + test('getFuturesSubAccountListV2 request test', ()=> { + /** + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all + */ + let builder = GetFuturesSubAccountListV2Req.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getFuturesSubAccountListV2(req); + return resp.then(result => { + expect(result.summary).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + }); + }) + + test('getSpotSubAccountListV1 request test', ()=> { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + let resp = api.getSpotSubAccountListV1(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSpotSubAccountDetail request test', ()=> { + /** + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} + */ + let builder = GetSpotSubAccountDetailReq.builder(); + builder.setSubUserId(?).setIncludeBaseAmount(?); + let req = builder.build(); + let resp = api.getSpotSubAccountDetail(req); + return resp.then(result => { + expect(result.subUserId).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + expect(result.mainAccounts).toEqual(expect.anything()); + expect(result.tradeAccounts).toEqual(expect.anything()); + expect(result.marginAccounts).toEqual(expect.anything()); + expect(result.tradeHFAccounts).toEqual(expect.anything()); + }); + }) + + test('deleteSubAccountApi request test', ()=> { + /** + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key + */ + let builder = DeleteSubAccountApiReq.builder(); + builder.setApiKey(?).setSubName(?).setPassphrase(?); + let req = builder.build(); + let resp = api.deleteSubAccountApi(req); + return resp.then(result => { + expect(result.subName).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + }); + }) + + test('getSubAccountApiList request test', ()=> { + /** + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key + */ + let builder = GetSubAccountApiListReq.builder(); + builder.setApiKey(?).setSubName(?); + let req = builder.build(); + let resp = api.getSubAccountApiList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('addSubAccountApi request test', ()=> { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key + */ + let builder = AddSubAccountApiReq.builder(); + builder.setPassphrase(?).setRemark(?).setPermission(?).setIpWhitelist(?).setExpire(?).setSubName(?); + let req = builder.build(); + let resp = api.addSubAccountApi(req); + return resp.then(result => { + expect(result.subName).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiSecret).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.passphrase).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + + test('modifySubAccountApi request test', ()=> { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update + */ + let builder = ModifySubAccountApiReq.builder(); + builder.setPassphrase(?).setPermission(?).setIpWhitelist(?).setExpire(?).setSubName(?).setApiKey(?); + let req = builder.build(); + let resp = api.modifySubAccountApi(req); + return resp.then(result => { + expect(result.subName).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + }); + }) + + test('getSpotSubAccountsSummaryV1 request test', ()=> { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + let resp = api.getSpotSubAccountsSummaryV1(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSpotSubAccountListV2 request test', ()=> { + /** + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts + */ + let builder = GetSpotSubAccountListV2Req.builder(); + builder.setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getSpotSubAccountListV2(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('addSubAccount request test', ()=> { + /** + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created + */ + let builder = AddSubAccountReq.builder(); + builder.setPassword(?).setRemarks(?).setSubName(?).setAccess(?); + let req = builder.build(); + let resp = api.addSubAccount(req); + return resp.then(result => { + expect(result.uid).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + expect(result.remarks).toEqual(expect.anything()); + expect(result.access).toEqual(expect.anything()); + }); + }) + + test('getSpotSubAccountsSummaryV2 request test', ()=> { + /** + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user + */ + let builder = GetSpotSubAccountsSummaryV2Req.builder(); + builder.setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getSpotSubAccountsSummaryV2(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('addSubAccountFuturesPermission request test', ()=> { + /** + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable + */ + let builder = AddSubAccountFuturesPermissionReq.builder(); + builder.setUid(?); + let req = builder.build(); + let resp = api.addSubAccountFuturesPermission(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('addSubAccountMarginPermission request test', ()=> { + /** + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable + */ + let builder = AddSubAccountMarginPermissionReq.builder(); + builder.setUid(?); + let req = builder.build(); + let resp = api.addSubAccountMarginPermission(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/transfer/api_transfer.template b/sdk/node/src/generate/account/transfer/api_transfer.template index e69de29b..3d031742 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.template +++ b/sdk/node/src/generate/account/transfer/api_transfer.template @@ -0,0 +1,137 @@ + +describe('Auto Test', ()=> { + let api: TransferAPI; + + beforeAll(()=> { + api = ?? + }); + test('getTransferQuotas request test', ()=> { + /** + * getTransferQuotas + * Get Transfer Quotas + * /api/v1/accounts/transferable + */ + let builder = GetTransferQuotasReq.builder(); + builder.setCurrency(?).setType(?).setTag(?); + let req = builder.build(); + let resp = api.getTransferQuotas(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.balance).toEqual(expect.anything()); + expect(result.available).toEqual(expect.anything()); + expect(result.holds).toEqual(expect.anything()); + expect(result.transferable).toEqual(expect.anything()); + }); + }) + + test('futuresAccountTransferIn request test', ()=> { + /** + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in + */ + let builder = FuturesAccountTransferInReq.builder(); + builder.setCurrency(?).setAmount(?).setPayAccountType(?); + let req = builder.build(); + let resp = api.futuresAccountTransferIn(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getFuturesAccountTransferOutLedger request test', ()=> { + /** + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list + */ + let builder = GetFuturesAccountTransferOutLedgerReq.builder(); + builder.setCurrency(?).setType(?).setTag(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getFuturesAccountTransferOutLedger(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('innerTransfer request test', ()=> { + /** + * innerTransfer + * Inner Transfer + * /api/v2/accounts/inner-transfer + */ + let builder = InnerTransferReq.builder(); + builder.setClientOid(?).setCurrency(?).setAmount(?).setTo(?).setFromTag(?).setToTag(?).setFrom(?); + let req = builder.build(); + let resp = api.innerTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('subAccountTransfer request test', ()=> { + /** + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer + */ + let builder = SubAccountTransferReq.builder(); + builder.setClientOid(?).setCurrency(?).setAmount(?).setDirection(?).setAccountType(?).setSubAccountType(?).setSubUserId(?); + let req = builder.build(); + let resp = api.subAccountTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('flexTransfer request test', ()=> { + /** + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer + */ + let builder = FlexTransferReq.builder(); + builder.setClientOid(?).setCurrency(?).setAmount(?).setFromUserId(?).setFromAccountType(?).setFromAccountTag(?).setType(?).setToUserId(?).setToAccountType(?).setToAccountTag(?); + let req = builder.build(); + let resp = api.flexTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('futuresAccountTransferOut request test', ()=> { + /** + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out + */ + let builder = FuturesAccountTransferOutReq.builder(); + builder.setCurrency(?).setAmount(?).setRecAccountType(?); + let req = builder.build(); + let resp = api.futuresAccountTransferOut(req); + return resp.then(result => { + expect(result.applyId).toEqual(expect.anything()); + expect(result.bizNo).toEqual(expect.anything()); + expect(result.payAccountType).toEqual(expect.anything()); + expect(result.payTag).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.recAccountType).toEqual(expect.anything()); + expect(result.recTag).toEqual(expect.anything()); + expect(result.recRemark).toEqual(expect.anything()); + expect(result.recSystem).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.sn).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.template b/sdk/node/src/generate/account/withdrawal/api_withdrawal.template index e69de29b..ff6b304e 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.template +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.template @@ -0,0 +1,121 @@ + +describe('Auto Test', ()=> { + let api: WithdrawalAPI; + + beforeAll(()=> { + api = ?? + }); + test('getWithdrawalHistoryOld request test', ()=> { + /** + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals + */ + let builder = GetWithdrawalHistoryOldReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getWithdrawalHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getWithdrawalHistory request test', ()=> { + /** + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals + */ + let builder = GetWithdrawalHistoryReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getWithdrawalHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('withdrawalV1 request test', ()=> { + /** + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals + */ + let builder = WithdrawalV1Req.builder(); + builder.setCurrency(?).setChain(?).setAddress(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?); + let req = builder.build(); + let resp = api.withdrawalV1(req); + return resp.then(result => { + expect(result.withdrawalId).toEqual(expect.anything()); + }); + }) + + test('getWithdrawalQuotas request test', ()=> { + /** + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas + */ + let builder = GetWithdrawalQuotasReq.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.getWithdrawalQuotas(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.limitBTCAmount).toEqual(expect.anything()); + expect(result.usedBTCAmount).toEqual(expect.anything()); + expect(result.quotaCurrency).toEqual(expect.anything()); + expect(result.limitQuotaCurrencyAmount).toEqual(expect.anything()); + expect(result.usedQuotaCurrencyAmount).toEqual(expect.anything()); + expect(result.remainAmount).toEqual(expect.anything()); + expect(result.availableAmount).toEqual(expect.anything()); + expect(result.withdrawMinFee).toEqual(expect.anything()); + expect(result.innerWithdrawMinFee).toEqual(expect.anything()); + expect(result.withdrawMinSize).toEqual(expect.anything()); + expect(result.isWithdrawEnabled).toEqual(expect.anything()); + expect(result.precision).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.lockedAmount).toEqual(expect.anything()); + }); + }) + + test('cancelWithdrawal request test', ()=> { + /** + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} + */ + let builder = CancelWithdrawalReq.builder(); + builder.setWithdrawalId(?); + let req = builder.build(); + let resp = api.cancelWithdrawal(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('withdrawalV3 request test', ()=> { + /** + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals + */ + let builder = WithdrawalV3Req.builder(); + builder.setCurrency(?).setChain(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?).setToAddress(?).setWithdrawType(?); + let req = builder.build(); + let resp = api.withdrawalV3(req); + return resp.then(result => { + expect(result.withdrawalId).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template index e69de29b..920648be 100644 --- a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template +++ b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template @@ -0,0 +1,25 @@ + +describe('Auto Test', ()=> { + let api: AffiliateAPI; + + beforeAll(()=> { + api = ?? + }); + test('getAccount request test', ()=> { + /** + * getAccount + * Get Account + * /api/v2/affiliate/inviter/statistics + */ + let resp = api.getAccount(); + return resp.then(result => { + expect(result.parentUid).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + expect(result.ltv).toEqual(expect.anything()); + expect(result.totalMarginAmount).toEqual(expect.anything()); + expect(result.transferMarginAmount).toEqual(expect.anything()); + expect(result.margins).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.template b/sdk/node/src/generate/broker/apibroker/api_api_broker.template index e69de29b..eccf2010 100644 --- a/sdk/node/src/generate/broker/apibroker/api_api_broker.template +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.template @@ -0,0 +1,23 @@ + +describe('Auto Test', ()=> { + let api: APIBrokerAPI; + + beforeAll(()=> { + api = ?? + }); + test('getRebase request test', ()=> { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/api/rebase/download + */ + let builder = GetRebaseReq.builder(); + builder.setBegin(?).setEnd(?).setTradeType(?); + let req = builder.build(); + let resp = api.getRebase(req); + return resp.then(result => { + expect(result.url).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template index e69de29b..215fcdad 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template @@ -0,0 +1,262 @@ + +describe('Auto Test', ()=> { + let api: NDBrokerAPI; + + beforeAll(()=> { + api = ?? + }); + test('getDepositList request test', ()=> { + /** + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list + */ + let builder = GetDepositListReq.builder(); + builder.setCurrency(?).setStatus(?).setHash(?).setStartTimestamp(?).setEndTimestamp(?).setLimit(?); + let req = builder.build(); + let resp = api.getDepositList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('deleteSubAccountAPI request test', ()=> { + /** + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = DeleteSubAccountAPIReq.builder(); + builder.setUid(?).setApiKey(?); + let req = builder.build(); + let resp = api.deleteSubAccountAPI(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSubAccountAPI request test', ()=> { + /** + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = GetSubAccountAPIReq.builder(); + builder.setUid(?).setApiKey(?); + let req = builder.build(); + let resp = api.getSubAccountAPI(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('addSubAccountApi request test', ()=> { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = AddSubAccountApiReq.builder(); + builder.setUid(?).setPassphrase(?).setIpWhitelist(?).setPermissions(?).setLabel(?); + let req = builder.build(); + let resp = api.addSubAccountApi(req); + return resp.then(result => { + expect(result.uid).toEqual(expect.anything()); + expect(result.label).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.secretKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permissions).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + + test('getSubAccount request test', ()=> { + /** + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account + */ + let builder = GetSubAccountReq.builder(); + builder.setUid(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getSubAccount(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('addSubAccount request test', ()=> { + /** + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account + */ + let builder = AddSubAccountReq.builder(); + builder.setAccountName(?); + let req = builder.build(); + let resp = api.addSubAccount(req); + return resp.then(result => { + expect(result.accountName).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + }); + }) + + test('modifySubAccountApi request test', ()=> { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey + */ + let builder = ModifySubAccountApiReq.builder(); + builder.setUid(?).setIpWhitelist(?).setPermissions(?).setLabel(?).setApiKey(?); + let req = builder.build(); + let resp = api.modifySubAccountApi(req); + return resp.then(result => { + expect(result.uid).toEqual(expect.anything()); + expect(result.label).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permissions).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + + test('getBrokerInfo request test', ()=> { + /** + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info + */ + let builder = GetBrokerInfoReq.builder(); + builder.setBegin(?).setEnd(?).setTradeType(?); + let req = builder.build(); + let resp = api.getBrokerInfo(req); + return resp.then(result => { + expect(result.accountSize).toEqual(expect.anything()); + expect(result.maxAccountSize).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + }); + }) + + test('getRebase request test', ()=> { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download + */ + let builder = GetRebaseReq.builder(); + builder.setBegin(?).setEnd(?).setTradeType(?); + let req = builder.build(); + let resp = api.getRebase(req); + return resp.then(result => { + expect(result.url).toEqual(expect.anything()); + }); + }) + + test('transfer request test', ()=> { + /** + * transfer + * Transfer + * /api/v1/broker/nd/transfer + */ + let builder = TransferReq.builder(); + builder.setCurrency(?).setAmount(?).setDirection(?).setAccountType(?).setSpecialUid(?).setSpecialAccountType(?).setClientOid(?); + let req = builder.build(); + let resp = api.transfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('getDepositDetail request test', ()=> { + /** + * getDepositDetail + * Get Deposit Detail + * /api/v3/broker/nd/deposit/detail + */ + let builder = GetDepositDetailReq.builder(); + builder.setCurrency(?).setHash(?); + let req = builder.build(); + let resp = api.getDepositDetail(req); + return resp.then(result => { + expect(result.chain).toEqual(expect.anything()); + expect(result.hash).toEqual(expect.anything()); + expect(result.walletTxId).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.address).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.isInner).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + + test('getTransferHistory request test', ()=> { + /** + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail + */ + let builder = GetTransferHistoryReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getTransferHistory(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.fromUid).toEqual(expect.anything()); + expect(result.fromAccountType).toEqual(expect.anything()); + expect(result.fromAccountTag).toEqual(expect.anything()); + expect(result.toUid).toEqual(expect.anything()); + expect(result.toAccountType).toEqual(expect.anything()); + expect(result.toAccountTag).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + + test('getWithdrawDetail request test', ()=> { + /** + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail + */ + let builder = GetWithdrawDetailReq.builder(); + builder.setWithdrawalId(?); + let req = builder.build(); + let resp = api.getWithdrawDetail(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.walletTxId).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.address).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.isInner).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/earn/earn/api_earn.template b/sdk/node/src/generate/earn/earn/api_earn.template index e69de29b..cddf738f 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.template +++ b/sdk/node/src/generate/earn/earn/api_earn.template @@ -0,0 +1,157 @@ + +describe('Auto Test', ()=> { + let api: EarnAPI; + + beforeAll(()=> { + api = ?? + }); + test('getETHStakingProducts request test', ()=> { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let builder = GetETHStakingProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getETHStakingProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getAccountHolding request test', ()=> { + /** + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets + */ + let builder = GetAccountHoldingReq.builder(); + builder.setCurrency(?).setProductId(?).setProductCategory(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getAccountHolding(req); + return resp.then(result => { + expect(result.totalNum).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + }); + }) + + test('getKcsStakingProducts request test', ()=> { + /** + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products + */ + let builder = GetKcsStakingProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getKcsStakingProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('redeem request test', ()=> { + /** + * redeem + * Redeem + * /api/v1/earn/orders + */ + let builder = RedeemReq.builder(); + builder.setOrderId(?).setAmount(?).setFromAccountType(?).setConfirmPunishRedeem(?); + let req = builder.build(); + let resp = api.redeem(req); + return resp.then(result => { + expect(result.orderTxId).toEqual(expect.anything()); + expect(result.deliverTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + }); + }) + + test('purchase request test', ()=> { + /** + * purchase + * purchase + * /api/v1/earn/orders + */ + let builder = PurchaseReq.builder(); + builder.setProductId(?).setAmount(?).setAccountType(?); + let req = builder.build(); + let resp = api.purchase(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTxId).toEqual(expect.anything()); + }); + }) + + test('getPromotionProducts request test', ()=> { + /** + * getPromotionProducts + * Get Promotion Products + * /api/v1/earn/promotion/products + */ + let builder = GetPromotionProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getPromotionProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getRedeemPreview request test', ()=> { + /** + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview + */ + let builder = GetRedeemPreviewReq.builder(); + builder.setOrderId(?).setFromAccountType(?); + let req = builder.build(); + let resp = api.getRedeemPreview(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.redeemAmount).toEqual(expect.anything()); + expect(result.penaltyInterestAmount).toEqual(expect.anything()); + expect(result.redeemPeriod).toEqual(expect.anything()); + expect(result.deliverTime).toEqual(expect.anything()); + expect(result.manualRedeemable).toEqual(expect.anything()); + expect(result.redeemAll).toEqual(expect.anything()); + }); + }) + + test('getSavingsProducts request test', ()=> { + /** + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products + */ + let builder = GetSavingsProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getSavingsProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getStakingProducts request test', ()=> { + /** + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products + */ + let builder = GetStakingProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getStakingProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template index e69de29b..38fcf36a 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template @@ -0,0 +1,60 @@ + +describe('Auto Test', ()=> { + let api: FundingFeesAPI; + + beforeAll(()=> { + api = ?? + }); + test('GetPublicFundingHistory request test', ()=> { + /** + * GetPublicFundingHistory + * Get Public Funding History + * /api/v1/contract/funding-rates + */ + let builder = GetPublicFundingHistoryReq.builder(); + builder.setSymbol(?).setFrom(?).setTo(?); + let req = builder.build(); + let resp = api.GetPublicFundingHistory(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getPrivateFundingHistory request test', ()=> { + /** + * getPrivateFundingHistory + * Get Private Funding History + * /api/v1/funding-history + */ + let builder = GetPrivateFundingHistoryReq.builder(); + builder.setSymbol(?).setFrom(?).setTo(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let req = builder.build(); + let resp = api.getPrivateFundingHistory(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + }); + }) + + test('GetCurrentFundingRate request test', ()=> { + /** + * GetCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let builder = GetCurrentFundingRateReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.GetCurrentFundingRate(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.granularity).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.predictedValue).toEqual(expect.anything()); + expect(result.fundingRateCap).toEqual(expect.anything()); + expect(result.fundingRateFloor).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/futures/market/api_market.template b/sdk/node/src/generate/futures/market/api_market.template index e69de29b..7b37f1e3 100644 --- a/sdk/node/src/generate/futures/market/api_market.template +++ b/sdk/node/src/generate/futures/market/api_market.template @@ -0,0 +1,331 @@ + +describe('Auto Test', ()=> { + let api: MarketAPI; + + beforeAll(()=> { + api = ?? + }); + test('getAllTickers request test', ()=> { + /** + * getAllTickers + * Get All Tickers + * /api/v1/allTickers + */ + let resp = api.getAllTickers(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getPrivateToken request test', ()=> { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + let resp = api.getPrivateToken(); + return resp.then(result => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + }); + }) + + test('getPublicToken request test', ()=> { + /** + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public + */ + let resp = api.getPublicToken(); + return resp.then(result => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + }); + }) + + test('GetAllSymbols request test', ()=> { + /** + * GetAllSymbols + * Get All Symbols + * /api/v1/contracts/active + */ + let resp = api.GetAllSymbols(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSymbol request test', ()=> { + /** + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} + */ + let builder = GetSymbolReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getSymbol(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.rootSymbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.firstOpenDate).toEqual(expect.anything()); + expect(result.expireDate).toEqual(expect.anything()); + expect(result.settleDate).toEqual(expect.anything()); + expect(result.baseCurrency).toEqual(expect.anything()); + expect(result.quoteCurrency).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.maxOrderQty).toEqual(expect.anything()); + expect(result.maxPrice).toEqual(expect.anything()); + expect(result.lotSize).toEqual(expect.anything()); + expect(result.tickSize).toEqual(expect.anything()); + expect(result.indexPriceTickSize).toEqual(expect.anything()); + expect(result.multiplier).toEqual(expect.anything()); + expect(result.initialMargin).toEqual(expect.anything()); + expect(result.maintainMargin).toEqual(expect.anything()); + expect(result.maxRiskLimit).toEqual(expect.anything()); + expect(result.minRiskLimit).toEqual(expect.anything()); + expect(result.riskStep).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.takerFixFee).toEqual(expect.anything()); + expect(result.makerFixFee).toEqual(expect.anything()); + expect(result.settlementFee).toEqual(expect.anything()); + expect(result.isDeleverage).toEqual(expect.anything()); + expect(result.isQuanto).toEqual(expect.anything()); + expect(result.isInverse).toEqual(expect.anything()); + expect(result.markMethod).toEqual(expect.anything()); + expect(result.fairMethod).toEqual(expect.anything()); + expect(result.fundingBaseSymbol).toEqual(expect.anything()); + expect(result.fundingQuoteSymbol).toEqual(expect.anything()); + expect(result.fundingRateSymbol).toEqual(expect.anything()); + expect(result.indexSymbol).toEqual(expect.anything()); + expect(result.settlementSymbol).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.fundingFeeRate).toEqual(expect.anything()); + expect(result.predictedFundingFeeRate).toEqual(expect.anything()); + expect(result.fundingRateGranularity).toEqual(expect.anything()); + expect(result.openInterest).toEqual(expect.anything()); + expect(result.turnoverOf24h).toEqual(expect.anything()); + expect(result.volumeOf24h).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.indexPrice).toEqual(expect.anything()); + expect(result.lastTradePrice).toEqual(expect.anything()); + expect(result.nextFundingRateTime).toEqual(expect.anything()); + expect(result.maxLeverage).toEqual(expect.anything()); + expect(result.sourceExchanges).toEqual(expect.anything()); + expect(result.premiumsSymbol1M).toEqual(expect.anything()); + expect(result.premiumsSymbol8H).toEqual(expect.anything()); + expect(result.fundingBaseSymbol1M).toEqual(expect.anything()); + expect(result.fundingQuoteSymbol1M).toEqual(expect.anything()); + expect(result.lowPrice).toEqual(expect.anything()); + expect(result.highPrice).toEqual(expect.anything()); + expect(result.priceChgPct).toEqual(expect.anything()); + expect(result.priceChg).toEqual(expect.anything()); + expect(result.k).toEqual(expect.anything()); + expect(result.m).toEqual(expect.anything()); + expect(result.f).toEqual(expect.anything()); + expect(result.mmrLimit).toEqual(expect.anything()); + expect(result.mmrLevConstant).toEqual(expect.anything()); + expect(result.supportCross).toEqual(expect.anything()); + }); + }) + + test('getSpotIndexPrice request test', ()=> { + /** + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query + */ + let builder = GetSpotIndexPriceReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let req = builder.build(); + let resp = api.getSpotIndexPrice(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + }); + }) + + test('getInterestRateIndex request test', ()=> { + /** + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query + */ + let builder = GetInterestRateIndexReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let req = builder.build(); + let resp = api.getInterestRateIndex(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + }); + }) + + test('getKlines request test', ()=> { + /** + * getKlines + * Get Klines + * /api/v1/kline/query + */ + let builder = GetKlinesReq.builder(); + builder.setSymbol(?).setGranularity(?).setFrom(?).setTo(?); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getPartOrderBook request test', ()=> { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} + */ + let builder = GetPartOrderBookReq.builder(); + builder.setSymbol(?).setSize(?); + let req = builder.build(); + let resp = api.getPartOrderBook(req); + return resp.then(result => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + }); + }) + + test('getFullOrderBook request test', ()=> { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot + */ + let builder = GetFullOrderBookReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getFullOrderBook(req); + return resp.then(result => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + }); + }) + + test('getMarkPrice request test', ()=> { + /** + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current + */ + let builder = GetMarkPriceReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMarkPrice(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.granularity).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.indexPrice).toEqual(expect.anything()); + }); + }) + + test('getPremiumIndex request test', ()=> { + /** + * getPremiumIndex + * Get Premium Index + * /api/v1/premium/query + */ + let builder = GetPremiumIndexReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let req = builder.build(); + let resp = api.getPremiumIndex(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + }); + }) + + test('getServiceStatus request test', ()=> { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + let resp = api.getServiceStatus(); + return resp.then(result => { + expect(result.msg).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + }); + }) + + test('getTicker request test', ()=> { + /** + * getTicker + * Get Ticker + * /api/v1/ticker + */ + let builder = GetTickerReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getTicker(req); + return resp.then(result => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.tradeId).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.bestBidPrice).toEqual(expect.anything()); + expect(result.bestBidSize).toEqual(expect.anything()); + expect(result.bestAskPrice).toEqual(expect.anything()); + expect(result.bestAskSize).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + }); + }) + + test('getServerTime request test', ()=> { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + let resp = api.getServerTime(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/trade/history + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('get24hrStats request test', ()=> { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics + */ + let resp = api.get24hrStats(); + return resp.then(result => { + expect(result.turnoverOf24h).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/futures/order/api_order.template b/sdk/node/src/generate/futures/order/api_order.template index e69de29b..76fdfbe4 100644 --- a/sdk/node/src/generate/futures/order/api_order.template +++ b/sdk/node/src/generate/futures/order/api_order.template @@ -0,0 +1,371 @@ + +describe('Auto Test', ()=> { + let api: OrderAPI; + + beforeAll(()=> { + api = ?? + }); + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setOrderId(?).setSymbol(?).setSide(?).setType(?).setTradeTypes(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('GetOpenOrderValue request test', ()=> { + /** + * GetOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics + */ + let builder = GetOpenOrderValueReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.GetOpenOrderValue(req); + return resp.then(result => { + expect(result.openOrderBuySize).toEqual(expect.anything()); + expect(result.openOrderSellSize).toEqual(expect.anything()); + expect(result.openOrderBuyCost).toEqual(expect.anything()); + expect(result.openOrderSellCost).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + }); + }) + + test('getOrderByClientOid request test', ()=> { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setClientOid(?); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.dealValue).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPriceType).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.forceHold).toEqual(expect.anything()); + expect(result.closeOrder).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.endAt).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.avgDealPrice).toEqual(expect.anything()); + expect(result.filledSize).toEqual(expect.anything()); + expect(result.filledValue).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reduceOnly).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByClientOid request test', ()=> { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('cancelAllOrdersV1 request test', ()=> { + /** + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders + */ + let builder = CancelAllOrdersV1Req.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.cancelAllOrdersV1(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('GetOrderList request test', ()=> { + /** + * GetOrderList + * Get Order List + * /api/v1/orders + */ + let builder = GetOrderListReq.builder(); + builder.setStatus(?).setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.GetOrderList(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('batchCancelOrders request test', ()=> { + /** + * batchCancelOrders + * Batch Cancel Orders + * /api/v1/orders/multi-cancel + */ + let builder = BatchCancelOrdersReq.builder(); + builder.setOrderIdsList(?).setClientOidsList(?); + let req = builder.build(); + let resp = api.batchCancelOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('batchAddOrders request test', ()=> { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi + */ + let builder = BatchAddOrdersReq.builder(); + builder.setItems(?); + let req = builder.build(); + let resp = api.batchAddOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOrderById request test', ()=> { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} + */ + let builder = CancelOrderByIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.cancelOrderById(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOrderByOrderId request test', ()=> { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/orders/{order-id} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.dealValue).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPriceType).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.forceHold).toEqual(expect.anything()); + expect(result.closeOrder).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.endAt).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.avgDealPrice).toEqual(expect.anything()); + expect(result.filledSize).toEqual(expect.anything()); + expect(result.filledValue).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reduceOnly).toEqual(expect.anything()); + }); + }) + + test('addOrder request test', ()=> { + /** + * addOrder + * Add Order + * /api/v1/orders + */ + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('addOrderTest request test', ()=> { + /** + * addOrderTest + * Add Order Test + * /api/v1/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('GetRecentClosedOrders request test', ()=> { + /** + * GetRecentClosedOrders + * Get Recent Closed Orders + * /api/v1/recentDoneOrders + */ + let builder = GetRecentClosedOrdersReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.GetRecentClosedOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getRecentTradeHistory request test', ()=> { + /** + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills + */ + let builder = GetRecentTradeHistoryReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getRecentTradeHistory(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('addTPSLOrder request test', ()=> { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders + */ + let builder = AddTPSLOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStopPriceType(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTriggerStopUpPrice(?).setTriggerStopDownPrice(?).setQty(?).setValueQty(?); + let req = builder.build(); + let resp = api.addTPSLOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('cancelAllStopOrders request test', ()=> { + /** + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders + */ + let builder = CancelAllStopOrdersReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.cancelAllStopOrders(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('GetStopOrderList request test', ()=> { + /** + * GetStopOrderList + * Get Stop Order List + * /api/v1/stopOrders + */ + let builder = GetStopOrderListReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.GetStopOrderList(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('cancelAllOrdersV3 request test', ()=> { + /** + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders + */ + let builder = CancelAllOrdersV3Req.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.cancelAllOrdersV3(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/futures/positions/api_positions.template b/sdk/node/src/generate/futures/positions/api_positions.template index e69de29b..bf6b63a6 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.template +++ b/sdk/node/src/generate/futures/positions/api_positions.template @@ -0,0 +1,307 @@ + +describe('Auto Test', ()=> { + let api: PositionsAPI; + + beforeAll(()=> { + api = ?? + }); + test('getIsolatedMarginRiskLimit request test', ()=> { + /** + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} + */ + let builder = GetIsolatedMarginRiskLimitReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getIsolatedMarginRiskLimit(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('GetPositionsHistory request test', ()=> { + /** + * GetPositionsHistory + * Get Positions History + * /api/v1/history-positions + */ + let builder = GetPositionsHistoryReq.builder(); + builder.setSymbol(?).setFrom(?).setTo(?).setLimit(?).setPageId(?); + let req = builder.build(); + let resp = api.GetPositionsHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('GetMaxWithdrawMargin request test', ()=> { + /** + * GetMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin + */ + let builder = GetMaxWithdrawMarginReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.GetMaxWithdrawMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('RemoveIsolatedMargin request test', ()=> { + /** + * RemoveIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin + */ + let builder = RemoveIsolatedMarginReq.builder(); + builder.setSymbol(?).setWithdrawAmount(?); + let req = builder.build(); + let resp = api.RemoveIsolatedMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('GetPositionDetails request test', ()=> { + /** + * GetPositionDetails + * Get Position Details + * /api/v1/position + */ + let builder = GetPositionDetailsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.GetPositionDetails(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.isInverse).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.positionSide).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posCrossMargin).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posCommCommon).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posFunding).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.maintainMargin).toEqual(expect.anything()); + }); + }) + + test('modifyAutoDepositStatus request test', ()=> { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let builder = ModifyAutoDepositStatusReq.builder(); + builder.setSymbol(?).setStatus(?); + let req = builder.build(); + let resp = api.modifyAutoDepositStatus(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('AddIsolatedMargin request test', ()=> { + /** + * AddIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin + */ + let builder = AddIsolatedMarginReq.builder(); + builder.setSymbol(?).setMargin(?).setBizNo(?); + let req = builder.build(); + let resp = api.AddIsolatedMargin(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + }); + }) + + test('modifyIsolatedMarginRiskLimt request test', ()=> { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change + */ + let builder = ModifyIsolatedMarginRiskLimtReq.builder(); + builder.setSymbol(?).setLevel(?); + let req = builder.build(); + let resp = api.modifyIsolatedMarginRiskLimt(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('GetPositionList request test', ()=> { + /** + * GetPositionList + * Get Position List + * /api/v1/positions + */ + let builder = GetPositionListReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.GetPositionList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('ModifyMarginLeverage request test', ()=> { + /** + * ModifyMarginLeverage + * Modify Cross Margin Leverage + * /api/v2/changeCrossUserLeverage + */ + let builder = ModifyMarginLeverageReq.builder(); + builder.setSymbol(?).setLeverage(?); + let req = builder.build(); + let resp = api.ModifyMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + }); + }) + + test('getCrossMarginLeverage request test', ()=> { + /** + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage + */ + let builder = GetCrossMarginLeverageReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCrossMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + }); + }) + + test('GetMaxOpenSize request test', ()=> { + /** + * GetMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize + */ + let builder = GetMaxOpenSizeReq.builder(); + builder.setSymbol(?).setPrice(?).setLeverage(?); + let req = builder.build(); + let resp = api.GetMaxOpenSize(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.maxBuyOpenSize).toEqual(expect.anything()); + expect(result.maxSellOpenSize).toEqual(expect.anything()); + }); + }) + + test('switchMarginMode request test', ()=> { + /** + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode + */ + let builder = SwitchMarginModeReq.builder(); + builder.setSymbol(?).setMarginMode(?); + let req = builder.build(); + let resp = api.switchMarginMode(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + }); + }) + + test('getMarginMode request test', ()=> { + /** + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode + */ + let builder = GetMarginModeReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMarginMode(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/margin/credit/api_credit.template b/sdk/node/src/generate/margin/credit/api_credit.template index e69de29b..eaec3996 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.template +++ b/sdk/node/src/generate/margin/credit/api_credit.template @@ -0,0 +1,121 @@ + +describe('Auto Test', ()=> { + let api: CreditAPI; + + beforeAll(()=> { + api = ?? + }); + test('modifyPurchase request test', ()=> { + /** + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update + */ + let builder = ModifyPurchaseReq.builder(); + builder.setCurrency(?).setInterestRate(?).setPurchaseOrderNo(?); + let req = builder.build(); + let resp = api.modifyPurchase(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getLoanMarket request test', ()=> { + /** + * getLoanMarket + * Get Loan Market + * /api/v3/project/list + */ + let builder = GetLoanMarketReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getLoanMarket(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getLoanMarketInterestRate request test', ()=> { + /** + * getLoanMarketInterestRate + * Get Loan Market Interest Rate + * /api/v3/project/marketInterestRate + */ + let builder = GetLoanMarketInterestRateReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getLoanMarketInterestRate(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getPurchaseOrders request test', ()=> { + /** + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders + */ + let builder = GetPurchaseOrdersReq.builder(); + builder.setCurrency(?).setStatus(?).setPurchaseOrderNo(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getPurchaseOrders(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('purchase request test', ()=> { + /** + * purchase + * Purchase + * /api/v3/purchase + */ + let builder = PurchaseReq.builder(); + builder.setCurrency(?).setSize(?).setInterestRate(?); + let req = builder.build(); + let resp = api.purchase(req); + return resp.then(result => { + expect(result.orderNo).toEqual(expect.anything()); + }); + }) + + test('getRedeemOrders request test', ()=> { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let builder = GetRedeemOrdersReq.builder(); + builder.setCurrency(?).setStatus(?).setRedeemOrderNo(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getRedeemOrders(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('redeem request test', ()=> { + /** + * redeem + * Redeem + * /api/v3/redeem + */ + let builder = RedeemReq.builder(); + builder.setCurrency(?).setSize(?).setPurchaseOrderNo(?); + let req = builder.build(); + let resp = api.redeem(req); + return resp.then(result => { + expect(result.orderNo).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/margin/debit/api_debit.template b/sdk/node/src/generate/margin/debit/api_debit.template index e69de29b..93dc2ebc 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.template +++ b/sdk/node/src/generate/margin/debit/api_debit.template @@ -0,0 +1,116 @@ + +describe('Auto Test', ()=> { + let api: DebitAPI; + + beforeAll(()=> { + api = ?? + }); + test('getBorrowHistory request test', ()=> { + /** + * getBorrowHistory + * Get Borrow History + * /api/v3/margin/borrow + */ + let builder = GetBorrowHistoryReq.builder(); + builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setOrderNo(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getBorrowHistory(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('borrow request test', ()=> { + /** + * borrow + * Borrow + * /api/v3/margin/borrow + */ + let builder = BorrowReq.builder(); + builder.setCurrency(?).setSize(?).setTimeInForce(?).setSymbol(?).setIsIsolated(?).setIsHf(?); + let req = builder.build(); + let resp = api.borrow(req); + return resp.then(result => { + expect(result.orderNo).toEqual(expect.anything()); + expect(result.actualSize).toEqual(expect.anything()); + }); + }) + + test('getInterestHistory request test', ()=> { + /** + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest + */ + let builder = GetInterestHistoryReq.builder(); + builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getInterestHistory(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getRepayHistory request test', ()=> { + /** + * getRepayHistory + * Get Repay History + * /api/v3/margin/repay + */ + let builder = GetRepayHistoryReq.builder(); + builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setOrderNo(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getRepayHistory(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('repay request test', ()=> { + /** + * repay + * Repay + * /api/v3/margin/repay + */ + let builder = RepayReq.builder(); + builder.setCurrency(?).setSize(?).setSymbol(?).setIsIsolated(?).setIsHf(?); + let req = builder.build(); + let resp = api.repay(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.orderNo).toEqual(expect.anything()); + expect(result.actualSize).toEqual(expect.anything()); + }); + }) + + test('modifyLeverage request test', ()=> { + /** + * modifyLeverage + * Modify Leverage + * /api/v3/position/update-user-leverage + */ + let builder = ModifyLeverageReq.builder(); + builder.setSymbol(?).setIsIsolated(?).setLeverage(?); + let req = builder.build(); + let resp = api.modifyLeverage(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/margin/market/api_market.template b/sdk/node/src/generate/margin/market/api_market.template index e69de29b..6d9e4fd2 100644 --- a/sdk/node/src/generate/margin/market/api_market.template +++ b/sdk/node/src/generate/margin/market/api_market.template @@ -0,0 +1,95 @@ + +describe('Auto Test', ()=> { + let api: MarketAPI; + + beforeAll(()=> { + api = ?? + }); + test('getIsolatedMarginSymbols request test', ()=> { + /** + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols + */ + let resp = api.getIsolatedMarginSymbols(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getMarginConfig request test', ()=> { + /** + * getMarginConfig + * Get Margin Config + * /api/v1/margin/config + */ + let resp = api.getMarginConfig(); + return resp.then(result => { + expect(result.currencyList).toEqual(expect.anything()); + expect(result.maxLeverage).toEqual(expect.anything()); + expect(result.warningDebtRatio).toEqual(expect.anything()); + expect(result.liqDebtRatio).toEqual(expect.anything()); + }); + }) + + test('getMarkPriceDetail request test', ()=> { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let builder = GetMarkPriceDetailReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMarkPriceDetail(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + }); + }) + + test('getETFInfo request test', ()=> { + /** + * getETFInfo + * Get ETF Info + * /api/v3/etf/info + */ + let builder = GetETFInfoReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getETFInfo(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getCrossMarginSymbols request test', ()=> { + /** + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols + */ + let builder = GetCrossMarginSymbolsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCrossMarginSymbols(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getMarkPriceList request test', ()=> { + /** + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols + */ + let resp = api.getMarkPriceList(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/margin/order/api_order.template b/sdk/node/src/generate/margin/order/api_order.template index e69de29b..daaa7e5d 100644 --- a/sdk/node/src/generate/margin/order/api_order.template +++ b/sdk/node/src/generate/margin/order/api_order.template @@ -0,0 +1,290 @@ + +describe('Auto Test', ()=> { + let api: OrderAPI; + + beforeAll(()=> { + api = ?? + }); + test('addOrderV1 request test', ()=> { + /** + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order + */ + let builder = AddOrderV1Req.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let req = builder.build(); + let resp = api.addOrderV1(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('addOrderTestV1 request test', ()=> { + /** + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test + */ + let builder = AddOrderTestV1Req.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let req = builder.build(); + let resp = api.addOrderTestV1(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?).setTradeType(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.items).toEqual(expect.anything()); + expect(result.lastId).toEqual(expect.anything()); + }); + }) + + test('getSymbolsWithOpenOrder request test', ()=> { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols + */ + let builder = GetSymbolsWithOpenOrderReq.builder(); + builder.setTradeType(?); + let req = builder.build(); + let resp = api.getSymbolsWithOpenOrder(req); + return resp.then(result => { + expect(result.symbolSize).toEqual(expect.anything()); + expect(result.symbols).toEqual(expect.anything()); + }); + }) + + test('addOrder request test', ()=> { + /** + * addOrder + * Add Order + * /api/v3/hf/margin/order + */ + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('addOrderTest request test', ()=> { + /** + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test + */ + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getOpenOrders request test', ()=> { + /** + * getOpenOrders + * Get Open Orders + * /api/v3/hf/margin/orders/active + */ + let builder = GetOpenOrdersReq.builder(); + builder.setSymbol(?).setTradeType(?); + let req = builder.build(); + let resp = api.getOpenOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByClientOid request test', ()=> { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getOrderByClientOid request test', ()=> { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + }); + }) + + test('cancelAllOrdersBySymbol request test', ()=> { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders + */ + let builder = CancelAllOrdersBySymbolReq.builder(); + builder.setSymbol(?).setTradeType(?); + let req = builder.build(); + let resp = api.cancelAllOrdersBySymbol(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getClosedOrders request test', ()=> { + /** + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done + */ + let builder = GetClosedOrdersReq.builder(); + builder.setSymbol(?).setTradeType(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getClosedOrders(req); + return resp.then(result => { + expect(result.lastId).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByOrderId request test', ()=> { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderId(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('getOrderByOrderId request test', ()=> { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.template b/sdk/node/src/generate/margin/risklimit/api_risk_limit.template index e69de29b..33c611e9 100644 --- a/sdk/node/src/generate/margin/risklimit/api_risk_limit.template +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.template @@ -0,0 +1,23 @@ + +describe('Auto Test', ()=> { + let api: RiskLimitAPI; + + beforeAll(()=> { + api = ?? + }); + test('getMarginRiskLimit request test', ()=> { + /** + * getMarginRiskLimit + * Get Margin Risk Limit + * /api/v3/margin/currencies + */ + let builder = GetMarginRiskLimitReq.builder(); + builder.setIsIsolated(?).setCurrency(?).setSymbol(?); + let req = builder.build(); + let resp = api.getMarginRiskLimit(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/spot/market/api_market.template b/sdk/node/src/generate/spot/market/api_market.template index e69de29b..1e4cd548 100644 --- a/sdk/node/src/generate/spot/market/api_market.template +++ b/sdk/node/src/generate/spot/market/api_market.template @@ -0,0 +1,1216 @@ + +describe('Auto Test', ()=> { + let api: MarketAPI; + + beforeAll(()=> { + api = ?? + }); + test('getPrivateToken request test', ()=> { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private + */ + let resp = api.getPrivateToken(); + return resp.then(result => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + }); + }) + + test('getPublicToken request test', ()=> { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + let resp = api.getPublicToken(); + return resp.then(result => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + }); + }) + + test('getAllTickers request test', ()=> { + /** + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers + */ + let resp = api.getAllTickers(); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.ticker).toEqual(expect.anything()); + }); + }) + + test('getKlines request test', ()=> { + /** + * getKlines + * Get Klines + * /api/v1/market/candles + */ + let builder = GetKlinesReq.builder(); + builder.setSymbol(?).setType(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/market/histories + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getTicker request test', ()=> { + /** + * getTicker + * Get Ticker + * /api/v1/market/orderbook/level1 + */ + let builder = GetTickerReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getTicker(req); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.bestBid).toEqual(expect.anything()); + expect(result.bestBidSize).toEqual(expect.anything()); + expect(result.bestAsk).toEqual(expect.anything()); + expect(result.bestAskSize).toEqual(expect.anything()); + }); + }) + + test('getPartOrderBook request test', ()=> { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} + */ + let builder = GetPartOrderBookReq.builder(); + builder.setSymbol(?).setSize(?); + let req = builder.build(); + let resp = api.getPartOrderBook(req); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + }); + }) + + test('get24hrStats request test', ()=> { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats + */ + let builder = Get24hrStatsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.get24hrStats(req); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.buy).toEqual(expect.anything()); + expect(result.sell).toEqual(expect.anything()); + expect(result.changeRate).toEqual(expect.anything()); + expect(result.changePrice).toEqual(expect.anything()); + expect(result.high).toEqual(expect.anything()); + expect(result.low).toEqual(expect.anything()); + expect(result.vol).toEqual(expect.anything()); + expect(result.volValue).toEqual(expect.anything()); + expect(result.last).toEqual(expect.anything()); + expect(result.averagePrice).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.takerCoefficient).toEqual(expect.anything()); + expect(result.makerCoefficient).toEqual(expect.anything()); + }); + }) + + test('getMarketList request test', ()=> { + /** + * getMarketList + * Get Market List + * /api/v1/markets + */ + let resp = api.getMarketList(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getFiatPrice request test', ()=> { + /** + * getFiatPrice + * Get Fiat Price + * /api/v1/prices + */ + let builder = GetFiatPriceReq.builder(); + builder.setBase(?).setCurrencies(?); + let req = builder.build(); + let resp = api.getFiatPrice(req); + return resp.then(result => { + expect(result.AGLD).toEqual(expect.anything()); + expect(result.DFI).toEqual(expect.anything()); + expect(result.PYTHUP).toEqual(expect.anything()); + expect(result.ISLM).toEqual(expect.anything()); + expect(result.NEAR).toEqual(expect.anything()); + expect(result.AIOZ).toEqual(expect.anything()); + expect(result.AUDIO).toEqual(expect.anything()); + expect(result.BBL).toEqual(expect.anything()); + expect(result.WLD).toEqual(expect.anything()); + expect(result.HNT).toEqual(expect.anything()); + expect(result.ETHFI).toEqual(expect.anything()); + expect(result.DMAIL).toEqual(expect.anything()); + expect(result.OPUP).toEqual(expect.anything()); + expect(result.VET3S).toEqual(expect.anything()); + expect(result.MANA3S).toEqual(expect.anything()); + expect(result.TIDAL).toEqual(expect.anything()); + expect(result.HALO).toEqual(expect.anything()); + expect(result.OPUL).toEqual(expect.anything()); + expect(result.MANA3L).toEqual(expect.anything()); + expect(result.DGB).toEqual(expect.anything()); + expect(result.AA).toEqual(expect.anything()); + expect(result.BCH).toEqual(expect.anything()); + expect(result.GMEE).toEqual(expect.anything()); + expect(result.JST).toEqual(expect.anything()); + expect(result.PBUX).toEqual(expect.anything()); + expect(result.AR).toEqual(expect.anything()); + expect(result.SEI).toEqual(expect.anything()); + expect(result.PSTAKE).toEqual(expect.anything()); + expect(result.LMWR).toEqual(expect.anything()); + expect(result.UNFIDOWN).toEqual(expect.anything()); + expect(result.BB).toEqual(expect.anything()); + expect(result.JTO).toEqual(expect.anything()); + expect(result.WEMIX).toEqual(expect.anything()); + expect(result.G).toEqual(expect.anything()); + expect(result.MARSH).toEqual(expect.anything()); + expect(result.BN).toEqual(expect.anything()); + expect(result.FLIP).toEqual(expect.anything()); + expect(result.FLR).toEqual(expect.anything()); + expect(result.BIGTIME).toEqual(expect.anything()); + expect(result.FLY).toEqual(expect.anything()); + expect(result.T).toEqual(expect.anything()); + expect(result.W).toEqual(expect.anything()); + expect(result.BDX).toEqual(expect.anything()); + expect(result.BABYDOGE).toEqual(expect.anything()); + expect(result.SFP).toEqual(expect.anything()); + expect(result.DIA).toEqual(expect.anything()); + expect(result.ISME).toEqual(expect.anything()); + expect(result.LYM).toEqual(expect.anything()); + expect(result.VET3L).toEqual(expect.anything()); + expect(result.JUP).toEqual(expect.anything()); + expect(result.LYX).toEqual(expect.anything()); + expect(result.AIEPK).toEqual(expect.anything()); + expect(result.SILLY).toEqual(expect.anything()); + expect(result.SCPT).toEqual(expect.anything()); + expect(result.WOO).toEqual(expect.anything()); + expect(result.BLUR).toEqual(expect.anything()); + expect(result.STRK).toEqual(expect.anything()); + expect(result.BFC).toEqual(expect.anything()); + expect(result.DC).toEqual(expect.anything()); + expect(result.KARATE).toEqual(expect.anything()); + expect(result.SUSHI3L).toEqual(expect.anything()); + expect(result.NETVR).toEqual(expect.anything()); + expect(result.WAVES).toEqual(expect.anything()); + expect(result.LITH).toEqual(expect.anything()); + expect(result.HAPI).toEqual(expect.anything()); + expect(result.SUSHI3S).toEqual(expect.anything()); + expect(result.CEEK).toEqual(expect.anything()); + expect(result.FLOKI).toEqual(expect.anything()); + expect(result.SHR).toEqual(expect.anything()); + expect(result.SAND).toEqual(expect.anything()); + expect(result.TURT).toEqual(expect.anything()); + expect(result.UMA).toEqual(expect.anything()); + expect(result.BEPRO).toEqual(expect.anything()); + expect(result.SCRT).toEqual(expect.anything()); + expect(result.TUSD).toEqual(expect.anything()); + expect(result.COOKIE).toEqual(expect.anything()); + expect(result.LRDS).toEqual(expect.anything()); + expect(result.SIN).toEqual(expect.anything()); + expect(result.OAS).toEqual(expect.anything()); + expect(result.ROOT).toEqual(expect.anything()); + expect(result.ADA3L).toEqual(expect.anything()); + expect(result.TIAUP).toEqual(expect.anything()); + expect(result.HTR).toEqual(expect.anything()); + expect(result.UNB).toEqual(expect.anything()); + expect(result.UNA).toEqual(expect.anything()); + expect(result.HARD).toEqual(expect.anything()); + expect(result.G3).toEqual(expect.anything()); + expect(result.ADA3S).toEqual(expect.anything()); + expect(result.MYRO).toEqual(expect.anything()); + expect(result.HTX).toEqual(expect.anything()); + expect(result.FT).toEqual(expect.anything()); + expect(result.BTCDOWN).toEqual(expect.anything()); + expect(result.UNI).toEqual(expect.anything()); + expect(result.FX).toEqual(expect.anything()); + expect(result.OBI).toEqual(expect.anything()); + expect(result.UNO).toEqual(expect.anything()); + expect(result.WRX).toEqual(expect.anything()); + expect(result.TIADOWN).toEqual(expect.anything()); + expect(result.ETHDOWN).toEqual(expect.anything()); + expect(result.WELL).toEqual(expect.anything()); + expect(result.SWFTC).toEqual(expect.anything()); + expect(result.SKL).toEqual(expect.anything()); + expect(result.UOS).toEqual(expect.anything()); + expect(result.AIPAD).toEqual(expect.anything()); + expect(result.BRETT).toEqual(expect.anything()); + expect(result.SKY).toEqual(expect.anything()); + expect(result.FRM).toEqual(expect.anything()); + expect(result.VISION).toEqual(expect.anything()); + expect(result.LENDS).toEqual(expect.anything()); + expect(result.SLF).toEqual(expect.anything()); + expect(result.BULL).toEqual(expect.anything()); + expect(result.FLOW).toEqual(expect.anything()); + expect(result.ODDZ).toEqual(expect.anything()); + expect(result.SLN).toEqual(expect.anything()); + expect(result.UPO).toEqual(expect.anything()); + expect(result.SLP).toEqual(expect.anything()); + expect(result.ID).toEqual(expect.anything()); + expect(result.SLIM).toEqual(expect.anything()); + expect(result.SPOT).toEqual(expect.anything()); + expect(result.DOP).toEqual(expect.anything()); + expect(result.ISSP).toEqual(expect.anything()); + expect(result.UQC).toEqual(expect.anything()); + expect(result.IO).toEqual(expect.anything()); + expect(result.DOT).toEqual(expect.anything()); + expect(result._1INCH).toEqual(expect.anything()); + expect(result.SMH).toEqual(expect.anything()); + expect(result.MAK).toEqual(expect.anything()); + expect(result.TOKO).toEqual(expect.anything()); + expect(result.TURBO).toEqual(expect.anything()); + expect(result.UNFI).toEqual(expect.anything()); + expect(result.MAN).toEqual(expect.anything()); + expect(result.EVER).toEqual(expect.anything()); + expect(result.FTM).toEqual(expect.anything()); + expect(result.SHRAP).toEqual(expect.anything()); + expect(result.MAV).toEqual(expect.anything()); + expect(result.MAX).toEqual(expect.anything()); + expect(result.DPR).toEqual(expect.anything()); + expect(result.FTT).toEqual(expect.anything()); + expect(result.ARKM).toEqual(expect.anything()); + expect(result.ATOM).toEqual(expect.anything()); + expect(result.PENDLE).toEqual(expect.anything()); + expect(result.QUICK).toEqual(expect.anything()); + expect(result.BLZ).toEqual(expect.anything()); + expect(result.BOBA).toEqual(expect.anything()); + expect(result.MBL).toEqual(expect.anything()); + expect(result.OFN).toEqual(expect.anything()); + expect(result.UNIO).toEqual(expect.anything()); + expect(result.SNS).toEqual(expect.anything()); + expect(result.SNX).toEqual(expect.anything()); + expect(result.NXRA).toEqual(expect.anything()); + expect(result.TAIKO).toEqual(expect.anything()); + expect(result.AVAX3L).toEqual(expect.anything()); + expect(result.L3).toEqual(expect.anything()); + expect(result.API3).toEqual(expect.anything()); + expect(result.XRP3S).toEqual(expect.anything()); + expect(result.QKC).toEqual(expect.anything()); + expect(result.AVAX3S).toEqual(expect.anything()); + expect(result.ROSE).toEqual(expect.anything()); + expect(result.SATS).toEqual(expect.anything()); + expect(result.BMX).toEqual(expect.anything()); + expect(result.PORTAL).toEqual(expect.anything()); + expect(result.TOMI).toEqual(expect.anything()); + expect(result.XRP3L).toEqual(expect.anything()); + expect(result.SOL).toEqual(expect.anything()); + expect(result.SON).toEqual(expect.anything()); + expect(result.BNC).toEqual(expect.anything()); + expect(result.SOCIAL).toEqual(expect.anything()); + expect(result.CGPT).toEqual(expect.anything()); + expect(result.CELR).toEqual(expect.anything()); + expect(result.BNB).toEqual(expect.anything()); + expect(result.OGN).toEqual(expect.anything()); + expect(result.CELO).toEqual(expect.anything()); + expect(result.AUCTION).toEqual(expect.anything()); + expect(result.MANTA).toEqual(expect.anything()); + expect(result.LAYER).toEqual(expect.anything()); + expect(result.AERO).toEqual(expect.anything()); + expect(result.CETUS).toEqual(expect.anything()); + expect(result.LL).toEqual(expect.anything()); + expect(result.SPA).toEqual(expect.anything()); + expect(result.PYTHDOWN).toEqual(expect.anything()); + expect(result.NEIROCTO).toEqual(expect.anything()); + expect(result.UTK).toEqual(expect.anything()); + expect(result.GMRX).toEqual(expect.anything()); + expect(result.BOB).toEqual(expect.anything()); + expect(result.HOTCROSS).toEqual(expect.anything()); + expect(result.AERGO).toEqual(expect.anything()); + expect(result.MOCA).toEqual(expect.anything()); + expect(result.SQD).toEqual(expect.anything()); + expect(result.MV).toEqual(expect.anything()); + expect(result.BNB3L).toEqual(expect.anything()); + expect(result.BNB3S).toEqual(expect.anything()); + expect(result.GALAX3L).toEqual(expect.anything()); + expect(result.KAI).toEqual(expect.anything()); + expect(result.SQR).toEqual(expect.anything()); + expect(result.GALAX3S).toEqual(expect.anything()); + expect(result.EGLD).toEqual(expect.anything()); + expect(result.ZBCN).toEqual(expect.anything()); + expect(result.KAS).toEqual(expect.anything()); + expect(result.MEW).toEqual(expect.anything()); + expect(result.PUNDIX).toEqual(expect.anything()); + expect(result.LOOKS).toEqual(expect.anything()); + expect(result.FXS).toEqual(expect.anything()); + expect(result.BOSON).toEqual(expect.anything()); + expect(result.BRISE).toEqual(expect.anything()); + expect(result.AEVO).toEqual(expect.anything()); + expect(result.FLUX).toEqual(expect.anything()); + expect(result.PRCL).toEqual(expect.anything()); + expect(result.UNFIUP).toEqual(expect.anything()); + expect(result.SEIDOWN).toEqual(expect.anything()); + expect(result.DOAI).toEqual(expect.anything()); + expect(result.QNT).toEqual(expect.anything()); + expect(result.REDO).toEqual(expect.anything()); + expect(result.STRIKE).toEqual(expect.anything()); + expect(result.ETHW).toEqual(expect.anything()); + expect(result.OM).toEqual(expect.anything()); + expect(result.OP).toEqual(expect.anything()); + expect(result.WHALE).toEqual(expect.anything()); + expect(result._1CAT).toEqual(expect.anything()); + expect(result.NEON).toEqual(expect.anything()); + expect(result.GTAI).toEqual(expect.anything()); + expect(result.SSV).toEqual(expect.anything()); + expect(result.ETH2).toEqual(expect.anything()); + expect(result.KCS).toEqual(expect.anything()); + expect(result.ARPA).toEqual(expect.anything()); + expect(result.ARTFI).toEqual(expect.anything()); + expect(result.BRL).toEqual(expect.anything()); + expect(result.ALEX).toEqual(expect.anything()); + expect(result.STG).toEqual(expect.anything()); + expect(result.SHIB).toEqual(expect.anything()); + expect(result.IOTX).toEqual(expect.anything()); + expect(result.OLE).toEqual(expect.anything()); + expect(result.KDA).toEqual(expect.anything()); + expect(result.CERE).toEqual(expect.anything()); + expect(result.DOCK).toEqual(expect.anything()); + expect(result.STX).toEqual(expect.anything()); + expect(result.OLT).toEqual(expect.anything()); + expect(result.QI).toEqual(expect.anything()); + expect(result.SDAO).toEqual(expect.anything()); + expect(result.BLAST).toEqual(expect.anything()); + expect(result.LINK3S).toEqual(expect.anything()); + expect(result.IOST).toEqual(expect.anything()); + expect(result.SUI).toEqual(expect.anything()); + expect(result.CAKE).toEqual(expect.anything()); + expect(result.BSW).toEqual(expect.anything()); + expect(result.OMG).toEqual(expect.anything()); + expect(result.VOLT).toEqual(expect.anything()); + expect(result.LINK3L).toEqual(expect.anything()); + expect(result.GEEQ).toEqual(expect.anything()); + expect(result.PYUSD).toEqual(expect.anything()); + expect(result.SUN).toEqual(expect.anything()); + expect(result.TOWER).toEqual(expect.anything()); + expect(result.BTC).toEqual(expect.anything()); + expect(result.IOTA).toEqual(expect.anything()); + expect(result.REEF).toEqual(expect.anything()); + expect(result.TRIAS).toEqual(expect.anything()); + expect(result.KEY).toEqual(expect.anything()); + expect(result.ETH3L).toEqual(expect.anything()); + expect(result.BTT).toEqual(expect.anything()); + expect(result.ONE).toEqual(expect.anything()); + expect(result.RENDER).toEqual(expect.anything()); + expect(result.ETH3S).toEqual(expect.anything()); + expect(result.ANKR).toEqual(expect.anything()); + expect(result.ALGO).toEqual(expect.anything()); + expect(result.SYLO).toEqual(expect.anything()); + expect(result.ZCX).toEqual(expect.anything()); + expect(result.SD).toEqual(expect.anything()); + expect(result.ONT).toEqual(expect.anything()); + expect(result.MJT).toEqual(expect.anything()); + expect(result.DYM).toEqual(expect.anything()); + expect(result.DYP).toEqual(expect.anything()); + expect(result.BAKEUP).toEqual(expect.anything()); + expect(result.OOE).toEqual(expect.anything()); + expect(result.ZELIX).toEqual(expect.anything()); + expect(result.DOGE3L).toEqual(expect.anything()); + expect(result.ARTY).toEqual(expect.anything()); + expect(result.QORPO).toEqual(expect.anything()); + expect(result.ICE).toEqual(expect.anything()); + expect(result.NOTAI).toEqual(expect.anything()); + expect(result.DOGE3S).toEqual(expect.anything()); + expect(result.NAKA).toEqual(expect.anything()); + expect(result.GALAX).toEqual(expect.anything()); + expect(result.MKR).toEqual(expect.anything()); + expect(result.DODO).toEqual(expect.anything()); + expect(result.ICP).toEqual(expect.anything()); + expect(result.ZEC).toEqual(expect.anything()); + expect(result.ZEE).toEqual(expect.anything()); + expect(result.ICX).toEqual(expect.anything()); + expect(result.KMNO).toEqual(expect.anything()); + expect(result.TT).toEqual(expect.anything()); + expect(result.DOT3L).toEqual(expect.anything()); + expect(result.XAI).toEqual(expect.anything()); + expect(result.ZEN).toEqual(expect.anything()); + expect(result.DOGE).toEqual(expect.anything()); + expect(result.ALPHA).toEqual(expect.anything()); + expect(result.DUSK).toEqual(expect.anything()); + expect(result.DOT3S).toEqual(expect.anything()); + expect(result.SXP).toEqual(expect.anything()); + expect(result.HBAR).toEqual(expect.anything()); + expect(result.SYNT).toEqual(expect.anything()); + expect(result.ZEX).toEqual(expect.anything()); + expect(result.BONDLY).toEqual(expect.anything()); + expect(result.MLK).toEqual(expect.anything()); + expect(result.KICKS).toEqual(expect.anything()); + expect(result.PEPE).toEqual(expect.anything()); + expect(result.OUSD).toEqual(expect.anything()); + expect(result.LUNCDOWN).toEqual(expect.anything()); + expect(result.DOGS).toEqual(expect.anything()); + expect(result.REV3L).toEqual(expect.anything()); + expect(result.CTSI).toEqual(expect.anything()); + expect(result.C98).toEqual(expect.anything()); + expect(result.OSMO).toEqual(expect.anything()); + expect(result.NTRN).toEqual(expect.anything()); + expect(result.CFX2S).toEqual(expect.anything()); + expect(result.SYN).toEqual(expect.anything()); + expect(result.VIDT).toEqual(expect.anything()); + expect(result.SYS).toEqual(expect.anything()); + expect(result.GAS).toEqual(expect.anything()); + expect(result.BOME).toEqual(expect.anything()); + expect(result.COMBO).toEqual(expect.anything()); + expect(result.XCH).toEqual(expect.anything()); + expect(result.VR).toEqual(expect.anything()); + expect(result.CFX2L).toEqual(expect.anything()); + expect(result.VSYS).toEqual(expect.anything()); + expect(result.PANDORA).toEqual(expect.anything()); + expect(result.THETA).toEqual(expect.anything()); + expect(result.XCN).toEqual(expect.anything()); + expect(result.NEXG).toEqual(expect.anything()); + expect(result.MELOS).toEqual(expect.anything()); + expect(result.XCV).toEqual(expect.anything()); + expect(result.ORN).toEqual(expect.anything()); + expect(result.WLKN).toEqual(expect.anything()); + expect(result.AAVE).toEqual(expect.anything()); + expect(result.MNT).toEqual(expect.anything()); + expect(result.BONK).toEqual(expect.anything()); + expect(result.PERP).toEqual(expect.anything()); + expect(result.XDC).toEqual(expect.anything()); + expect(result.MNW).toEqual(expect.anything()); + expect(result.XDB).toEqual(expect.anything()); + expect(result.BOND).toEqual(expect.anything()); + expect(result.SUIA).toEqual(expect.anything()); + expect(result.MOG).toEqual(expect.anything()); + expect(result.SUTER).toEqual(expect.anything()); + expect(result.TIME).toEqual(expect.anything()); + expect(result.RACA).toEqual(expect.anything()); + expect(result.BICO).toEqual(expect.anything()); + expect(result.MON).toEqual(expect.anything()); + expect(result.SWEAT).toEqual(expect.anything()); + expect(result.MOXIE).toEqual(expect.anything()); + expect(result.BABYBNB).toEqual(expect.anything()); + expect(result.IGU).toEqual(expect.anything()); + expect(result.HMSTR).toEqual(expect.anything()); + expect(result.XEC).toEqual(expect.anything()); + expect(result.MONI).toEqual(expect.anything()); + expect(result.XR).toEqual(expect.anything()); + expect(result.PEOPLE).toEqual(expect.anything()); + expect(result.PUMLX).toEqual(expect.anything()); + expect(result.ZIL).toEqual(expect.anything()); + expect(result.WLDDOWN).toEqual(expect.anything()); + expect(result.VAI).toEqual(expect.anything()); + expect(result.XEN).toEqual(expect.anything()); + expect(result.MPC).toEqual(expect.anything()); + expect(result.XEM).toEqual(expect.anything()); + expect(result.JASMY3S).toEqual(expect.anything()); + expect(result.OTK).toEqual(expect.anything()); + expect(result.TRAC).toEqual(expect.anything()); + expect(result.DFYN).toEqual(expect.anything()); + expect(result.BIDP).toEqual(expect.anything()); + expect(result.JASMY3L).toEqual(expect.anything()); + expect(result.INJDOWN).toEqual(expect.anything()); + expect(result.KLV).toEqual(expect.anything()); + expect(result.WAXL).toEqual(expect.anything()); + expect(result.TRBDOWN).toEqual(expect.anything()); + expect(result.BCH3L).toEqual(expect.anything()); + expect(result.GMT3S).toEqual(expect.anything()); + expect(result.KMD).toEqual(expect.anything()); + expect(result.BCH3S).toEqual(expect.anything()); + expect(result.ECOX).toEqual(expect.anything()); + expect(result.AAVE3S).toEqual(expect.anything()); + expect(result.GMT3L).toEqual(expect.anything()); + expect(result.EPIK).toEqual(expect.anything()); + expect(result.SUIP).toEqual(expect.anything()); + expect(result.AAVE3L).toEqual(expect.anything()); + expect(result.ZK).toEqual(expect.anything()); + expect(result.ZKF).toEqual(expect.anything()); + expect(result.OMNIA).toEqual(expect.anything()); + expect(result.ZKJ).toEqual(expect.anything()); + expect(result.ZKL).toEqual(expect.anything()); + expect(result.GAFI).toEqual(expect.anything()); + expect(result.CARV).toEqual(expect.anything()); + expect(result.KNC).toEqual(expect.anything()); + expect(result.CATS).toEqual(expect.anything()); + expect(result.PROM).toEqual(expect.anything()); + expect(result.ALEPH).toEqual(expect.anything()); + expect(result.PONKE).toEqual(expect.anything()); + expect(result.OVR).toEqual(expect.anything()); + expect(result.CATI).toEqual(expect.anything()); + expect(result.ORDER).toEqual(expect.anything()); + expect(result.GFT).toEqual(expect.anything()); + expect(result.BIFI).toEqual(expect.anything()); + expect(result.GGC).toEqual(expect.anything()); + expect(result.GGG).toEqual(expect.anything()); + expect(result.DAPPX).toEqual(expect.anything()); + expect(result.SUKU).toEqual(expect.anything()); + expect(result.ULTI).toEqual(expect.anything()); + expect(result.CREDI).toEqual(expect.anything()); + expect(result.ERTHA).toEqual(expect.anything()); + expect(result.FURY).toEqual(expect.anything()); + expect(result.KARRAT).toEqual(expect.anything()); + expect(result.MOBILE).toEqual(expect.anything()); + expect(result.SIDUS).toEqual(expect.anything()); + expect(result.NAVI).toEqual(expect.anything()); + expect(result.TAO).toEqual(expect.anything()); + expect(result.USDJ).toEqual(expect.anything()); + expect(result.MTL).toEqual(expect.anything()); + expect(result.VET).toEqual(expect.anything()); + expect(result.FITFI).toEqual(expect.anything()); + expect(result.USDT).toEqual(expect.anything()); + expect(result.OXT).toEqual(expect.anything()); + expect(result.CANDY).toEqual(expect.anything()); + expect(result.USDP).toEqual(expect.anything()); + expect(result.MTS).toEqual(expect.anything()); + expect(result.TADA).toEqual(expect.anything()); + expect(result.MTV).toEqual(expect.anything()); + expect(result.NAVX).toEqual(expect.anything()); + expect(result.ILV).toEqual(expect.anything()); + expect(result.VINU).toEqual(expect.anything()); + expect(result.GHX).toEqual(expect.anything()); + expect(result.EDU).toEqual(expect.anything()); + expect(result.HYVE).toEqual(expect.anything()); + expect(result.BTC3L).toEqual(expect.anything()); + expect(result.ANYONE).toEqual(expect.anything()); + expect(result.BEAT).toEqual(expect.anything()); + expect(result.KING).toEqual(expect.anything()); + expect(result.CREAM).toEqual(expect.anything()); + expect(result.CAS).toEqual(expect.anything()); + expect(result.IMX).toEqual(expect.anything()); + expect(result.CAT).toEqual(expect.anything()); + expect(result.BTC3S).toEqual(expect.anything()); + expect(result.USDE).toEqual(expect.anything()); + expect(result.USDD).toEqual(expect.anything()); + expect(result.CWAR).toEqual(expect.anything()); + expect(result.USDC).toEqual(expect.anything()); + expect(result.KRL).toEqual(expect.anything()); + expect(result.INJ).toEqual(expect.anything()); + expect(result.GAME).toEqual(expect.anything()); + expect(result.TRIBL).toEqual(expect.anything()); + expect(result.XLM).toEqual(expect.anything()); + expect(result.TRBUP).toEqual(expect.anything()); + expect(result.VRADOWN).toEqual(expect.anything()); + expect(result.SUPER).toEqual(expect.anything()); + expect(result.EIGEN).toEqual(expect.anything()); + expect(result.IOI).toEqual(expect.anything()); + expect(result.KSM).toEqual(expect.anything()); + expect(result.CCD).toEqual(expect.anything()); + expect(result.EGO).toEqual(expect.anything()); + expect(result.EGP).toEqual(expect.anything()); + expect(result.MXC).toEqual(expect.anything()); + expect(result.TEL).toEqual(expect.anything()); + expect(result.MOVR).toEqual(expect.anything()); + expect(result.XMR).toEqual(expect.anything()); + expect(result.MXM).toEqual(expect.anything()); + expect(result.OORT).toEqual(expect.anything()); + expect(result.GLM).toEqual(expect.anything()); + expect(result.RAY).toEqual(expect.anything()); + expect(result.XTAG).toEqual(expect.anything()); + expect(result.GLQ).toEqual(expect.anything()); + expect(result.CWEB).toEqual(expect.anything()); + expect(result.REVU).toEqual(expect.anything()); + expect(result.REVV).toEqual(expect.anything()); + expect(result.ZRO).toEqual(expect.anything()); + expect(result.XNL).toEqual(expect.anything()); + expect(result.XNO).toEqual(expect.anything()); + expect(result.SAROS).toEqual(expect.anything()); + expect(result.KACE).toEqual(expect.anything()); + expect(result.ZRX).toEqual(expect.anything()); + expect(result.WLTH).toEqual(expect.anything()); + expect(result.ATOM3L).toEqual(expect.anything()); + expect(result.GMM).toEqual(expect.anything()); + expect(result.BEER).toEqual(expect.anything()); + expect(result.GMT).toEqual(expect.anything()); + expect(result.HEART).toEqual(expect.anything()); + expect(result.GMX).toEqual(expect.anything()); + expect(result.ABBC).toEqual(expect.anything()); + expect(result.OMNI).toEqual(expect.anything()); + expect(result.ATOM3S).toEqual(expect.anything()); + expect(result.IRL).toEqual(expect.anything()); + expect(result.CFG).toEqual(expect.anything()); + expect(result.WSDM).toEqual(expect.anything()); + expect(result.GNS).toEqual(expect.anything()); + expect(result.VANRY).toEqual(expect.anything()); + expect(result.CFX).toEqual(expect.anything()); + expect(result.GRAIL).toEqual(expect.anything()); + expect(result.BEFI).toEqual(expect.anything()); + expect(result.VELO).toEqual(expect.anything()); + expect(result.XPR).toEqual(expect.anything()); + expect(result.DOVI).toEqual(expect.anything()); + expect(result.ACE).toEqual(expect.anything()); + expect(result.ACH).toEqual(expect.anything()); + expect(result.ISP).toEqual(expect.anything()); + expect(result.XCAD).toEqual(expect.anything()); + expect(result.MINA).toEqual(expect.anything()); + expect(result.TIA).toEqual(expect.anything()); + expect(result.DRIFT).toEqual(expect.anything()); + expect(result.ACQ).toEqual(expect.anything()); + expect(result.ACS).toEqual(expect.anything()); + expect(result.MIND).toEqual(expect.anything()); + expect(result.STORE).toEqual(expect.anything()); + expect(result.REN).toEqual(expect.anything()); + expect(result.ELA).toEqual(expect.anything()); + expect(result.DREAMS).toEqual(expect.anything()); + expect(result.ADA).toEqual(expect.anything()); + expect(result.ELF).toEqual(expect.anything()); + expect(result.REQ).toEqual(expect.anything()); + expect(result.STORJ).toEqual(expect.anything()); + expect(result.LADYS).toEqual(expect.anything()); + expect(result.PAXG).toEqual(expect.anything()); + expect(result.REZ).toEqual(expect.anything()); + expect(result.XRD).toEqual(expect.anything()); + expect(result.CHO).toEqual(expect.anything()); + expect(result.CHR).toEqual(expect.anything()); + expect(result.ADS).toEqual(expect.anything()); + expect(result.CHZ).toEqual(expect.anything()); + expect(result.ADX).toEqual(expect.anything()); + expect(result.XRP).toEqual(expect.anything()); + expect(result.JASMY).toEqual(expect.anything()); + expect(result.KAGI).toEqual(expect.anything()); + expect(result.FIDA).toEqual(expect.anything()); + expect(result.PBR).toEqual(expect.anything()); + expect(result.AEG).toEqual(expect.anything()); + expect(result.H2O).toEqual(expect.anything()); + expect(result.CHMB).toEqual(expect.anything()); + expect(result.SAND3L).toEqual(expect.anything()); + expect(result.PBX).toEqual(expect.anything()); + expect(result.SOLVE).toEqual(expect.anything()); + expect(result.DECHAT).toEqual(expect.anything()); + expect(result.GARI).toEqual(expect.anything()); + expect(result.SHIB2L).toEqual(expect.anything()); + expect(result.SHIB2S).toEqual(expect.anything()); + expect(result.ENA).toEqual(expect.anything()); + expect(result.VEMP).toEqual(expect.anything()); + expect(result.ENJ).toEqual(expect.anything()); + expect(result.AFG).toEqual(expect.anything()); + expect(result.RATS).toEqual(expect.anything()); + expect(result.GRT).toEqual(expect.anything()); + expect(result.FORWARD).toEqual(expect.anything()); + expect(result.TFUEL).toEqual(expect.anything()); + expect(result.ENS).toEqual(expect.anything()); + expect(result.KASDOWN).toEqual(expect.anything()); + expect(result.XTM).toEqual(expect.anything()); + expect(result.DEGEN).toEqual(expect.anything()); + expect(result.TLM).toEqual(expect.anything()); + expect(result.DYDXDOWN).toEqual(expect.anything()); + expect(result.CKB).toEqual(expect.anything()); + expect(result.LUNC).toEqual(expect.anything()); + expect(result.AURORA).toEqual(expect.anything()); + expect(result.LUNA).toEqual(expect.anything()); + expect(result.XTZ).toEqual(expect.anything()); + expect(result.ELON).toEqual(expect.anything()); + expect(result.DMTR).toEqual(expect.anything()); + expect(result.EOS).toEqual(expect.anything()); + expect(result.GST).toEqual(expect.anything()); + expect(result.FORT).toEqual(expect.anything()); + expect(result.FLAME).toEqual(expect.anything()); + expect(result.PATEX).toEqual(expect.anything()); + expect(result.DEEP).toEqual(expect.anything()); + expect(result.ID3L).toEqual(expect.anything()); + expect(result.GTC).toEqual(expect.anything()); + expect(result.ID3S).toEqual(expect.anything()); + expect(result.RIO).toEqual(expect.anything()); + expect(result.CLH).toEqual(expect.anything()); + expect(result.BURGER).toEqual(expect.anything()); + expect(result.VRA).toEqual(expect.anything()); + expect(result.SUNDOG).toEqual(expect.anything()); + expect(result.GTT).toEqual(expect.anything()); + expect(result.INJUP).toEqual(expect.anything()); + expect(result.CPOOL).toEqual(expect.anything()); + expect(result.EPX).toEqual(expect.anything()); + expect(result.CLV).toEqual(expect.anything()); + expect(result.FEAR).toEqual(expect.anything()); + expect(result.MEME).toEqual(expect.anything()); + expect(result.ROOBEE).toEqual(expect.anything()); + expect(result.DEFI).toEqual(expect.anything()); + expect(result.TOKEN).toEqual(expect.anything()); + expect(result.GRAPE).toEqual(expect.anything()); + expect(result.KASUP).toEqual(expect.anything()); + expect(result.XWG).toEqual(expect.anything()); + expect(result.SKEY).toEqual(expect.anything()); + expect(result.SFUND).toEqual(expect.anything()); + expect(result.EQX).toEqual(expect.anything()); + expect(result.ORDIUP).toEqual(expect.anything()); + expect(result.TON).toEqual(expect.anything()); + expect(result.DEGO).toEqual(expect.anything()); + expect(result.IZI).toEqual(expect.anything()); + expect(result.ERG).toEqual(expect.anything()); + expect(result.ERN).toEqual(expect.anything()); + expect(result.VENOM).toEqual(expect.anything()); + expect(result.VOXEL).toEqual(expect.anything()); + expect(result.RLC).toEqual(expect.anything()); + expect(result.PHA).toEqual(expect.anything()); + expect(result.DYDXUP).toEqual(expect.anything()); + expect(result.APE3S).toEqual(expect.anything()); + expect(result.ORBS).toEqual(expect.anything()); + expect(result.OPDOWN).toEqual(expect.anything()); + expect(result.ESE).toEqual(expect.anything()); + expect(result.APE3L).toEqual(expect.anything()); + expect(result.HMND).toEqual(expect.anything()); + expect(result.COQ).toEqual(expect.anything()); + expect(result.AURY).toEqual(expect.anything()); + expect(result.CULT).toEqual(expect.anything()); + expect(result.AKT).toEqual(expect.anything()); + expect(result.GLMR).toEqual(expect.anything()); + expect(result.XYM).toEqual(expect.anything()); + expect(result.ORAI).toEqual(expect.anything()); + expect(result.XYO).toEqual(expect.anything()); + expect(result.ETC).toEqual(expect.anything()); + expect(result.LAI).toEqual(expect.anything()); + expect(result.PIP).toEqual(expect.anything()); + expect(result.ETH).toEqual(expect.anything()); + expect(result.NEO).toEqual(expect.anything()); + expect(result.RMV).toEqual(expect.anything()); + expect(result.KLAY).toEqual(expect.anything()); + expect(result.PIT).toEqual(expect.anything()); + expect(result.TARA).toEqual(expect.anything()); + expect(result.KALT).toEqual(expect.anything()); + expect(result.PIX).toEqual(expect.anything()); + expect(result.ETN).toEqual(expect.anything()); + expect(result.CSIX).toEqual(expect.anything()); + expect(result.TRADE).toEqual(expect.anything()); + expect(result.MAVIA).toEqual(expect.anything()); + expect(result.HIGH).toEqual(expect.anything()); + expect(result.TRB).toEqual(expect.anything()); + expect(result.ORDI).toEqual(expect.anything()); + expect(result.TRVL).toEqual(expect.anything()); + expect(result.AMB).toEqual(expect.anything()); + expect(result.TRU).toEqual(expect.anything()); + expect(result.LOGX).toEqual(expect.anything()); + expect(result.FINC).toEqual(expect.anything()); + expect(result.INFRA).toEqual(expect.anything()); + expect(result.NATIX).toEqual(expect.anything()); + expect(result.NFP).toEqual(expect.anything()); + expect(result.TRY).toEqual(expect.anything()); + expect(result.TRX).toEqual(expect.anything()); + expect(result.LBP).toEqual(expect.anything()); + expect(result.LBR).toEqual(expect.anything()); + expect(result.EUL).toEqual(expect.anything()); + expect(result.NFT).toEqual(expect.anything()); + expect(result.SEIUP).toEqual(expect.anything()); + expect(result.PUFFER).toEqual(expect.anything()); + expect(result.EUR).toEqual(expect.anything()); + expect(result.ORCA).toEqual(expect.anything()); + expect(result.NEAR3L).toEqual(expect.anything()); + expect(result.AMP).toEqual(expect.anything()); + expect(result.XDEFI).toEqual(expect.anything()); + expect(result.HIFI).toEqual(expect.anything()); + expect(result.TRUF).toEqual(expect.anything()); + expect(result.AITECH).toEqual(expect.anything()); + expect(result.AMU).toEqual(expect.anything()); + expect(result.USTC).toEqual(expect.anything()); + expect(result.KNGL).toEqual(expect.anything()); + expect(result.FOXY).toEqual(expect.anything()); + expect(result.NGC).toEqual(expect.anything()); + expect(result.TENET).toEqual(expect.anything()); + expect(result.NEAR3S).toEqual(expect.anything()); + expect(result.MAHA).toEqual(expect.anything()); + expect(result.NGL).toEqual(expect.anything()); + expect(result.TST).toEqual(expect.anything()); + expect(result.HIPPO).toEqual(expect.anything()); + expect(result.AXS3S).toEqual(expect.anything()); + expect(result.CRO).toEqual(expect.anything()); + expect(result.ZPAY).toEqual(expect.anything()); + expect(result.MNDE).toEqual(expect.anything()); + expect(result.CRV).toEqual(expect.anything()); + expect(result.SWASH).toEqual(expect.anything()); + expect(result.AXS3L).toEqual(expect.anything()); + expect(result.VERSE).toEqual(expect.anything()); + expect(result.RPK).toEqual(expect.anything()); + expect(result.RPL).toEqual(expect.anything()); + expect(result.AZERO).toEqual(expect.anything()); + expect(result.SOUL).toEqual(expect.anything()); + expect(result.VXV).toEqual(expect.anything()); + expect(result.LDO).toEqual(expect.anything()); + expect(result.MAGIC).toEqual(expect.anything()); + expect(result.ALICE).toEqual(expect.anything()); + expect(result.SEAM).toEqual(expect.anything()); + expect(result.PLU).toEqual(expect.anything()); + expect(result.AOG).toEqual(expect.anything()); + expect(result.SMOLE).toEqual(expect.anything()); + expect(result.EWT).toEqual(expect.anything()); + expect(result.TSUGT).toEqual(expect.anything()); + expect(result.PMG).toEqual(expect.anything()); + expect(result.OPAI).toEqual(expect.anything()); + expect(result.LOCUS).toEqual(expect.anything()); + expect(result.CTA).toEqual(expect.anything()); + expect(result.NIM).toEqual(expect.anything()); + expect(result.CTC).toEqual(expect.anything()); + expect(result.APE).toEqual(expect.anything()); + expect(result.MERL).toEqual(expect.anything()); + expect(result.JAM).toEqual(expect.anything()); + expect(result.CTI).toEqual(expect.anything()); + expect(result.APP).toEqual(expect.anything()); + expect(result.APT).toEqual(expect.anything()); + expect(result.WLDUP).toEqual(expect.anything()); + expect(result.ZEND).toEqual(expect.anything()); + expect(result.FIRE).toEqual(expect.anything()); + expect(result.DENT).toEqual(expect.anything()); + expect(result.PYTH).toEqual(expect.anything()); + expect(result.LFT).toEqual(expect.anything()); + expect(result.DPET).toEqual(expect.anything()); + expect(result.ORDIDOWN).toEqual(expect.anything()); + expect(result.KPOL).toEqual(expect.anything()); + expect(result.ETHUP).toEqual(expect.anything()); + expect(result.BAND).toEqual(expect.anything()); + expect(result.POL).toEqual(expect.anything()); + expect(result.ASTR).toEqual(expect.anything()); + expect(result.NKN).toEqual(expect.anything()); + expect(result.RSR).toEqual(expect.anything()); + expect(result.DVPN).toEqual(expect.anything()); + expect(result.TWT).toEqual(expect.anything()); + expect(result.ARB).toEqual(expect.anything()); + expect(result.CVC).toEqual(expect.anything()); + expect(result.ARC).toEqual(expect.anything()); + expect(result.XETA).toEqual(expect.anything()); + expect(result.MTRG).toEqual(expect.anything()); + expect(result.LOKA).toEqual(expect.anything()); + expect(result.LPOOL).toEqual(expect.anything()); + expect(result.TURBOS).toEqual(expect.anything()); + expect(result.CVX).toEqual(expect.anything()); + expect(result.ARX).toEqual(expect.anything()); + expect(result.MPLX).toEqual(expect.anything()); + expect(result.SUSHI).toEqual(expect.anything()); + expect(result.NLK).toEqual(expect.anything()); + expect(result.PEPE2).toEqual(expect.anything()); + expect(result.WBTC).toEqual(expect.anything()); + expect(result.SUI3L).toEqual(expect.anything()); + expect(result.CWS).toEqual(expect.anything()); + expect(result.SUI3S).toEqual(expect.anything()); + expect(result.INSP).toEqual(expect.anything()); + expect(result.MANA).toEqual(expect.anything()); + expect(result.VRTX).toEqual(expect.anything()); + expect(result.CSPR).toEqual(expect.anything()); + expect(result.ATA).toEqual(expect.anything()); + expect(result.OPEN).toEqual(expect.anything()); + expect(result.HAI).toEqual(expect.anything()); + expect(result.NMR).toEqual(expect.anything()); + expect(result.ATH).toEqual(expect.anything()); + expect(result.LIT).toEqual(expect.anything()); + expect(result.TLOS).toEqual(expect.anything()); + expect(result.TNSR).toEqual(expect.anything()); + expect(result.CXT).toEqual(expect.anything()); + expect(result.POLYX).toEqual(expect.anything()); + expect(result.ZERO).toEqual(expect.anything()); + expect(result.ROUTE).toEqual(expect.anything()); + expect(result.LOOM).toEqual(expect.anything()); + expect(result.PRE).toEqual(expect.anything()); + expect(result.VRAUP).toEqual(expect.anything()); + expect(result.HBB).toEqual(expect.anything()); + expect(result.RVN).toEqual(expect.anything()); + expect(result.PRQ).toEqual(expect.anything()); + expect(result.ONDO).toEqual(expect.anything()); + expect(result.PEPEDOWN).toEqual(expect.anything()); + expect(result.WOOP).toEqual(expect.anything()); + expect(result.LUNCUP).toEqual(expect.anything()); + expect(result.KAVA).toEqual(expect.anything()); + expect(result.LKI).toEqual(expect.anything()); + expect(result.AVA).toEqual(expect.anything()); + expect(result.NOM).toEqual(expect.anything()); + expect(result.MAPO).toEqual(expect.anything()); + expect(result.PEPEUP).toEqual(expect.anything()); + expect(result.STRAX).toEqual(expect.anything()); + expect(result.NOT).toEqual(expect.anything()); + expect(result.ZERC).toEqual(expect.anything()); + expect(result.BCUT).toEqual(expect.anything()); + expect(result.MASA).toEqual(expect.anything()); + expect(result.WAN).toEqual(expect.anything()); + expect(result.WAT).toEqual(expect.anything()); + expect(result.WAX).toEqual(expect.anything()); + expect(result.MASK).toEqual(expect.anything()); + expect(result.EOS3L).toEqual(expect.anything()); + expect(result.IDEA).toEqual(expect.anything()); + expect(result.EOS3S).toEqual(expect.anything()); + expect(result.YFI).toEqual(expect.anything()); + expect(result.MOODENG).toEqual(expect.anything()); + expect(result.XCUR).toEqual(expect.anything()); + expect(result.HYDRA).toEqual(expect.anything()); + expect(result.POPCAT).toEqual(expect.anything()); + expect(result.LQTY).toEqual(expect.anything()); + expect(result.PIXEL).toEqual(expect.anything()); + expect(result.LMR).toEqual(expect.anything()); + expect(result.ZETA).toEqual(expect.anything()); + expect(result.YGG).toEqual(expect.anything()); + expect(result.AXS).toEqual(expect.anything()); + expect(result.BCHSV).toEqual(expect.anything()); + expect(result.NRN).toEqual(expect.anything()); + expect(result.FTON).toEqual(expect.anything()); + expect(result.COMP).toEqual(expect.anything()); + expect(result.XPRT).toEqual(expect.anything()); + expect(result.HFT).toEqual(expect.anything()); + expect(result.UXLINK).toEqual(expect.anything()); + expect(result.STAMP).toEqual(expect.anything()); + expect(result.RUNE).toEqual(expect.anything()); + expect(result.ZEUS).toEqual(expect.anything()); + expect(result.LTC3L).toEqual(expect.anything()); + expect(result.DAPP).toEqual(expect.anything()); + expect(result.FORTH).toEqual(expect.anything()); + expect(result.ALPINE).toEqual(expect.anything()); + expect(result.SENSO).toEqual(expect.anything()); + expect(result.LTC3S).toEqual(expect.anything()); + expect(result.DEXE).toEqual(expect.anything()); + expect(result.GOAL).toEqual(expect.anything()); + expect(result.AVAX).toEqual(expect.anything()); + expect(result.LISTA).toEqual(expect.anything()); + expect(result.AMPL).toEqual(expect.anything()); + expect(result.WORK).toEqual(expect.anything()); + expect(result.BRWL).toEqual(expect.anything()); + expect(result.BANANA).toEqual(expect.anything()); + expect(result.PUSH).toEqual(expect.anything()); + expect(result.WEN).toEqual(expect.anything()); + expect(result.NEIRO).toEqual(expect.anything()); + expect(result.BTCUP).toEqual(expect.anything()); + expect(result.SOL3S).toEqual(expect.anything()); + expect(result.BRAWL).toEqual(expect.anything()); + expect(result.LAY3R).toEqual(expect.anything()); + expect(result.LPT).toEqual(expect.anything()); + expect(result.GODS).toEqual(expect.anything()); + expect(result.SAND3S).toEqual(expect.anything()); + expect(result.RDNT).toEqual(expect.anything()); + expect(result.SOL3L).toEqual(expect.anything()); + expect(result.NIBI).toEqual(expect.anything()); + expect(result.NUM).toEqual(expect.anything()); + expect(result.PYR).toEqual(expect.anything()); + expect(result.DAG).toEqual(expect.anything()); + expect(result.DAI).toEqual(expect.anything()); + expect(result.HIP).toEqual(expect.anything()); + expect(result.DAO).toEqual(expect.anything()); + expect(result.AVAIL).toEqual(expect.anything()); + expect(result.DAR).toEqual(expect.anything()); + expect(result.FET).toEqual(expect.anything()); + expect(result.FCON).toEqual(expect.anything()); + expect(result.XAVA).toEqual(expect.anything()); + expect(result.LRC).toEqual(expect.anything()); + expect(result.UNI3S).toEqual(expect.anything()); + expect(result.POKT).toEqual(expect.anything()); + expect(result.DASH).toEqual(expect.anything()); + expect(result.BAKEDOWN).toEqual(expect.anything()); + expect(result.POLC).toEqual(expect.anything()); + expect(result.CIRUS).toEqual(expect.anything()); + expect(result.UNI3L).toEqual(expect.anything()); + expect(result.NWC).toEqual(expect.anything()); + expect(result.POLK).toEqual(expect.anything()); + expect(result.LSD).toEqual(expect.anything()); + expect(result.MARS4).toEqual(expect.anything()); + expect(result.LSK).toEqual(expect.anything()); + expect(result.BLOCK).toEqual(expect.anything()); + expect(result.ANALOS).toEqual(expect.anything()); + expect(result.SAFE).toEqual(expect.anything()); + expect(result.DCK).toEqual(expect.anything()); + expect(result.LSS).toEqual(expect.anything()); + expect(result.DCR).toEqual(expect.anything()); + expect(result.LIKE).toEqual(expect.anything()); + expect(result.DATA).toEqual(expect.anything()); + expect(result.WIF).toEqual(expect.anything()); + expect(result.BLOK).toEqual(expect.anything()); + expect(result.LTC).toEqual(expect.anything()); + expect(result.METIS).toEqual(expect.anything()); + expect(result.WIN).toEqual(expect.anything()); + expect(result.HLG).toEqual(expect.anything()); + expect(result.LTO).toEqual(expect.anything()); + expect(result.DYDX).toEqual(expect.anything()); + expect(result.ARB3S).toEqual(expect.anything()); + expect(result.MUBI).toEqual(expect.anything()); + expect(result.ARB3L).toEqual(expect.anything()); + expect(result.RBTC1).toEqual(expect.anything()); + expect(result.POND).toEqual(expect.anything()); + expect(result.LINA).toEqual(expect.anything()); + expect(result.MYRIA).toEqual(expect.anything()); + expect(result.LINK).toEqual(expect.anything()); + expect(result.QTUM).toEqual(expect.anything()); + expect(result.TUNE).toEqual(expect.anything()); + expect(result.UFO).toEqual(expect.anything()); + expect(result.CYBER).toEqual(expect.anything()); + expect(result.WILD).toEqual(expect.anything()); + expect(result.POLS).toEqual(expect.anything()); + expect(result.NYM).toEqual(expect.anything()); + expect(result.FIL).toEqual(expect.anything()); + expect(result.BAL).toEqual(expect.anything()); + expect(result.SCA).toEqual(expect.anything()); + expect(result.STND).toEqual(expect.anything()); + expect(result.WMTX).toEqual(expect.anything()); + expect(result.SCLP).toEqual(expect.anything()); + expect(result.MANEKI).toEqual(expect.anything()); + expect(result.BAT).toEqual(expect.anything()); + expect(result.AKRO).toEqual(expect.anything()); + expect(result.FTM3L).toEqual(expect.anything()); + expect(result.BAX).toEqual(expect.anything()); + expect(result.FTM3S).toEqual(expect.anything()); + expect(result.COTI).toEqual(expect.anything()); + }); + }) + + test('getServiceStatus request test', ()=> { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + let resp = api.getServiceStatus(); + return resp.then(result => { + expect(result.status).toEqual(expect.anything()); + expect(result.msg).toEqual(expect.anything()); + }); + }) + + test('getServerTime request test', ()=> { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + let resp = api.getServerTime(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getAllSymbols request test', ()=> { + /** + * getAllSymbols + * Get All Symbols + * /api/v2/symbols + */ + let builder = GetAllSymbolsReq.builder(); + builder.setMarket(?); + let req = builder.build(); + let resp = api.getAllSymbols(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSymbol request test', ()=> { + /** + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} + */ + let builder = GetSymbolReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getSymbol(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.baseCurrency).toEqual(expect.anything()); + expect(result.quoteCurrency).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.market).toEqual(expect.anything()); + expect(result.baseMinSize).toEqual(expect.anything()); + expect(result.quoteMinSize).toEqual(expect.anything()); + expect(result.baseMaxSize).toEqual(expect.anything()); + expect(result.quoteMaxSize).toEqual(expect.anything()); + expect(result.baseIncrement).toEqual(expect.anything()); + expect(result.quoteIncrement).toEqual(expect.anything()); + expect(result.priceIncrement).toEqual(expect.anything()); + expect(result.priceLimitRate).toEqual(expect.anything()); + expect(result.minFunds).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.enableTrading).toEqual(expect.anything()); + expect(result.feeCategory).toEqual(expect.anything()); + expect(result.makerFeeCoefficient).toEqual(expect.anything()); + expect(result.takerFeeCoefficient).toEqual(expect.anything()); + expect(result.st).toEqual(expect.anything()); + }); + }) + + test('getAnnouncements request test', ()=> { + /** + * getAnnouncements + * Get Announcements + * /api/v3/announcements + */ + let builder = GetAnnouncementsReq.builder(); + builder.setCurrentPage(?).setPageSize(?).setAnnType(?).setLang(?).setStartTime(?).setEndTime(?); + let req = builder.build(); + let resp = api.getAnnouncements(req); + return resp.then(result => { + expect(result.totalNum).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + }); + }) + + test('getCurrency request test', ()=> { + /** + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} + */ + let builder = GetCurrencyReq.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.getCurrency(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.fullName).toEqual(expect.anything()); + expect(result.precision).toEqual(expect.anything()); + expect(result.confirms).toEqual(expect.anything()); + expect(result.contractAddress).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.isDebitEnabled).toEqual(expect.anything()); + expect(result.chains).toEqual(expect.anything()); + }); + }) + + test('getAllCurrencies request test', ()=> { + /** + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies + */ + let resp = api.getAllCurrencies(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getFullOrderBook request test', ()=> { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 + */ + let builder = GetFullOrderBookReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getFullOrderBook(req); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/spot/order/api_order.template b/sdk/node/src/generate/spot/order/api_order.template index e69de29b..44599612 100644 --- a/sdk/node/src/generate/spot/order/api_order.template +++ b/sdk/node/src/generate/spot/order/api_order.template @@ -0,0 +1,935 @@ + +describe('Auto Test', ()=> { + let api: OrderAPI; + + beforeAll(()=> { + api = ?? + }); + test('getTradeHistoryOld request test', ()=> { + /** + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills + */ + let builder = GetTradeHistoryOldReq.builder(); + builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getTradeHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.items).toEqual(expect.anything()); + expect(result.lastId).toEqual(expect.anything()); + }); + }) + + test('getOpenOrders request test', ()=> { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let builder = GetOpenOrdersReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getOpenOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getSymbolsWithOpenOrder request test', ()=> { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols + */ + let resp = api.getSymbolsWithOpenOrder(); + return resp.then(result => { + expect(result.symbols).toEqual(expect.anything()); + }); + }) + + test('modifyOrder request test', ()=> { + /** + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter + */ + let builder = ModifyOrderReq.builder(); + builder.setClientOid(?).setSymbol(?).setOrderId(?).setNewPrice(?).setNewSize(?); + let req = builder.build(); + let resp = api.modifyOrder(req); + return resp.then(result => { + expect(result.newOrderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('cancelAllOrders request test', ()=> { + /** + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll + */ + let resp = api.cancelAllOrders(); + return resp.then(result => { + expect(result.succeedSymbols).toEqual(expect.anything()); + expect(result.failedSymbols).toEqual(expect.anything()); + }); + }) + + test('cancelPartialOrder request test', ()=> { + /** + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} + */ + let builder = CancelPartialOrderReq.builder(); + builder.setOrderId(?).setSymbol(?).setCancelSize(?); + let req = builder.build(); + let resp = api.cancelPartialOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.cancelSize).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByClientOid request test', ()=> { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getOrderByClientOid request test', ()=> { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + }); + }) + + test('setDCP request test', ()=> { + /** + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all + */ + let builder = SetDCPReq.builder(); + builder.setTimeout(?).setSymbols(?); + let req = builder.build(); + let resp = api.setDCP(req); + return resp.then(result => { + expect(result.currentTime).toEqual(expect.anything()); + expect(result.triggerTime).toEqual(expect.anything()); + }); + }) + + test('getDCP request test', ()=> { + /** + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query + */ + let resp = api.getDCP(); + return resp.then(result => { + expect(result.timeout).toEqual(expect.anything()); + expect(result.symbols).toEqual(expect.anything()); + expect(result.currentTime).toEqual(expect.anything()); + expect(result.triggerTime).toEqual(expect.anything()); + }); + }) + + test('cancelAllOrdersBySymbol request test', ()=> { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v1/hf/orders + */ + let builder = CancelAllOrdersBySymbolReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.cancelAllOrdersBySymbol(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getClosedOrders request test', ()=> { + /** + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done + */ + let builder = GetClosedOrdersReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getClosedOrders(req); + return resp.then(result => { + expect(result.lastId).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('batchAddOrders request test', ()=> { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi + */ + let builder = BatchAddOrdersReq.builder(); + builder.setOrderList(?); + let req = builder.build(); + let resp = api.batchAddOrders(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('batchAddOrdersSync request test', ()=> { + /** + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync + */ + let builder = BatchAddOrdersSyncReq.builder(); + builder.setOrderList(?); + let req = builder.build(); + let resp = api.batchAddOrdersSync(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByOrderId request test', ()=> { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderId(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('getOrderByOrderId request test', ()=> { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + }); + }) + + test('addOrder request test', ()=> { + /** + * addOrder + * Add Order + * /api/v1/hf/orders + */ + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByClientOidSync request test', ()=> { + /** + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidSyncReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOidSync(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByOrderIdSync request test', ()=> { + /** + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} + */ + let builder = CancelOrderByOrderIdSyncReq.builder(); + builder.setOrderId(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdSync(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + }); + }) + + test('addOrderSync request test', ()=> { + /** + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync + */ + let builder = AddOrderSyncReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let req = builder.build(); + let resp = api.addOrderSync(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.matchTime).toEqual(expect.anything()); + }); + }) + + test('addOrderTest request test', ()=> { + /** + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getRecentTradeHistoryOld request test', ()=> { + /** + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills + */ + let builder = GetRecentTradeHistoryOldReq.builder(); + builder.setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getRecentTradeHistoryOld(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getRecentOrdersListOld request test', ()=> { + /** + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders + */ + let builder = GetRecentOrdersListOldReq.builder(); + builder.setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getRecentOrdersListOld(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByClientOidOld request test', ()=> { + /** + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidOldReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOidOld(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelledOrderId).toEqual(expect.anything()); + expect(result.cancelledOcoOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOrderByClientOidOld request test', ()=> { + /** + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let builder = GetOrderByClientOidOldReq.builder(); + builder.setClientOid(?); + let req = builder.build(); + let resp = api.getOrderByClientOidOld(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + }); + }) + + test('batchCancelOrderOld request test', ()=> { + /** + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders + */ + let builder = BatchCancelOrderOldReq.builder(); + builder.setSymbol(?).setTradeType(?); + let req = builder.build(); + let resp = api.batchCancelOrderOld(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOrdersListOld request test', ()=> { + /** + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders + */ + let builder = GetOrdersListOldReq.builder(); + builder.setSymbol(?).setStatus(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getOrdersListOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('batchAddOrdersOld request test', ()=> { + /** + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi + */ + let builder = BatchAddOrdersOldReq.builder(); + builder.setOrderList(?).setSymbol(?); + let req = builder.build(); + let resp = api.batchAddOrdersOld(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOrderByOrderIdOld request test', ()=> { + /** + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let builder = CancelOrderByOrderIdOldReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdOld(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOrderByOrderIdOld request test', ()=> { + /** + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let builder = GetOrderByOrderIdOldReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderIdOld(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + }); + }) + + test('addOrderOld request test', ()=> { + /** + * addOrderOld + * Add Order - Old + * /api/v1/orders + */ + let builder = AddOrderOldReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); + let req = builder.build(); + let resp = api.addOrderOld(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('addOrderTestOld request test', ()=> { + /** + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test + */ + let builder = AddOrderTestOldReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); + let req = builder.build(); + let resp = api.addOrderTestOld(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('batchCancelStopOrder request test', ()=> { + /** + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel + */ + let builder = BatchCancelStopOrderReq.builder(); + builder.setSymbol(?).setTradeType(?).setOrderIds(?); + let req = builder.build(); + let resp = api.batchCancelStopOrder(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('cancelStopOrderByClientOid request test', ()=> { + /** + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid + */ + let builder = CancelStopOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.cancelStopOrderByClientOid(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelledOrderId).toEqual(expect.anything()); + }); + }) + + test('getStopOrdersList request test', ()=> { + /** + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order + */ + let builder = GetStopOrdersListReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setOrderIds(?).setPageSize(?).setStop(?); + let req = builder.build(); + let resp = api.getStopOrdersList(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + + test('cancelStopOrderByOrderId request test', ()=> { + /** + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let builder = CancelStopOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.cancelStopOrderByOrderId(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getStopOrderByOrderId request test', ()=> { + /** + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let builder = GetStopOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getStopOrderByOrderId(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.domainId).toEqual(expect.anything()); + expect(result.tradeSource).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggerTime).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + }); + }) + + test('addStopOrder request test', ()=> { + /** + * addStopOrder + * Add Stop Order + * /api/v1/stop-order + */ + let builder = AddStopOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setStopPrice(?).setTradeType(?); + let req = builder.build(); + let resp = api.addStopOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + }); + }) + + test('getStopOrderByClientOid request test', ()=> { + /** + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid + */ + let builder = GetStopOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.getStopOrderByClientOid(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('cancelOcoOrderByClientOid request test', ()=> { + /** + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let builder = CancelOcoOrderByClientOidReq.builder(); + builder.setClientOid(?); + let req = builder.build(); + let resp = api.cancelOcoOrderByClientOid(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOcoOrderByClientOid request test', ()=> { + /** + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let builder = GetOcoOrderByClientOidReq.builder(); + builder.setClientOid(?); + let req = builder.build(); + let resp = api.getOcoOrderByClientOid(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + }); + }) + + test('getOcoOrderDetailByOrderId request test', ()=> { + /** + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} + */ + let builder = GetOcoOrderDetailByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getOcoOrderDetailByOrderId(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + }); + }) + + test('cancelOcoOrderByOrderId request test', ()=> { + /** + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let builder = CancelOcoOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.cancelOcoOrderByOrderId(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOcoOrderByOrderId request test', ()=> { + /** + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let builder = GetOcoOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getOcoOrderByOrderId(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + }); + }) + + test('addOcoOrder request test', ()=> { + /** + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order + */ + let builder = AddOcoOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setRemark(?).setPrice(?).setSize(?).setStopPrice(?).setLimitPrice(?).setTradeType(?); + let req = builder.build(); + let resp = api.addOcoOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + }); + }) + + test('batchCancelOcoOrders request test', ()=> { + /** + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders + */ + let builder = BatchCancelOcoOrdersReq.builder(); + builder.setOrderIds(?).setSymbol(?); + let req = builder.build(); + let resp = api.batchCancelOcoOrders(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + }); + }) + + test('getOcoOrderList request test', ()=> { + /** + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders + */ + let builder = GetOcoOrderListReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setOrderIds(?).setPageSize(?).setCurrentPage(?); + let req = builder.build(); + let resp = api.getOcoOrderList(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 291eeda2..304afb70 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-09'; +export const SdkGenerateDate = '2025-01-10'; diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.template b/sdk/node/src/generate/viplending/viplending/api_vip_lending.template index e69de29b..7290e228 100644 --- a/sdk/node/src/generate/viplending/viplending/api_vip_lending.template +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.template @@ -0,0 +1,37 @@ + +describe('Auto Test', ()=> { + let api: VIPLendingAPI; + + beforeAll(()=> { + api = ?? + }); + test('getAccounts request test', ()=> { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + let resp = api.getAccounts(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + }); + }) + + test('getAccountDetail request test', ()=> { + /** + * getAccountDetail + * Get Account Detail + * /api/v1/otc-loan/loan + */ + let resp = api.getAccountDetail(); + return resp.then(result => { + expect(result.parentUid).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + expect(result.ltv).toEqual(expect.anything()); + expect(result.totalMarginAmount).toEqual(expect.anything()); + expect(result.transferMarginAmount).toEqual(expect.anything()); + expect(result.margins).toEqual(expect.anything()); + }); + }) + +}) \ No newline at end of file From 8778376ae9ab26763f6e76a191de9fedab2b20da Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 13 Jan 2025 10:46:19 +0800 Subject: [PATCH 016/106] feat(nodejs): export types --- sdk/node/example/example_api.ts | 147 +++++++++++++++ sdk/node/package-lock.json | 120 +++++++++++- sdk/node/package.json | 7 +- sdk/node/src/api/client.ts | 8 +- .../account/account/api_account.template.ts | 176 ------------------ sdk/node/src/generate/futures/order/index.ts | 3 + sdk/node/src/generate/service/index.ts | 3 + sdk/node/src/generate/spot/index.ts | 0 sdk/node/src/generate/spot/order/index.ts | 3 + sdk/node/src/index.ts | 12 ++ sdk/node/src/model/client_option.ts | 64 +++---- 11 files changed, 326 insertions(+), 217 deletions(-) create mode 100644 sdk/node/example/example_api.ts delete mode 100644 sdk/node/src/generate/account/account/api_account.template.ts create mode 100644 sdk/node/src/generate/futures/order/index.ts create mode 100644 sdk/node/src/generate/service/index.ts create mode 100644 sdk/node/src/generate/spot/index.ts create mode 100644 sdk/node/src/generate/spot/order/index.ts diff --git a/sdk/node/example/example_api.ts b/sdk/node/example/example_api.ts new file mode 100644 index 00000000..fb748335 --- /dev/null +++ b/sdk/node/example/example_api.ts @@ -0,0 +1,147 @@ +import { + DefaultClient, + DomainType +} from 'kucoin-universal-sdk/api/client'; + +import { randomUUID } from 'crypto'; +import { DomainType } from '../src'; + +async function restExample() { + console.log('Starting REST example'); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Optional: Retrieve broker secret information from environment variables + const brokerName = process.env.BROKER_NAME || ''; + const brokerKey = process.env.BROKER_KEY || ''; + const brokerPartner = process.env.BROKER_PARTNER || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setBrokerName(brokerName) + .setBrokerKey(brokerKey) + .setBrokerPartner(brokerPartner) + .setSpotEndpoint(DomainType.Spot) + .setFuturesEndpoint(DomainType.Futures) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + + await accountServiceExample(kucoinRestService.getAccountService()); + await spotServiceExample(kucoinRestService.getSpotService()); + await futuresServiceExample(kucoinRestService.getFuturesService()); +} + +async function accountServiceExample(accountService: AccountService) { + // Get account api + const accountApi = accountService.getAccountApi(); + // Get summary information + const accountInfoResp = accountApi.getAccountInfo().then((info) => { + console.log(`Account info: level: ${info.level}, SubAccountSize: ${info.subQuantity}`); + }); + // Other Account APIs... + + // Get fee api + const feeApi = accountService.getFeeApi(); + const getActualFeeReq: GetSpotActualFeeReq = new GetSpotActualFeeReqBuilder() + .setSymbols('BTC-USDT,ETH-USDT') + .build(); + const getActualFeeResp = feeApi.getSpotActualFee(getActualFeeReq).then((resp) => { + if (resp.data) { + resp.data.forEach((feeData: any) => { + console.log( + `Fee info: symbol: ${feeData.symbol}, TakerFee: ${feeData.takerFeeRate}, MakerFee: ${feeData.makerFeeRate}`, + ); + }); + } + }); + + // Other Fee APIs... + // Other APIs related to account... + + await Promise.all([accountInfoResp, getActualFeeResp]).catch((err) => { + console.error('Account API error:', err); + }); +} + +async function spotServiceExample(spotService: SpotService) { + const orderApi = spotService.getOrderApi(); + + // Add limit order + const addOrderReq = new AddOrderSyncReqBuilder() + .setClientOid(randomUUID().toString()) + .setSide(AddOrderSyncReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark('sdk_example') + .setPrice('10000') + .setSize('0.001') + .build(); + + const addOrderResp = await orderApi.addOrderSync(addOrderReq); + console.log(`Add order success, id: ${addOrderResp.orderId}, oid: ${addOrderResp.clientOid}`); + + // Query order detail + const orderId = addOrderResp.orderId!; + const queryOrderDetailReq = new GetOrderByOrderIdReqBuilder() + .setOrderId(orderId) + .setSymbol('BTC-USDT') + .build(); + const orderDetailResp = await orderApi.getOrderByOrderId(queryOrderDetailReq); + console.log(`Order detail: ${orderDetailResp.toJson()}`); + + // Cancel order + const cancelOrderReq = new CancelOrderByOrderIdSyncReqBuilder() + .setOrderId(orderId) + .setSymbol('BTC-USDT') + .build(); + const cancelOrderResp = await orderApi.cancelOrderByOrderIdSync(cancelOrderReq); + console.log(`Cancel order success, id: ${cancelOrderResp.orderId}`); +} + +async function futuresServiceExample(futuresService: any) { + const marketApi = futuresService.getMarketApi(); + const allSymbolResp = await marketApi.getAllSymbols(); + + const maxQuery = Math.min(allSymbolResp.data.length, 10); + for (let i = 0; i < maxQuery; i++) { + const symbol = allSymbolResp.data[i]; + const start = Date.now() - 10 * 60 * 1000; + const end = Date.now(); + + const getKlineReq = new GetKlinesReqBuilder() + .setSymbol(symbol.symbol) + .setType(GetKlinesReq.TypeEnum._1MIN) + .setStartAt(start) + .setEndAt(end) + .build(); + + const getKlineResp = await marketApi.getKlines(getKlineReq); + const rows = getKlineResp.data.map((row: any) => { + const timestamp = new Date(row[0]).toISOString(); + return `[Time: ${timestamp}, Open: ${row[1]}, High: ${row[2]}, Low: ${row[3]}, Close: ${row[4]}, Volume: ${row[5]}]`; + }); + console.log(`Symbol: ${symbol.symbol}, Kline: ${rows.join(', ')}`); + } +} + +restExample().catch((err) => { + console.error('Error occurred:', err); +}); diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 14fae1d5..3e863711 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -1,6 +1,6 @@ { - "name": "kucoin-universal-node-sdk", - "version": "0.0.1", + "name": "kucoin-universal-sdk", + "version": "0.1.0-alpha", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1204,6 +1204,12 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -1310,6 +1316,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true + }, "brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1398,6 +1410,22 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, + "chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -1453,6 +1481,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1530,6 +1564,15 @@ "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -1977,6 +2020,20 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -2070,6 +2127,15 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-core-module": { "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", @@ -2820,6 +2886,12 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "mylas": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz", + "integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==", + "dev": true + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -2954,6 +3026,12 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -3020,6 +3098,15 @@ } } }, + "plimit-lit": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz", + "integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==", + "dev": true, + "requires": { + "queue-lit": "^1.5.1" + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -3082,6 +3169,12 @@ "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", "dev": true }, + "queue-lit": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz", + "integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -3094,6 +3187,15 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "reflect-metadata": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", @@ -3381,6 +3483,20 @@ "yargs-parser": "^21.1.1" } }, + "tsc-alias": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.10.tgz", + "integrity": "sha512-Ibv4KAWfFkFdKJxnWfVtdOmB0Zi1RJVxcbPGiCDsFpCQSsmpWyuzHG3rQyI5YkobWwxFPEyQfu1hdo4qLG2zPw==", + "dev": true, + "requires": { + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "globby": "^11.0.4", + "mylas": "^2.1.9", + "normalize-path": "^3.0.0", + "plimit-lit": "^1.2.6" + } + }, "tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index b02f17c9..d6813ca9 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -1,6 +1,6 @@ { - "name": "kucoin-universal-node-sdk", - "version": "0.0.1", + "name": "kucoin-universal-sdk", + "version": "0.1.0-alpha", "description": "Official KuCoin Universal SDK.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -8,7 +8,7 @@ "dist" ], "scripts": { - "build": "tsc", + "build": "tsc && tsc-alias", "lint": "eslint 'src/**/*.{ts,js}' --fix", "format": "prettier --write 'src/**/*.{ts,js,json}'", "test": "jest", @@ -37,6 +37,7 @@ "jest": "^29.7.0", "prettier": "^3.4.2", "ts-jest": "^29.2.5", + "tsc-alias": "^1.8.10", "typescript": "^5.7.2" }, "peerDependencies": {}, diff --git a/sdk/node/src/api/client.ts b/sdk/node/src/api/client.ts index f9c99204..d55fbc1b 100644 --- a/sdk/node/src/api/client.ts +++ b/sdk/node/src/api/client.ts @@ -57,12 +57,12 @@ export interface Client { /** * Get RESTful service. */ - RestService(): KucoinRestService; + restService(): KucoinRestService; /** * Get WebSocket service. */ - WsService(): KucoinWSService; + wsService(): KucoinWSService; } /** @@ -80,14 +80,14 @@ export class DefaultClient implements Client { /** * Get RESTful service implementation. */ - RestService(): KucoinRestService { + restService(): KucoinRestService { return this.restImpl; } /** * Get WebSocket service implementation. */ - WsService(): KucoinWSService { + wsService(): KucoinWSService { return this.wsImpl; } } diff --git a/sdk/node/src/generate/account/account/api_account.template.ts b/sdk/node/src/generate/account/account/api_account.template.ts deleted file mode 100644 index b7edd9be..00000000 --- a/sdk/node/src/generate/account/account/api_account.template.ts +++ /dev/null @@ -1,176 +0,0 @@ - -describe('Auto Test', ()=> { - let api: AccountAPI; - - beforeAll(()=> { - api = ?? - }); - test('getFuturesAccount request test', ()=> { - /** - * getFuturesAccount - * Get Account - Futures - * /api/v1/account-overview - */ - let builder = GetFuturesAccount.builder(); - builder.setCurrency(?) - let req = builder.Build() - let resp = this.api.getFuturesAccount(req) - }) - - test('getSpotAccountDetail request test', ()=> { - /** - * getSpotAccountDetail - * Get Account Detail - Spot - * /api/v1/accounts/{accountId} - */ - let builder = GetSpotAccountDetail.builder(); - builder.setAccountId(?) - let req = builder.Build() - let resp = this.api.getSpotAccountDetail(req) - }) - - test('getSpotAccountList request test', ()=> { - /** - * getSpotAccountList - * Get Account List - Spot - * /api/v1/accounts - */ - let builder = GetSpotAccountList.builder(); - builder.setCurrency(?).setType(?) - let req = builder.Build() - let resp = this.api.getSpotAccountList(req) - }) - - test('getSpotLedger request test', ()=> { - /** - * getSpotLedger - * Get Account Ledgers - Spot/Margin - * /api/v1/accounts/ledgers - */ - let builder = GetSpotLedger.builder(); - builder.setCurrency(?).setDirection(?).setBizType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?) - let req = builder.Build() - let resp = this.api.getSpotLedger(req) - }) - - test('getSpotHFLedger request test', ()=> { - /** - * getSpotHFLedger - * Get Account Ledgers - Trade_hf - * /api/v1/hf/accounts/ledgers - */ - let builder = GetSpotHFLedger.builder(); - builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?) - let req = builder.Build() - let resp = this.api.getSpotHFLedger(req) - }) - - test('getSpotAccountType request test', ()=> { - /** - * getSpotAccountType - * Get Account Type - Spot - * /api/v1/hf/accounts/opened - */ - let resp = this.api.getSpotAccountType() - }) - - test('getIsolatedMarginAccountDetailV1 request test', ()=> { - /** - * getIsolatedMarginAccountDetailV1 - * Get Account Detail - Isolated Margin - V1 - * /api/v1/isolated/account/{symbol} - */ - let builder = GetIsolatedMarginAccountDetailV1.builder(); - builder.setSymbol(?) - let req = builder.Build() - let resp = this.api.getIsolatedMarginAccountDetailV1(req) - }) - - test('getIsolatedMarginAccountListV1 request test', ()=> { - /** - * getIsolatedMarginAccountListV1 - * Get Account List - Isolated Margin - V1 - * /api/v1/isolated/accounts - */ - let builder = GetIsolatedMarginAccountListV1.builder(); - builder.setBalanceCurrency(?) - let req = builder.Build() - let resp = this.api.getIsolatedMarginAccountListV1(req) - }) - - test('getMarginAccountDetail request test', ()=> { - /** - * getMarginAccountDetail - * Get Account Detail - Margin - * /api/v1/margin/account - */ - let resp = this.api.getMarginAccountDetail() - }) - - test('getFuturesLedger request test', ()=> { - /** - * getFuturesLedger - * Get Account Ledgers - Futures - * /api/v1/transaction-history - */ - let builder = GetFuturesLedger.builder(); - builder.setCurrency(?).setType(?).setOffset(?).setForward(?).setMaxCount(?).setStartAt(?).setEndAt(?) - let req = builder.Build() - let resp = this.api.getFuturesLedger(req) - }) - - test('getApikeyInfo request test', ()=> { - /** - * getApikeyInfo - * Get Apikey Info - * /api/v1/user/api-key - */ - let resp = this.api.getApikeyInfo() - }) - - test('getAccountInfo request test', ()=> { - /** - * getAccountInfo - * Get Account Summary Info - * /api/v2/user-info - */ - let resp = this.api.getAccountInfo() - }) - - test('getMarginHFLedger request test', ()=> { - /** - * getMarginHFLedger - * Get Account Ledgers - Margin_hf - * /api/v3/hf/margin/account/ledgers - */ - let builder = GetMarginHFLedger.builder(); - builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?) - let req = builder.Build() - let resp = this.api.getMarginHFLedger(req) - }) - - test('getIsolatedMarginAccount request test', ()=> { - /** - * getIsolatedMarginAccount - * Get Account - Isolated Margin - * /api/v3/isolated/accounts - */ - let builder = GetIsolatedMarginAccount.builder(); - builder.setSymbol(?).setQuoteCurrency(?).setQueryType(?) - let req = builder.Build() - let resp = this.api.getIsolatedMarginAccount(req) - }) - - test('getCrossMarginAccount request test', ()=> { - /** - * getCrossMarginAccount - * Get Account - Cross Margin - * /api/v3/margin/accounts - */ - let builder = GetCrossMarginAccount.builder(); - builder.setQuoteCurrency(?).setQueryType(?) - let req = builder.Build() - let resp = this.api.getCrossMarginAccount(req) - }) - -}) \ No newline at end of file diff --git a/sdk/node/src/generate/futures/order/index.ts b/sdk/node/src/generate/futures/order/index.ts new file mode 100644 index 00000000..11b56973 --- /dev/null +++ b/sdk/node/src/generate/futures/order/index.ts @@ -0,0 +1,3 @@ + + +export * from './model_add_order_req' \ No newline at end of file diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts new file mode 100644 index 00000000..621ace8a --- /dev/null +++ b/sdk/node/src/generate/service/index.ts @@ -0,0 +1,3 @@ + + +// export * from './spot_api' \ No newline at end of file diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/sdk/node/src/generate/spot/order/index.ts b/sdk/node/src/generate/spot/order/index.ts new file mode 100644 index 00000000..4df9a2bd --- /dev/null +++ b/sdk/node/src/generate/spot/order/index.ts @@ -0,0 +1,3 @@ + +export * from './model_add_order_req' +export * from './api_order' \ No newline at end of file diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index e69de29b..7e16d4e8 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -0,0 +1,12 @@ +// Exporting from api +export * from './api/client'; + +// Exporting from generate services +import * as Spot from './generate/spot/order/'; +import * as Futures from './generate/futures/order/'; + +export { Spot, Futures }; +// Exporting models +export * from './model/client_option'; +export * from './model/transport_option'; +export * from './model/constant'; diff --git a/sdk/node/src/model/client_option.ts b/sdk/node/src/model/client_option.ts index 6c6cbe4b..3be36567 100644 --- a/sdk/node/src/model/client_option.ts +++ b/sdk/node/src/model/client_option.ts @@ -8,39 +8,39 @@ export interface ClientOption { /** * Key is the authentication key for the client */ - key: string; + key?: string; /** * Secret is the authentication secret for the client */ - secret: string; + secret?: string; /** * Passphrase is the authentication passphrase for the client */ - passphrase: string; + passphrase?: string; /** * BrokerName The name of the broker */ - brokerName: string; + brokerName?: string; /** * BrokerPartner The partner associated with the broker */ - brokerPartner: string; + brokerPartner?: string; /** * BrokerKey The secret key for the broker */ - brokerKey: string; + brokerKey?: string; /** * SpotEndpoint is the spot market API endpoint for the client */ - spotEndpoint: string; + spotEndpoint?: string; /** * FuturesEndpoint is the futures market API endpoint for the client */ - futuresEndpoint: string; + futuresEndpoint?: string; /** * BrokerEndpoint is the broker API endpoint for the client */ - brokerEndpoint: string; + brokerEndpoint?: string; /** * TransportOption is an optional configuration for HTTP network transport */ @@ -54,7 +54,7 @@ export interface ClientOption { /** * ClientOptionBuilder is the builder for ClientOption */ -class ClientOptionBuilder { +export class ClientOptionBuilder { private clientOption: ClientOption; constructor() { @@ -72,89 +72,89 @@ class ClientOptionBuilder { } /** - * WithKey sets the authentication key + * setKey sets the authentication key */ - withKey(key: string): ClientOptionBuilder { + setKey(key: string): ClientOptionBuilder { this.clientOption.key = key; return this; } /** - * WithSecret sets the authentication secret + * setSecret sets the authentication secret */ - withSecret(secret: string): ClientOptionBuilder { + setSecret(secret: string): ClientOptionBuilder { this.clientOption.secret = secret; return this; } /** - * WithPassphrase sets the authentication passphrase + * setPassphrase sets the authentication passphrase */ - withPassphrase(passphrase: string): ClientOptionBuilder { + setPassphrase(passphrase: string): ClientOptionBuilder { this.clientOption.passphrase = passphrase; return this; } /** - * WithBrokerName sets the broker name + * setBrokerName sets the broker name */ - withBrokerName(brokerName: string): ClientOptionBuilder { + setBrokerName(brokerName: string): ClientOptionBuilder { this.clientOption.brokerName = brokerName; return this; } /** - * WithBrokerPartner sets the broker partner + * setBrokerPartner sets the broker partner */ - withBrokerPartner(brokerPartner: string): ClientOptionBuilder { + setBrokerPartner(brokerPartner: string): ClientOptionBuilder { this.clientOption.brokerPartner = brokerPartner; return this; } /** - * WithBrokerKey sets the broker key + * setBrokerKey sets the broker key */ - withBrokerKey(brokerKey: string): ClientOptionBuilder { + setBrokerKey(brokerKey: string): ClientOptionBuilder { this.clientOption.brokerKey = brokerKey; return this; } /** - * WithSpotEndpoint sets the spot market API endpoint + * setSpotEndpoint sets the spot market API endpoint */ - withSpotEndpoint(endpoint: string): ClientOptionBuilder { + setSpotEndpoint(endpoint: string): ClientOptionBuilder { this.clientOption.spotEndpoint = endpoint; return this; } /** - * WithFuturesEndpoint sets the futures market API endpoint + * setFuturesEndpoint sets the futures market API endpoint */ - withFuturesEndpoint(endpoint: string): ClientOptionBuilder { + setFuturesEndpoint(endpoint: string): ClientOptionBuilder { this.clientOption.futuresEndpoint = endpoint; return this; } /** - * WithBrokerEndpoint sets the broker API endpoint + * setBrokerEndpoint sets the broker API endpoint */ - withBrokerEndpoint(endpoint: string): ClientOptionBuilder { + setBrokerEndpoint(endpoint: string): ClientOptionBuilder { this.clientOption.brokerEndpoint = endpoint; return this; } /** - * WithTransportOption sets the HTTP transport options + * setTransportOption sets the HTTP transport options */ - withTransportOption(option: TransportOption): ClientOptionBuilder { + setTransportOption(option: TransportOption): ClientOptionBuilder { this.clientOption.transportOption = option; return this; } /** - * WithWebSocketClientOption sets the WebSocket client options + * setWebSocketClientOption sets the WebSocket client options */ - withWebSocketClientOption(option: WebSocketClientOption): ClientOptionBuilder { + setWebSocketClientOption(option: WebSocketClientOption): ClientOptionBuilder { this.clientOption.webSocketClientOption = option; return this; } From 19dc0f02199ec0025265b33ee0d70f35879d8a69 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 13 Jan 2025 16:56:09 +0800 Subject: [PATCH 017/106] feat(nodejs): generate index.ts --- .../plugin/generator/NodeSdkGenerator.java | 77 ++++++++++++++- .../main/resources/node-sdk/module.mustache | 3 + .../sdk/plugin/SdkGeneratorTest.java | 4 +- sdk/node/src/api/index.ts | 3 + .../src/generate/account/account/index.ts | 27 ++++++ .../src/generate/account/deposit/index.ts | 15 +++ sdk/node/src/generate/account/fee/index.ts | 7 ++ sdk/node/src/generate/account/index.ts | 15 +++ .../src/generate/account/subaccount/index.ts | 25 +++++ .../src/generate/account/transfer/index.ts | 15 +++ .../src/generate/account/withdrawal/index.ts | 13 +++ .../src/generate/affiliate/affiliate/index.ts | 2 + sdk/node/src/generate/affiliate/index.ts | 5 + .../src/generate/broker/apibroker/index.ts | 3 + sdk/node/src/generate/broker/index.ts | 7 ++ .../src/generate/broker/ndbroker/index.ts | 27 ++++++ sdk/node/src/generate/earn/earn/index.ts | 19 ++++ sdk/node/src/generate/earn/index.ts | 5 + .../src/generate/futures/fundingfees/index.ts | 7 ++ .../generate/futures/futuresprivate/index.ts | 8 ++ .../generate/futures/futurespublic/index.ts | 10 ++ sdk/node/src/generate/futures/index.ts | 11 +++ sdk/node/src/generate/futures/market/index.ts | 28 ++++++ sdk/node/src/generate/futures/order/index.ts | 40 +++++++- .../src/generate/futures/positions/index.ts | 29 ++++++ sdk/node/src/generate/margin/credit/index.ts | 15 +++ sdk/node/src/generate/margin/debit/index.ts | 13 +++ sdk/node/src/generate/margin/index.ts | 13 +++ .../generate/margin/marginprivate/index.ts | 2 + .../src/generate/margin/marginpublic/index.ts | 2 + sdk/node/src/generate/margin/market/index.ts | 10 ++ sdk/node/src/generate/margin/order/index.ts | 27 ++++++ .../src/generate/margin/risklimit/index.ts | 3 + sdk/node/src/generate/service/index.ts | 3 - sdk/node/src/generate/spot/index.ts | 7 ++ sdk/node/src/generate/spot/market/index.ts | 30 ++++++ sdk/node/src/generate/spot/order/index.ts | 97 ++++++++++++++++++- .../src/generate/spot/spotprivate/index.ts | 3 + .../src/generate/spot/spotpublic/index.ts | 10 ++ sdk/node/src/generate/version.ts | 2 +- sdk/node/src/generate/viplending/index.ts | 5 + .../generate/viplending/viplending/index.ts | 3 + sdk/node/src/index.ts | 11 +-- sdk/node/src/model/index.ts | 5 + 44 files changed, 643 insertions(+), 23 deletions(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/module.mustache create mode 100644 sdk/node/src/api/index.ts create mode 100644 sdk/node/src/generate/account/account/index.ts create mode 100644 sdk/node/src/generate/account/deposit/index.ts create mode 100644 sdk/node/src/generate/account/fee/index.ts create mode 100644 sdk/node/src/generate/account/index.ts create mode 100644 sdk/node/src/generate/account/subaccount/index.ts create mode 100644 sdk/node/src/generate/account/transfer/index.ts create mode 100644 sdk/node/src/generate/account/withdrawal/index.ts create mode 100644 sdk/node/src/generate/affiliate/affiliate/index.ts create mode 100644 sdk/node/src/generate/affiliate/index.ts create mode 100644 sdk/node/src/generate/broker/apibroker/index.ts create mode 100644 sdk/node/src/generate/broker/index.ts create mode 100644 sdk/node/src/generate/broker/ndbroker/index.ts create mode 100644 sdk/node/src/generate/earn/earn/index.ts create mode 100644 sdk/node/src/generate/earn/index.ts create mode 100644 sdk/node/src/generate/futures/fundingfees/index.ts create mode 100644 sdk/node/src/generate/futures/futuresprivate/index.ts create mode 100644 sdk/node/src/generate/futures/futurespublic/index.ts create mode 100644 sdk/node/src/generate/futures/index.ts create mode 100644 sdk/node/src/generate/futures/market/index.ts create mode 100644 sdk/node/src/generate/futures/positions/index.ts create mode 100644 sdk/node/src/generate/margin/credit/index.ts create mode 100644 sdk/node/src/generate/margin/debit/index.ts create mode 100644 sdk/node/src/generate/margin/index.ts create mode 100644 sdk/node/src/generate/margin/marginprivate/index.ts create mode 100644 sdk/node/src/generate/margin/marginpublic/index.ts create mode 100644 sdk/node/src/generate/margin/market/index.ts create mode 100644 sdk/node/src/generate/margin/order/index.ts create mode 100644 sdk/node/src/generate/margin/risklimit/index.ts delete mode 100644 sdk/node/src/generate/service/index.ts create mode 100644 sdk/node/src/generate/spot/market/index.ts create mode 100644 sdk/node/src/generate/spot/spotprivate/index.ts create mode 100644 sdk/node/src/generate/spot/spotpublic/index.ts create mode 100644 sdk/node/src/generate/viplending/index.ts create mode 100644 sdk/node/src/generate/viplending/viplending/index.ts create mode 100644 sdk/node/src/model/index.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 78b537f9..fe359dd9 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -21,6 +21,7 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.utils.CamelizeOption; import java.io.File; import java.util.*; @@ -60,6 +61,7 @@ public String toImport() { private String service; private String subService; + private Set exports = new LinkedHashSet<>(); public CodegenType getTag() { return CodegenType.OTHER; @@ -82,11 +84,14 @@ public NodeSdkGenerator() { public void processOpts() { super.processOpts(); modeSwitch = new ModeSwitch(additionalProperties); + service = openAPI.getInfo().getTitle(); + subService = openAPI.getInfo().getDescription(); switch (modeSwitch.getMode()) { case API: { modelTemplateFiles.put("model.mustache", ".ts"); apiTemplateFiles.put("api.mustache", ".ts"); + supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/%s/index.ts", service, formatPackage(subService)))); break; } case TEST: { @@ -99,12 +104,14 @@ public void processOpts() { } case ENTRY: { apiTemplateFiles.put("api_entry.mustache", ".ts"); + supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/index.ts", service))); break; } case WS: { modelTemplateFiles.put("model_ws.mustache", ".ts"); apiTemplateFiles.put("api_ws.mustache", ".ts"); additionalProperties.put("WS_MODE", "true"); + supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/%s/index.ts", service, formatPackage(subService)))); break; } case WS_TEST: { @@ -122,9 +129,6 @@ public void processOpts() { // override parent properties enablePostProcessFile = true; - service = openAPI.getInfo().getTitle(); - subService = openAPI.getInfo().getDescription(); - inlineSchemaOption.put("SKIP_SCHEMA_REUSE", "true"); } @@ -362,6 +366,60 @@ private void generateApiImport(Meta meta, boolean req, Map } } + private void generateApiExport(Meta meta, boolean req, Set export) { + switch (modeSwitch.getMode()) { + case API: { + String suffix = "resp"; + if (req) { + suffix = "req"; + } + export.add(String.format("export * from \"./%s\"", toModelFilename(meta.getMethod()) + "_" + suffix)); + + + operationService.getServiceMeta().forEach((k, v) -> { + if (v.getService().equalsIgnoreCase(meta.getService())) { + export.add(String.format("export * from \"./%s\"", toApiFilename(formatMethodName(k)))); + } + }); + + break; + } + case WS: { + String suffix = "event"; + String fileName = "./" + toModelFilename(meta.getMethod()) + "_" + suffix; + export.add(String.format("export * from \"%s\"", fileName)); + break; + + } + case ENTRY: { + List serviceAliases = new LinkedList<>(); + operationService.getServiceMeta().forEach((k, v) -> { + if (v.getService().equalsIgnoreCase(meta.getService())) { + String serviceAlias = v.getSubService().toUpperCase(); + export.add(String.format("import * as %s from \"./%s\"", serviceAlias, formatPackage(v.getSubService()))); + serviceAliases.add(serviceAlias); + } + }); + + String exportService = camelize(service.toLowerCase(), CamelizeOption.UPPERCASE_FIRST_CHAR); + export.add(String.format("const %s = \n{\n%s\n};", exportService, + serviceAliases.stream().map(s -> " ..." + s).collect(Collectors.joining(",\n")))); + export.add(String.format("export default %s;", exportService)); + + break; + } + case WS_TEST: + case TEST: { + // skip + break; + } + default: { + throw new RuntimeException("unsupported mode"); + } + } + } + + @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); @@ -392,6 +450,8 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { generateApiImport(meta, false, imports); + generateApiExport(meta, false, exports); + }); break; } @@ -400,13 +460,16 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List postProcessSupportingFileData(Map objs) { + Map data = super.postProcessSupportingFileData(objs); + data.put("exports", exports); + return data; + } } diff --git a/generator/plugin/src/main/resources/node-sdk/module.mustache b/generator/plugin/src/main/resources/node-sdk/module.mustache new file mode 100644 index 00000000..a577b4ba --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/module.mustache @@ -0,0 +1,3 @@ +{{#exports}} +{{{.}}} +{{/exports}} \ No newline at end of file diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 86b9d75f..2558652c 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,8 +8,8 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-account.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-viplending-viplending.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-viplending.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; diff --git a/sdk/node/src/api/index.ts b/sdk/node/src/api/index.ts new file mode 100644 index 00000000..0464e89b --- /dev/null +++ b/sdk/node/src/api/index.ts @@ -0,0 +1,3 @@ +export * from './client'; +export * from './api_rest'; +export * from './api_ws'; diff --git a/sdk/node/src/generate/account/account/index.ts b/sdk/node/src/generate/account/account/index.ts new file mode 100644 index 00000000..ee8e056a --- /dev/null +++ b/sdk/node/src/generate/account/account/index.ts @@ -0,0 +1,27 @@ +export * from './model_get_futures_account_req'; +export * from './api_account'; +export * from './model_get_futures_account_resp'; +export * from './model_get_spot_account_detail_req'; +export * from './model_get_spot_account_detail_resp'; +export * from './model_get_spot_account_list_req'; +export * from './model_get_spot_account_list_resp'; +export * from './model_get_spot_ledger_req'; +export * from './model_get_spot_ledger_resp'; +export * from './model_get_spot_hf_ledger_req'; +export * from './model_get_spot_hf_ledger_resp'; +export * from './model_get_spot_account_type_resp'; +export * from './model_get_isolated_margin_account_detail_v1_req'; +export * from './model_get_isolated_margin_account_detail_v1_resp'; +export * from './model_get_isolated_margin_account_list_v1_req'; +export * from './model_get_isolated_margin_account_list_v1_resp'; +export * from './model_get_margin_account_detail_resp'; +export * from './model_get_futures_ledger_req'; +export * from './model_get_futures_ledger_resp'; +export * from './model_get_apikey_info_resp'; +export * from './model_get_account_info_resp'; +export * from './model_get_margin_hf_ledger_req'; +export * from './model_get_margin_hf_ledger_resp'; +export * from './model_get_isolated_margin_account_req'; +export * from './model_get_isolated_margin_account_resp'; +export * from './model_get_cross_margin_account_req'; +export * from './model_get_cross_margin_account_resp'; diff --git a/sdk/node/src/generate/account/deposit/index.ts b/sdk/node/src/generate/account/deposit/index.ts new file mode 100644 index 00000000..684aa2e6 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/index.ts @@ -0,0 +1,15 @@ +export * from './model_get_deposit_address_v1_req'; +export * from './api_deposit'; +export * from './model_get_deposit_address_v1_resp'; +export * from './model_add_deposit_address_v1_req'; +export * from './model_add_deposit_address_v1_resp'; +export * from './model_get_deposit_history_req'; +export * from './model_get_deposit_history_resp'; +export * from './model_get_deposit_history_old_req'; +export * from './model_get_deposit_history_old_resp'; +export * from './model_get_deposit_address_v2_req'; +export * from './model_get_deposit_address_v2_resp'; +export * from './model_add_deposit_address_v3_req'; +export * from './model_add_deposit_address_v3_resp'; +export * from './model_get_deposit_address_v3_req'; +export * from './model_get_deposit_address_v3_resp'; diff --git a/sdk/node/src/generate/account/fee/index.ts b/sdk/node/src/generate/account/fee/index.ts new file mode 100644 index 00000000..aa2a2072 --- /dev/null +++ b/sdk/node/src/generate/account/fee/index.ts @@ -0,0 +1,7 @@ +export * from './model_get_basic_fee_req'; +export * from './api_fee'; +export * from './model_get_basic_fee_resp'; +export * from './model_get_spot_actual_fee_req'; +export * from './model_get_spot_actual_fee_resp'; +export * from './model_get_futures_actual_fee_req'; +export * from './model_get_futures_actual_fee_resp'; diff --git a/sdk/node/src/generate/account/index.ts b/sdk/node/src/generate/account/index.ts new file mode 100644 index 00000000..0f71585e --- /dev/null +++ b/sdk/node/src/generate/account/index.ts @@ -0,0 +1,15 @@ +import * as ACCOUNT from './account'; +import * as DEPOSIT from './deposit'; +import * as WITHDRAWAL from './withdrawal'; +import * as FEE from './fee'; +import * as SUBACCOUNT from './subaccount'; +import * as TRANSFER from './transfer'; +const Account = { + ...ACCOUNT, + ...DEPOSIT, + ...WITHDRAWAL, + ...FEE, + ...SUBACCOUNT, + ...TRANSFER, +}; +export default Account; diff --git a/sdk/node/src/generate/account/subaccount/index.ts b/sdk/node/src/generate/account/subaccount/index.ts new file mode 100644 index 00000000..63508573 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/index.ts @@ -0,0 +1,25 @@ +export * from './model_get_futures_sub_account_list_v2_req'; +export * from './api_sub_account'; +export * from './model_get_futures_sub_account_list_v2_resp'; +export * from './model_get_spot_sub_account_list_v1_resp'; +export * from './model_get_spot_sub_account_detail_req'; +export * from './model_get_spot_sub_account_detail_resp'; +export * from './model_delete_sub_account_api_req'; +export * from './model_delete_sub_account_api_resp'; +export * from './model_get_sub_account_api_list_req'; +export * from './model_get_sub_account_api_list_resp'; +export * from './model_add_sub_account_api_req'; +export * from './model_add_sub_account_api_resp'; +export * from './model_modify_sub_account_api_req'; +export * from './model_modify_sub_account_api_resp'; +export * from './model_get_spot_sub_accounts_summary_v1_resp'; +export * from './model_get_spot_sub_account_list_v2_req'; +export * from './model_get_spot_sub_account_list_v2_resp'; +export * from './model_add_sub_account_req'; +export * from './model_add_sub_account_resp'; +export * from './model_get_spot_sub_accounts_summary_v2_req'; +export * from './model_get_spot_sub_accounts_summary_v2_resp'; +export * from './model_add_sub_account_futures_permission_req'; +export * from './model_add_sub_account_futures_permission_resp'; +export * from './model_add_sub_account_margin_permission_req'; +export * from './model_add_sub_account_margin_permission_resp'; diff --git a/sdk/node/src/generate/account/transfer/index.ts b/sdk/node/src/generate/account/transfer/index.ts new file mode 100644 index 00000000..3370d728 --- /dev/null +++ b/sdk/node/src/generate/account/transfer/index.ts @@ -0,0 +1,15 @@ +export * from './model_get_transfer_quotas_req'; +export * from './api_transfer'; +export * from './model_get_transfer_quotas_resp'; +export * from './model_futures_account_transfer_in_req'; +export * from './model_futures_account_transfer_in_resp'; +export * from './model_get_futures_account_transfer_out_ledger_req'; +export * from './model_get_futures_account_transfer_out_ledger_resp'; +export * from './model_inner_transfer_req'; +export * from './model_inner_transfer_resp'; +export * from './model_sub_account_transfer_req'; +export * from './model_sub_account_transfer_resp'; +export * from './model_flex_transfer_req'; +export * from './model_flex_transfer_resp'; +export * from './model_futures_account_transfer_out_req'; +export * from './model_futures_account_transfer_out_resp'; diff --git a/sdk/node/src/generate/account/withdrawal/index.ts b/sdk/node/src/generate/account/withdrawal/index.ts new file mode 100644 index 00000000..742db4ae --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/index.ts @@ -0,0 +1,13 @@ +export * from './model_get_withdrawal_history_old_req'; +export * from './api_withdrawal'; +export * from './model_get_withdrawal_history_old_resp'; +export * from './model_get_withdrawal_history_req'; +export * from './model_get_withdrawal_history_resp'; +export * from './model_withdrawal_v1_req'; +export * from './model_withdrawal_v1_resp'; +export * from './model_get_withdrawal_quotas_req'; +export * from './model_get_withdrawal_quotas_resp'; +export * from './model_cancel_withdrawal_req'; +export * from './model_cancel_withdrawal_resp'; +export * from './model_withdrawal_v3_req'; +export * from './model_withdrawal_v3_resp'; diff --git a/sdk/node/src/generate/affiliate/affiliate/index.ts b/sdk/node/src/generate/affiliate/affiliate/index.ts new file mode 100644 index 00000000..1b0a33ca --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/index.ts @@ -0,0 +1,2 @@ +export * from './model_get_account_resp'; +export * from './api_affiliate'; diff --git a/sdk/node/src/generate/affiliate/index.ts b/sdk/node/src/generate/affiliate/index.ts new file mode 100644 index 00000000..f0ac8ca5 --- /dev/null +++ b/sdk/node/src/generate/affiliate/index.ts @@ -0,0 +1,5 @@ +import * as AFFILIATE from './affiliate'; +const Affiliate = { + ...AFFILIATE, +}; +export default Affiliate; diff --git a/sdk/node/src/generate/broker/apibroker/index.ts b/sdk/node/src/generate/broker/apibroker/index.ts new file mode 100644 index 00000000..260507f1 --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/index.ts @@ -0,0 +1,3 @@ +export * from './model_get_rebase_req'; +export * from './api_api_broker'; +export * from './model_get_rebase_resp'; diff --git a/sdk/node/src/generate/broker/index.ts b/sdk/node/src/generate/broker/index.ts new file mode 100644 index 00000000..9da5ecf8 --- /dev/null +++ b/sdk/node/src/generate/broker/index.ts @@ -0,0 +1,7 @@ +import * as APIBROKER from './apibroker'; +import * as NDBROKER from './ndbroker'; +const Broker = { + ...APIBROKER, + ...NDBROKER, +}; +export default Broker; diff --git a/sdk/node/src/generate/broker/ndbroker/index.ts b/sdk/node/src/generate/broker/ndbroker/index.ts new file mode 100644 index 00000000..31a22fc5 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/index.ts @@ -0,0 +1,27 @@ +export * from './model_get_deposit_list_req'; +export * from './api_nd_broker'; +export * from './model_get_deposit_list_resp'; +export * from './model_delete_sub_account_api_req'; +export * from './model_delete_sub_account_api_resp'; +export * from './model_get_sub_account_api_req'; +export * from './model_get_sub_account_api_resp'; +export * from './model_add_sub_account_api_req'; +export * from './model_add_sub_account_api_resp'; +export * from './model_get_sub_account_req'; +export * from './model_get_sub_account_resp'; +export * from './model_add_sub_account_req'; +export * from './model_add_sub_account_resp'; +export * from './model_modify_sub_account_api_req'; +export * from './model_modify_sub_account_api_resp'; +export * from './model_get_broker_info_req'; +export * from './model_get_broker_info_resp'; +export * from './model_get_rebase_req'; +export * from './model_get_rebase_resp'; +export * from './model_transfer_req'; +export * from './model_transfer_resp'; +export * from './model_get_deposit_detail_req'; +export * from './model_get_deposit_detail_resp'; +export * from './model_get_transfer_history_req'; +export * from './model_get_transfer_history_resp'; +export * from './model_get_withdraw_detail_req'; +export * from './model_get_withdraw_detail_resp'; diff --git a/sdk/node/src/generate/earn/earn/index.ts b/sdk/node/src/generate/earn/earn/index.ts new file mode 100644 index 00000000..6ede832a --- /dev/null +++ b/sdk/node/src/generate/earn/earn/index.ts @@ -0,0 +1,19 @@ +export * from './model_get_eth_staking_products_req'; +export * from './api_earn'; +export * from './model_get_eth_staking_products_resp'; +export * from './model_get_account_holding_req'; +export * from './model_get_account_holding_resp'; +export * from './model_get_kcs_staking_products_req'; +export * from './model_get_kcs_staking_products_resp'; +export * from './model_redeem_req'; +export * from './model_redeem_resp'; +export * from './model_purchase_req'; +export * from './model_purchase_resp'; +export * from './model_get_promotion_products_req'; +export * from './model_get_promotion_products_resp'; +export * from './model_get_redeem_preview_req'; +export * from './model_get_redeem_preview_resp'; +export * from './model_get_savings_products_req'; +export * from './model_get_savings_products_resp'; +export * from './model_get_staking_products_req'; +export * from './model_get_staking_products_resp'; diff --git a/sdk/node/src/generate/earn/index.ts b/sdk/node/src/generate/earn/index.ts new file mode 100644 index 00000000..a2c83bfc --- /dev/null +++ b/sdk/node/src/generate/earn/index.ts @@ -0,0 +1,5 @@ +import * as EARN from './earn'; +const Earn = { + ...EARN, +}; +export default Earn; diff --git a/sdk/node/src/generate/futures/fundingfees/index.ts b/sdk/node/src/generate/futures/fundingfees/index.ts new file mode 100644 index 00000000..558ac693 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/index.ts @@ -0,0 +1,7 @@ +export * from './model_get_public_funding_history_req'; +export * from './api_funding_fees'; +export * from './model_get_public_funding_history_resp'; +export * from './model_get_private_funding_history_req'; +export * from './model_get_private_funding_history_resp'; +export * from './model_get_current_funding_rate_req'; +export * from './model_get_current_funding_rate_resp'; diff --git a/sdk/node/src/generate/futures/futuresprivate/index.ts b/sdk/node/src/generate/futures/futuresprivate/index.ts new file mode 100644 index 00000000..3bb19277 --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/index.ts @@ -0,0 +1,8 @@ +export * from './model_all_order_event'; +export * from './model_all_position_event'; +export * from './model_balance_event'; +export * from './model_cross_leverage_event'; +export * from './model_margin_mode_event'; +export * from './model_order_event'; +export * from './model_position_event'; +export * from './model_stop_orders_event'; diff --git a/sdk/node/src/generate/futures/futurespublic/index.ts b/sdk/node/src/generate/futures/futurespublic/index.ts new file mode 100644 index 00000000..ddf6b0db --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/index.ts @@ -0,0 +1,10 @@ +export * from './model_announcement_event'; +export * from './model_execution_event'; +export * from './model_instrument_event'; +export * from './model_klines_event'; +export * from './model_orderbook_increment_event'; +export * from './model_orderbook_level50_event'; +export * from './model_orderbook_level5_event'; +export * from './model_symbol_snapshot_event'; +export * from './model_ticker_v1_event'; +export * from './model_ticker_v2_event'; diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts new file mode 100644 index 00000000..3df463b3 --- /dev/null +++ b/sdk/node/src/generate/futures/index.ts @@ -0,0 +1,11 @@ +import * as ORDER from './order'; +import * as POSITIONS from './positions'; +import * as FUNDINGFEES from './fundingfees'; +import * as MARKET from './market'; +const Futures = { + ...ORDER, + ...POSITIONS, + ...FUNDINGFEES, + ...MARKET, +}; +export default Futures; diff --git a/sdk/node/src/generate/futures/market/index.ts b/sdk/node/src/generate/futures/market/index.ts new file mode 100644 index 00000000..8480a1fc --- /dev/null +++ b/sdk/node/src/generate/futures/market/index.ts @@ -0,0 +1,28 @@ +export * from './model_get_all_tickers_resp'; +export * from './api_market'; +export * from './model_get_private_token_resp'; +export * from './model_get_public_token_resp'; +export * from './model_get_all_symbols_resp'; +export * from './model_get_symbol_req'; +export * from './model_get_symbol_resp'; +export * from './model_get_spot_index_price_req'; +export * from './model_get_spot_index_price_resp'; +export * from './model_get_interest_rate_index_req'; +export * from './model_get_interest_rate_index_resp'; +export * from './model_get_klines_req'; +export * from './model_get_klines_resp'; +export * from './model_get_part_order_book_req'; +export * from './model_get_part_order_book_resp'; +export * from './model_get_full_order_book_req'; +export * from './model_get_full_order_book_resp'; +export * from './model_get_mark_price_req'; +export * from './model_get_mark_price_resp'; +export * from './model_get_premium_index_req'; +export * from './model_get_premium_index_resp'; +export * from './model_get_service_status_resp'; +export * from './model_get_ticker_req'; +export * from './model_get_ticker_resp'; +export * from './model_get_server_time_resp'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './model_get24hr_stats_resp'; diff --git a/sdk/node/src/generate/futures/order/index.ts b/sdk/node/src/generate/futures/order/index.ts index 11b56973..1bb81ccd 100644 --- a/sdk/node/src/generate/futures/order/index.ts +++ b/sdk/node/src/generate/futures/order/index.ts @@ -1,3 +1,37 @@ - - -export * from './model_add_order_req' \ No newline at end of file +export * from './model_get_trade_history_req'; +export * from './api_order'; +export * from './model_get_trade_history_resp'; +export * from './model_get_open_order_value_req'; +export * from './model_get_open_order_value_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; +export * from './model_cancel_all_orders_v1_req'; +export * from './model_cancel_all_orders_v1_resp'; +export * from './model_get_order_list_req'; +export * from './model_get_order_list_resp'; +export * from './model_batch_cancel_orders_req'; +export * from './model_batch_cancel_orders_resp'; +export * from './model_batch_add_orders_req'; +export * from './model_batch_add_orders_resp'; +export * from './model_cancel_order_by_id_req'; +export * from './model_cancel_order_by_id_resp'; +export * from './model_get_order_by_order_id_req'; +export * from './model_get_order_by_order_id_resp'; +export * from './model_add_order_req'; +export * from './model_add_order_resp'; +export * from './model_add_order_test_req'; +export * from './model_add_order_test_resp'; +export * from './model_get_recent_closed_orders_req'; +export * from './model_get_recent_closed_orders_resp'; +export * from './model_get_recent_trade_history_req'; +export * from './model_get_recent_trade_history_resp'; +export * from './model_add_tpsl_order_req'; +export * from './model_add_tpsl_order_resp'; +export * from './model_cancel_all_stop_orders_req'; +export * from './model_cancel_all_stop_orders_resp'; +export * from './model_get_stop_order_list_req'; +export * from './model_get_stop_order_list_resp'; +export * from './model_cancel_all_orders_v3_req'; +export * from './model_cancel_all_orders_v3_resp'; diff --git a/sdk/node/src/generate/futures/positions/index.ts b/sdk/node/src/generate/futures/positions/index.ts new file mode 100644 index 00000000..aeaa63de --- /dev/null +++ b/sdk/node/src/generate/futures/positions/index.ts @@ -0,0 +1,29 @@ +export * from './model_get_isolated_margin_risk_limit_req'; +export * from './api_positions'; +export * from './model_get_isolated_margin_risk_limit_resp'; +export * from './model_get_positions_history_req'; +export * from './model_get_positions_history_resp'; +export * from './model_get_max_withdraw_margin_req'; +export * from './model_get_max_withdraw_margin_resp'; +export * from './model_remove_isolated_margin_req'; +export * from './model_remove_isolated_margin_resp'; +export * from './model_get_position_details_req'; +export * from './model_get_position_details_resp'; +export * from './model_modify_auto_deposit_status_req'; +export * from './model_modify_auto_deposit_status_resp'; +export * from './model_add_isolated_margin_req'; +export * from './model_add_isolated_margin_resp'; +export * from './model_modify_isolated_margin_risk_limt_req'; +export * from './model_modify_isolated_margin_risk_limt_resp'; +export * from './model_get_position_list_req'; +export * from './model_get_position_list_resp'; +export * from './model_modify_margin_leverage_req'; +export * from './model_modify_margin_leverage_resp'; +export * from './model_get_cross_margin_leverage_req'; +export * from './model_get_cross_margin_leverage_resp'; +export * from './model_get_max_open_size_req'; +export * from './model_get_max_open_size_resp'; +export * from './model_switch_margin_mode_req'; +export * from './model_switch_margin_mode_resp'; +export * from './model_get_margin_mode_req'; +export * from './model_get_margin_mode_resp'; diff --git a/sdk/node/src/generate/margin/credit/index.ts b/sdk/node/src/generate/margin/credit/index.ts new file mode 100644 index 00000000..3aff9cbe --- /dev/null +++ b/sdk/node/src/generate/margin/credit/index.ts @@ -0,0 +1,15 @@ +export * from './model_modify_purchase_req'; +export * from './api_credit'; +export * from './model_modify_purchase_resp'; +export * from './model_get_loan_market_req'; +export * from './model_get_loan_market_resp'; +export * from './model_get_loan_market_interest_rate_req'; +export * from './model_get_loan_market_interest_rate_resp'; +export * from './model_get_purchase_orders_req'; +export * from './model_get_purchase_orders_resp'; +export * from './model_purchase_req'; +export * from './model_purchase_resp'; +export * from './model_get_redeem_orders_req'; +export * from './model_get_redeem_orders_resp'; +export * from './model_redeem_req'; +export * from './model_redeem_resp'; diff --git a/sdk/node/src/generate/margin/debit/index.ts b/sdk/node/src/generate/margin/debit/index.ts new file mode 100644 index 00000000..ea2716d3 --- /dev/null +++ b/sdk/node/src/generate/margin/debit/index.ts @@ -0,0 +1,13 @@ +export * from './model_get_borrow_history_req'; +export * from './api_debit'; +export * from './model_get_borrow_history_resp'; +export * from './model_borrow_req'; +export * from './model_borrow_resp'; +export * from './model_get_interest_history_req'; +export * from './model_get_interest_history_resp'; +export * from './model_get_repay_history_req'; +export * from './model_get_repay_history_resp'; +export * from './model_repay_req'; +export * from './model_repay_resp'; +export * from './model_modify_leverage_req'; +export * from './model_modify_leverage_resp'; diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts new file mode 100644 index 00000000..54153b05 --- /dev/null +++ b/sdk/node/src/generate/margin/index.ts @@ -0,0 +1,13 @@ +import * as ORDER from './order'; +import * as DEBIT from './debit'; +import * as CREDIT from './credit'; +import * as MARKET from './market'; +import * as RISKLIMIT from './risklimit'; +const Margin = { + ...ORDER, + ...DEBIT, + ...CREDIT, + ...MARKET, + ...RISKLIMIT, +}; +export default Margin; diff --git a/sdk/node/src/generate/margin/marginprivate/index.ts b/sdk/node/src/generate/margin/marginprivate/index.ts new file mode 100644 index 00000000..838b29ec --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/index.ts @@ -0,0 +1,2 @@ +export * from './model_cross_margin_position_event'; +export * from './model_isolated_margin_position_event'; diff --git a/sdk/node/src/generate/margin/marginpublic/index.ts b/sdk/node/src/generate/margin/marginpublic/index.ts new file mode 100644 index 00000000..30c07031 --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/index.ts @@ -0,0 +1,2 @@ +export * from './model_index_price_event'; +export * from './model_mark_price_event'; diff --git a/sdk/node/src/generate/margin/market/index.ts b/sdk/node/src/generate/margin/market/index.ts new file mode 100644 index 00000000..06606d65 --- /dev/null +++ b/sdk/node/src/generate/margin/market/index.ts @@ -0,0 +1,10 @@ +export * from './model_get_isolated_margin_symbols_resp'; +export * from './api_market'; +export * from './model_get_margin_config_resp'; +export * from './model_get_mark_price_detail_req'; +export * from './model_get_mark_price_detail_resp'; +export * from './model_get_etf_info_req'; +export * from './model_get_etf_info_resp'; +export * from './model_get_cross_margin_symbols_req'; +export * from './model_get_cross_margin_symbols_resp'; +export * from './model_get_mark_price_list_resp'; diff --git a/sdk/node/src/generate/margin/order/index.ts b/sdk/node/src/generate/margin/order/index.ts new file mode 100644 index 00000000..2eeabcf8 --- /dev/null +++ b/sdk/node/src/generate/margin/order/index.ts @@ -0,0 +1,27 @@ +export * from './model_add_order_v1_req'; +export * from './api_order'; +export * from './model_add_order_v1_resp'; +export * from './model_add_order_test_v1_req'; +export * from './model_add_order_test_v1_resp'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './model_get_symbols_with_open_order_req'; +export * from './model_get_symbols_with_open_order_resp'; +export * from './model_add_order_req'; +export * from './model_add_order_resp'; +export * from './model_add_order_test_req'; +export * from './model_add_order_test_resp'; +export * from './model_get_open_orders_req'; +export * from './model_get_open_orders_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; +export * from './model_cancel_all_orders_by_symbol_req'; +export * from './model_cancel_all_orders_by_symbol_resp'; +export * from './model_get_closed_orders_req'; +export * from './model_get_closed_orders_resp'; +export * from './model_cancel_order_by_order_id_req'; +export * from './model_cancel_order_by_order_id_resp'; +export * from './model_get_order_by_order_id_req'; +export * from './model_get_order_by_order_id_resp'; diff --git a/sdk/node/src/generate/margin/risklimit/index.ts b/sdk/node/src/generate/margin/risklimit/index.ts new file mode 100644 index 00000000..ec34a350 --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/index.ts @@ -0,0 +1,3 @@ +export * from './model_get_margin_risk_limit_req'; +export * from './api_risk_limit'; +export * from './model_get_margin_risk_limit_resp'; diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts deleted file mode 100644 index 621ace8a..00000000 --- a/sdk/node/src/generate/service/index.ts +++ /dev/null @@ -1,3 +0,0 @@ - - -// export * from './spot_api' \ No newline at end of file diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index e69de29b..59085a9c 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -0,0 +1,7 @@ +import * as ORDER from './order'; +import * as MARKET from './market'; +const Spot = { + ...ORDER, + ...MARKET, +}; +export default Spot; diff --git a/sdk/node/src/generate/spot/market/index.ts b/sdk/node/src/generate/spot/market/index.ts new file mode 100644 index 00000000..57c6f35c --- /dev/null +++ b/sdk/node/src/generate/spot/market/index.ts @@ -0,0 +1,30 @@ +export * from './model_get_private_token_resp'; +export * from './api_market'; +export * from './model_get_public_token_resp'; +export * from './model_get_all_tickers_resp'; +export * from './model_get_klines_req'; +export * from './model_get_klines_resp'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './model_get_ticker_req'; +export * from './model_get_ticker_resp'; +export * from './model_get_part_order_book_req'; +export * from './model_get_part_order_book_resp'; +export * from './model_get24hr_stats_req'; +export * from './model_get24hr_stats_resp'; +export * from './model_get_market_list_resp'; +export * from './model_get_fiat_price_req'; +export * from './model_get_fiat_price_resp'; +export * from './model_get_service_status_resp'; +export * from './model_get_server_time_resp'; +export * from './model_get_all_symbols_req'; +export * from './model_get_all_symbols_resp'; +export * from './model_get_symbol_req'; +export * from './model_get_symbol_resp'; +export * from './model_get_announcements_req'; +export * from './model_get_announcements_resp'; +export * from './model_get_currency_req'; +export * from './model_get_currency_resp'; +export * from './model_get_all_currencies_resp'; +export * from './model_get_full_order_book_req'; +export * from './model_get_full_order_book_resp'; diff --git a/sdk/node/src/generate/spot/order/index.ts b/sdk/node/src/generate/spot/order/index.ts index 4df9a2bd..32037488 100644 --- a/sdk/node/src/generate/spot/order/index.ts +++ b/sdk/node/src/generate/spot/order/index.ts @@ -1,3 +1,94 @@ - -export * from './model_add_order_req' -export * from './api_order' \ No newline at end of file +export * from './model_get_trade_history_old_req'; +export * from './api_order'; +export * from './model_get_trade_history_old_resp'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './model_get_open_orders_req'; +export * from './model_get_open_orders_resp'; +export * from './model_get_symbols_with_open_order_resp'; +export * from './model_modify_order_req'; +export * from './model_modify_order_resp'; +export * from './model_cancel_all_orders_resp'; +export * from './model_cancel_partial_order_req'; +export * from './model_cancel_partial_order_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; +export * from './model_set_dcp_req'; +export * from './model_set_dcp_resp'; +export * from './model_get_dcp_resp'; +export * from './model_cancel_all_orders_by_symbol_req'; +export * from './model_cancel_all_orders_by_symbol_resp'; +export * from './model_get_closed_orders_req'; +export * from './model_get_closed_orders_resp'; +export * from './model_batch_add_orders_req'; +export * from './model_batch_add_orders_resp'; +export * from './model_batch_add_orders_sync_req'; +export * from './model_batch_add_orders_sync_resp'; +export * from './model_cancel_order_by_order_id_req'; +export * from './model_cancel_order_by_order_id_resp'; +export * from './model_get_order_by_order_id_req'; +export * from './model_get_order_by_order_id_resp'; +export * from './model_add_order_req'; +export * from './model_add_order_resp'; +export * from './model_cancel_order_by_client_oid_sync_req'; +export * from './model_cancel_order_by_client_oid_sync_resp'; +export * from './model_cancel_order_by_order_id_sync_req'; +export * from './model_cancel_order_by_order_id_sync_resp'; +export * from './model_add_order_sync_req'; +export * from './model_add_order_sync_resp'; +export * from './model_add_order_test_req'; +export * from './model_add_order_test_resp'; +export * from './model_get_recent_trade_history_old_req'; +export * from './model_get_recent_trade_history_old_resp'; +export * from './model_get_recent_orders_list_old_req'; +export * from './model_get_recent_orders_list_old_resp'; +export * from './model_cancel_order_by_client_oid_old_req'; +export * from './model_cancel_order_by_client_oid_old_resp'; +export * from './model_get_order_by_client_oid_old_req'; +export * from './model_get_order_by_client_oid_old_resp'; +export * from './model_batch_cancel_order_old_req'; +export * from './model_batch_cancel_order_old_resp'; +export * from './model_get_orders_list_old_req'; +export * from './model_get_orders_list_old_resp'; +export * from './model_batch_add_orders_old_req'; +export * from './model_batch_add_orders_old_resp'; +export * from './model_cancel_order_by_order_id_old_req'; +export * from './model_cancel_order_by_order_id_old_resp'; +export * from './model_get_order_by_order_id_old_req'; +export * from './model_get_order_by_order_id_old_resp'; +export * from './model_add_order_old_req'; +export * from './model_add_order_old_resp'; +export * from './model_add_order_test_old_req'; +export * from './model_add_order_test_old_resp'; +export * from './model_batch_cancel_stop_order_req'; +export * from './model_batch_cancel_stop_order_resp'; +export * from './model_cancel_stop_order_by_client_oid_req'; +export * from './model_cancel_stop_order_by_client_oid_resp'; +export * from './model_get_stop_orders_list_req'; +export * from './model_get_stop_orders_list_resp'; +export * from './model_cancel_stop_order_by_order_id_req'; +export * from './model_cancel_stop_order_by_order_id_resp'; +export * from './model_get_stop_order_by_order_id_req'; +export * from './model_get_stop_order_by_order_id_resp'; +export * from './model_add_stop_order_req'; +export * from './model_add_stop_order_resp'; +export * from './model_get_stop_order_by_client_oid_req'; +export * from './model_get_stop_order_by_client_oid_resp'; +export * from './model_cancel_oco_order_by_client_oid_req'; +export * from './model_cancel_oco_order_by_client_oid_resp'; +export * from './model_get_oco_order_by_client_oid_req'; +export * from './model_get_oco_order_by_client_oid_resp'; +export * from './model_get_oco_order_detail_by_order_id_req'; +export * from './model_get_oco_order_detail_by_order_id_resp'; +export * from './model_cancel_oco_order_by_order_id_req'; +export * from './model_cancel_oco_order_by_order_id_resp'; +export * from './model_get_oco_order_by_order_id_req'; +export * from './model_get_oco_order_by_order_id_resp'; +export * from './model_add_oco_order_req'; +export * from './model_add_oco_order_resp'; +export * from './model_batch_cancel_oco_orders_req'; +export * from './model_batch_cancel_oco_orders_resp'; +export * from './model_get_oco_order_list_req'; +export * from './model_get_oco_order_list_resp'; diff --git a/sdk/node/src/generate/spot/spotprivate/index.ts b/sdk/node/src/generate/spot/spotprivate/index.ts new file mode 100644 index 00000000..764702ef --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/index.ts @@ -0,0 +1,3 @@ +export * from './model_account_event'; +export * from './model_order_v1_event'; +export * from './model_order_v2_event'; diff --git a/sdk/node/src/generate/spot/spotpublic/index.ts b/sdk/node/src/generate/spot/spotpublic/index.ts new file mode 100644 index 00000000..977bde4e --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/index.ts @@ -0,0 +1,10 @@ +export * from './model_all_tickers_event'; +export * from './model_klines_event'; +export * from './model_market_snapshot_event'; +export * from './model_orderbook_increment_event'; +export * from './model_orderbook_level1_event'; +export * from './model_orderbook_level50_event'; +export * from './model_orderbook_level5_event'; +export * from './model_symbol_snapshot_event'; +export * from './model_ticker_event'; +export * from './model_trade_event'; diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 304afb70..3d654af4 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-10'; +export const SdkGenerateDate = '2025-01-13'; diff --git a/sdk/node/src/generate/viplending/index.ts b/sdk/node/src/generate/viplending/index.ts new file mode 100644 index 00000000..af4c033c --- /dev/null +++ b/sdk/node/src/generate/viplending/index.ts @@ -0,0 +1,5 @@ +import * as VIPLENDING from './viplending'; +const Viplending = { + ...VIPLENDING, +}; +export default Viplending; diff --git a/sdk/node/src/generate/viplending/viplending/index.ts b/sdk/node/src/generate/viplending/viplending/index.ts new file mode 100644 index 00000000..c1b2c6f2 --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/index.ts @@ -0,0 +1,3 @@ +export * from './model_get_accounts_resp'; +export * from './api_vip_lending'; +export * from './model_get_account_detail_resp'; diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index 7e16d4e8..fd6b6af4 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -1,12 +1,9 @@ // Exporting from api -export * from './api/client'; +export * from './api'; +export * from './model'; // Exporting from generate services -import * as Spot from './generate/spot/order/'; -import * as Futures from './generate/futures/order/'; +import * as Spot from './generate/spot'; +import * as Futures from './generate/futures'; export { Spot, Futures }; -// Exporting models -export * from './model/client_option'; -export * from './model/transport_option'; -export * from './model/constant'; diff --git a/sdk/node/src/model/index.ts b/sdk/node/src/model/index.ts new file mode 100644 index 00000000..2f493d7d --- /dev/null +++ b/sdk/node/src/model/index.ts @@ -0,0 +1,5 @@ +export * from './common'; +export * from './client_option'; +export * from './constant'; +export * from './transport_option'; +export * from './websocket_option'; From a009f1d72584ca77ba12fe0de38c9d1cf2e7099a Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 13 Jan 2025 17:27:27 +0800 Subject: [PATCH 018/106] feat(nodejs): generate index.ts with all models --- .../plugin/generator/NodeSdkGenerator.java | 23 ++- .../src/generate/account/account/index.ts | 51 ++++-- .../src/generate/account/deposit/index.ts | 22 ++- sdk/node/src/generate/account/fee/index.ts | 7 +- .../src/generate/account/subaccount/index.ts | 50 ++++-- .../src/generate/account/transfer/index.ts | 15 +- .../src/generate/account/withdrawal/index.ts | 12 +- .../src/generate/affiliate/affiliate/index.ts | 3 + .../src/generate/broker/apibroker/index.ts | 2 +- .../src/generate/broker/ndbroker/index.ts | 33 ++-- sdk/node/src/generate/earn/earn/index.ts | 20 ++- .../src/generate/futures/fundingfees/index.ts | 12 +- sdk/node/src/generate/futures/market/index.ts | 37 ++-- sdk/node/src/generate/futures/order/index.ts | 59 ++++--- .../src/generate/futures/positions/index.ts | 33 ++-- sdk/node/src/generate/margin/credit/index.ts | 18 +- sdk/node/src/generate/margin/debit/index.ts | 13 +- sdk/node/src/generate/margin/market/index.ts | 14 +- sdk/node/src/generate/margin/order/index.ts | 37 ++-- .../src/generate/margin/risklimit/index.ts | 3 +- sdk/node/src/generate/spot/market/index.ts | 49 +++--- sdk/node/src/generate/spot/order/index.ts | 166 ++++++++++-------- .../generate/viplending/viplending/index.ts | 6 +- 23 files changed, 402 insertions(+), 283 deletions(-) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index fe359dd9..dedf8d7d 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -366,16 +366,9 @@ private void generateApiImport(Meta meta, boolean req, Map } } - private void generateApiExport(Meta meta, boolean req, Set export) { + private void generateApiExport(Meta meta, Set export) { switch (modeSwitch.getMode()) { case API: { - String suffix = "resp"; - if (req) { - suffix = "req"; - } - export.add(String.format("export * from \"./%s\"", toModelFilename(meta.getMethod()) + "_" + suffix)); - - operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { export.add(String.format("export * from \"./%s\"", toApiFilename(formatMethodName(k)))); @@ -450,7 +443,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { generateApiImport(meta, false, imports); - generateApiExport(meta, false, exports); + generateApiExport(meta, exports); }); break; @@ -458,18 +451,24 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { + String path = (String) m.get("importPath"); + path = toModelFilename(path); + exports.add(String.format("export * from \"./%s\"", path)); + }); + if (op.hasParams) { generateApiImport(meta, true, imports); - generateApiExport(meta, true, exports); } generateApiImport(meta, false, imports); - generateApiExport(meta, false, exports); + generateApiExport(meta, exports); + break; } case WS: case WS_TEST: { generateApiImport(meta, false, imports); - generateApiExport(meta, false, exports); + generateApiExport(meta, exports); break; } case TEST_TEMPLATE: { diff --git a/sdk/node/src/generate/account/account/index.ts b/sdk/node/src/generate/account/account/index.ts index ee8e056a..7f0cefed 100644 --- a/sdk/node/src/generate/account/account/index.ts +++ b/sdk/node/src/generate/account/account/index.ts @@ -1,27 +1,42 @@ +export * from './model_get_account_info_resp'; +export * from './model_get_apikey_info_resp'; +export * from './model_get_cross_margin_account_accounts'; +export * from './model_get_cross_margin_account_req'; +export * from './model_get_cross_margin_account_resp'; export * from './model_get_futures_account_req'; -export * from './api_account'; export * from './model_get_futures_account_resp'; -export * from './model_get_spot_account_detail_req'; -export * from './model_get_spot_account_detail_resp'; -export * from './model_get_spot_account_list_req'; -export * from './model_get_spot_account_list_resp'; -export * from './model_get_spot_ledger_req'; -export * from './model_get_spot_ledger_resp'; -export * from './model_get_spot_hf_ledger_req'; -export * from './model_get_spot_hf_ledger_resp'; -export * from './model_get_spot_account_type_resp'; +export * from './model_get_futures_ledger_data_list'; +export * from './model_get_futures_ledger_req'; +export * from './model_get_futures_ledger_resp'; +export * from './model_get_isolated_margin_account_assets'; +export * from './model_get_isolated_margin_account_assets_base_asset'; +export * from './model_get_isolated_margin_account_assets_quote_asset'; +export * from './model_get_isolated_margin_account_detail_v1_base_asset'; +export * from './model_get_isolated_margin_account_detail_v1_quote_asset'; export * from './model_get_isolated_margin_account_detail_v1_req'; export * from './model_get_isolated_margin_account_detail_v1_resp'; +export * from './model_get_isolated_margin_account_list_v1_assets'; +export * from './model_get_isolated_margin_account_list_v1_assets_base_asset'; +export * from './model_get_isolated_margin_account_list_v1_assets_quote_asset'; export * from './model_get_isolated_margin_account_list_v1_req'; export * from './model_get_isolated_margin_account_list_v1_resp'; +export * from './model_get_isolated_margin_account_req'; +export * from './model_get_isolated_margin_account_resp'; +export * from './model_get_margin_account_detail_accounts'; export * from './model_get_margin_account_detail_resp'; -export * from './model_get_futures_ledger_req'; -export * from './model_get_futures_ledger_resp'; -export * from './model_get_apikey_info_resp'; -export * from './model_get_account_info_resp'; +export * from './model_get_margin_hf_ledger_data'; export * from './model_get_margin_hf_ledger_req'; export * from './model_get_margin_hf_ledger_resp'; -export * from './model_get_isolated_margin_account_req'; -export * from './model_get_isolated_margin_account_resp'; -export * from './model_get_cross_margin_account_req'; -export * from './model_get_cross_margin_account_resp'; +export * from './model_get_spot_account_detail_req'; +export * from './model_get_spot_account_detail_resp'; +export * from './model_get_spot_account_list_data'; +export * from './model_get_spot_account_list_req'; +export * from './model_get_spot_account_list_resp'; +export * from './model_get_spot_account_type_resp'; +export * from './model_get_spot_hf_ledger_data'; +export * from './model_get_spot_hf_ledger_req'; +export * from './model_get_spot_hf_ledger_resp'; +export * from './model_get_spot_ledger_items'; +export * from './model_get_spot_ledger_req'; +export * from './model_get_spot_ledger_resp'; +export * from './api_account'; diff --git a/sdk/node/src/generate/account/deposit/index.ts b/sdk/node/src/generate/account/deposit/index.ts index 684aa2e6..604e8e44 100644 --- a/sdk/node/src/generate/account/deposit/index.ts +++ b/sdk/node/src/generate/account/deposit/index.ts @@ -1,15 +1,19 @@ -export * from './model_get_deposit_address_v1_req'; -export * from './api_deposit'; -export * from './model_get_deposit_address_v1_resp'; export * from './model_add_deposit_address_v1_req'; export * from './model_add_deposit_address_v1_resp'; -export * from './model_get_deposit_history_req'; -export * from './model_get_deposit_history_resp'; -export * from './model_get_deposit_history_old_req'; -export * from './model_get_deposit_history_old_resp'; -export * from './model_get_deposit_address_v2_req'; -export * from './model_get_deposit_address_v2_resp'; export * from './model_add_deposit_address_v3_req'; export * from './model_add_deposit_address_v3_resp'; +export * from './model_get_deposit_address_v1_req'; +export * from './model_get_deposit_address_v1_resp'; +export * from './model_get_deposit_address_v2_data'; +export * from './model_get_deposit_address_v2_req'; +export * from './model_get_deposit_address_v2_resp'; +export * from './model_get_deposit_address_v3_data'; export * from './model_get_deposit_address_v3_req'; export * from './model_get_deposit_address_v3_resp'; +export * from './model_get_deposit_history_items'; +export * from './model_get_deposit_history_old_items'; +export * from './model_get_deposit_history_old_req'; +export * from './model_get_deposit_history_old_resp'; +export * from './model_get_deposit_history_req'; +export * from './model_get_deposit_history_resp'; +export * from './api_deposit'; diff --git a/sdk/node/src/generate/account/fee/index.ts b/sdk/node/src/generate/account/fee/index.ts index aa2a2072..70932918 100644 --- a/sdk/node/src/generate/account/fee/index.ts +++ b/sdk/node/src/generate/account/fee/index.ts @@ -1,7 +1,8 @@ export * from './model_get_basic_fee_req'; -export * from './api_fee'; export * from './model_get_basic_fee_resp'; -export * from './model_get_spot_actual_fee_req'; -export * from './model_get_spot_actual_fee_resp'; export * from './model_get_futures_actual_fee_req'; export * from './model_get_futures_actual_fee_resp'; +export * from './model_get_spot_actual_fee_data'; +export * from './model_get_spot_actual_fee_req'; +export * from './model_get_spot_actual_fee_resp'; +export * from './api_fee'; diff --git a/sdk/node/src/generate/account/subaccount/index.ts b/sdk/node/src/generate/account/subaccount/index.ts index 63508573..caaa90b6 100644 --- a/sdk/node/src/generate/account/subaccount/index.ts +++ b/sdk/node/src/generate/account/subaccount/index.ts @@ -1,25 +1,41 @@ +export * from './model_add_sub_account_api_req'; +export * from './model_add_sub_account_api_resp'; +export * from './model_add_sub_account_futures_permission_req'; +export * from './model_add_sub_account_futures_permission_resp'; +export * from './model_add_sub_account_margin_permission_req'; +export * from './model_add_sub_account_margin_permission_resp'; +export * from './model_add_sub_account_req'; +export * from './model_add_sub_account_resp'; +export * from './model_delete_sub_account_api_req'; +export * from './model_delete_sub_account_api_resp'; +export * from './model_get_futures_sub_account_list_v2_accounts'; export * from './model_get_futures_sub_account_list_v2_req'; -export * from './api_sub_account'; export * from './model_get_futures_sub_account_list_v2_resp'; -export * from './model_get_spot_sub_account_list_v1_resp'; +export * from './model_get_futures_sub_account_list_v2_summary'; +export * from './model_get_spot_sub_account_detail_main_accounts'; +export * from './model_get_spot_sub_account_detail_margin_accounts'; export * from './model_get_spot_sub_account_detail_req'; export * from './model_get_spot_sub_account_detail_resp'; -export * from './model_delete_sub_account_api_req'; -export * from './model_delete_sub_account_api_resp'; -export * from './model_get_sub_account_api_list_req'; -export * from './model_get_sub_account_api_list_resp'; -export * from './model_add_sub_account_api_req'; -export * from './model_add_sub_account_api_resp'; -export * from './model_modify_sub_account_api_req'; -export * from './model_modify_sub_account_api_resp'; -export * from './model_get_spot_sub_accounts_summary_v1_resp'; +export * from './model_get_spot_sub_account_detail_trade_accounts'; +export * from './model_get_spot_sub_account_list_v1_data'; +export * from './model_get_spot_sub_account_list_v1_data_main_accounts'; +export * from './model_get_spot_sub_account_list_v1_data_margin_accounts'; +export * from './model_get_spot_sub_account_list_v1_data_trade_accounts'; +export * from './model_get_spot_sub_account_list_v1_resp'; +export * from './model_get_spot_sub_account_list_v2_items'; +export * from './model_get_spot_sub_account_list_v2_items_main_accounts'; +export * from './model_get_spot_sub_account_list_v2_items_margin_accounts'; +export * from './model_get_spot_sub_account_list_v2_items_trade_accounts'; export * from './model_get_spot_sub_account_list_v2_req'; export * from './model_get_spot_sub_account_list_v2_resp'; -export * from './model_add_sub_account_req'; -export * from './model_add_sub_account_resp'; +export * from './model_get_spot_sub_accounts_summary_v1_data'; +export * from './model_get_spot_sub_accounts_summary_v1_resp'; +export * from './model_get_spot_sub_accounts_summary_v2_items'; export * from './model_get_spot_sub_accounts_summary_v2_req'; export * from './model_get_spot_sub_accounts_summary_v2_resp'; -export * from './model_add_sub_account_futures_permission_req'; -export * from './model_add_sub_account_futures_permission_resp'; -export * from './model_add_sub_account_margin_permission_req'; -export * from './model_add_sub_account_margin_permission_resp'; +export * from './model_get_sub_account_api_list_data'; +export * from './model_get_sub_account_api_list_req'; +export * from './model_get_sub_account_api_list_resp'; +export * from './model_modify_sub_account_api_req'; +export * from './model_modify_sub_account_api_resp'; +export * from './api_sub_account'; diff --git a/sdk/node/src/generate/account/transfer/index.ts b/sdk/node/src/generate/account/transfer/index.ts index 3370d728..e013073f 100644 --- a/sdk/node/src/generate/account/transfer/index.ts +++ b/sdk/node/src/generate/account/transfer/index.ts @@ -1,15 +1,16 @@ -export * from './model_get_transfer_quotas_req'; -export * from './api_transfer'; -export * from './model_get_transfer_quotas_resp'; +export * from './model_flex_transfer_req'; +export * from './model_flex_transfer_resp'; export * from './model_futures_account_transfer_in_req'; export * from './model_futures_account_transfer_in_resp'; +export * from './model_futures_account_transfer_out_req'; +export * from './model_futures_account_transfer_out_resp'; +export * from './model_get_futures_account_transfer_out_ledger_items'; export * from './model_get_futures_account_transfer_out_ledger_req'; export * from './model_get_futures_account_transfer_out_ledger_resp'; +export * from './model_get_transfer_quotas_req'; +export * from './model_get_transfer_quotas_resp'; export * from './model_inner_transfer_req'; export * from './model_inner_transfer_resp'; export * from './model_sub_account_transfer_req'; export * from './model_sub_account_transfer_resp'; -export * from './model_flex_transfer_req'; -export * from './model_flex_transfer_resp'; -export * from './model_futures_account_transfer_out_req'; -export * from './model_futures_account_transfer_out_resp'; +export * from './api_transfer'; diff --git a/sdk/node/src/generate/account/withdrawal/index.ts b/sdk/node/src/generate/account/withdrawal/index.ts index 742db4ae..b8c2bc89 100644 --- a/sdk/node/src/generate/account/withdrawal/index.ts +++ b/sdk/node/src/generate/account/withdrawal/index.ts @@ -1,13 +1,15 @@ +export * from './model_cancel_withdrawal_req'; +export * from './model_cancel_withdrawal_resp'; +export * from './model_get_withdrawal_history_items'; +export * from './model_get_withdrawal_history_old_items'; export * from './model_get_withdrawal_history_old_req'; -export * from './api_withdrawal'; export * from './model_get_withdrawal_history_old_resp'; export * from './model_get_withdrawal_history_req'; export * from './model_get_withdrawal_history_resp'; -export * from './model_withdrawal_v1_req'; -export * from './model_withdrawal_v1_resp'; export * from './model_get_withdrawal_quotas_req'; export * from './model_get_withdrawal_quotas_resp'; -export * from './model_cancel_withdrawal_req'; -export * from './model_cancel_withdrawal_resp'; +export * from './model_withdrawal_v1_req'; +export * from './model_withdrawal_v1_resp'; export * from './model_withdrawal_v3_req'; export * from './model_withdrawal_v3_resp'; +export * from './api_withdrawal'; diff --git a/sdk/node/src/generate/affiliate/affiliate/index.ts b/sdk/node/src/generate/affiliate/affiliate/index.ts index 1b0a33ca..dadf75ee 100644 --- a/sdk/node/src/generate/affiliate/affiliate/index.ts +++ b/sdk/node/src/generate/affiliate/affiliate/index.ts @@ -1,2 +1,5 @@ +export * from './model_get_account_ltv'; +export * from './model_get_account_margins'; +export * from './model_get_account_orders'; export * from './model_get_account_resp'; export * from './api_affiliate'; diff --git a/sdk/node/src/generate/broker/apibroker/index.ts b/sdk/node/src/generate/broker/apibroker/index.ts index 260507f1..4a8960d2 100644 --- a/sdk/node/src/generate/broker/apibroker/index.ts +++ b/sdk/node/src/generate/broker/apibroker/index.ts @@ -1,3 +1,3 @@ export * from './model_get_rebase_req'; -export * from './api_api_broker'; export * from './model_get_rebase_resp'; +export * from './api_api_broker'; diff --git a/sdk/node/src/generate/broker/ndbroker/index.ts b/sdk/node/src/generate/broker/ndbroker/index.ts index 31a22fc5..18146685 100644 --- a/sdk/node/src/generate/broker/ndbroker/index.ts +++ b/sdk/node/src/generate/broker/ndbroker/index.ts @@ -1,27 +1,30 @@ -export * from './model_get_deposit_list_req'; -export * from './api_nd_broker'; -export * from './model_get_deposit_list_resp'; -export * from './model_delete_sub_account_api_req'; -export * from './model_delete_sub_account_api_resp'; -export * from './model_get_sub_account_api_req'; -export * from './model_get_sub_account_api_resp'; export * from './model_add_sub_account_api_req'; export * from './model_add_sub_account_api_resp'; -export * from './model_get_sub_account_req'; -export * from './model_get_sub_account_resp'; export * from './model_add_sub_account_req'; export * from './model_add_sub_account_resp'; -export * from './model_modify_sub_account_api_req'; -export * from './model_modify_sub_account_api_resp'; +export * from './model_delete_sub_account_api_req'; +export * from './model_delete_sub_account_api_resp'; export * from './model_get_broker_info_req'; export * from './model_get_broker_info_resp'; -export * from './model_get_rebase_req'; -export * from './model_get_rebase_resp'; -export * from './model_transfer_req'; -export * from './model_transfer_resp'; export * from './model_get_deposit_detail_req'; export * from './model_get_deposit_detail_resp'; +export * from './model_get_deposit_list_data'; +export * from './model_get_deposit_list_req'; +export * from './model_get_deposit_list_resp'; +export * from './model_get_rebase_req'; +export * from './model_get_rebase_resp'; +export * from './model_get_sub_account_api_data'; +export * from './model_get_sub_account_api_req'; +export * from './model_get_sub_account_api_resp'; +export * from './model_get_sub_account_items'; +export * from './model_get_sub_account_req'; +export * from './model_get_sub_account_resp'; export * from './model_get_transfer_history_req'; export * from './model_get_transfer_history_resp'; export * from './model_get_withdraw_detail_req'; export * from './model_get_withdraw_detail_resp'; +export * from './model_modify_sub_account_api_req'; +export * from './model_modify_sub_account_api_resp'; +export * from './model_transfer_req'; +export * from './model_transfer_resp'; +export * from './api_nd_broker'; diff --git a/sdk/node/src/generate/earn/earn/index.ts b/sdk/node/src/generate/earn/earn/index.ts index 6ede832a..bf5e2941 100644 --- a/sdk/node/src/generate/earn/earn/index.ts +++ b/sdk/node/src/generate/earn/earn/index.ts @@ -1,19 +1,25 @@ -export * from './model_get_eth_staking_products_req'; -export * from './api_earn'; -export * from './model_get_eth_staking_products_resp'; +export * from './model_get_account_holding_items'; export * from './model_get_account_holding_req'; export * from './model_get_account_holding_resp'; +export * from './model_get_eth_staking_products_data'; +export * from './model_get_eth_staking_products_req'; +export * from './model_get_eth_staking_products_resp'; +export * from './model_get_kcs_staking_products_data'; export * from './model_get_kcs_staking_products_req'; export * from './model_get_kcs_staking_products_resp'; -export * from './model_redeem_req'; -export * from './model_redeem_resp'; -export * from './model_purchase_req'; -export * from './model_purchase_resp'; +export * from './model_get_promotion_products_data'; export * from './model_get_promotion_products_req'; export * from './model_get_promotion_products_resp'; export * from './model_get_redeem_preview_req'; export * from './model_get_redeem_preview_resp'; +export * from './model_get_savings_products_data'; export * from './model_get_savings_products_req'; export * from './model_get_savings_products_resp'; +export * from './model_get_staking_products_data'; export * from './model_get_staking_products_req'; export * from './model_get_staking_products_resp'; +export * from './model_purchase_req'; +export * from './model_purchase_resp'; +export * from './model_redeem_req'; +export * from './model_redeem_resp'; +export * from './api_earn'; diff --git a/sdk/node/src/generate/futures/fundingfees/index.ts b/sdk/node/src/generate/futures/fundingfees/index.ts index 558ac693..f7b90d31 100644 --- a/sdk/node/src/generate/futures/fundingfees/index.ts +++ b/sdk/node/src/generate/futures/fundingfees/index.ts @@ -1,7 +1,9 @@ -export * from './model_get_public_funding_history_req'; -export * from './api_funding_fees'; -export * from './model_get_public_funding_history_resp'; -export * from './model_get_private_funding_history_req'; -export * from './model_get_private_funding_history_resp'; export * from './model_get_current_funding_rate_req'; export * from './model_get_current_funding_rate_resp'; +export * from './model_get_private_funding_history_data_list'; +export * from './model_get_private_funding_history_req'; +export * from './model_get_private_funding_history_resp'; +export * from './model_get_public_funding_history_data'; +export * from './model_get_public_funding_history_req'; +export * from './model_get_public_funding_history_resp'; +export * from './api_funding_fees'; diff --git a/sdk/node/src/generate/futures/market/index.ts b/sdk/node/src/generate/futures/market/index.ts index 8480a1fc..2a55b6bf 100644 --- a/sdk/node/src/generate/futures/market/index.ts +++ b/sdk/node/src/generate/futures/market/index.ts @@ -1,28 +1,37 @@ -export * from './model_get_all_tickers_resp'; -export * from './api_market'; -export * from './model_get_private_token_resp'; -export * from './model_get_public_token_resp'; +export * from './model_get24hr_stats_resp'; +export * from './model_get_all_symbols_data'; export * from './model_get_all_symbols_resp'; -export * from './model_get_symbol_req'; -export * from './model_get_symbol_resp'; -export * from './model_get_spot_index_price_req'; -export * from './model_get_spot_index_price_resp'; +export * from './model_get_all_tickers_data'; +export * from './model_get_all_tickers_resp'; +export * from './model_get_full_order_book_req'; +export * from './model_get_full_order_book_resp'; +export * from './model_get_interest_rate_index_data_list'; export * from './model_get_interest_rate_index_req'; export * from './model_get_interest_rate_index_resp'; export * from './model_get_klines_req'; export * from './model_get_klines_resp'; -export * from './model_get_part_order_book_req'; -export * from './model_get_part_order_book_resp'; -export * from './model_get_full_order_book_req'; -export * from './model_get_full_order_book_resp'; export * from './model_get_mark_price_req'; export * from './model_get_mark_price_resp'; +export * from './model_get_part_order_book_req'; +export * from './model_get_part_order_book_resp'; +export * from './model_get_premium_index_data_list'; export * from './model_get_premium_index_req'; export * from './model_get_premium_index_resp'; +export * from './model_get_private_token_instance_servers'; +export * from './model_get_private_token_resp'; +export * from './model_get_public_token_instance_servers'; +export * from './model_get_public_token_resp'; +export * from './model_get_server_time_resp'; export * from './model_get_service_status_resp'; +export * from './model_get_spot_index_price_data_list'; +export * from './model_get_spot_index_price_data_list_decomposion_list'; +export * from './model_get_spot_index_price_req'; +export * from './model_get_spot_index_price_resp'; +export * from './model_get_symbol_req'; +export * from './model_get_symbol_resp'; export * from './model_get_ticker_req'; export * from './model_get_ticker_resp'; -export * from './model_get_server_time_resp'; +export * from './model_get_trade_history_data'; export * from './model_get_trade_history_req'; export * from './model_get_trade_history_resp'; -export * from './model_get24hr_stats_resp'; +export * from './api_market'; diff --git a/sdk/node/src/generate/futures/order/index.ts b/sdk/node/src/generate/futures/order/index.ts index 1bb81ccd..00640bdb 100644 --- a/sdk/node/src/generate/futures/order/index.ts +++ b/sdk/node/src/generate/futures/order/index.ts @@ -1,37 +1,46 @@ -export * from './model_get_trade_history_req'; -export * from './api_order'; -export * from './model_get_trade_history_resp'; -export * from './model_get_open_order_value_req'; -export * from './model_get_open_order_value_resp'; -export * from './model_get_order_by_client_oid_req'; -export * from './model_get_order_by_client_oid_resp'; -export * from './model_cancel_order_by_client_oid_req'; -export * from './model_cancel_order_by_client_oid_resp'; -export * from './model_cancel_all_orders_v1_req'; -export * from './model_cancel_all_orders_v1_resp'; -export * from './model_get_order_list_req'; -export * from './model_get_order_list_resp'; -export * from './model_batch_cancel_orders_req'; -export * from './model_batch_cancel_orders_resp'; +export * from './model_add_order_req'; +export * from './model_add_order_resp'; +export * from './model_add_order_test_req'; +export * from './model_add_order_test_resp'; +export * from './model_add_tpsl_order_req'; +export * from './model_add_tpsl_order_resp'; +export * from './model_batch_add_orders_data'; +export * from './model_batch_add_orders_item'; export * from './model_batch_add_orders_req'; export * from './model_batch_add_orders_resp'; +export * from './model_batch_cancel_orders_client_oids_list'; +export * from './model_batch_cancel_orders_data'; +export * from './model_batch_cancel_orders_req'; +export * from './model_batch_cancel_orders_resp'; +export * from './model_cancel_all_orders_v1_req'; +export * from './model_cancel_all_orders_v1_resp'; +export * from './model_cancel_all_orders_v3_req'; +export * from './model_cancel_all_orders_v3_resp'; +export * from './model_cancel_all_stop_orders_req'; +export * from './model_cancel_all_stop_orders_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; export * from './model_cancel_order_by_id_req'; export * from './model_cancel_order_by_id_resp'; +export * from './model_get_open_order_value_req'; +export * from './model_get_open_order_value_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; export * from './model_get_order_by_order_id_req'; export * from './model_get_order_by_order_id_resp'; -export * from './model_add_order_req'; -export * from './model_add_order_resp'; -export * from './model_add_order_test_req'; -export * from './model_add_order_test_resp'; +export * from './model_get_order_list_items'; +export * from './model_get_order_list_req'; +export * from './model_get_order_list_resp'; +export * from './model_get_recent_closed_orders_data'; export * from './model_get_recent_closed_orders_req'; export * from './model_get_recent_closed_orders_resp'; +export * from './model_get_recent_trade_history_data'; export * from './model_get_recent_trade_history_req'; export * from './model_get_recent_trade_history_resp'; -export * from './model_add_tpsl_order_req'; -export * from './model_add_tpsl_order_resp'; -export * from './model_cancel_all_stop_orders_req'; -export * from './model_cancel_all_stop_orders_resp'; +export * from './model_get_stop_order_list_items'; export * from './model_get_stop_order_list_req'; export * from './model_get_stop_order_list_resp'; -export * from './model_cancel_all_orders_v3_req'; -export * from './model_cancel_all_orders_v3_resp'; +export * from './model_get_trade_history_items'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './api_order'; diff --git a/sdk/node/src/generate/futures/positions/index.ts b/sdk/node/src/generate/futures/positions/index.ts index aeaa63de..6d10d6ac 100644 --- a/sdk/node/src/generate/futures/positions/index.ts +++ b/sdk/node/src/generate/futures/positions/index.ts @@ -1,29 +1,32 @@ +export * from './model_add_isolated_margin_req'; +export * from './model_add_isolated_margin_resp'; +export * from './model_get_cross_margin_leverage_req'; +export * from './model_get_cross_margin_leverage_resp'; +export * from './model_get_isolated_margin_risk_limit_data'; export * from './model_get_isolated_margin_risk_limit_req'; -export * from './api_positions'; export * from './model_get_isolated_margin_risk_limit_resp'; -export * from './model_get_positions_history_req'; -export * from './model_get_positions_history_resp'; +export * from './model_get_margin_mode_req'; +export * from './model_get_margin_mode_resp'; +export * from './model_get_max_open_size_req'; +export * from './model_get_max_open_size_resp'; export * from './model_get_max_withdraw_margin_req'; export * from './model_get_max_withdraw_margin_resp'; -export * from './model_remove_isolated_margin_req'; -export * from './model_remove_isolated_margin_resp'; export * from './model_get_position_details_req'; export * from './model_get_position_details_resp'; +export * from './model_get_position_list_data'; +export * from './model_get_position_list_req'; +export * from './model_get_position_list_resp'; +export * from './model_get_positions_history_items'; +export * from './model_get_positions_history_req'; +export * from './model_get_positions_history_resp'; export * from './model_modify_auto_deposit_status_req'; export * from './model_modify_auto_deposit_status_resp'; -export * from './model_add_isolated_margin_req'; -export * from './model_add_isolated_margin_resp'; export * from './model_modify_isolated_margin_risk_limt_req'; export * from './model_modify_isolated_margin_risk_limt_resp'; -export * from './model_get_position_list_req'; -export * from './model_get_position_list_resp'; export * from './model_modify_margin_leverage_req'; export * from './model_modify_margin_leverage_resp'; -export * from './model_get_cross_margin_leverage_req'; -export * from './model_get_cross_margin_leverage_resp'; -export * from './model_get_max_open_size_req'; -export * from './model_get_max_open_size_resp'; +export * from './model_remove_isolated_margin_req'; +export * from './model_remove_isolated_margin_resp'; export * from './model_switch_margin_mode_req'; export * from './model_switch_margin_mode_resp'; -export * from './model_get_margin_mode_req'; -export * from './model_get_margin_mode_resp'; +export * from './api_positions'; diff --git a/sdk/node/src/generate/margin/credit/index.ts b/sdk/node/src/generate/margin/credit/index.ts index 3aff9cbe..ee7ef6ec 100644 --- a/sdk/node/src/generate/margin/credit/index.ts +++ b/sdk/node/src/generate/margin/credit/index.ts @@ -1,15 +1,19 @@ -export * from './model_modify_purchase_req'; -export * from './api_credit'; -export * from './model_modify_purchase_resp'; -export * from './model_get_loan_market_req'; -export * from './model_get_loan_market_resp'; +export * from './model_get_loan_market_data'; +export * from './model_get_loan_market_interest_rate_data'; export * from './model_get_loan_market_interest_rate_req'; export * from './model_get_loan_market_interest_rate_resp'; +export * from './model_get_loan_market_req'; +export * from './model_get_loan_market_resp'; +export * from './model_get_purchase_orders_items'; export * from './model_get_purchase_orders_req'; export * from './model_get_purchase_orders_resp'; -export * from './model_purchase_req'; -export * from './model_purchase_resp'; +export * from './model_get_redeem_orders_items'; export * from './model_get_redeem_orders_req'; export * from './model_get_redeem_orders_resp'; +export * from './model_modify_purchase_req'; +export * from './model_modify_purchase_resp'; +export * from './model_purchase_req'; +export * from './model_purchase_resp'; export * from './model_redeem_req'; export * from './model_redeem_resp'; +export * from './api_credit'; diff --git a/sdk/node/src/generate/margin/debit/index.ts b/sdk/node/src/generate/margin/debit/index.ts index ea2716d3..ca225400 100644 --- a/sdk/node/src/generate/margin/debit/index.ts +++ b/sdk/node/src/generate/margin/debit/index.ts @@ -1,13 +1,16 @@ -export * from './model_get_borrow_history_req'; -export * from './api_debit'; -export * from './model_get_borrow_history_resp'; export * from './model_borrow_req'; export * from './model_borrow_resp'; +export * from './model_get_borrow_history_items'; +export * from './model_get_borrow_history_req'; +export * from './model_get_borrow_history_resp'; +export * from './model_get_interest_history_items'; export * from './model_get_interest_history_req'; export * from './model_get_interest_history_resp'; +export * from './model_get_repay_history_items'; export * from './model_get_repay_history_req'; export * from './model_get_repay_history_resp'; -export * from './model_repay_req'; -export * from './model_repay_resp'; export * from './model_modify_leverage_req'; export * from './model_modify_leverage_resp'; +export * from './model_repay_req'; +export * from './model_repay_resp'; +export * from './api_debit'; diff --git a/sdk/node/src/generate/margin/market/index.ts b/sdk/node/src/generate/margin/market/index.ts index 06606d65..33001a9e 100644 --- a/sdk/node/src/generate/margin/market/index.ts +++ b/sdk/node/src/generate/margin/market/index.ts @@ -1,10 +1,14 @@ +export * from './model_get_cross_margin_symbols_items'; +export * from './model_get_cross_margin_symbols_req'; +export * from './model_get_cross_margin_symbols_resp'; +export * from './model_get_etf_info_data'; +export * from './model_get_etf_info_req'; +export * from './model_get_etf_info_resp'; +export * from './model_get_isolated_margin_symbols_data'; export * from './model_get_isolated_margin_symbols_resp'; -export * from './api_market'; export * from './model_get_margin_config_resp'; export * from './model_get_mark_price_detail_req'; export * from './model_get_mark_price_detail_resp'; -export * from './model_get_etf_info_req'; -export * from './model_get_etf_info_resp'; -export * from './model_get_cross_margin_symbols_req'; -export * from './model_get_cross_margin_symbols_resp'; +export * from './model_get_mark_price_list_data'; export * from './model_get_mark_price_list_resp'; +export * from './api_market'; diff --git a/sdk/node/src/generate/margin/order/index.ts b/sdk/node/src/generate/margin/order/index.ts index 2eeabcf8..87091b44 100644 --- a/sdk/node/src/generate/margin/order/index.ts +++ b/sdk/node/src/generate/margin/order/index.ts @@ -1,27 +1,30 @@ -export * from './model_add_order_v1_req'; -export * from './api_order'; -export * from './model_add_order_v1_resp'; -export * from './model_add_order_test_v1_req'; -export * from './model_add_order_test_v1_resp'; -export * from './model_get_trade_history_req'; -export * from './model_get_trade_history_resp'; -export * from './model_get_symbols_with_open_order_req'; -export * from './model_get_symbols_with_open_order_resp'; export * from './model_add_order_req'; export * from './model_add_order_resp'; export * from './model_add_order_test_req'; export * from './model_add_order_test_resp'; -export * from './model_get_open_orders_req'; -export * from './model_get_open_orders_resp'; -export * from './model_cancel_order_by_client_oid_req'; -export * from './model_cancel_order_by_client_oid_resp'; -export * from './model_get_order_by_client_oid_req'; -export * from './model_get_order_by_client_oid_resp'; +export * from './model_add_order_test_v1_req'; +export * from './model_add_order_test_v1_resp'; +export * from './model_add_order_v1_req'; +export * from './model_add_order_v1_resp'; export * from './model_cancel_all_orders_by_symbol_req'; export * from './model_cancel_all_orders_by_symbol_resp'; -export * from './model_get_closed_orders_req'; -export * from './model_get_closed_orders_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; export * from './model_cancel_order_by_order_id_req'; export * from './model_cancel_order_by_order_id_resp'; +export * from './model_get_closed_orders_items'; +export * from './model_get_closed_orders_req'; +export * from './model_get_closed_orders_resp'; +export * from './model_get_open_orders_data'; +export * from './model_get_open_orders_req'; +export * from './model_get_open_orders_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; export * from './model_get_order_by_order_id_req'; export * from './model_get_order_by_order_id_resp'; +export * from './model_get_symbols_with_open_order_req'; +export * from './model_get_symbols_with_open_order_resp'; +export * from './model_get_trade_history_items'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './api_order'; diff --git a/sdk/node/src/generate/margin/risklimit/index.ts b/sdk/node/src/generate/margin/risklimit/index.ts index ec34a350..e7c73dcc 100644 --- a/sdk/node/src/generate/margin/risklimit/index.ts +++ b/sdk/node/src/generate/margin/risklimit/index.ts @@ -1,3 +1,4 @@ +export * from './model_get_margin_risk_limit_data'; export * from './model_get_margin_risk_limit_req'; -export * from './api_risk_limit'; export * from './model_get_margin_risk_limit_resp'; +export * from './api_risk_limit'; diff --git a/sdk/node/src/generate/spot/market/index.ts b/sdk/node/src/generate/spot/market/index.ts index 57c6f35c..74a4ce2f 100644 --- a/sdk/node/src/generate/spot/market/index.ts +++ b/sdk/node/src/generate/spot/market/index.ts @@ -1,30 +1,39 @@ -export * from './model_get_private_token_resp'; -export * from './api_market'; -export * from './model_get_public_token_resp'; -export * from './model_get_all_tickers_resp'; -export * from './model_get_klines_req'; -export * from './model_get_klines_resp'; -export * from './model_get_trade_history_req'; -export * from './model_get_trade_history_resp'; -export * from './model_get_ticker_req'; -export * from './model_get_ticker_resp'; -export * from './model_get_part_order_book_req'; -export * from './model_get_part_order_book_resp'; export * from './model_get24hr_stats_req'; export * from './model_get24hr_stats_resp'; -export * from './model_get_market_list_resp'; -export * from './model_get_fiat_price_req'; -export * from './model_get_fiat_price_resp'; -export * from './model_get_service_status_resp'; -export * from './model_get_server_time_resp'; +export * from './model_get_all_currencies_data'; +export * from './model_get_all_currencies_data_chains'; +export * from './model_get_all_currencies_resp'; +export * from './model_get_all_symbols_data'; export * from './model_get_all_symbols_req'; export * from './model_get_all_symbols_resp'; -export * from './model_get_symbol_req'; -export * from './model_get_symbol_resp'; +export * from './model_get_all_tickers_resp'; +export * from './model_get_all_tickers_ticker'; +export * from './model_get_announcements_items'; export * from './model_get_announcements_req'; export * from './model_get_announcements_resp'; +export * from './model_get_currency_chains'; export * from './model_get_currency_req'; export * from './model_get_currency_resp'; -export * from './model_get_all_currencies_resp'; +export * from './model_get_fiat_price_req'; +export * from './model_get_fiat_price_resp'; export * from './model_get_full_order_book_req'; export * from './model_get_full_order_book_resp'; +export * from './model_get_klines_req'; +export * from './model_get_klines_resp'; +export * from './model_get_market_list_resp'; +export * from './model_get_part_order_book_req'; +export * from './model_get_part_order_book_resp'; +export * from './model_get_private_token_instance_servers'; +export * from './model_get_private_token_resp'; +export * from './model_get_public_token_instance_servers'; +export * from './model_get_public_token_resp'; +export * from './model_get_server_time_resp'; +export * from './model_get_service_status_resp'; +export * from './model_get_symbol_req'; +export * from './model_get_symbol_resp'; +export * from './model_get_ticker_req'; +export * from './model_get_ticker_resp'; +export * from './model_get_trade_history_data'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './api_market'; diff --git a/sdk/node/src/generate/spot/order/index.ts b/sdk/node/src/generate/spot/order/index.ts index 32037488..7a0cc109 100644 --- a/sdk/node/src/generate/spot/order/index.ts +++ b/sdk/node/src/generate/spot/order/index.ts @@ -1,94 +1,112 @@ -export * from './model_get_trade_history_old_req'; -export * from './api_order'; -export * from './model_get_trade_history_old_resp'; -export * from './model_get_trade_history_req'; -export * from './model_get_trade_history_resp'; -export * from './model_get_open_orders_req'; -export * from './model_get_open_orders_resp'; -export * from './model_get_symbols_with_open_order_resp'; -export * from './model_modify_order_req'; -export * from './model_modify_order_resp'; -export * from './model_cancel_all_orders_resp'; -export * from './model_cancel_partial_order_req'; -export * from './model_cancel_partial_order_resp'; -export * from './model_cancel_order_by_client_oid_req'; -export * from './model_cancel_order_by_client_oid_resp'; -export * from './model_get_order_by_client_oid_req'; -export * from './model_get_order_by_client_oid_resp'; -export * from './model_set_dcp_req'; -export * from './model_set_dcp_resp'; -export * from './model_get_dcp_resp'; -export * from './model_cancel_all_orders_by_symbol_req'; -export * from './model_cancel_all_orders_by_symbol_resp'; -export * from './model_get_closed_orders_req'; -export * from './model_get_closed_orders_resp'; -export * from './model_batch_add_orders_req'; -export * from './model_batch_add_orders_resp'; -export * from './model_batch_add_orders_sync_req'; -export * from './model_batch_add_orders_sync_resp'; -export * from './model_cancel_order_by_order_id_req'; -export * from './model_cancel_order_by_order_id_resp'; -export * from './model_get_order_by_order_id_req'; -export * from './model_get_order_by_order_id_resp'; +export * from './model_add_oco_order_req'; +export * from './model_add_oco_order_resp'; +export * from './model_add_order_old_req'; +export * from './model_add_order_old_resp'; export * from './model_add_order_req'; export * from './model_add_order_resp'; -export * from './model_cancel_order_by_client_oid_sync_req'; -export * from './model_cancel_order_by_client_oid_sync_resp'; -export * from './model_cancel_order_by_order_id_sync_req'; -export * from './model_cancel_order_by_order_id_sync_resp'; export * from './model_add_order_sync_req'; export * from './model_add_order_sync_resp'; +export * from './model_add_order_test_old_req'; +export * from './model_add_order_test_old_resp'; export * from './model_add_order_test_req'; export * from './model_add_order_test_resp'; -export * from './model_get_recent_trade_history_old_req'; -export * from './model_get_recent_trade_history_old_resp'; -export * from './model_get_recent_orders_list_old_req'; -export * from './model_get_recent_orders_list_old_resp'; -export * from './model_cancel_order_by_client_oid_old_req'; -export * from './model_cancel_order_by_client_oid_old_resp'; -export * from './model_get_order_by_client_oid_old_req'; -export * from './model_get_order_by_client_oid_old_resp'; -export * from './model_batch_cancel_order_old_req'; -export * from './model_batch_cancel_order_old_resp'; -export * from './model_get_orders_list_old_req'; -export * from './model_get_orders_list_old_resp'; +export * from './model_add_stop_order_req'; +export * from './model_add_stop_order_resp'; +export * from './model_batch_add_orders_data'; +export * from './model_batch_add_orders_old_data'; +export * from './model_batch_add_orders_old_order_list'; export * from './model_batch_add_orders_old_req'; export * from './model_batch_add_orders_old_resp'; -export * from './model_cancel_order_by_order_id_old_req'; -export * from './model_cancel_order_by_order_id_old_resp'; -export * from './model_get_order_by_order_id_old_req'; -export * from './model_get_order_by_order_id_old_resp'; -export * from './model_add_order_old_req'; -export * from './model_add_order_old_resp'; -export * from './model_add_order_test_old_req'; -export * from './model_add_order_test_old_resp'; +export * from './model_batch_add_orders_order_list'; +export * from './model_batch_add_orders_req'; +export * from './model_batch_add_orders_resp'; +export * from './model_batch_add_orders_sync_data'; +export * from './model_batch_add_orders_sync_order_list'; +export * from './model_batch_add_orders_sync_req'; +export * from './model_batch_add_orders_sync_resp'; +export * from './model_batch_cancel_oco_orders_req'; +export * from './model_batch_cancel_oco_orders_resp'; +export * from './model_batch_cancel_order_old_req'; +export * from './model_batch_cancel_order_old_resp'; export * from './model_batch_cancel_stop_order_req'; export * from './model_batch_cancel_stop_order_resp'; +export * from './model_cancel_all_orders_by_symbol_req'; +export * from './model_cancel_all_orders_by_symbol_resp'; +export * from './model_cancel_all_orders_failed_symbols'; +export * from './model_cancel_all_orders_resp'; +export * from './model_cancel_oco_order_by_client_oid_req'; +export * from './model_cancel_oco_order_by_client_oid_resp'; +export * from './model_cancel_oco_order_by_order_id_req'; +export * from './model_cancel_oco_order_by_order_id_resp'; +export * from './model_cancel_order_by_client_oid_old_req'; +export * from './model_cancel_order_by_client_oid_old_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; +export * from './model_cancel_order_by_client_oid_sync_req'; +export * from './model_cancel_order_by_client_oid_sync_resp'; +export * from './model_cancel_order_by_order_id_old_req'; +export * from './model_cancel_order_by_order_id_old_resp'; +export * from './model_cancel_order_by_order_id_req'; +export * from './model_cancel_order_by_order_id_resp'; +export * from './model_cancel_order_by_order_id_sync_req'; +export * from './model_cancel_order_by_order_id_sync_resp'; +export * from './model_cancel_partial_order_req'; +export * from './model_cancel_partial_order_resp'; export * from './model_cancel_stop_order_by_client_oid_req'; export * from './model_cancel_stop_order_by_client_oid_resp'; -export * from './model_get_stop_orders_list_req'; -export * from './model_get_stop_orders_list_resp'; export * from './model_cancel_stop_order_by_order_id_req'; export * from './model_cancel_stop_order_by_order_id_resp'; -export * from './model_get_stop_order_by_order_id_req'; -export * from './model_get_stop_order_by_order_id_resp'; -export * from './model_add_stop_order_req'; -export * from './model_add_stop_order_resp'; -export * from './model_get_stop_order_by_client_oid_req'; -export * from './model_get_stop_order_by_client_oid_resp'; -export * from './model_cancel_oco_order_by_client_oid_req'; -export * from './model_cancel_oco_order_by_client_oid_resp'; +export * from './model_get_closed_orders_items'; +export * from './model_get_closed_orders_req'; +export * from './model_get_closed_orders_resp'; +export * from './model_get_dcp_resp'; export * from './model_get_oco_order_by_client_oid_req'; export * from './model_get_oco_order_by_client_oid_resp'; -export * from './model_get_oco_order_detail_by_order_id_req'; -export * from './model_get_oco_order_detail_by_order_id_resp'; -export * from './model_cancel_oco_order_by_order_id_req'; -export * from './model_cancel_oco_order_by_order_id_resp'; export * from './model_get_oco_order_by_order_id_req'; export * from './model_get_oco_order_by_order_id_resp'; -export * from './model_add_oco_order_req'; -export * from './model_add_oco_order_resp'; -export * from './model_batch_cancel_oco_orders_req'; -export * from './model_batch_cancel_oco_orders_resp'; +export * from './model_get_oco_order_detail_by_order_id_orders'; +export * from './model_get_oco_order_detail_by_order_id_req'; +export * from './model_get_oco_order_detail_by_order_id_resp'; +export * from './model_get_oco_order_list_items'; export * from './model_get_oco_order_list_req'; export * from './model_get_oco_order_list_resp'; +export * from './model_get_open_orders_data'; +export * from './model_get_open_orders_req'; +export * from './model_get_open_orders_resp'; +export * from './model_get_order_by_client_oid_old_req'; +export * from './model_get_order_by_client_oid_old_resp'; +export * from './model_get_order_by_client_oid_req'; +export * from './model_get_order_by_client_oid_resp'; +export * from './model_get_order_by_order_id_old_req'; +export * from './model_get_order_by_order_id_old_resp'; +export * from './model_get_order_by_order_id_req'; +export * from './model_get_order_by_order_id_resp'; +export * from './model_get_orders_list_old_items'; +export * from './model_get_orders_list_old_req'; +export * from './model_get_orders_list_old_resp'; +export * from './model_get_recent_orders_list_old_data'; +export * from './model_get_recent_orders_list_old_req'; +export * from './model_get_recent_orders_list_old_resp'; +export * from './model_get_recent_trade_history_old_data'; +export * from './model_get_recent_trade_history_old_req'; +export * from './model_get_recent_trade_history_old_resp'; +export * from './model_get_stop_order_by_client_oid_data'; +export * from './model_get_stop_order_by_client_oid_req'; +export * from './model_get_stop_order_by_client_oid_resp'; +export * from './model_get_stop_order_by_order_id_req'; +export * from './model_get_stop_order_by_order_id_resp'; +export * from './model_get_stop_orders_list_items'; +export * from './model_get_stop_orders_list_req'; +export * from './model_get_stop_orders_list_resp'; +export * from './model_get_symbols_with_open_order_resp'; +export * from './model_get_trade_history_items'; +export * from './model_get_trade_history_old_items'; +export * from './model_get_trade_history_old_req'; +export * from './model_get_trade_history_old_resp'; +export * from './model_get_trade_history_req'; +export * from './model_get_trade_history_resp'; +export * from './model_modify_order_req'; +export * from './model_modify_order_resp'; +export * from './model_set_dcp_req'; +export * from './model_set_dcp_resp'; +export * from './api_order'; diff --git a/sdk/node/src/generate/viplending/viplending/index.ts b/sdk/node/src/generate/viplending/viplending/index.ts index c1b2c6f2..b0b08e3d 100644 --- a/sdk/node/src/generate/viplending/viplending/index.ts +++ b/sdk/node/src/generate/viplending/viplending/index.ts @@ -1,3 +1,7 @@ +export * from './model_get_account_detail_ltv'; +export * from './model_get_account_detail_margins'; +export * from './model_get_account_detail_orders'; +export * from './model_get_account_detail_resp'; +export * from './model_get_accounts_data'; export * from './model_get_accounts_resp'; export * from './api_vip_lending'; -export * from './model_get_account_detail_resp'; From bed8aaac91422d029ea83de539b93a658e679bb5 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 14 Jan 2025 11:05:14 +0800 Subject: [PATCH 019/106] feat(nodejs): generate index.ts for entry --- generate.mk | 2 +- generator/plugin/pom.xml | 8 ++++ .../plugin/generator/NodeSdkGenerator.java | 42 ++++++++++++++++- .../node-sdk/module_generated.mustache | 3 ++ .../node-sdk/module_service.mustache | 3 ++ .../sdk/plugin/SdkGeneratorTest.java | 2 + sdk/node/example/example_api.ts | 45 +++++++++++-------- sdk/node/src/generate/account/index.ts | 3 +- sdk/node/src/generate/affiliate/index.ts | 3 +- sdk/node/src/generate/broker/index.ts | 3 +- sdk/node/src/generate/earn/index.ts | 3 +- sdk/node/src/generate/futures/index.ts | 3 +- sdk/node/src/generate/index.ts | 9 ++++ sdk/node/src/generate/margin/index.ts | 3 +- sdk/node/src/generate/service/index.ts | 8 ++++ sdk/node/src/generate/spot/index.ts | 3 +- sdk/node/src/generate/version.ts | 2 +- sdk/node/src/generate/viplending/index.ts | 3 +- sdk/node/src/index.ts | 4 +- 19 files changed, 110 insertions(+), 42 deletions(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/module_generated.mustache create mode 100644 generator/plugin/src/main/resources/node-sdk/module_service.mustache create mode 100644 sdk/node/src/generate/index.ts create mode 100644 sdk/node/src/generate/service/index.ts diff --git a/generate.mk b/generate.mk index 2197652e..5fdb15a2 100644 --- a/generate.mk +++ b/generate.mk @@ -57,7 +57,7 @@ define generate-entry -g $(2)-sdk \ -o $(3) \ --skip-validate-spec \ - --additional-properties=GEN_MODE=entry,API_VERSION=$(VERSION),API_DATE=$(DATE) > logs/$(service)-$(lang)-entry.log 2>&1 || \ + --additional-properties=GEN_MODE=entry,API_VERSION=$(VERSION),API_DATE=$(DATE),CSV_PATH=/local/spec > logs/$(service)-$(lang)-entry.log 2>&1 || \ { echo "$(RED)Entry Task $(service) for $(lang) failed$(NC)"; exit 1; } endef diff --git a/generator/plugin/pom.xml b/generator/plugin/pom.xml index c954e290..dcbf4519 100644 --- a/generator/plugin/pom.xml +++ b/generator/plugin/pom.xml @@ -16,6 +16,7 @@ 3.2.4 3.6.1 1.8.0 + 5.7.1 @@ -36,6 +37,12 @@ ${ascii-table.version} compile + + com.opencsv + opencsv + ${csv.version} + compile + @@ -67,6 +74,7 @@ org.openapitools:openapi-generator-cli com.github.freva:ascii-table + com.opencsv:opencsv diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index dedf8d7d..07a80ac4 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -9,6 +9,7 @@ import com.kucoin.universal.sdk.plugin.service.impl.OperationServiceImpl; import com.kucoin.universal.sdk.plugin.service.impl.SchemaServiceImpl; import com.kucoin.universal.sdk.plugin.util.SpecificationUtil; +import com.opencsv.CSVReader; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; @@ -24,6 +25,7 @@ import org.openapitools.codegen.utils.CamelizeOption; import java.io.File; +import java.io.FileReader; import java.util.*; import java.util.stream.Collectors; @@ -105,6 +107,8 @@ public void processOpts() { case ENTRY: { apiTemplateFiles.put("api_entry.mustache", ".ts"); supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/index.ts", service))); + supportingFiles.add(new SupportingFile("module_service.mustache", "./service/index.ts")); + supportingFiles.add(new SupportingFile("module_generated.mustache", "index.ts")); break; } case WS: { @@ -395,9 +399,9 @@ private void generateApiExport(Meta meta, Set export) { }); String exportService = camelize(service.toLowerCase(), CamelizeOption.UPPERCASE_FIRST_CHAR); - export.add(String.format("const %s = \n{\n%s\n};", exportService, + export.add(String.format("export const %s = \n{\n%s\n};", exportService, serviceAliases.stream().map(s -> " ..." + s).collect(Collectors.joining(",\n")))); - export.add(String.format("export default %s;", exportService)); + break; } @@ -553,6 +557,40 @@ public ModelsMap postProcessModels(ModelsMap objs) { public Map postProcessSupportingFileData(Map objs) { Map data = super.postProcessSupportingFileData(objs); data.put("exports", exports); + + String csvPath = (String) additionalProperties.get("CSV_PATH"); + if (csvPath == null) { + log.error("no csv path found"); + return data; + } + + Set serviceExports = new TreeSet<>(); + Set generatedExports = new TreeSet<>(); + + String apiCsvFile = csvPath + "/apis.csv"; + + Set services = new TreeSet<>(); + try { + + CSVReader reader = new CSVReader(new FileReader(apiCsvFile)); + List rows = reader.readAll(); + for (int i = 1; i < rows.size(); i++) { + services.add(rows.get(i)[0].toLowerCase()); + } + } catch (Exception e) { + throw new RuntimeException("read csv fail", e); + } + + services.forEach(s-> { + serviceExports.add(String.format("export * from \"./%s_api\"", s)); + generatedExports.add(String.format("export * from \"./%s\"", s)); + }); + + generatedExports.add("export * from \"./service\""); + + data.put("service-exports", serviceExports); + data.put("generated-exports", generatedExports); + return data; } } diff --git a/generator/plugin/src/main/resources/node-sdk/module_generated.mustache b/generator/plugin/src/main/resources/node-sdk/module_generated.mustache new file mode 100644 index 00000000..f4b88004 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/module_generated.mustache @@ -0,0 +1,3 @@ +{{#generated-exports}} +{{{.}}} +{{/generated-exports}} \ No newline at end of file diff --git a/generator/plugin/src/main/resources/node-sdk/module_service.mustache b/generator/plugin/src/main/resources/node-sdk/module_service.mustache new file mode 100644 index 00000000..53ac2fc3 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/module_service.mustache @@ -0,0 +1,3 @@ +{{#service-exports}} +{{{.}}} +{{/service-exports}} \ No newline at end of file diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 2558652c..8841f218 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -12,6 +12,7 @@ public class SdkGeneratorTest { private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-viplending.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; + private static final String CSV_PATH = "../../spec"; @Test public void launchCodeGenerator() { @@ -33,6 +34,7 @@ public void launchCodeGenerator() { .setInputSpec(SPEC_ENTRY_NAME) .setValidateSpec(false) .addAdditionalProperty("GEN_MODE", "ENTRY") + .addAdditionalProperty("CSV_PATH", CSV_PATH) .setOutputDir(OUTPUT_DIR); final ClientOptInput clientOptInput = configurator.toClientOptInput(); diff --git a/sdk/node/example/example_api.ts b/sdk/node/example/example_api.ts index fb748335..e3de1131 100644 --- a/sdk/node/example/example_api.ts +++ b/sdk/node/example/example_api.ts @@ -1,10 +1,17 @@ import { + Account, + AccountService, + ClientOptionBuilder, DefaultClient, - DomainType -} from 'kucoin-universal-sdk/api/client'; + DomainType, + Futures, + FuturesService, + Spot, + SpotService, + TransportOptionBuilder, +} from 'kucoin-universal-sdk'; import { randomUUID } from 'crypto'; -import { DomainType } from '../src'; async function restExample() { console.log('Starting REST example'); @@ -60,7 +67,7 @@ async function accountServiceExample(accountService: AccountService) { // Get fee api const feeApi = accountService.getFeeApi(); - const getActualFeeReq: GetSpotActualFeeReq = new GetSpotActualFeeReqBuilder() + const getActualFeeReq = new Account.GetSpotActualFeeReqBuilder() .setSymbols('BTC-USDT,ETH-USDT') .build(); const getActualFeeResp = feeApi.getSpotActualFee(getActualFeeReq).then((resp) => { @@ -85,11 +92,11 @@ async function spotServiceExample(spotService: SpotService) { const orderApi = spotService.getOrderApi(); // Add limit order - const addOrderReq = new AddOrderSyncReqBuilder() + const addOrderReq = new Spot.AddOrderSyncReqBuilder() .setClientOid(randomUUID().toString()) - .setSide(AddOrderSyncReq.SideEnum.BUY) + .setSide(Spot.AddOrderSyncReq.SideEnum.BUY) .setSymbol('BTC-USDT') - .setType(AddOrderSyncReq.TypeEnum.LIMIT) + .setType(Spot.AddOrderSyncReq.TypeEnum.LIMIT) .setRemark('sdk_example') .setPrice('10000') .setSize('0.001') @@ -100,7 +107,7 @@ async function spotServiceExample(spotService: SpotService) { // Query order detail const orderId = addOrderResp.orderId!; - const queryOrderDetailReq = new GetOrderByOrderIdReqBuilder() + const queryOrderDetailReq = new Spot.GetOrderByOrderIdReqBuilder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -108,7 +115,7 @@ async function spotServiceExample(spotService: SpotService) { console.log(`Order detail: ${orderDetailResp.toJson()}`); // Cancel order - const cancelOrderReq = new CancelOrderByOrderIdSyncReqBuilder() + const cancelOrderReq = new Spot.CancelOrderByOrderIdSyncReqBuilder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -116,25 +123,25 @@ async function spotServiceExample(spotService: SpotService) { console.log(`Cancel order success, id: ${cancelOrderResp.orderId}`); } -async function futuresServiceExample(futuresService: any) { +async function futuresServiceExample(futuresService: FuturesService) { const marketApi = futuresService.getMarketApi(); - const allSymbolResp = await marketApi.getAllSymbols(); + const allSymbolResp = await marketApi.GetAllSymbols(); - const maxQuery = Math.min(allSymbolResp.data.length, 10); + const maxQuery = Math.min(allSymbolResp.data!.length, 10); for (let i = 0; i < maxQuery; i++) { - const symbol = allSymbolResp.data[i]; + const symbol = allSymbolResp.data![i]; const start = Date.now() - 10 * 60 * 1000; const end = Date.now(); - const getKlineReq = new GetKlinesReqBuilder() - .setSymbol(symbol.symbol) - .setType(GetKlinesReq.TypeEnum._1MIN) - .setStartAt(start) - .setEndAt(end) + const getKlineReq = new Futures.GetKlinesReqBuilder() + .setSymbol(symbol.symbol!) + .setGranularity(Futures.GetKlinesReq.GranularityEnum._1) + .setFrom(start) + .setTo(end) .build(); const getKlineResp = await marketApi.getKlines(getKlineReq); - const rows = getKlineResp.data.map((row: any) => { + const rows = getKlineResp.data!.map((row: any) => { const timestamp = new Date(row[0]).toISOString(); return `[Time: ${timestamp}, Open: ${row[1]}, High: ${row[2]}, Low: ${row[3]}, Close: ${row[4]}, Volume: ${row[5]}]`; }); diff --git a/sdk/node/src/generate/account/index.ts b/sdk/node/src/generate/account/index.ts index 0f71585e..5aa743a4 100644 --- a/sdk/node/src/generate/account/index.ts +++ b/sdk/node/src/generate/account/index.ts @@ -4,7 +4,7 @@ import * as WITHDRAWAL from './withdrawal'; import * as FEE from './fee'; import * as SUBACCOUNT from './subaccount'; import * as TRANSFER from './transfer'; -const Account = { +export const Account = { ...ACCOUNT, ...DEPOSIT, ...WITHDRAWAL, @@ -12,4 +12,3 @@ const Account = { ...SUBACCOUNT, ...TRANSFER, }; -export default Account; diff --git a/sdk/node/src/generate/affiliate/index.ts b/sdk/node/src/generate/affiliate/index.ts index f0ac8ca5..06a24a45 100644 --- a/sdk/node/src/generate/affiliate/index.ts +++ b/sdk/node/src/generate/affiliate/index.ts @@ -1,5 +1,4 @@ import * as AFFILIATE from './affiliate'; -const Affiliate = { +export const Affiliate = { ...AFFILIATE, }; -export default Affiliate; diff --git a/sdk/node/src/generate/broker/index.ts b/sdk/node/src/generate/broker/index.ts index 9da5ecf8..d9ce8890 100644 --- a/sdk/node/src/generate/broker/index.ts +++ b/sdk/node/src/generate/broker/index.ts @@ -1,7 +1,6 @@ import * as APIBROKER from './apibroker'; import * as NDBROKER from './ndbroker'; -const Broker = { +export const Broker = { ...APIBROKER, ...NDBROKER, }; -export default Broker; diff --git a/sdk/node/src/generate/earn/index.ts b/sdk/node/src/generate/earn/index.ts index a2c83bfc..5dd2fc54 100644 --- a/sdk/node/src/generate/earn/index.ts +++ b/sdk/node/src/generate/earn/index.ts @@ -1,5 +1,4 @@ import * as EARN from './earn'; -const Earn = { +export const Earn = { ...EARN, }; -export default Earn; diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts index 3df463b3..66353ab6 100644 --- a/sdk/node/src/generate/futures/index.ts +++ b/sdk/node/src/generate/futures/index.ts @@ -2,10 +2,9 @@ import * as ORDER from './order'; import * as POSITIONS from './positions'; import * as FUNDINGFEES from './fundingfees'; import * as MARKET from './market'; -const Futures = { +export const Futures = { ...ORDER, ...POSITIONS, ...FUNDINGFEES, ...MARKET, }; -export default Futures; diff --git a/sdk/node/src/generate/index.ts b/sdk/node/src/generate/index.ts new file mode 100644 index 00000000..fdeadcdf --- /dev/null +++ b/sdk/node/src/generate/index.ts @@ -0,0 +1,9 @@ +export * from './account'; +export * from './affiliate'; +export * from './broker'; +export * from './earn'; +export * from './futures'; +export * from './margin'; +export * from './service'; +export * from './spot'; +export * from './viplending'; diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts index 54153b05..95ad15ec 100644 --- a/sdk/node/src/generate/margin/index.ts +++ b/sdk/node/src/generate/margin/index.ts @@ -3,11 +3,10 @@ import * as DEBIT from './debit'; import * as CREDIT from './credit'; import * as MARKET from './market'; import * as RISKLIMIT from './risklimit'; -const Margin = { +export const Margin = { ...ORDER, ...DEBIT, ...CREDIT, ...MARKET, ...RISKLIMIT, }; -export default Margin; diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts new file mode 100644 index 00000000..7cd8cf53 --- /dev/null +++ b/sdk/node/src/generate/service/index.ts @@ -0,0 +1,8 @@ +export * from './account_api'; +export * from './affiliate_api'; +export * from './broker_api'; +export * from './earn_api'; +export * from './futures_api'; +export * from './margin_api'; +export * from './spot_api'; +export * from './viplending_api'; diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index 59085a9c..475df945 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -1,7 +1,6 @@ import * as ORDER from './order'; import * as MARKET from './market'; -const Spot = { +export const Spot = { ...ORDER, ...MARKET, }; -export default Spot; diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 3d654af4..6c2f4dca 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-13'; +export const SdkGenerateDate = '2025-01-14'; diff --git a/sdk/node/src/generate/viplending/index.ts b/sdk/node/src/generate/viplending/index.ts index af4c033c..49cc630b 100644 --- a/sdk/node/src/generate/viplending/index.ts +++ b/sdk/node/src/generate/viplending/index.ts @@ -1,5 +1,4 @@ import * as VIPLENDING from './viplending'; -const Viplending = { +export const Viplending = { ...VIPLENDING, }; -export default Viplending; diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index fd6b6af4..99f23c9b 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -3,7 +3,5 @@ export * from './api'; export * from './model'; // Exporting from generate services -import * as Spot from './generate/spot'; -import * as Futures from './generate/futures'; +export * from './generate' -export { Spot, Futures }; From 96c52ba6e9ae87c45c5fd79b5c3fde963436bcc6 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 14 Jan 2025 11:49:16 +0800 Subject: [PATCH 020/106] feat(nodejs): rename generated method --- .../plugin/generator/NodeSdkGenerator.java | 6 +- sdk/node/example/example_api.ts | 2 +- .../fundingfees/api_funding_fees.template | 12 ++-- .../fundingfees/api_funding_fees.test.ts | 16 ++--- .../futures/fundingfees/api_funding_fees.ts | 12 ++-- .../futures/market/api_market.template | 6 +- .../futures/market/api_market.test.ts | 8 +-- .../src/generate/futures/market/api_market.ts | 6 +- .../generate/futures/order/api_order.template | 24 +++---- .../generate/futures/order/api_order.test.ts | 32 +++++----- .../src/generate/futures/order/api_order.ts | 24 +++---- .../futures/positions/api_positions.template | 48 +++++++------- .../futures/positions/api_positions.test.ts | 64 +++++++++---------- .../futures/positions/api_positions.ts | 48 +++++++------- sdk/node/src/generate/service/account_api.ts | 36 +++++------ .../src/generate/service/affiliate_api.ts | 6 +- sdk/node/src/generate/service/broker_api.ts | 12 ++-- sdk/node/src/generate/service/earn_api.ts | 6 +- sdk/node/src/generate/service/futures_api.ts | 24 +++---- sdk/node/src/generate/service/margin_api.ts | 30 ++++----- sdk/node/src/generate/service/spot_api.ts | 12 ++-- .../src/generate/service/viplending_api.ts | 6 +- 22 files changed, 220 insertions(+), 220 deletions(-) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 07a80ac4..13bfe4c3 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -155,7 +155,7 @@ public String formatParamName(String name) { @Override public String formatMethodName(String name) { - return sanitizeName(name); + return camelize(sanitizeName(name), CamelizeOption.LOWERCASE_FIRST_CHAR); } @Override @@ -358,7 +358,7 @@ private void generateApiImport(Meta meta, boolean req, Map if (v.getService().equalsIgnoreCase(meta.getService())) { List services = Arrays.asList(formatService(k + "API"), formatService(k + "APIImpl")); String fileName = String.format("@generate/%s/%s/%s", formatPackage(v.getService()), - formatPackage(v.getSubService()), toApiFilename(formatMethodName(k))); + formatPackage(v.getSubService()), toApiFilename(sanitizeName(k))); imports.computeIfAbsent(fileName, ImportModel::new).component.addAll(services); } }); @@ -375,7 +375,7 @@ private void generateApiExport(Meta meta, Set export) { case API: { operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { - export.add(String.format("export * from \"./%s\"", toApiFilename(formatMethodName(k)))); + export.add(String.format("export * from \"./%s\"", toApiFilename(sanitizeName(k)))); } }); diff --git a/sdk/node/example/example_api.ts b/sdk/node/example/example_api.ts index e3de1131..03c619d4 100644 --- a/sdk/node/example/example_api.ts +++ b/sdk/node/example/example_api.ts @@ -125,7 +125,7 @@ async function spotServiceExample(spotService: SpotService) { async function futuresServiceExample(futuresService: FuturesService) { const marketApi = futuresService.getMarketApi(); - const allSymbolResp = await marketApi.GetAllSymbols(); + const allSymbolResp = await marketApi.getAllSymbols(); const maxQuery = Math.min(allSymbolResp.data!.length, 10); for (let i = 0; i < maxQuery; i++) { diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template index 38fcf36a..bb30bf2c 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template @@ -5,16 +5,16 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('GetPublicFundingHistory request test', ()=> { + test('getPublicFundingHistory request test', ()=> { /** - * GetPublicFundingHistory + * getPublicFundingHistory * Get Public Funding History * /api/v1/contract/funding-rates */ let builder = GetPublicFundingHistoryReq.builder(); builder.setSymbol(?).setFrom(?).setTo(?); let req = builder.build(); - let resp = api.GetPublicFundingHistory(req); + let resp = api.getPublicFundingHistory(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); @@ -36,16 +36,16 @@ describe('Auto Test', ()=> { }); }) - test('GetCurrentFundingRate request test', ()=> { + test('getCurrentFundingRate request test', ()=> { /** - * GetCurrentFundingRate + * getCurrentFundingRate * Get Current Funding Rate * /api/v1/funding-rate/{symbol}/current */ let builder = GetCurrentFundingRateReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.GetCurrentFundingRate(req); + let resp = api.getCurrentFundingRate(req); return resp.then(result => { expect(result.symbol).toEqual(expect.anything()); expect(result.granularity).toEqual(expect.anything()); diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts index 07ed6e03..7124f323 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -7,9 +7,9 @@ import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('GetPublicFundingHistory request test', () => { + test('getPublicFundingHistory request test', () => { /** - * GetPublicFundingHistory + * getPublicFundingHistory * Get Public Funding History * /api/v1/contract/funding-rates */ @@ -22,9 +22,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetPublicFundingHistory response test', () => { + test('getPublicFundingHistory response test', () => { /** - * GetPublicFundingHistory + * getPublicFundingHistory * Get Public Funding History * /api/v1/contract/funding-rates */ @@ -74,9 +74,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetCurrentFundingRate request test', () => { + test('getCurrentFundingRate request test', () => { /** - * GetCurrentFundingRate + * getCurrentFundingRate * Get Current Funding Rate * /api/v1/funding-rate/{symbol}/current */ @@ -89,9 +89,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetCurrentFundingRate response test', () => { + test('getCurrentFundingRate response test', () => { /** - * GetCurrentFundingRate + * getCurrentFundingRate * Get Current Funding Rate * /api/v1/funding-rate/{symbol}/current */ diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts index f8e3ba70..206d0455 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts @@ -10,7 +10,7 @@ import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; export interface FundingFeesAPI { /** - * GetPublicFundingHistory Get Public Funding History + * getPublicFundingHistory Get Public Funding History * Description: Query the funding rate at each settlement time point within a certain time range of the corresponding contract * Documentation: https://www.kucoin.com/docs-new/api-3470266 * +---------------------+---------+ @@ -23,7 +23,7 @@ export interface FundingFeesAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - GetPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise; + getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise; /** * getPrivateFundingHistory Get Private Funding History @@ -44,7 +44,7 @@ export interface FundingFeesAPI { ): Promise; /** - * GetCurrentFundingRate Get Current Funding Rate + * getCurrentFundingRate Get Current Funding Rate * Description: get Current Funding Rate * Documentation: https://www.kucoin.com/docs-new/api-3470265 * +---------------------+---------+ @@ -57,13 +57,13 @@ export interface FundingFeesAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; } export class FundingFeesAPIImpl implements FundingFeesAPI { constructor(private transport: Transport) {} - GetPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { + getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { return this.transport.call( 'futures', false, @@ -89,7 +89,7 @@ export class FundingFeesAPIImpl implements FundingFeesAPI { ); } - GetCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/market/api_market.template b/sdk/node/src/generate/futures/market/api_market.template index 7b37f1e3..ca6bb2a9 100644 --- a/sdk/node/src/generate/futures/market/api_market.template +++ b/sdk/node/src/generate/futures/market/api_market.template @@ -43,13 +43,13 @@ describe('Auto Test', ()=> { }); }) - test('GetAllSymbols request test', ()=> { + test('getAllSymbols request test', ()=> { /** - * GetAllSymbols + * getAllSymbols * Get All Symbols * /api/v1/contracts/active */ - let resp = api.GetAllSymbols(); + let resp = api.getAllSymbols(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts index d0d5d61e..5c2280b8 100644 --- a/sdk/node/src/generate/futures/market/api_market.test.ts +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -73,17 +73,17 @@ describe('Auto Test', () => { * /api/v1/bullet-public */ }); - test('GetAllSymbols request test', () => { + test('getAllSymbols request test', () => { /** - * GetAllSymbols + * getAllSymbols * Get All Symbols * /api/v1/contracts/active */ }); - test('GetAllSymbols response test', () => { + test('getAllSymbols response test', () => { /** - * GetAllSymbols + * getAllSymbols * Get All Symbols * /api/v1/contracts/active */ diff --git a/sdk/node/src/generate/futures/market/api_market.ts b/sdk/node/src/generate/futures/market/api_market.ts index f880a2f0..198c6d9d 100644 --- a/sdk/node/src/generate/futures/market/api_market.ts +++ b/sdk/node/src/generate/futures/market/api_market.ts @@ -79,7 +79,7 @@ export interface MarketAPI { getPublicToken(): Promise; /** - * GetAllSymbols Get All Symbols + * getAllSymbols Get All Symbols * Description: Get detailed information of all contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. * Documentation: https://www.kucoin.com/docs-new/api-3470220 * +---------------------+---------+ @@ -92,7 +92,7 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - GetAllSymbols(): Promise; + getAllSymbols(): Promise; /** * getSymbol Get Symbol @@ -342,7 +342,7 @@ export class MarketAPIImpl implements MarketAPI { ); } - GetAllSymbols(): Promise { + getAllSymbols(): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/order/api_order.template b/sdk/node/src/generate/futures/order/api_order.template index 76fdfbe4..addd4311 100644 --- a/sdk/node/src/generate/futures/order/api_order.template +++ b/sdk/node/src/generate/futures/order/api_order.template @@ -24,16 +24,16 @@ describe('Auto Test', ()=> { }); }) - test('GetOpenOrderValue request test', ()=> { + test('getOpenOrderValue request test', ()=> { /** - * GetOpenOrderValue + * getOpenOrderValue * Get Open Order Value * /api/v1/openOrderStatistics */ let builder = GetOpenOrderValueReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.GetOpenOrderValue(req); + let resp = api.getOpenOrderValue(req); return resp.then(result => { expect(result.openOrderBuySize).toEqual(expect.anything()); expect(result.openOrderSellSize).toEqual(expect.anything()); @@ -125,16 +125,16 @@ describe('Auto Test', ()=> { }); }) - test('GetOrderList request test', ()=> { + test('getOrderList request test', ()=> { /** - * GetOrderList + * getOrderList * Get Order List * /api/v1/orders */ let builder = GetOrderListReq.builder(); builder.setStatus(?).setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.GetOrderList(req); + let resp = api.getOrderList(req); return resp.then(result => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); @@ -273,16 +273,16 @@ describe('Auto Test', ()=> { }); }) - test('GetRecentClosedOrders request test', ()=> { + test('getRecentClosedOrders request test', ()=> { /** - * GetRecentClosedOrders + * getRecentClosedOrders * Get Recent Closed Orders * /api/v1/recentDoneOrders */ let builder = GetRecentClosedOrdersReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.GetRecentClosedOrders(req); + let resp = api.getRecentClosedOrders(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); @@ -334,16 +334,16 @@ describe('Auto Test', ()=> { }); }) - test('GetStopOrderList request test', ()=> { + test('getStopOrderList request test', ()=> { /** - * GetStopOrderList + * getStopOrderList * Get Stop Order List * /api/v1/stopOrders */ let builder = GetStopOrderListReq.builder(); builder.setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.GetStopOrderList(req); + let resp = api.getStopOrderList(req); return resp.then(result => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts index 1fb7eff1..9199119a 100644 --- a/sdk/node/src/generate/futures/order/api_order.test.ts +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -71,9 +71,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetOpenOrderValue request test', () => { + test('getOpenOrderValue request test', () => { /** - * GetOpenOrderValue + * getOpenOrderValue * Get Open Order Value * /api/v1/openOrderStatistics */ @@ -86,9 +86,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetOpenOrderValue response test', () => { + test('getOpenOrderValue response test', () => { /** - * GetOpenOrderValue + * getOpenOrderValue * Get Open Order Value * /api/v1/openOrderStatistics */ @@ -203,9 +203,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetOrderList request test', () => { + test('getOrderList request test', () => { /** - * GetOrderList + * getOrderList * Get Order List * /api/v1/orders */ @@ -219,9 +219,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetOrderList response test', () => { + test('getOrderList response test', () => { /** - * GetOrderList + * getOrderList * Get Order List * /api/v1/orders */ @@ -438,9 +438,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetRecentClosedOrders request test', () => { + test('getRecentClosedOrders request test', () => { /** - * GetRecentClosedOrders + * getRecentClosedOrders * Get Recent Closed Orders * /api/v1/recentDoneOrders */ @@ -453,9 +453,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetRecentClosedOrders response test', () => { + test('getRecentClosedOrders response test', () => { /** - * GetRecentClosedOrders + * getRecentClosedOrders * Get Recent Closed Orders * /api/v1/recentDoneOrders */ @@ -571,9 +571,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetStopOrderList request test', () => { + test('getStopOrderList request test', () => { /** - * GetStopOrderList + * getStopOrderList * Get Stop Order List * /api/v1/stopOrders */ @@ -587,9 +587,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetStopOrderList response test', () => { + test('getStopOrderList response test', () => { /** - * GetStopOrderList + * getStopOrderList * Get Stop Order List * /api/v1/stopOrders */ diff --git a/sdk/node/src/generate/futures/order/api_order.ts b/sdk/node/src/generate/futures/order/api_order.ts index 5f3ffcc5..8f5dd44b 100644 --- a/sdk/node/src/generate/futures/order/api_order.ts +++ b/sdk/node/src/generate/futures/order/api_order.ts @@ -56,7 +56,7 @@ export interface OrderAPI { getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * GetOpenOrderValue Get Open Order Value + * getOpenOrderValue Get Open Order Value * Description: You can query this endpoint to get the the total number and value of the all your active orders. * Documentation: https://www.kucoin.com/docs-new/api-3470250 * +---------------------+---------+ @@ -69,7 +69,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - GetOpenOrderValue(req: GetOpenOrderValueReq): Promise; + getOpenOrderValue(req: GetOpenOrderValueReq): Promise; /** * getOrderByClientOid Get Order By ClientOid @@ -121,7 +121,7 @@ export interface OrderAPI { cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise; /** - * GetOrderList Get Order List + * getOrderList Get Order List * Description: List your current orders. * Documentation: https://www.kucoin.com/docs-new/api-3470244 * +---------------------+---------+ @@ -134,7 +134,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetOrderList(req: GetOrderListReq): Promise; + getOrderList(req: GetOrderListReq): Promise; /** * batchCancelOrders Batch Cancel Orders @@ -233,7 +233,7 @@ export interface OrderAPI { addOrderTest(req: AddOrderTestReq): Promise; /** - * GetRecentClosedOrders Get Recent Closed Orders + * getRecentClosedOrders Get Recent Closed Orders * Description: Get a list of recent 1000 closed orders in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. * Documentation: https://www.kucoin.com/docs-new/api-3470246 * +---------------------+---------+ @@ -246,7 +246,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - GetRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; + getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; /** * getRecentTradeHistory Get Recent Trade History @@ -297,7 +297,7 @@ export interface OrderAPI { cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise; /** - * GetStopOrderList Get Stop Order List + * getStopOrderList Get Stop Order List * Description: Get the un-triggered stop orders list. Stop orders that have been triggered can be queried through the general order interface * Documentation: https://www.kucoin.com/docs-new/api-3470247 * +---------------------+---------+ @@ -310,7 +310,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 6 | * +---------------------+---------+ */ - GetStopOrderList(req: GetStopOrderListReq): Promise; + getStopOrderList(req: GetStopOrderListReq): Promise; /** * cancelAllOrdersV3 Cancel All Orders @@ -344,7 +344,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - GetOpenOrderValue(req: GetOpenOrderValueReq): Promise { + getOpenOrderValue(req: GetOpenOrderValueReq): Promise { return this.transport.call( 'futures', false, @@ -392,7 +392,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - GetOrderList(req: GetOrderListReq): Promise { + getOrderList(req: GetOrderListReq): Promise { return this.transport.call( 'futures', false, @@ -476,7 +476,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - GetRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise { + getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise { return this.transport.call( 'futures', false, @@ -524,7 +524,7 @@ export class OrderAPIImpl implements OrderAPI { ); } - GetStopOrderList(req: GetStopOrderListReq): Promise { + getStopOrderList(req: GetStopOrderListReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/futures/positions/api_positions.template b/sdk/node/src/generate/futures/positions/api_positions.template index bf6b63a6..b61c44ee 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.template +++ b/sdk/node/src/generate/futures/positions/api_positions.template @@ -20,16 +20,16 @@ describe('Auto Test', ()=> { }); }) - test('GetPositionsHistory request test', ()=> { + test('getPositionsHistory request test', ()=> { /** - * GetPositionsHistory + * getPositionsHistory * Get Positions History * /api/v1/history-positions */ let builder = GetPositionsHistoryReq.builder(); builder.setSymbol(?).setFrom(?).setTo(?).setLimit(?).setPageId(?); let req = builder.build(); - let resp = api.GetPositionsHistory(req); + let resp = api.getPositionsHistory(req); return resp.then(result => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); @@ -39,46 +39,46 @@ describe('Auto Test', ()=> { }); }) - test('GetMaxWithdrawMargin request test', ()=> { + test('getMaxWithdrawMargin request test', ()=> { /** - * GetMaxWithdrawMargin + * getMaxWithdrawMargin * Get Max Withdraw Margin * /api/v1/margin/maxWithdrawMargin */ let builder = GetMaxWithdrawMarginReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.GetMaxWithdrawMargin(req); + let resp = api.getMaxWithdrawMargin(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); }) - test('RemoveIsolatedMargin request test', ()=> { + test('removeIsolatedMargin request test', ()=> { /** - * RemoveIsolatedMargin + * removeIsolatedMargin * Remove Isolated Margin * /api/v1/margin/withdrawMargin */ let builder = RemoveIsolatedMarginReq.builder(); builder.setSymbol(?).setWithdrawAmount(?); let req = builder.build(); - let resp = api.RemoveIsolatedMargin(req); + let resp = api.removeIsolatedMargin(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); }) - test('GetPositionDetails request test', ()=> { + test('getPositionDetails request test', ()=> { /** - * GetPositionDetails + * getPositionDetails * Get Position Details * /api/v1/position */ let builder = GetPositionDetailsReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.GetPositionDetails(req); + let resp = api.getPositionDetails(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); @@ -142,16 +142,16 @@ describe('Auto Test', ()=> { }); }) - test('AddIsolatedMargin request test', ()=> { + test('addIsolatedMargin request test', ()=> { /** - * AddIsolatedMargin + * addIsolatedMargin * Add Isolated Margin * /api/v1/position/margin/deposit-margin */ let builder = AddIsolatedMarginReq.builder(); builder.setSymbol(?).setMargin(?).setBizNo(?); let req = builder.build(); - let resp = api.AddIsolatedMargin(req); + let resp = api.addIsolatedMargin(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); @@ -208,31 +208,31 @@ describe('Auto Test', ()=> { }); }) - test('GetPositionList request test', ()=> { + test('getPositionList request test', ()=> { /** - * GetPositionList + * getPositionList * Get Position List * /api/v1/positions */ let builder = GetPositionListReq.builder(); builder.setCurrency(?); let req = builder.build(); - let resp = api.GetPositionList(req); + let resp = api.getPositionList(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); }); }) - test('ModifyMarginLeverage request test', ()=> { + test('modifyMarginLeverage request test', ()=> { /** - * ModifyMarginLeverage + * modifyMarginLeverage * Modify Cross Margin Leverage * /api/v2/changeCrossUserLeverage */ let builder = ModifyMarginLeverageReq.builder(); builder.setSymbol(?).setLeverage(?); let req = builder.build(); - let resp = api.ModifyMarginLeverage(req); + let resp = api.modifyMarginLeverage(req); return resp.then(result => { expect(result.symbol).toEqual(expect.anything()); expect(result.leverage).toEqual(expect.anything()); @@ -255,16 +255,16 @@ describe('Auto Test', ()=> { }); }) - test('GetMaxOpenSize request test', ()=> { + test('getMaxOpenSize request test', ()=> { /** - * GetMaxOpenSize + * getMaxOpenSize * Get Max Open Size * /api/v2/getMaxOpenSize */ let builder = GetMaxOpenSizeReq.builder(); builder.setSymbol(?).setPrice(?).setLeverage(?); let req = builder.build(); - let resp = api.GetMaxOpenSize(req); + let resp = api.getMaxOpenSize(req); return resp.then(result => { expect(result.symbol).toEqual(expect.anything()); expect(result.maxBuyOpenSize).toEqual(expect.anything()); diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts index 99c58835..b2e0e517 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.test.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -62,9 +62,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetPositionsHistory request test', () => { + test('getPositionsHistory request test', () => { /** - * GetPositionsHistory + * getPositionsHistory * Get Positions History * /api/v1/history-positions */ @@ -78,9 +78,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetPositionsHistory response test', () => { + test('getPositionsHistory response test', () => { /** - * GetPositionsHistory + * getPositionsHistory * Get Positions History * /api/v1/history-positions */ @@ -96,9 +96,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetMaxWithdrawMargin request test', () => { + test('getMaxWithdrawMargin request test', () => { /** - * GetMaxWithdrawMargin + * getMaxWithdrawMargin * Get Max Withdraw Margin * /api/v1/margin/maxWithdrawMargin */ @@ -111,9 +111,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetMaxWithdrawMargin response test', () => { + test('getMaxWithdrawMargin response test', () => { /** - * GetMaxWithdrawMargin + * getMaxWithdrawMargin * Get Max Withdraw Margin * /api/v1/margin/maxWithdrawMargin */ @@ -128,9 +128,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('RemoveIsolatedMargin request test', () => { + test('removeIsolatedMargin request test', () => { /** - * RemoveIsolatedMargin + * removeIsolatedMargin * Remove Isolated Margin * /api/v1/margin/withdrawMargin */ @@ -143,9 +143,9 @@ describe('Auto Test', () => { console.log(req); }); - test('RemoveIsolatedMargin response test', () => { + test('removeIsolatedMargin response test', () => { /** - * RemoveIsolatedMargin + * removeIsolatedMargin * Remove Isolated Margin * /api/v1/margin/withdrawMargin */ @@ -160,9 +160,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetPositionDetails request test', () => { + test('getPositionDetails request test', () => { /** - * GetPositionDetails + * getPositionDetails * Get Position Details * /api/v1/position */ @@ -175,9 +175,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetPositionDetails response test', () => { + test('getPositionDetails response test', () => { /** - * GetPositionDetails + * getPositionDetails * Get Position Details * /api/v1/position */ @@ -225,9 +225,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('AddIsolatedMargin request test', () => { + test('addIsolatedMargin request test', () => { /** - * AddIsolatedMargin + * addIsolatedMargin * Add Isolated Margin * /api/v1/position/margin/deposit-margin */ @@ -240,9 +240,9 @@ describe('Auto Test', () => { console.log(req); }); - test('AddIsolatedMargin response test', () => { + test('addIsolatedMargin response test', () => { /** - * AddIsolatedMargin + * addIsolatedMargin * Add Isolated Margin * /api/v1/position/margin/deposit-margin */ @@ -290,9 +290,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetPositionList request test', () => { + test('getPositionList request test', () => { /** - * GetPositionList + * getPositionList * Get Position List * /api/v1/positions */ @@ -305,9 +305,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetPositionList response test', () => { + test('getPositionList response test', () => { /** - * GetPositionList + * getPositionList * Get Position List * /api/v1/positions */ @@ -323,9 +323,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('ModifyMarginLeverage request test', () => { + test('modifyMarginLeverage request test', () => { /** - * ModifyMarginLeverage + * modifyMarginLeverage * Modify Cross Margin Leverage * /api/v2/changeCrossUserLeverage */ @@ -338,9 +338,9 @@ describe('Auto Test', () => { console.log(req); }); - test('ModifyMarginLeverage response test', () => { + test('modifyMarginLeverage response test', () => { /** - * ModifyMarginLeverage + * modifyMarginLeverage * Modify Cross Margin Leverage * /api/v2/changeCrossUserLeverage */ @@ -389,9 +389,9 @@ describe('Auto Test', () => { console.log(resp); } }); - test('GetMaxOpenSize request test', () => { + test('getMaxOpenSize request test', () => { /** - * GetMaxOpenSize + * getMaxOpenSize * Get Max Open Size * /api/v2/getMaxOpenSize */ @@ -405,9 +405,9 @@ describe('Auto Test', () => { console.log(req); }); - test('GetMaxOpenSize response test', () => { + test('getMaxOpenSize response test', () => { /** - * GetMaxOpenSize + * getMaxOpenSize * Get Max Open Size * /api/v2/getMaxOpenSize */ diff --git a/sdk/node/src/generate/futures/positions/api_positions.ts b/sdk/node/src/generate/futures/positions/api_positions.ts index ffc0975c..d9c4a311 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.ts @@ -50,7 +50,7 @@ export interface PositionsAPI { ): Promise; /** - * GetPositionsHistory Get Positions History + * getPositionsHistory Get Positions History * Description: This interface can query position history information records. * Documentation: https://www.kucoin.com/docs-new/api-3470254 * +---------------------+---------+ @@ -63,10 +63,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetPositionsHistory(req: GetPositionsHistoryReq): Promise; + getPositionsHistory(req: GetPositionsHistoryReq): Promise; /** - * GetMaxWithdrawMargin Get Max Withdraw Margin + * getMaxWithdrawMargin Get Max Withdraw Margin * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. * Documentation: https://www.kucoin.com/docs-new/api-3470258 * +---------------------+---------+ @@ -79,10 +79,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - GetMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; /** - * RemoveIsolatedMargin Remove Isolated Margin + * removeIsolatedMargin Remove Isolated Margin * Description: Remove Isolated Margin Manually. * Documentation: https://www.kucoin.com/docs-new/api-3470256 * +---------------------+---------+ @@ -95,10 +95,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - RemoveIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; /** - * GetPositionDetails Get Position Details + * getPositionDetails Get Position Details * Description: Get the position details of a specified position. * Documentation: https://www.kucoin.com/docs-new/api-3470252 * +---------------------+---------+ @@ -111,7 +111,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetPositionDetails(req: GetPositionDetailsReq): Promise; + getPositionDetails(req: GetPositionDetailsReq): Promise; /** * @deprecated @@ -131,7 +131,7 @@ export interface PositionsAPI { modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; /** - * AddIsolatedMargin Add Isolated Margin + * addIsolatedMargin Add Isolated Margin * Description: Add Isolated Margin Manually. * Documentation: https://www.kucoin.com/docs-new/api-3470257 * +---------------------+---------+ @@ -144,7 +144,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 4 | * +---------------------+---------+ */ - AddIsolatedMargin(req: AddIsolatedMarginReq): Promise; + addIsolatedMargin(req: AddIsolatedMarginReq): Promise; /** * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit @@ -165,7 +165,7 @@ export interface PositionsAPI { ): Promise; /** - * GetPositionList Get Position List + * getPositionList Get Position List * Description: Get the position details of a specified position. * Documentation: https://www.kucoin.com/docs-new/api-3470253 * +---------------------+---------+ @@ -178,10 +178,10 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetPositionList(req: GetPositionListReq): Promise; + getPositionList(req: GetPositionListReq): Promise; /** - * ModifyMarginLeverage Modify Cross Margin Leverage + * modifyMarginLeverage Modify Cross Margin Leverage * Description: This interface can modify the current symbol’s cross-margin leverage multiple. * Documentation: https://www.kucoin.com/docs-new/api-3470261 * +---------------------+---------+ @@ -194,7 +194,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - ModifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; /** * getCrossMarginLeverage Get Cross Margin Leverage @@ -213,7 +213,7 @@ export interface PositionsAPI { getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise; /** - * GetMaxOpenSize Get Max Open Size + * getMaxOpenSize Get Max Open Size * Description: Get Maximum Open Position Size. * Documentation: https://www.kucoin.com/docs-new/api-3470251 * +---------------------+---------+ @@ -226,7 +226,7 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - GetMaxOpenSize(req: GetMaxOpenSizeReq): Promise; + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; /** * switchMarginMode Switch Margin Mode @@ -278,7 +278,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - GetPositionsHistory(req: GetPositionsHistoryReq): Promise { + getPositionsHistory(req: GetPositionsHistoryReq): Promise { return this.transport.call( 'futures', false, @@ -290,7 +290,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - GetMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { return this.transport.call( 'futures', false, @@ -302,7 +302,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - RemoveIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, @@ -314,7 +314,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - GetPositionDetails(req: GetPositionDetailsReq): Promise { + getPositionDetails(req: GetPositionDetailsReq): Promise { return this.transport.call( 'futures', false, @@ -338,7 +338,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - AddIsolatedMargin(req: AddIsolatedMarginReq): Promise { + addIsolatedMargin(req: AddIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, @@ -364,7 +364,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - GetPositionList(req: GetPositionListReq): Promise { + getPositionList(req: GetPositionListReq): Promise { return this.transport.call( 'futures', false, @@ -376,7 +376,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - ModifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { return this.transport.call( 'futures', false, @@ -400,7 +400,7 @@ export class PositionsAPIImpl implements PositionsAPI { ); } - GetMaxOpenSize(req: GetMaxOpenSizeReq): Promise { + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { return this.transport.call( 'futures', false, diff --git a/sdk/node/src/generate/service/account_api.ts b/sdk/node/src/generate/service/account_api.ts index 7c6ccb3c..cce1005a 100644 --- a/sdk/node/src/generate/service/account_api.ts +++ b/sdk/node/src/generate/service/account_api.ts @@ -25,44 +25,44 @@ export interface AccountService { export class AccountServiceImpl implements AccountService { private readonly transport: Transport; - private readonly Account: AccountAPI; - private readonly Deposit: DepositAPI; - private readonly Withdrawal: WithdrawalAPI; - private readonly Fee: FeeAPI; - private readonly SubAccount: SubAccountAPI; - private readonly Transfer: TransferAPI; + private readonly account: AccountAPI; + private readonly deposit: DepositAPI; + private readonly withdrawal: WithdrawalAPI; + private readonly fee: FeeAPI; + private readonly subAccount: SubAccountAPI; + private readonly transfer: TransferAPI; constructor(transport: Transport) { this.transport = transport; - this.Account = new AccountAPIImpl(transport); - this.Deposit = new DepositAPIImpl(transport); - this.Withdrawal = new WithdrawalAPIImpl(transport); - this.Fee = new FeeAPIImpl(transport); - this.SubAccount = new SubAccountAPIImpl(transport); - this.Transfer = new TransferAPIImpl(transport); + this.account = new AccountAPIImpl(transport); + this.deposit = new DepositAPIImpl(transport); + this.withdrawal = new WithdrawalAPIImpl(transport); + this.fee = new FeeAPIImpl(transport); + this.subAccount = new SubAccountAPIImpl(transport); + this.transfer = new TransferAPIImpl(transport); } getAccountApi(): AccountAPI { - return this.Account; + return this.account; } getDepositApi(): DepositAPI { - return this.Deposit; + return this.deposit; } getWithdrawalApi(): WithdrawalAPI { - return this.Withdrawal; + return this.withdrawal; } getFeeApi(): FeeAPI { - return this.Fee; + return this.fee; } getSubAccountApi(): SubAccountAPI { - return this.SubAccount; + return this.subAccount; } getTransferApi(): TransferAPI { - return this.Transfer; + return this.transfer; } } diff --git a/sdk/node/src/generate/service/affiliate_api.ts b/sdk/node/src/generate/service/affiliate_api.ts index 1f1b3b64..5487d892 100644 --- a/sdk/node/src/generate/service/affiliate_api.ts +++ b/sdk/node/src/generate/service/affiliate_api.ts @@ -10,14 +10,14 @@ export interface AffiliateService { export class AffiliateServiceImpl implements AffiliateService { private readonly transport: Transport; - private readonly Affiliate: AffiliateAPI; + private readonly affiliate: AffiliateAPI; constructor(transport: Transport) { this.transport = transport; - this.Affiliate = new AffiliateAPIImpl(transport); + this.affiliate = new AffiliateAPIImpl(transport); } getAffiliateApi(): AffiliateAPI { - return this.Affiliate; + return this.affiliate; } } diff --git a/sdk/node/src/generate/service/broker_api.ts b/sdk/node/src/generate/service/broker_api.ts index 4e9e5870..7b84d742 100644 --- a/sdk/node/src/generate/service/broker_api.ts +++ b/sdk/node/src/generate/service/broker_api.ts @@ -13,20 +13,20 @@ export interface BrokerService { export class BrokerServiceImpl implements BrokerService { private readonly transport: Transport; - private readonly APIBroker: APIBrokerAPI; - private readonly NDBroker: NDBrokerAPI; + private readonly aPIBroker: APIBrokerAPI; + private readonly nDBroker: NDBrokerAPI; constructor(transport: Transport) { this.transport = transport; - this.APIBroker = new APIBrokerAPIImpl(transport); - this.NDBroker = new NDBrokerAPIImpl(transport); + this.aPIBroker = new APIBrokerAPIImpl(transport); + this.nDBroker = new NDBrokerAPIImpl(transport); } getAPIBrokerApi(): APIBrokerAPI { - return this.APIBroker; + return this.aPIBroker; } getNDBrokerApi(): NDBrokerAPI { - return this.NDBroker; + return this.nDBroker; } } diff --git a/sdk/node/src/generate/service/earn_api.ts b/sdk/node/src/generate/service/earn_api.ts index 7f04cac4..2b74810d 100644 --- a/sdk/node/src/generate/service/earn_api.ts +++ b/sdk/node/src/generate/service/earn_api.ts @@ -10,14 +10,14 @@ export interface EarnService { export class EarnServiceImpl implements EarnService { private readonly transport: Transport; - private readonly Earn: EarnAPI; + private readonly earn: EarnAPI; constructor(transport: Transport) { this.transport = transport; - this.Earn = new EarnAPIImpl(transport); + this.earn = new EarnAPIImpl(transport); } getEarnApi(): EarnAPI { - return this.Earn; + return this.earn; } } diff --git a/sdk/node/src/generate/service/futures_api.ts b/sdk/node/src/generate/service/futures_api.ts index 90289df0..7575f6e8 100644 --- a/sdk/node/src/generate/service/futures_api.ts +++ b/sdk/node/src/generate/service/futures_api.ts @@ -19,32 +19,32 @@ export interface FuturesService { export class FuturesServiceImpl implements FuturesService { private readonly transport: Transport; - private readonly Order: OrderAPI; - private readonly Positions: PositionsAPI; - private readonly FundingFees: FundingFeesAPI; - private readonly Market: MarketAPI; + private readonly order: OrderAPI; + private readonly positions: PositionsAPI; + private readonly fundingFees: FundingFeesAPI; + private readonly market: MarketAPI; constructor(transport: Transport) { this.transport = transport; - this.Order = new OrderAPIImpl(transport); - this.Positions = new PositionsAPIImpl(transport); - this.FundingFees = new FundingFeesAPIImpl(transport); - this.Market = new MarketAPIImpl(transport); + this.order = new OrderAPIImpl(transport); + this.positions = new PositionsAPIImpl(transport); + this.fundingFees = new FundingFeesAPIImpl(transport); + this.market = new MarketAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.Order; + return this.order; } getPositionsApi(): PositionsAPI { - return this.Positions; + return this.positions; } getFundingFeesApi(): FundingFeesAPI { - return this.FundingFees; + return this.fundingFees; } getMarketApi(): MarketAPI { - return this.Market; + return this.market; } } diff --git a/sdk/node/src/generate/service/margin_api.ts b/sdk/node/src/generate/service/margin_api.ts index b2b81827..76c1eeaa 100644 --- a/sdk/node/src/generate/service/margin_api.ts +++ b/sdk/node/src/generate/service/margin_api.ts @@ -22,38 +22,38 @@ export interface MarginService { export class MarginServiceImpl implements MarginService { private readonly transport: Transport; - private readonly Order: OrderAPI; - private readonly Debit: DebitAPI; - private readonly Credit: CreditAPI; - private readonly Market: MarketAPI; - private readonly RiskLimit: RiskLimitAPI; + private readonly order: OrderAPI; + private readonly debit: DebitAPI; + private readonly credit: CreditAPI; + private readonly market: MarketAPI; + private readonly riskLimit: RiskLimitAPI; constructor(transport: Transport) { this.transport = transport; - this.Order = new OrderAPIImpl(transport); - this.Debit = new DebitAPIImpl(transport); - this.Credit = new CreditAPIImpl(transport); - this.Market = new MarketAPIImpl(transport); - this.RiskLimit = new RiskLimitAPIImpl(transport); + this.order = new OrderAPIImpl(transport); + this.debit = new DebitAPIImpl(transport); + this.credit = new CreditAPIImpl(transport); + this.market = new MarketAPIImpl(transport); + this.riskLimit = new RiskLimitAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.Order; + return this.order; } getDebitApi(): DebitAPI { - return this.Debit; + return this.debit; } getCreditApi(): CreditAPI { - return this.Credit; + return this.credit; } getMarketApi(): MarketAPI { - return this.Market; + return this.market; } getRiskLimitApi(): RiskLimitAPI { - return this.RiskLimit; + return this.riskLimit; } } diff --git a/sdk/node/src/generate/service/spot_api.ts b/sdk/node/src/generate/service/spot_api.ts index c55d15c9..99bc507a 100644 --- a/sdk/node/src/generate/service/spot_api.ts +++ b/sdk/node/src/generate/service/spot_api.ts @@ -13,20 +13,20 @@ export interface SpotService { export class SpotServiceImpl implements SpotService { private readonly transport: Transport; - private readonly Order: OrderAPI; - private readonly Market: MarketAPI; + private readonly order: OrderAPI; + private readonly market: MarketAPI; constructor(transport: Transport) { this.transport = transport; - this.Order = new OrderAPIImpl(transport); - this.Market = new MarketAPIImpl(transport); + this.order = new OrderAPIImpl(transport); + this.market = new MarketAPIImpl(transport); } getOrderApi(): OrderAPI { - return this.Order; + return this.order; } getMarketApi(): MarketAPI { - return this.Market; + return this.market; } } diff --git a/sdk/node/src/generate/service/viplending_api.ts b/sdk/node/src/generate/service/viplending_api.ts index 020e8323..1d53cfcf 100644 --- a/sdk/node/src/generate/service/viplending_api.ts +++ b/sdk/node/src/generate/service/viplending_api.ts @@ -10,14 +10,14 @@ export interface VIPLendingService { export class VIPLendingServiceImpl implements VIPLendingService { private readonly transport: Transport; - private readonly VIPLending: VIPLendingAPI; + private readonly vIPLending: VIPLendingAPI; constructor(transport: Transport) { this.transport = transport; - this.VIPLending = new VIPLendingAPIImpl(transport); + this.vIPLending = new VIPLendingAPIImpl(transport); } getVIPLendingApi(): VIPLendingAPI { - return this.VIPLending; + return this.vIPLending; } } From d0dfb17736a4408a392af6829fa43db63959588a Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 14 Jan 2025 14:53:13 +0800 Subject: [PATCH 021/106] feat(nodejs): add ws index.ts --- .../plugin/generator/NodeSdkGenerator.java | 47 +++++++++++++------ .../sdk/plugin/SdkGeneratorTest.java | 4 +- ...ures_private.ts => api_futures_private.ts} | 0 .../generate/futures/futuresprivate/index.ts | 2 + ...utures_public.ts => api_futures_public.ts} | 0 .../generate/futures/futurespublic/index.ts | 1 + sdk/node/src/generate/futures/index.ts | 4 ++ sdk/node/src/generate/margin/index.ts | 4 ++ ...argin_private.ts => api_margin_private.ts} | 0 .../generate/margin/marginprivate/index.ts | 3 ++ ..._margin_public.ts => api_margin_public.ts} | 0 .../src/generate/margin/marginpublic/index.ts | 1 + sdk/node/src/generate/spot/index.ts | 4 ++ ...ws_spot_private.ts => api_spot_private.ts} | 0 .../src/generate/spot/spotprivate/index.ts | 2 + .../{ws_spot_public.ts => api_spot_public.ts} | 0 .../src/generate/spot/spotpublic/index.ts | 11 +++++ 17 files changed, 66 insertions(+), 17 deletions(-) rename sdk/node/src/generate/futures/futuresprivate/{ws_futures_private.ts => api_futures_private.ts} (100%) rename sdk/node/src/generate/futures/futurespublic/{ws_futures_public.ts => api_futures_public.ts} (100%) rename sdk/node/src/generate/margin/marginprivate/{ws_margin_private.ts => api_margin_private.ts} (100%) rename sdk/node/src/generate/margin/marginpublic/{ws_margin_public.ts => api_margin_public.ts} (100%) rename sdk/node/src/generate/spot/spotprivate/{ws_spot_private.ts => api_spot_private.ts} (100%) rename sdk/node/src/generate/spot/spotpublic/{ws_spot_public.ts => api_spot_public.ts} (100%) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 13bfe4c3..d4edb891 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -64,6 +64,7 @@ public String toImport() { private String service; private String subService; private Set exports = new LinkedHashSet<>(); + private static final Set wsServices = Set.of("spot", "futures", "margin"); public CodegenType getTag() { return CodegenType.OTHER; @@ -274,10 +275,7 @@ public String modelFileFolder() { public String toApiFilename(String name) { String apiName = name.replaceAll("-", "_"); switch (modeSwitch.getMode()) { - case WS: { - apiName = "ws_" + underscore(apiName); - break; - } + case WS: case API: case ENTRY: case TEST_TEMPLATE: { @@ -372,7 +370,8 @@ private void generateApiImport(Meta meta, boolean req, Map private void generateApiExport(Meta meta, Set export) { switch (modeSwitch.getMode()) { - case API: { + case API: + case WS: { operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { export.add(String.format("export * from \"./%s\"", toApiFilename(sanitizeName(k)))); @@ -381,14 +380,14 @@ private void generateApiExport(Meta meta, Set export) { break; } - case WS: { - String suffix = "event"; - String fileName = "./" + toModelFilename(meta.getMethod()) + "_" + suffix; - export.add(String.format("export * from \"%s\"", fileName)); - break; - - } case ENTRY: { + // index.ts + // export const Spot = { + // ...ORDER, + // ...MARKET, + // ... + //}; + List serviceAliases = new LinkedList<>(); operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { @@ -398,6 +397,19 @@ private void generateApiExport(Meta meta, Set export) { } }); + if (wsServices.contains(service.toLowerCase())) { + + String privateService = service.toUpperCase() + "PRIVATE"; + String publicService = service.toUpperCase() + "PUBLIC"; + + export.add(String.format("import * as %s from \"./%s\"", privateService, formatPackage(privateService))); + export.add(String.format("import * as %s from \"./%s\"", publicService, formatPackage(publicService))); + + serviceAliases.add(privateService); + serviceAliases.add(publicService); + } + + String exportService = camelize(service.toLowerCase(), CamelizeOption.UPPERCASE_FIRST_CHAR); export.add(String.format("export const %s = \n{\n%s\n};", exportService, serviceAliases.stream().map(s -> " ..." + s).collect(Collectors.joining(",\n")))); @@ -472,6 +484,11 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { + String path = (String) m.get("importPath"); + path = toModelFilename(path); + exports.add(String.format("export * from \"./%s\"", path)); + }); generateApiExport(meta, exports); break; } @@ -560,8 +577,8 @@ public Map postProcessSupportingFileData(Map obj String csvPath = (String) additionalProperties.get("CSV_PATH"); if (csvPath == null) { - log.error("no csv path found"); - return data; + log.error("no csv path found"); + return data; } Set serviceExports = new TreeSet<>(); @@ -581,7 +598,7 @@ public Map postProcessSupportingFileData(Map obj throw new RuntimeException("read csv fail", e); } - services.forEach(s-> { + services.forEach(s -> { serviceExports.add(String.format("export * from \"./%s_api\"", s)); generatedExports.add(String.format("export * from \"./%s\"", s)); }); diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 8841f218..c0ba0db8 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,8 +8,8 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-viplending-viplending.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-viplending.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-futures-order.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-futures.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; private static final String CSV_PATH = "../../spec"; diff --git a/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.ts b/sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts similarity index 100% rename from sdk/node/src/generate/futures/futuresprivate/ws_futures_private.ts rename to sdk/node/src/generate/futures/futuresprivate/api_futures_private.ts diff --git a/sdk/node/src/generate/futures/futuresprivate/index.ts b/sdk/node/src/generate/futures/futuresprivate/index.ts index 3bb19277..58d55fe9 100644 --- a/sdk/node/src/generate/futures/futuresprivate/index.ts +++ b/sdk/node/src/generate/futures/futuresprivate/index.ts @@ -1,8 +1,10 @@ export * from './model_all_order_event'; export * from './model_all_position_event'; export * from './model_balance_event'; +export * from './model_cross_leverage_data_value'; export * from './model_cross_leverage_event'; export * from './model_margin_mode_event'; export * from './model_order_event'; export * from './model_position_event'; export * from './model_stop_orders_event'; +export * from './api_futures_private'; diff --git a/sdk/node/src/generate/futures/futurespublic/ws_futures_public.ts b/sdk/node/src/generate/futures/futurespublic/api_futures_public.ts similarity index 100% rename from sdk/node/src/generate/futures/futurespublic/ws_futures_public.ts rename to sdk/node/src/generate/futures/futurespublic/api_futures_public.ts diff --git a/sdk/node/src/generate/futures/futurespublic/index.ts b/sdk/node/src/generate/futures/futurespublic/index.ts index ddf6b0db..a7a55b68 100644 --- a/sdk/node/src/generate/futures/futurespublic/index.ts +++ b/sdk/node/src/generate/futures/futurespublic/index.ts @@ -8,3 +8,4 @@ export * from './model_orderbook_level5_event'; export * from './model_symbol_snapshot_event'; export * from './model_ticker_v1_event'; export * from './model_ticker_v2_event'; +export * from './api_futures_public'; diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts index 66353ab6..62321266 100644 --- a/sdk/node/src/generate/futures/index.ts +++ b/sdk/node/src/generate/futures/index.ts @@ -2,9 +2,13 @@ import * as ORDER from './order'; import * as POSITIONS from './positions'; import * as FUNDINGFEES from './fundingfees'; import * as MARKET from './market'; +import * as FUTURESPRIVATE from './futuresprivate'; +import * as FUTURESPUBLIC from './futurespublic'; export const Futures = { ...ORDER, ...POSITIONS, ...FUNDINGFEES, ...MARKET, + ...FUTURESPRIVATE, + ...FUTURESPUBLIC, }; diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts index 95ad15ec..9e878580 100644 --- a/sdk/node/src/generate/margin/index.ts +++ b/sdk/node/src/generate/margin/index.ts @@ -3,10 +3,14 @@ import * as DEBIT from './debit'; import * as CREDIT from './credit'; import * as MARKET from './market'; import * as RISKLIMIT from './risklimit'; +import * as MARGINPRIVATE from './marginprivate'; +import * as MARGINPUBLIC from './marginpublic'; export const Margin = { ...ORDER, ...DEBIT, ...CREDIT, ...MARKET, ...RISKLIMIT, + ...MARGINPRIVATE, + ...MARGINPUBLIC, }; diff --git a/sdk/node/src/generate/margin/marginprivate/ws_margin_private.ts b/sdk/node/src/generate/margin/marginprivate/api_margin_private.ts similarity index 100% rename from sdk/node/src/generate/margin/marginprivate/ws_margin_private.ts rename to sdk/node/src/generate/margin/marginprivate/api_margin_private.ts diff --git a/sdk/node/src/generate/margin/marginprivate/index.ts b/sdk/node/src/generate/margin/marginprivate/index.ts index 838b29ec..874c1ffb 100644 --- a/sdk/node/src/generate/margin/marginprivate/index.ts +++ b/sdk/node/src/generate/margin/marginprivate/index.ts @@ -1,2 +1,5 @@ +export * from './model_cross_margin_position_asset_list_value'; export * from './model_cross_margin_position_event'; +export * from './model_isolated_margin_position_change_assets_value'; export * from './model_isolated_margin_position_event'; +export * from './api_margin_private'; diff --git a/sdk/node/src/generate/margin/marginpublic/ws_margin_public.ts b/sdk/node/src/generate/margin/marginpublic/api_margin_public.ts similarity index 100% rename from sdk/node/src/generate/margin/marginpublic/ws_margin_public.ts rename to sdk/node/src/generate/margin/marginpublic/api_margin_public.ts diff --git a/sdk/node/src/generate/margin/marginpublic/index.ts b/sdk/node/src/generate/margin/marginpublic/index.ts index 30c07031..dc9039e7 100644 --- a/sdk/node/src/generate/margin/marginpublic/index.ts +++ b/sdk/node/src/generate/margin/marginpublic/index.ts @@ -1,2 +1,3 @@ export * from './model_index_price_event'; export * from './model_mark_price_event'; +export * from './api_margin_public'; diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index 475df945..150479d9 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -1,6 +1,10 @@ import * as ORDER from './order'; import * as MARKET from './market'; +import * as SPOTPRIVATE from './spotprivate'; +import * as SPOTPUBLIC from './spotpublic'; export const Spot = { ...ORDER, ...MARKET, + ...SPOTPRIVATE, + ...SPOTPUBLIC, }; diff --git a/sdk/node/src/generate/spot/spotprivate/ws_spot_private.ts b/sdk/node/src/generate/spot/spotprivate/api_spot_private.ts similarity index 100% rename from sdk/node/src/generate/spot/spotprivate/ws_spot_private.ts rename to sdk/node/src/generate/spot/spotprivate/api_spot_private.ts diff --git a/sdk/node/src/generate/spot/spotprivate/index.ts b/sdk/node/src/generate/spot/spotprivate/index.ts index 764702ef..b6f03011 100644 --- a/sdk/node/src/generate/spot/spotprivate/index.ts +++ b/sdk/node/src/generate/spot/spotprivate/index.ts @@ -1,3 +1,5 @@ export * from './model_account_event'; +export * from './model_account_relation_context'; export * from './model_order_v1_event'; export * from './model_order_v2_event'; +export * from './api_spot_private'; diff --git a/sdk/node/src/generate/spot/spotpublic/ws_spot_public.ts b/sdk/node/src/generate/spot/spotpublic/api_spot_public.ts similarity index 100% rename from sdk/node/src/generate/spot/spotpublic/ws_spot_public.ts rename to sdk/node/src/generate/spot/spotpublic/api_spot_public.ts diff --git a/sdk/node/src/generate/spot/spotpublic/index.ts b/sdk/node/src/generate/spot/spotpublic/index.ts index 977bde4e..20f9a35f 100644 --- a/sdk/node/src/generate/spot/spotpublic/index.ts +++ b/sdk/node/src/generate/spot/spotpublic/index.ts @@ -1,10 +1,21 @@ export * from './model_all_tickers_event'; export * from './model_klines_event'; +export * from './model_market_snapshot_data'; +export * from './model_market_snapshot_data_market_change1h'; +export * from './model_market_snapshot_data_market_change24h'; +export * from './model_market_snapshot_data_market_change4h'; export * from './model_market_snapshot_event'; +export * from './model_orderbook_increment_changes'; export * from './model_orderbook_increment_event'; export * from './model_orderbook_level1_event'; +export * from './model_orderbook_level50_changes'; export * from './model_orderbook_level50_event'; export * from './model_orderbook_level5_event'; +export * from './model_symbol_snapshot_data'; +export * from './model_symbol_snapshot_data_market_change1h'; +export * from './model_symbol_snapshot_data_market_change24h'; +export * from './model_symbol_snapshot_data_market_change4h'; export * from './model_symbol_snapshot_event'; export * from './model_ticker_event'; export * from './model_trade_event'; +export * from './api_spot_public'; From a4ed675618cd51287c3beae11d13d7081224c4b7 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 14 Jan 2025 19:04:30 +0800 Subject: [PATCH 022/106] feat(nodejs): add restful api implementation --- sdk/node/src/internal/infra/default_signer.ts | 103 +++++++ .../src/internal/infra/default_transport.ts | 253 +++++++++++++++++- 2 files changed, 352 insertions(+), 4 deletions(-) create mode 100644 sdk/node/src/internal/infra/default_signer.ts diff --git a/sdk/node/src/internal/infra/default_signer.ts b/sdk/node/src/internal/infra/default_signer.ts new file mode 100644 index 00000000..d1efb907 --- /dev/null +++ b/sdk/node/src/internal/infra/default_signer.ts @@ -0,0 +1,103 @@ +import * as crypto from 'crypto'; + +/** + * KcSigner contains information about `apiKey`, `apiSecret`, `apiPassPhrase`, and `apiKeyVersion` + * and provides methods to sign and generate headers for API requests. + */ +export class KcSigner { + private readonly apiKey: string; + private readonly apiSecret: string; + private readonly apiPassphrase: string; + private readonly brokerName: string; + private readonly brokerPartner: string; + private readonly brokerKey: string; + + constructor( + apiKey: string = '', + apiSecret: string = '', + apiPassphrase: string = '', + brokerName: string = '', + brokerPartner: string = '', + brokerKey: string = '' + ) { + this.apiKey = apiKey; + this.apiSecret = apiSecret; + this.apiPassphrase = apiPassphrase && apiSecret + ? this.sign(Buffer.from(apiPassphrase), Buffer.from(apiSecret)) + : apiPassphrase; + this.brokerName = brokerName; + this.brokerPartner = brokerPartner; + this.brokerKey = brokerKey; + + if (!apiKey || !apiSecret || !apiPassphrase) { + console.warn('[AUTH WARNING] API credentials incomplete. Access is restricted to public interfaces only.'); + } + } + + /** + * Sign the input data with the given key using HMAC-SHA256 + */ + private sign(plain: Buffer, key: Buffer): string { + const hmac = crypto.createHmac('sha256', key); + hmac.update(plain); + const digest = hmac.digest(); + return digest.toString('base64'); + } + + /** + * Headers method generates and returns a map of signature headers needed for API authorization + * It takes a plain string as an argument to help form the signature + */ + public headers(plain: string): Record { + const timestamp = Date.now().toString(); + const signatureInput = timestamp + plain; + const signature = this.sign(Buffer.from(signatureInput), Buffer.from(this.apiSecret)); + + const headers = { + 'KC-API-KEY': this.apiKey, + 'KC-API-PASSPHRASE': this.apiPassphrase, + 'KC-API-TIMESTAMP': timestamp, + 'KC-API-SIGN': signature, + 'KC-API-KEY-VERSION': '2' + }; + + return headers; + } + + /** + * Generate broker-specific headers including partner verification + */ + public brokerHeaders(plain: string): Record { + if (!this.brokerPartner || !this.brokerName) { + console.error('[BROKER ERROR] Missing broker information'); + throw new Error('Broker information cannot be empty'); + } + + const timestamp = Date.now().toString(); + const signatureInput = timestamp + plain; + const signature = this.sign( + Buffer.from(signatureInput), + Buffer.from(this.apiSecret) + ); + + const partnerInput = timestamp + this.brokerPartner + this.apiKey; + const partnerSignature = this.sign( + Buffer.from(partnerInput), + Buffer.from(this.apiSecret) + ); + + const headers = { + 'KC-API-KEY': this.apiKey, + 'KC-API-PASSPHRASE': this.apiPassphrase, + 'KC-API-TIMESTAMP': timestamp, + 'KC-API-SIGN': signature, + 'KC-API-KEY-VERSION': '2', + 'KC-API-PARTNER': this.brokerPartner, + 'KC-BROKER-NAME': this.brokerName, + 'KC-API-PARTNER-VERIFY': 'true', + 'KC-API-PARTNER-SIGN': partnerSignature + }; + + return headers; + } +} diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 5fc3820e..88630cf8 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -2,18 +2,242 @@ import { Transport } from '@internal/interfaces/transport'; import { Serializable } from '@internal/interfaces/serializable'; import { Response } from '@internal/interfaces/response'; import { ClientOption } from '@model/client_option'; +import { RestRateLimit, RestResponse } from '@model/common'; +import { DomainType } from '@model/constant'; +import { TransportOption } from '@model/transport_option'; +import { KcSigner } from './default_signer'; +import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'; +import type { AxiosResponse } from 'axios'; +import "reflect-metadata"; export class DefaultTransport implements Transport { private readonly option: ClientOption; private readonly version: String; + private transportOption: TransportOption = {} as TransportOption; + private signer: KcSigner; + private httpClient: AxiosInstance; - constructor(option: ClientOption, version: String) { + constructor(option: ClientOption, version: string) { this.option = option; this.version = version; + + this.transportOption = option.transportOption || {} as TransportOption; + + this.signer = new KcSigner(option.key, + option.secret, + option.passphrase, + option.brokerName, + option.brokerPartner, + option.brokerKey); + + this.httpClient = this.createHttpClient(this.transportOption); + } + + private createHttpClient(trans_option: TransportOption): AxiosInstance { + const instance = axios.create({ + timeout: trans_option.timeout, + headers: { + 'Connection': trans_option.keepAlive ? 'keep-alive' : 'close', + }, + }); + + instance.interceptors.request.use( + config => { + console.log('[REQUEST]', { + method: config.method?.toUpperCase(), + url: config.url + }); + return config; + }, + error => { + console.error('[REQUEST ERROR]', error.message); + return Promise.reject(error); + } + ); + + instance.interceptors.response.use( + response => { + if (response.status >= 400) { + console.error('[RESPONSE ERROR]', { + status: response.status, + data: response.data + }); + } + return response; + }, + error => { + console.error('[RESPONSE ERROR]', { + message: error.message, + status: error.response?.status, + data: error.response?.data + }); + return Promise.reject(error); + } + ); + + return instance; + } + + private processHeaders(body: string, rawUrl: string, config: AxiosRequestConfig, method: string, broker: boolean): void { + const payload = `${method}${rawUrl}${body || ''}`; + const headers = broker ? this.signer.brokerHeaders(payload) : this.signer.headers(payload); + + config.headers = { + ...config.headers, + ...headers, + }; + } + + private processPathVariable(path: string, requestObj: any | null): string { + if (!requestObj) { + return path; + } + + const pathVariables: { [key: string]: any } = {}; + + for (const key of Object.keys(requestObj)) { + const metadata = Reflect.getMetadata("path", requestObj, key); + if (metadata) { + pathVariables[metadata] = requestObj[key]; + } + } + + const missingPlaceholders = Object.entries(pathVariables) + .filter(([_, value]) => value == null) + .map(([key]) => key); + + if (missingPlaceholders.length > 0) { + throw new Error(`Missing path variable value(s) for: ${missingPlaceholders.join(", ")}`); + } + + return path.replace(/{(.*?)}/g, (_, key) => { + if (key in pathVariables) { + return String(pathVariables[key]); + } + throw new Error(`Path variable {${key}} is not defined in request object.`); + }); + } + + private rawQuery(queryDict: Record): string { + return Object.entries(queryDict).map(([key, value]) => { + if (Array.isArray(value)) { + return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&'); + } + return `${key}=${encodeURIComponent(value)}`; + }).join('&'); + } + + private async processRequest( + requestObj: Serializable | null, + broker: boolean, + path: string, + endpoint: string, + method: string, + requestAsJson: boolean, + args?: any + ): Promise { + const fullPath = endpoint + path; + const rawUrl = path; + let reqBody = ''; + let queryPath = path; + + if (requestAsJson && requestObj) { + reqBody = JSON.stringify(requestObj); + } else if (method === 'GET' || method === 'DELETE') { + const queryParams = this.rawQuery(requestObj || {}); + if (queryParams) { + queryPath = `${path}?${queryParams}`; + } + } else if(requestObj){ + reqBody = JSON.stringify(requestObj); + } else { + throw new Error('Invalid request object'); + } + + const config: AxiosRequestConfig = { + method: method.toLowerCase() as any, + url: endpoint + queryPath, + data: reqBody, + headers: { + 'User-Agent': `Kucoin-Universal-Node-SDK/${this.version}` + } + }; + + // Add Content-Type only for POST and PUT requests + if (method === 'POST' || method === 'PUT') { + config.headers = { + ...config.headers, + 'Content-Type': 'application/json' + }; + } + + // Use queryPath instead of rawUrl for signature + this.processHeaders(reqBody, queryPath, config, method, broker); + return config; + } + + private async doWithRetry(req_config: AxiosRequestConfig): Promise { + try { + if(this.transportOption.interceptors){ + for (const interceptor of this.transportOption.interceptors) { + req_config = interceptor.before(req_config) || req_config; + } + } + + let response = await this.httpClient.request(req_config); + + if(this.transportOption.interceptors){ + for (const interceptor of this.transportOption.interceptors) { + response = interceptor.after(req_config,response,null); + } + } + + return response; + } catch (err) { + throw err; + } + } + + private processLimit(headers: Record): RestRateLimit { + const limit = parseInt(headers['gw-ratelimit-limit'] || '-1', 10); + const remaining = parseInt(headers['gw-ratelimit-remaining'] || '-1', 10); + const reset = parseInt(headers['gw-ratelimit-reset'] || '-1', 10); + + const rateLimit = { + limit, + remaining, + reset + }; + + if (remaining <= Math.ceil(limit * 0.1)) { + console.warn('[RATE LIMIT WARNING]', rateLimit); + } + + return rateLimit; } - call( + private processResponse(response: AxiosResponse, responseObj: Response): Response { + if (response.status >= 400) { + console.error('[RESPONSE ERROR]', { + status: response.status, + statusText: response.statusText, + data: response.data + }); + } + + const commonResponse = RestResponse.fromJson(JSON.stringify(response.data)); + commonResponse.rateLimit = this.processLimit(response.headers); + responseObj.setCommonResponse(commonResponse); + + if (commonResponse.data) { + responseObj = responseObj.fromObject(commonResponse.data); + } + + return responseObj; + } + + async call( domain: string, isBroker: boolean, method: string, @@ -21,9 +245,30 @@ export class DefaultTransport implements Transport { requestObj: Serializable | null, responseObj: Response, requestJson: boolean, - args?: any, + args?: any ): Promise> { - return Promise.resolve(undefined); + domain = domain.toLowerCase(); + method = method.toUpperCase(); + + const endpoint = this.getEndpoint(domain); + const processedPath = this.processPathVariable(path, requestObj); + const config = await this.processRequest(requestObj, isBroker, processedPath, endpoint, method, requestJson, args); + const response = await this.doWithRetry(config); + + return this.processResponse(response, responseObj); + } + + private getEndpoint(domain: string): string { + switch (domain.toLowerCase()) { + case DomainType.Spot: + return this.option.spotEndpoint; + case DomainType.Futures: + return this.option.futuresEndpoint; + case DomainType.Broker: + return this.option.brokerEndpoint; + default: + throw new Error(`Invalid domain: ${domain}`); + } } close(): Promise { From 61709778458b4c3867b1d7ff0e6994d4a9097566 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 15 Jan 2025 09:28:48 +0800 Subject: [PATCH 023/106] feat(nodejs): update ws files --- sdk/node/src/internal/ws/default_ws_impl.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sdk/node/src/internal/ws/default_ws_impl.ts b/sdk/node/src/internal/ws/default_ws_impl.ts index 173dfcb0..0dd2a08f 100644 --- a/sdk/node/src/internal/ws/default_ws_impl.ts +++ b/sdk/node/src/internal/ws/default_ws_impl.ts @@ -1,21 +1,24 @@ import { KucoinWSService } from '@api/api_ws'; import { ClientOption } from '@model/client_option'; -import { SpotPublicWS, SpotPublicWSImpl } from '@generate/spot/spotpublic/ws_spot_public'; +import { SpotPublicWS, SpotPublicWSImpl } from '@generate/spot/spotpublic/api_spot_public'; import { DomainType } from '@model/constant'; -import { SpotPrivateWS, SpotPrivateWSImpl } from '@generate/spot/spotprivate/ws_spot_private'; -import { MarginPublicWS, MarginPublicWSImpl } from '@generate/margin/marginpublic/ws_margin_public'; +import { SpotPrivateWS, SpotPrivateWSImpl } from '@generate/spot/spotprivate/api_spot_private'; +import { + MarginPublicWS, + MarginPublicWSImpl, +} from '@generate/margin/marginpublic/api_margin_public'; import { MarginPrivateWS, MarginPrivateWSImpl, -} from '@generate/margin/marginprivate/ws_margin_private'; +} from '@generate/margin/marginprivate/api_margin_private'; import { FuturesPublicWS, FuturesPublicWSImpl, -} from '@generate/futures/futurespublic/ws_futures_public'; +} from '@generate/futures/futurespublic/api_futures_public'; import { FuturesPrivateWS, FuturesPrivateWSImpl, -} from '@generate/futures/futuresprivate/ws_futures_private'; +} from '@generate/futures/futuresprivate/api_futures_private'; import { DefaultWsService } from '../infra/default_ws_service'; import { SdkVersion } from '@generate/version'; From 73849869a9f124004b5cd32580825cd9ba834a54 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 15 Jan 2025 10:02:28 +0800 Subject: [PATCH 024/106] feat(nodejs): add missing axios lib --- sdk/node/package-lock.json | 61 ++++++++++++++++++++++++++++++++++++++ sdk/node/package.json | 1 + 2 files changed, 62 insertions(+) diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 3e863711..2111b391 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -1216,6 +1216,21 @@ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -1481,6 +1496,14 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "9.5.0", "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", @@ -1552,6 +1575,11 @@ "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -1927,6 +1955,21 @@ "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true }, + "follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==" + }, + "form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2865,6 +2908,19 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -3157,6 +3213,11 @@ "sisteransi": "^1.0.5" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index d6813ca9..34cd78b3 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -45,6 +45,7 @@ "node": ">=18" }, "dependencies": { + "axios": "^1.7.9", "class-transformer": "^0.5.1", "reflect-metadata": "^0.2.2" } From 8acd5c34513104d0b888cee67d0813cce5d6752f Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 11:22:32 +0800 Subject: [PATCH 025/106] feat(nodejs): Optimize code,Add exception handling --- sdk/node/src/internal/infra/default_transport.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 88630cf8..0838eb8d 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -177,7 +177,7 @@ export class DefaultTransport implements Transport { return config; } - private async doWithRetry(req_config: AxiosRequestConfig): Promise { + private doWithRetry(req_config: AxiosRequestConfig): AxiosResponse { try { if(this.transportOption.interceptors){ for (const interceptor of this.transportOption.interceptors) { @@ -185,7 +185,7 @@ export class DefaultTransport implements Transport { } } - let response = await this.httpClient.request(req_config); + let response = this.httpClient.request(req_config); if(this.transportOption.interceptors){ for (const interceptor of this.transportOption.interceptors) { @@ -261,10 +261,19 @@ export class DefaultTransport implements Transport { private getEndpoint(domain: string): string { switch (domain.toLowerCase()) { case DomainType.Spot: + if (!this.option.spotEndpoint) { + throw new Error('Spot endpoint is not set'); + } return this.option.spotEndpoint; case DomainType.Futures: + if (!this.option.futuresEndpoint) { + throw new Error('Futures endpoint is not set'); + } return this.option.futuresEndpoint; case DomainType.Broker: + if (!this.option.brokerEndpoint) { + throw new Error('Broker endpoint is not set'); + } return this.option.brokerEndpoint; default: throw new Error(`Invalid domain: ${domain}`); From 64ea8b023d62d21ae8ffc879dc2de84653a9ea6a Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 14:33:05 +0800 Subject: [PATCH 026/106] feat(nodejs): Add retry logic --- .../src/internal/infra/default_transport.ts | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 0838eb8d..9065935c 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -6,9 +6,10 @@ import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; -import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'; -import type { AxiosResponse } from 'axios'; +import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; import "reflect-metadata"; +import axiosRetry from 'axios-retry'; + export class DefaultTransport implements Transport { @@ -42,6 +43,30 @@ export class DefaultTransport implements Transport { }, }); + // Add retry logic + axiosRetry(instance, { + retries: trans_option.maxRetries || 3, + shouldResetTimeout: true, + retryDelay: (retryCount, error) => { + const delay = trans_option.retryDelay; + return delay; + }, + retryCondition: (error) => { + // acquire request config + const currentRetry = ((error.config as any)?._retry || 0); + const maxRetries = trans_option.maxRetries || 3; + + // change retry condition here + const shouldRetry = ( + axiosRetry.isNetworkOrIdempotentRequestError(error) || + error.message.includes('timeout') || + (error.response && error.response.status >= 500) || + error.code === 'ECONNABORTED' + ); + return shouldRetry && currentRetry < maxRetries; + } + }); + instance.interceptors.request.use( config => { console.log('[REQUEST]', { From 3e00861891d9b29990318f622125503c3df608f1 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 15:05:25 +0800 Subject: [PATCH 027/106] feat(nodejs): Add Connection pooling with Axios and agentkeepalive --- .../src/internal/infra/default_transport.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 9065935c..cf83a050 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -9,6 +9,7 @@ import { KcSigner } from './default_signer'; import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; import "reflect-metadata"; import axiosRetry from 'axios-retry'; +import { HttpAgent, HttpsAgent } from "agentkeepalive"; export class DefaultTransport implements Transport { @@ -67,6 +68,22 @@ export class DefaultTransport implements Transport { } }); + instance.defaults.httpAgent = new HttpAgent({ + maxSockets: trans_option.maxConnsPerHost || 100, + maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, + timeout: trans_option.timeout || 60000, + freeSocketTimeout: trans_option.idleConnTimeout || 30000, + keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true + }); + + instance.defaults.httpsAgent = new HttpsAgent({ + maxSockets: trans_option.maxConnsPerHost || 100, + maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, + timeout: trans_option.timeout || 60000, + freeSocketTimeout: trans_option.idleConnTimeout || 30000, + keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true + }); + instance.interceptors.request.use( config => { console.log('[REQUEST]', { From 28cf4d757c97dc92a4fd12b8959a6d07c07da37e Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 15:52:16 +0800 Subject: [PATCH 028/106] feat(nodejs): First Add Websocket transport api implementation --- .../src/internal/infra/default_ws_callback.ts | 153 ++++++ .../src/internal/infra/default_ws_client.ts | 465 ++++++++++++++++++ .../src/internal/infra/default_ws_service.ts | 263 +++++++++- .../infra/default_ws_token_provider.ts | 153 ++++++ sdk/node/src/internal/util/sub.ts | 57 +++ 5 files changed, 1082 insertions(+), 9 deletions(-) create mode 100644 sdk/node/src/internal/infra/default_ws_callback.ts create mode 100644 sdk/node/src/internal/infra/default_ws_client.ts create mode 100644 sdk/node/src/internal/infra/default_ws_token_provider.ts create mode 100644 sdk/node/src/internal/util/sub.ts diff --git a/sdk/node/src/internal/infra/default_ws_callback.ts b/sdk/node/src/internal/infra/default_ws_callback.ts new file mode 100644 index 00000000..94d4b33d --- /dev/null +++ b/sdk/node/src/internal/infra/default_ws_callback.ts @@ -0,0 +1,153 @@ +import { WebSocketMessageCallback } from '../interfaces/websocket'; +import { SubInfo } from '@internal/util/sub'; + +// callback class, used to store callback function and related info +// callback: callback function +// id:function id +// topic:topic related +class Callback { + constructor( + public callback: WebSocketMessageCallback, + public id: string, + public topic: string + ) {} +} + +// Callback manager +export class CallbackManager { + private idTopicMapping: Map>; + private topicCallbackMapping: Map; + private topicPrefix: string; + + constructor(topicPrefix: string) { + this.idTopicMapping = new Map(); + this.topicCallbackMapping = new Map(); + this.topicPrefix = topicPrefix; + } + + // + isEmpty(): boolean { + return this.idTopicMapping.size === 0 && this.topicCallbackMapping.size === 0; + } + + // get sub info + getSubInfo(): SubInfo[] { + const subInfoList: SubInfo[] = []; + + + for (const topics of this.idTopicMapping.values()) { + // + const info = new SubInfo(this.topicPrefix, [], null); + + // + for (const topic of topics.keys()) { + // split topic + const parts = topic.split(":"); + // if split into 2 parts, then it's a valid topic + if (parts.length === 2) { + // add the second part to info.args + info.args.push(parts[1]); + } + // check if topic exists in topicCallbackMapping + if (this.topicCallbackMapping.has(topic)) { + // get the callback object + const callbackObj = this.topicCallbackMapping.get(topic); + // assign the callback + if (callbackObj) { + info.callback = callbackObj.callback; + } + } + } + // add to list + subInfoList.push(info); + } + + // return list of sub info + return subInfoList; + } + + // add sub info + add(subInfo: SubInfo): boolean { + // get id + const id = subInfo.toId(); + + // if id exists, return false + if (this.idTopicMapping.has(id)) { + return false; + } + + // create a new map to store topics + const topicMap = new Map(); + + // iterate through all topics in subInfo + for (const topic of subInfo.topics()) { + // if topic exists, skip + if (this.topicCallbackMapping.has(topic)) { + continue; + } + + // add topic to map + topicMap.set(topic, true); + // add new Callback object to topicCallbackMapping + this.topicCallbackMapping.set( + topic, + new Callback(subInfo.callback!, id, topic) + ); + } + + // add id and topic map to idTopicMapping + this.idTopicMapping.set(id, topicMap); + return true; + } + + // remove sub info + remove(id: string): void { + const topicMap = this.idTopicMapping.get(id); + if (!topicMap) { + return; + } + + this.idTopicMapping.delete(id); + for (const topic of topicMap.keys()) { + this.topicCallbackMapping.delete(topic); + } + } + + // get callback + get(topic: string): WebSocketMessageCallback | undefined { + const cb = this.topicCallbackMapping.get(topic); + return cb ? cb.callback : undefined; + } +} + +// topic manager +export class TopicManager { + private topicPrefix: Map; + + constructor() { + this.topicPrefix = new Map(); + } + + // get callback manager + getCallbackManager(topic: string): CallbackManager { + const parts = topic.split(':'); + let prefix = topic; + if (parts.length === 2 && parts[1] !== "all") { + prefix = parts[0]; + } + + if (!this.topicPrefix.has(prefix)) { + this.topicPrefix.set(prefix, new CallbackManager(topic)); + } + return this.topicPrefix.get(prefix)!; + } + + // iterate all callback managers + range(func: (key: string, value: CallbackManager) => boolean): void { + for (const [key, value] of this.topicPrefix.entries()) { + if (!func(key, value)) { + break; + } + } + } +} diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts new file mode 100644 index 00000000..000f5bcc --- /dev/null +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -0,0 +1,465 @@ +import WebSocket from 'ws'; +import { EventEmitter } from 'events'; +import { Queue } from 'queue-typescript'; + +import { WsMessage } from '../../model/common'; +import { MessageType } from '../../model/constant'; +import { WebSocketClientOption } from '../../model/websocket_option'; +import { WebSocketEvent } from '../../model/websocket_option'; +import { WsToken, WsTokenProvider } from '../interfaces/websocket'; + + +export class WriteMsg { + public msg: WsMessage; + public ts: number; + public timeout: number; + public exception: Error | null; + private eventEmitter: EventEmitter; + + constructor(msg: WsMessage, timeout: number) { + this.msg = msg; + this.ts = Date.now(); + this.timeout = timeout; + this.exception = null; + this.eventEmitter = new EventEmitter(); + } + + // TODO: + setException(exception: Error): void { + this.exception = exception; + this.eventEmitter.emit('complete'); + } + + // TODO: + waitForCompletion(): Promise { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => { + reject(new Error('Operation timed out')); + }, this.timeout); + + this.eventEmitter.once('complete', () => { + clearTimeout(timeout); + if (this.exception) { + reject(this.exception); + } else { + resolve(); + } + }); + }); + } + + complete(): void { + this.eventEmitter.emit('complete'); + } +} + +// WebSocketClient class, used to manage WebSocket connection and its related operations +export class WebSocketClient { + private options: WebSocketClientOption; + private conn: WebSocket | null; + private connected: boolean; + private shutdown: boolean; + private disconnected: boolean; + private reconnected: boolean; + + private tokenProvider: WsTokenProvider; + + private tokenInfo: WsToken | null; + private closed: boolean; + private reconnectClosed: boolean; + + private readMsg: Queue; + private writeMsg: Queue; + private readMsgMaxSize: number; + private writeMsgMaxSize: number; + + private ackEvents: Map; + private metric: { pingSuccess: number; pingErr: number }; + private keepAliveInterval: NodeJS.Timeout | null; + private writeInterval: NodeJS.Timeout | null; + private welcomeReceived: boolean; + private eventEmitter: EventEmitter; + private lastPingTime: number | null; + + + constructor(tokenProvider: WsTokenProvider, options: WebSocketClientOption) { + this.options = options; + this.conn = null; + this.connected = false; + this.shutdown = false; + this.disconnected = false; + this.reconnected = false; + this.tokenProvider = tokenProvider; + this.tokenInfo = null; + this.closed = false; + this.reconnectClosed = false; + this.welcomeReceived = false; + + // Message queues + this.readMsg = new Queue(); + this.writeMsg = new Queue(); + this.readMsgMaxSize = options.readMessageBuffer; + this.writeMsgMaxSize = options.writeMessageBuffer; + + this.ackEvents = new Map(); + this.metric = { pingSuccess: 0, pingErr: 0 }; + this.keepAliveInterval = null; + this.writeInterval = null; + this.eventEmitter = new EventEmitter(); + + this.lastPingTime = null; + } + + // # Start the WebSocket client + async start(): Promise { + if (this.connected) { + console.warn("WebSocket client is already connected."); + return; + } + + try { + await this.dial(); + this.connected = true; + this.notifyEvent(WebSocketEvent.EventConnected, ""); + this.run(); + this.reconnect(); + } catch (err) { + console.error("Failed to start WebSocket client:", err); + throw err; + } + } + + // Start the message processing and keep-alive + private run(): void { + // + if (!this.keepAliveInterval) { + this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); + } + + if (!this.writeInterval) { + this.writeInterval = setInterval(() => this.writeMessage(), 100); + } + } + + // Stop the WebSocket client + async stop(): Promise { + this.notifyEvent(WebSocketEvent.EventClientShutdown, ""); + this.shutdown = true; + await this.close(); + } + + // dial connects to the WebSocket server + private async dial(): Promise { + try { + // get token + const tokenInfos = await this.tokenProvider.getToken(); + this.tokenInfo = this.randomEndpoint(tokenInfos); + + // create WebSocket connection + const queryParams = new URLSearchParams({ + connectId: Date.now().toString(), + token: this.tokenInfo.token + }); + + // create WebSocket connection + const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; + this.conn = new WebSocket(wsUrl); + + await new Promise((resolve, reject) => { + if (!this.conn) return reject(new Error('No connection')); + + this.conn.on('open', () => { + this.onOpen(); + resolve(); + }); + + this.conn.on('message', (data) => this.onMessage(data.toString())); + this.conn.on('error', (error) => this.onError(error)); + this.conn.on('close', (code, reason) => this.onClose(code, reason.toString())); + + setTimeout(() => { + if (!this.welcomeReceived) { + reject(new Error("Did not receive welcome message")); + } + }, 5000); + }); + } catch (err) { + this.connected = false; + console.error("Failed to connect or validate welcome message:", err); + throw err; + } + } + + // open callback + private onOpen(): void { + console.log("WebSocket connection opened."); + this.notifyEvent(WebSocketEvent.EventConnected, "WebSocket connection opened."); + } + + // error callback + private onError(error: Error): void { + console.error("WebSocket error:", error); + this.disconnected = true; + } + + // close callback + private onClose(code: number, reason: string): void { + this.connected = false; + this.disconnected = true; + console.log(`WebSocket closed with status code ${code}, message: ${reason}`); + } + + // receive message callback + private onMessage(message: string): void { + console.debug("Received message:", message); + const m = WsMessage.fromJson(message); + + switch (m.type) { + case MessageType.WelcomeMessage: + this.welcomeReceived = true; + console.log("Welcome message received."); + break; + + case MessageType.Message: + this.notifyEvent(WebSocketEvent.EventMessageReceived, ""); + // queue message + if (this.readMsg.length < this.readMsgMaxSize) { + this.readMsg.enqueue(m); + } else { + this.notifyEvent(WebSocketEvent.EventReadBufferFull, ""); + console.warn("Read buffer full"); + } + break; + + case MessageType.PongMessage: + this.notifyEvent(WebSocketEvent.EventPongReceived, ""); + console.debug("PONG received"); + this.handleAckEvent(m); + break; + + case MessageType.AckMessage: + case MessageType.ErrorMessage: + this.handleAckEvent(m); + break; + + default: + console.warn("Unknown message type:", m.type); + } + } + + // TODO: + private handleAckEvent(m: WsMessage): void { + const data = m.id ? this.ackEvents.get(m.id) : undefined; + if (!data) { + console.warn("Cannot find ack event, id:", m.id); + return; + } + + if (m.id) { + this.ackEvents.delete(m.id); + } + if (m.type === MessageType.ErrorMessage) { + const error = m.data; + this.notifyEvent(WebSocketEvent.EventErrorReceived, error); + data.setException(new Error(error)); + } else { + data.complete(); + } + } + + // read message + read(): WsMessage[] { + return this.readMsg.toArray(); + } + + // write message + async write(ms: WsMessage, timeout: number): Promise { + console.log("Write message:", ms); + if (!this.connected) { + throw new Error("Not connected"); + } + + const msg = new WriteMsg(ms, timeout); + if (ms.id) { + this.ackEvents.set(ms.id, msg); + } else { + throw new Error("Message ID is undefined"); + } + + try { + // write message to queue and check if it reaches the max size + if (this.writeMsg.length < this.writeMsgMaxSize) { + this.writeMsg.enqueue(msg); + } else { + throw new Error("Write buffer is full"); + } + await msg.waitForCompletion(); + } catch (e) { + this.ackEvents.delete(ms.id); + throw e; + } + } + + // send message TODO: + private writeMessage(): void { + if (this.closed || !this.conn) return; + + const msg = this.writeMsg.dequeue(); + if (msg) { + try { + //Send message TODO: + this.conn.send(msg.msg.data); + console.debug("Message sent:", msg.msg); + msg.ts = Date.now(); + } catch (e) { + console.error("Error sending message:", e); + } + } + } + + // keep-alive + private async keepAlive(): Promise { + if (!this.tokenInfo || this.shutdown || this.closed) return; + + const interval = this.tokenInfo.pingInterval / 1000; + const timeout = this.tokenInfo.pingTimeout / 1000; + const currentTime = Date.now() / 1000; + + if (currentTime - (this.lastPingTime || 0) >= interval) { + const pingMsg = this.newPingMessage(); + try { + await this.write(pingMsg, timeout); + this.metric.pingSuccess++; + } catch (e) { + console.error("Heartbeat ping error:", e); + this.metric.pingErr++; + } + this.lastPingTime = currentTime; + } + } + + private reconnect(): void { + const reconnectLoop = async () => { + while (!this.reconnectClosed) { + if (this.disconnected && !this.shutdown) { + console.log("Broken WebSocket connection, starting reconnection"); + await this.close(); + this.notifyEvent(WebSocketEvent.EventTryReconnect, ""); + this.disconnected = false; + + let attempt = 0; + let reconnected = false; + + while (!reconnected && + this.options.reconnect && + (this.options.reconnectAttempts === -1 || attempt < this.options.reconnectAttempts)) { + console.log(`Reconnecting in ${this.options.reconnectInterval} seconds... (attempt ${attempt})`); + await new Promise(resolve => setTimeout(resolve, this.options.reconnectInterval * 1000)); + + try { + await this.dial(); + this.notifyEvent(WebSocketEvent.EventConnected, ""); + this.connected = true; + this.run(); + reconnected = true; + this.reconnected = true; + } catch (err) { + console.error(`Reconnect attempt ${attempt} failed:`, err); + attempt++; + } + } + + if (!reconnected) { + this.notifyEvent(WebSocketEvent.EventClientFail, ""); + console.error("Failed to reconnect after all attempts."); + } + } + await new Promise(resolve => setTimeout(resolve, 1000)); + } + }; + + reconnectLoop().catch(err => { + console.error("Error in reconnect loop:", err); + }); + } + + // TODO: + private clearMessageQueues(): void { + // clear message queues + while (this.readMsg.length > 0) { + this.readMsg.dequeue(); + } + + while (this.writeMsg.length > 0) { + this.writeMsg.dequeue(); + } + } + + // close the WebSocket connection + // TODO: need to confirm the logic of closing the connection, and release the resources that have been opened + private async close(): Promise { + if (this.connected) { + this.shutdown = true; + this.disconnected = true; + this.reconnectClosed = true; + this.connected = false; + + this.ackEvents.forEach(msg => msg.complete()); + this.ackEvents.clear(); + this.clearMessageQueues(); + + if (this.conn) { + this.conn.close(); + this.conn = null; + this.closed = true; + console.log("WebSocket connection closed."); + } + + if (this.keepAliveInterval) clearInterval(this.keepAliveInterval); + if (this.writeInterval) clearInterval(this.writeInterval); + + + console.log("Closing token provider..."); + this.tokenProvider.close(); + this.notifyEvent(WebSocketEvent.EventDisconnected, ""); + console.log("WebSocket client closed."); + } + } + + // TODO: + private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ""): void { + try { + if (this.options.eventCallback) { + this.options.eventCallback(event, msg); + } + } catch (e) { + console.error("Exception in notify_event:", e); + } + } + + // + private randomEndpoint(tokens: WsToken[]): WsToken { + if (!tokens.length) { + throw new Error("Tokens list is empty"); + } + return tokens[Math.floor(Math.random() * tokens.length)]; + } + + // + private newPingMessage(): WsMessage { + const pingMessage = new WsMessage(); + pingMessage.id = Date.now().toString(); + pingMessage.type = MessageType.PingMessage; + return pingMessage; + } + + // Check if the client has been reconnected + isReconnected(): boolean { + return this.reconnected; + } + + // Clear the reconnected flag + clearReconnectedFlag(): void { + this.reconnected = false; + } +} diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 9168b14b..897066b9 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -2,37 +2,282 @@ import { WebSocketMessageCallback, WebSocketService } from '@internal/interfaces import { ClientOption } from '@model/client_option'; import { DomainType } from '@model/constant'; +import { DefaultTransport } from './default_transport'; +import { TopicManager, CallbackManager } from './default_ws_callback'; +import { WebSocketClient, WriteMsg } from './default_ws_client'; +import { DefaultWsTokenProvider } from './default_ws_token_provider'; +import { WebSocketClientOption, WebSocketEvent } from '../../model/websocket_option'; + +import { SubInfo } from '@internal/util/sub'; +import { WsMessage } from '@model/common'; +import { MessageType } from '@model/constant'; + +import { v4 as uuidv4 } from 'uuid'; + +/** + * DefaultWsService implements the WebSocket service interface for handling real-time data communication. + * It manages WebSocket connections, subscriptions, and message handling with automatic reconnection support. + */ export class DefaultWsService implements WebSocketService { private readonly option: ClientOption; private readonly domain: DomainType; private readonly privateChannel: boolean; private readonly versionString: string; + private readonly tokenTransport: DefaultTransport; + private topicManager: TopicManager; + private client: WebSocketClient; + private stopSignal: boolean = false; + private messageLoop?: NodeJS.Timeout; + private recoveryLoop?: NodeJS.Timeout; + /** + * Creates a new instance of DefaultWsService + * @param option - Client configuration options including WebSocket settings + * @param domain - The domain type for the WebSocket connection + * @param privateChannel - Whether this is a private channel connection + * @param versionString - SDK version string + */ constructor( option: ClientOption, domain: DomainType, privateChannel: boolean, versionString: string, ) { - this.option = option; + if (!option.webSocketClientOption) { + throw new Error('WebSocketClientOption is undefined'); + } + this.wsOption = option.webSocketClientOption; this.domain = domain; this.privateChannel = privateChannel; this.versionString = versionString; + this.tokenTransport = new DefaultTransport(option, versionString); + this.topicManager = new TopicManager(); + this.client = new WebSocketClient( + new DefaultWsTokenProvider(this.tokenTransport, domain, privateChannel), + this.wsOption + ); + } + + /** + * Notifies subscribers of WebSocket events through the configured callback + * @param event - Event type identifier + * @param msg - Primary message content + * @param msg2 - Optional secondary message content + */ + private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { + try { + if (this.wsOption.eventCallback) { + this.wsOption.eventCallback(event, msg); + } + } catch (err) { + console.error('Exception in notify_event:', err); + } + } + + /** + * Resubscribes to topics after a reconnection + * @param callbackManager - The callback manager containing subscription information + */ + private async resubscribe(callbackManager: CallbackManager): Promise { + const subInfoList = callbackManager.getSubInfo(); + for (const sub of subInfoList) { + try { + if (sub.callback) { + const subId = await this.subscribe(sub.prefix, sub.args, sub.callback); + this.notifyEvent(WebSocketEvent.EventReSubscribeOK, subId); + } + } catch (err) { + this.notifyEvent(WebSocketEvent.EventReSubscribeError, `id: ${sub.toId()}, err: ${err}`); + } + } + } + + /** + * Starts the message processing loop + * Continuously reads messages from the WebSocket connection and dispatches them to appropriate callbacks + * Messages are processed every 1000ms (1 second) + */ + private startMessageLoop(): void { + this.messageLoop = setInterval(async () => { + if (this.stopSignal) { + if (this.messageLoop) clearInterval(this.messageLoop); + return; + } + + try { + // Read messages from the WebSocket client + const messages = await this.client.read(); + if (!messages || messages.length === 0) return; + + for (const msg of messages) { + if (msg.type !== MessageType.Message) continue; + + const callbackManager = this.topicManager.getCallbackManager(msg.topic); + if (!callbackManager) { + console.error(`Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`); + continue; + } + + const cb = callbackManager.get(msg.topic); + if (!cb) { + console.error(`Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`); + continue; + } + + try { + await cb.onMessage(msg); + } catch (err) { + console.error('Exception in callback:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); + } + } + } catch (err) { + console.error('Error in message loop:', err); + } + }, 1000); } - start(): Promise { - return Promise.resolve(undefined); + /** + * Starts the recovery loop for handling reconnection scenarios + * Monitors connection status and triggers resubscription when reconnected + * Checks every 1000ms (1 second) for reconnection events + */ + private startRecoveryLoop(): void { + this.recoveryLoop = setInterval(async () => { + if (this.stopSignal) { + if (this.recoveryLoop) clearInterval(this.recoveryLoop); + return; + } + + if (this.client.isReconnected()) { + console.info('WebSocket client reconnected, resubscribe...'); + + const oldTopicManager = this.topicManager; + this.topicManager = new TopicManager(); + + // Create an array of promises for all resubscribe operations + const resubscribePromises: Promise[] = []; + oldTopicManager.range((key, value) => { + resubscribePromises.push(this.resubscribe(value)); + return true; + }); + + // Wait for all resubscribe operations to complete + await Promise.all(resubscribePromises); + + this.client.clearReconnectedFlag(); + } + }, 1000); } - stop(): Promise { - return Promise.resolve(undefined); + /** + * Starts the WebSocket service + * Initializes the client connection and starts message processing and recovery loops + * @throws Error if client initialization fails + */ + async start(): Promise { + try { + await this.client.start(); + this.stopSignal = false; + this.startMessageLoop(); + this.startRecoveryLoop(); + } catch (err) { + console.error('Failed to start client:', err); + throw err; + } } - subscribe(topic: string, args: string[], callback: WebSocketMessageCallback): Promise { - return Promise.resolve(''); + /** + * Stops the WebSocket service + * Cleans up resources by stopping message and recovery loops + * Closes the WebSocket connection + */ + async stop(): Promise { + this.stopSignal = true; + if (this.messageLoop) clearInterval(this.messageLoop); + if (this.recoveryLoop) clearInterval(this.recoveryLoop); + await this.client.stop(); } - unsubscribe(id: string): Promise { - return Promise.resolve(undefined); + /** + * Subscribes to a topic with specified arguments + * @param prefix - Topic prefix identifier + * @param args - Array of subscription arguments + * @param callback - Callback function to handle incoming messages for this subscription + * @returns Promise resolving to subscription ID + * @throws Error if subscription fails or is already subscribed + */ + async subscribe(prefix: string, args: string[], callback: WebSocketMessageCallback): Promise { + try { + // Create subscription info with prefix, args, and callback + const subInfo = new SubInfo(prefix, args || [], callback); + const subId = subInfo.toId(); + + // Get callback manager for the prefix and attempt to add subscription + const callbackManager = this.topicManager.getCallbackManager(prefix); + const created = callbackManager.add(subInfo); + + // Check if already subscribed + if (!created) { + console.info(`Already subscribed: ${subId}`); + throw new Error('Already subscribed'); + } + + // Create subscription message + const subEvent = new WsMessage(); + subEvent.id = subId; + subEvent.type = MessageType.SubscribeMessage; + subEvent.topic = subInfo.subTopic(); + subEvent.privateChannel = this.privateChannel; + subEvent.response = true; + + try { + // Send subscription request + await this.client.write(subEvent, this.wsOption.writeTimeout); + return subId; + } catch (err) { + // Clean up on failure + const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); + callbackManager.remove(subId); + throw err; + } + } catch (err) { + console.error(`Subscribe error: ${err}`); + throw err; + } + } + + /** + * Unsubscribes from a topic using the subscription ID + * @param id - Subscription ID to unsubscribe + * @throws Error if unsubscribe operation fails + */ + async unsubscribe(id: string): Promise { + return new Promise(async (resolve, reject) => { + try { + const subInfo = SubInfo.fromId(id); + const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); + + const subEvent = new WsMessage(); + + subEvent.id = uuidv4().toString(); + subEvent.type = MessageType.UnsubscribeMessage; + subEvent.topic = subInfo.subTopic(); + subEvent.privateChannel = this.privateChannel; + subEvent.response = true; + + try { + await this.client.write(subEvent, this.wsOption.writeTimeout); + callbackManager.remove(id); + console.info(`Unsubscribe success: ${id}`); + resolve(); + } catch (err) { + console.error(`Unsubscribe error: ${id}, error: ${err}`); + reject(err); + } + } catch (err) { + reject(err); + } + }); } } diff --git a/sdk/node/src/internal/infra/default_ws_token_provider.ts b/sdk/node/src/internal/infra/default_ws_token_provider.ts new file mode 100644 index 00000000..d4670708 --- /dev/null +++ b/sdk/node/src/internal/infra/default_ws_token_provider.ts @@ -0,0 +1,153 @@ +import { DomainType } from '../../model/constant'; +import { WsToken, WsTokenProvider } from '../interfaces/websocket'; +import { DefaultTransport } from './default_transport'; +import { RestResponse } from '../../model/common'; + +const PATH_PRIVATE = '/api/v1/bullet-private'; +const PATH_PUBLIC = '/api/v1/bullet-public'; + +/** + * TokenResponse interface defining the structure of the WebSocket token response + */ +interface TokenResponse { + commonResponse?: RestResponse; + token?: string; + instanceServers?: WsToken[]; +} + +/** + * Implementation of TokenResponse with validation and serialization methods + */ +export class TokenResponseImpl implements TokenResponse { + commonResponse?: RestResponse; + token?: string; + instanceServers?: WsToken[]; + + constructor(data?: Partial) { + if (data) { + this.commonResponse = data.commonResponse; + this.token = data.token; + this.instanceServers = data.instanceServers; + } + } + + /** + * Sets the common response for the token response + * @param response - RestResponse object to set + */ + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + /** + * Creates a TokenResponse instance from a JSON string + * @param jsonStr - JSON string to parse + * @returns TokenResponseImpl instance or null if parsing fails + */ + static fromJSON(jsonStr: string): TokenResponseImpl | null { + try { + return TokenResponseImpl.fromDict(JSON.parse(jsonStr)); + } catch { + return null; + } + } + + /** + * Creates a TokenResponse instance from a dictionary object + * @param obj - Object to convert to TokenResponse + * @returns TokenResponseImpl instance or null if conversion fails + */ + static fromDict(obj: Record | null): TokenResponseImpl | null { + if (!obj) return null; + + return new TokenResponseImpl({ + token: obj.token, + instanceServers: Array.isArray(obj.instanceServers) + ? obj.instanceServers.map((item: any) => ({ + token: item.token || '', + pingInterval: item.pingInterval || 0, + endpoint: item.endpoint || '', + protocol: item.protocol || '', + encrypt: item.encrypt || false, + pingTimeout: item.pingTimeout || 0 + })) + : undefined + }); + } + + fromJson(input: string): TokenResponseImpl { + const jsonObject = JSON.parse(input); + return this.fromObject(jsonObject); + } + + toJson(): string { + return JSON.stringify({ + token: this.token, + instanceServers: this.instanceServers + }); + } + + fromObject(jsonObject: Object): TokenResponseImpl { + const data = jsonObject as Partial; + return new TokenResponseImpl(data); + } +} + +/** + * Default implementation of the WebSocket token provider + * Handles token retrieval and management for WebSocket connections + */ +export class DefaultWsTokenProvider implements WsTokenProvider { + private readonly transport: DefaultTransport; + private readonly domain: DomainType; + private readonly isPrivate: boolean; + + constructor(transport: DefaultTransport, domain: DomainType, isPrivate: boolean) { + this.transport = transport; + this.domain = domain; + this.isPrivate = isPrivate; + } + + /** + * Retrieves WebSocket tokens from the server + * @returns Promise resolving to array of WsToken objects + * @throws Error if token retrieval fails + */ + async getToken(): Promise { + const path = this.isPrivate ? PATH_PRIVATE : PATH_PUBLIC; + + try { + const response = new TokenResponseImpl(); + const result = await this.transport.call( + this.domain, + false, + 'POST', + path, + null, + response, + false + ) as TokenResponseImpl; + + if (result.instanceServers && result.token) { + // Assign token to each instance server + const token: string = result.token; + result.instanceServers.forEach(server => { + server.token = token; + }); + return result.instanceServers; + } + + return []; + } catch (error) { + throw error; + } + } + + /** + * Closes the token provider and its associated transport + * @returns A promise that resolves when the transport is closed + */ + async close(): Promise { + this.transport.close(); + } +} diff --git a/sdk/node/src/internal/util/sub.ts b/sdk/node/src/internal/util/sub.ts new file mode 100644 index 00000000..720c8931 --- /dev/null +++ b/sdk/node/src/internal/util/sub.ts @@ -0,0 +1,57 @@ +import { EventEmitter } from 'events'; + +import {WebSocketMessageCallback} from '@internal/interfaces/websocket'; +const EMPTY_ARGS_STR = "EMPTY_ARGS"; + +export class SubInfo { + prefix: string; + args: string[]; + callback: WebSocketMessageCallback | null; + + constructor(prefix: string, args: string[], callback: WebSocketMessageCallback | null) { + this.prefix = prefix; + this.args = args; + this.callback = callback; + } + + toId(): string { + let argsStr: string; + if (!this.args.length) { + argsStr = EMPTY_ARGS_STR; + } else { + const sortedArgs = this.args.slice().sort(); + argsStr = sortedArgs.join(","); + } + return `${this.prefix}@@${argsStr}`; + } + + static fromId(id: string, callback: WebSocketMessageCallback | null = null): SubInfo { + const parts = id.split("@@"); + if (parts.length !== 2) { + throw new Error(`SubInfo.fromId: invalid id format: ${id}`); + } + + const prefix = parts[0]; + let args: string[]; + if (parts[1] === EMPTY_ARGS_STR) { + args = []; + } else { + args = parts[1].split(","); + } + return new SubInfo(prefix, args, callback); + } + + topics(): string[] { + if (!this.args.length) { + return [this.prefix]; + } + return this.args.map(arg => `${this.prefix}:${arg}`); + } + + subTopic(): string { + if (!this.args.length) { + return this.prefix; + } + return `${this.prefix}:${this.args.join(",")}`; + } +} \ No newline at end of file From d8a5cd048c2d26563b2792a720b656d9c2bb72af Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 16:19:02 +0800 Subject: [PATCH 029/106] feat(nodejs): Fix writeMessage error --- sdk/node/src/internal/infra/default_ws_client.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 000f5bcc..4eb710a2 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -307,12 +307,17 @@ export class WebSocketClient { const msg = this.writeMsg.dequeue(); if (msg) { try { - //Send message TODO: - this.conn.send(msg.msg.data); + // Send the complete message as JSON string + this.conn.send(JSON.stringify(msg.msg)); console.debug("Message sent:", msg.msg); msg.ts = Date.now(); + msg.complete(); } catch (e) { - console.error("Error sending message:", e); + console.error("Failed to send message:", e); + if (msg.msg.id) { + this.ackEvents.delete(msg.msg.id); + } + msg.setException(e as Error); } } } From 0f26185e3859afa0b577cd44444d4e98d31975a3 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 16:37:54 +0800 Subject: [PATCH 030/106] fix(nodejs): deal with requests is null --- sdk/node/src/internal/infra/default_transport.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index cf83a050..2d34fb99 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -193,8 +193,9 @@ export class DefaultTransport implements Transport { } } else if(requestObj){ reqBody = JSON.stringify(requestObj); - } else { - throw new Error('Invalid request object'); + } else if (method === 'POST') { + // For POST requests, if no request body is provided, use an empty object + reqBody = '{}'; } const config: AxiosRequestConfig = { From ff9558cae5f54bd213c574a752b01c8f4b7c983d Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 15 Jan 2025 18:36:25 +0800 Subject: [PATCH 031/106] feat(nodejs): modify doWithRetry --- .../src/internal/infra/default_transport.ts | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 2d34fb99..75f81543 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -170,7 +170,7 @@ export class DefaultTransport implements Transport { }).join('&'); } - private async processRequest( + private processRequest( requestObj: Serializable | null, broker: boolean, path: string, @@ -178,7 +178,7 @@ export class DefaultTransport implements Transport { method: string, requestAsJson: boolean, args?: any - ): Promise { + ): AxiosRequestConfig { const fullPath = endpoint + path; const rawUrl = path; let reqBody = ''; @@ -220,7 +220,7 @@ export class DefaultTransport implements Transport { return config; } - private doWithRetry(req_config: AxiosRequestConfig): AxiosResponse { + private doWithRetry(req_config: AxiosRequestConfig): Promise { try { if(this.transportOption.interceptors){ for (const interceptor of this.transportOption.interceptors) { @@ -228,17 +228,18 @@ export class DefaultTransport implements Transport { } } - let response = this.httpClient.request(req_config); - - if(this.transportOption.interceptors){ - for (const interceptor of this.transportOption.interceptors) { - response = interceptor.after(req_config,response,null); + return this.httpClient.request(req_config).then(response => { + if(this.transportOption.interceptors){ + for (const interceptor of this.transportOption.interceptors) { + response = interceptor.after(req_config, response, null); + } } - } - - return response; + return response; + }).catch(err => { + throw err; + }); } catch (err) { - throw err; + return Promise.reject(err); } } @@ -280,7 +281,7 @@ export class DefaultTransport implements Transport { return responseObj; } - async call( + call( domain: string, isBroker: boolean, method: string, @@ -295,10 +296,14 @@ export class DefaultTransport implements Transport { const endpoint = this.getEndpoint(domain); const processedPath = this.processPathVariable(path, requestObj); - const config = await this.processRequest(requestObj, isBroker, processedPath, endpoint, method, requestJson, args); - const response = await this.doWithRetry(config); - - return this.processResponse(response, responseObj); + const config = this.processRequest(requestObj, isBroker, processedPath, endpoint, method, requestJson, args); + + return this.doWithRetry(config).then(response => { + return this.processResponse(response, responseObj); + }).catch(error => { + console.error('[CALL ERROR]', error); + throw error; + }); } private getEndpoint(domain: string): string { From 36826ff68947484132bb68dc96bdfc5a8b09ffc9 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 11:23:48 +0800 Subject: [PATCH 032/106] feat(nodejs): update transport implements --- sdk/node/package-lock.json | 32 ++- sdk/node/package.json | 2 + .../src/internal/infra/default_transport.ts | 193 +++++++++--------- 3 files changed, 131 insertions(+), 96 deletions(-) diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 2111b391..5f057f32 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -1152,6 +1152,14 @@ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true }, + "agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "requires": { + "humanize-ms": "^1.2.1" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1231,6 +1239,14 @@ "proxy-from-env": "^1.1.0" } }, + "axios-retry": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-4.5.0.tgz", + "integrity": "sha512-aR99oXhpEDGo0UuAlYcn2iGRds30k366Zfa05XWScR9QaQD4JYiP3/1Qt1u7YlefUOK+cn0CcwoL1oefavQUlQ==", + "requires": { + "is-retry-allowed": "^2.2.0" + } + }, "babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -2116,6 +2132,14 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "requires": { + "ms": "^2.0.0" + } + }, "ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -2221,6 +2245,11 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-retry-allowed": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", + "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==" + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -2939,8 +2968,7 @@ "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "mylas": { "version": "2.1.13", diff --git a/sdk/node/package.json b/sdk/node/package.json index 34cd78b3..703ddd91 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -45,7 +45,9 @@ "node": ">=18" }, "dependencies": { + "agentkeepalive": "^4.6.0", "axios": "^1.7.9", + "axios-retry": "^4.5.0", "class-transformer": "^0.5.1", "reflect-metadata": "^0.2.2" } diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 75f81543..47b1ab9c 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -6,14 +6,18 @@ import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; -import "reflect-metadata"; +import axios, { + AxiosInstance, + AxiosRequestConfig, + AxiosResponse, + AxiosResponseHeaders, + RawAxiosResponseHeaders, +} from 'axios'; +import 'reflect-metadata'; import axiosRetry from 'axios-retry'; -import { HttpAgent, HttpsAgent } from "agentkeepalive"; - +import { HttpAgent, HttpsAgent } from 'agentkeepalive'; export class DefaultTransport implements Transport { - private readonly option: ClientOption; private readonly version: String; private transportOption: TransportOption = {} as TransportOption; @@ -24,14 +28,16 @@ export class DefaultTransport implements Transport { this.option = option; this.version = version; - this.transportOption = option.transportOption || {} as TransportOption; - - this.signer = new KcSigner(option.key, + this.transportOption = option.transportOption || ({} as TransportOption); + + this.signer = new KcSigner( + option.key, option.secret, option.passphrase, option.brokerName, option.brokerPartner, - option.brokerKey); + option.brokerKey, + ); this.httpClient = this.createHttpClient(this.transportOption); } @@ -40,7 +46,7 @@ export class DefaultTransport implements Transport { const instance = axios.create({ timeout: trans_option.timeout, headers: { - 'Connection': trans_option.keepAlive ? 'keep-alive' : 'close', + Connection: trans_option.keepAlive ? 'keep-alive' : 'close', }, }); @@ -54,18 +60,17 @@ export class DefaultTransport implements Transport { }, retryCondition: (error) => { // acquire request config - const currentRetry = ((error.config as any)?._retry || 0); + const currentRetry = (error.config as any)?._retry || 0; const maxRetries = trans_option.maxRetries || 3; - + // change retry condition here - const shouldRetry = ( - axiosRetry.isNetworkOrIdempotentRequestError(error) || + const shouldRetry = + axiosRetry.isNetworkOrIdempotentRequestError(error) || error.message.includes('timeout') || (error.response && error.response.status >= 500) || - error.code === 'ECONNABORTED' - ); + error.code === 'ECONNABORTED'; return shouldRetry && currentRetry < maxRetries; - } + }, }); instance.defaults.httpAgent = new HttpAgent({ @@ -73,7 +78,7 @@ export class DefaultTransport implements Transport { maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, timeout: trans_option.timeout || 60000, freeSocketTimeout: trans_option.idleConnTimeout || 30000, - keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true + keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, }); instance.defaults.httpsAgent = new HttpsAgent({ @@ -81,47 +86,53 @@ export class DefaultTransport implements Transport { maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, timeout: trans_option.timeout || 60000, freeSocketTimeout: trans_option.idleConnTimeout || 30000, - keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true + keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, }); - + instance.interceptors.request.use( - config => { + (config) => { console.log('[REQUEST]', { method: config.method?.toUpperCase(), - url: config.url + url: config.url, }); return config; }, - error => { + (error) => { console.error('[REQUEST ERROR]', error.message); return Promise.reject(error); - } + }, ); instance.interceptors.response.use( - response => { + (response) => { if (response.status >= 400) { console.error('[RESPONSE ERROR]', { status: response.status, - data: response.data + data: response.data, }); } return response; }, - error => { + (error) => { console.error('[RESPONSE ERROR]', { - message: error.message, - status: error.response?.status, - data: error.response?.data - }); - return Promise.reject(error); - } + message: error.message, + status: error.response?.status, + data: error.response?.data, + }); + return Promise.reject(error); + }, ); return instance; } - private processHeaders(body: string, rawUrl: string, config: AxiosRequestConfig, method: string, broker: boolean): void { + private processHeaders( + body: string, + rawUrl: string, + config: AxiosRequestConfig, + method: string, + broker: boolean, + ): void { const payload = `${method}${rawUrl}${body || ''}`; const headers = broker ? this.signer.brokerHeaders(payload) : this.signer.headers(payload); @@ -137,22 +148,24 @@ export class DefaultTransport implements Transport { } const pathVariables: { [key: string]: any } = {}; - + for (const key of Object.keys(requestObj)) { - const metadata = Reflect.getMetadata("path", requestObj, key); + const metadata = Reflect.getMetadata('path', requestObj, key); if (metadata) { pathVariables[metadata] = requestObj[key]; } } - + const missingPlaceholders = Object.entries(pathVariables) .filter(([_, value]) => value == null) .map(([key]) => key); - + if (missingPlaceholders.length > 0) { - throw new Error(`Missing path variable value(s) for: ${missingPlaceholders.join(", ")}`); + throw new Error( + `Missing path variable value(s) for: ${missingPlaceholders.join(', ')}`, + ); } - + return path.replace(/{(.*?)}/g, (_, key) => { if (key in pathVariables) { return String(pathVariables[key]); @@ -162,12 +175,14 @@ export class DefaultTransport implements Transport { } private rawQuery(queryDict: Record): string { - return Object.entries(queryDict).map(([key, value]) => { - if (Array.isArray(value)) { - return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&'); - } - return `${key}=${encodeURIComponent(value)}`; - }).join('&'); + return Object.entries(queryDict) + .map(([key, value]) => { + if (Array.isArray(value)) { + return value.map((val) => `${key}=${encodeURIComponent(val)}`).join('&'); + } + return `${key}=${encodeURIComponent(value)}`; + }) + .join('&'); } private processRequest( @@ -177,7 +192,7 @@ export class DefaultTransport implements Transport { endpoint: string, method: string, requestAsJson: boolean, - args?: any + args?: any, ): AxiosRequestConfig { const fullPath = endpoint + path; const rawUrl = path; @@ -191,7 +206,7 @@ export class DefaultTransport implements Transport { if (queryParams) { queryPath = `${path}?${queryParams}`; } - } else if(requestObj){ + } else if (requestObj) { reqBody = JSON.stringify(requestObj); } else if (method === 'POST') { // For POST requests, if no request body is provided, use an empty object @@ -203,15 +218,15 @@ export class DefaultTransport implements Transport { url: endpoint + queryPath, data: reqBody, headers: { - 'User-Agent': `Kucoin-Universal-Node-SDK/${this.version}` - } + 'User-Agent': `Kucoin-Universal-Node-SDK/${this.version}`, + }, }; // Add Content-Type only for POST and PUT requests if (method === 'POST' || method === 'PUT') { config.headers = { ...config.headers, - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', }; } @@ -220,30 +235,7 @@ export class DefaultTransport implements Transport { return config; } - private doWithRetry(req_config: AxiosRequestConfig): Promise { - try { - if(this.transportOption.interceptors){ - for (const interceptor of this.transportOption.interceptors) { - req_config = interceptor.before(req_config) || req_config; - } - } - - return this.httpClient.request(req_config).then(response => { - if(this.transportOption.interceptors){ - for (const interceptor of this.transportOption.interceptors) { - response = interceptor.after(req_config, response, null); - } - } - return response; - }).catch(err => { - throw err; - }); - } catch (err) { - return Promise.reject(err); - } - } - - private processLimit(headers: Record): RestRateLimit { + private processLimit(headers: RawAxiosResponseHeaders | AxiosResponseHeaders): RestRateLimit { const limit = parseInt(headers['gw-ratelimit-limit'] || '-1', 10); const remaining = parseInt(headers['gw-ratelimit-remaining'] || '-1', 10); const reset = parseInt(headers['gw-ratelimit-reset'] || '-1', 10); @@ -251,22 +243,25 @@ export class DefaultTransport implements Transport { const rateLimit = { limit, remaining, - reset + reset, }; - + if (remaining <= Math.ceil(limit * 0.1)) { console.warn('[RATE LIMIT WARNING]', rateLimit); } - + return rateLimit; } - private processResponse(response: AxiosResponse, responseObj: Response): Response { + private processResponse( + response: AxiosResponse, + responseObj: Response, + ): Response { if (response.status >= 400) { console.error('[RESPONSE ERROR]', { status: response.status, statusText: response.statusText, - data: response.data + data: response.data, }); } @@ -289,21 +284,31 @@ export class DefaultTransport implements Transport { requestObj: Serializable | null, responseObj: Response, requestJson: boolean, - args?: any + args?: any, ): Promise> { - domain = domain.toLowerCase(); - method = method.toUpperCase(); - - const endpoint = this.getEndpoint(domain); - const processedPath = this.processPathVariable(path, requestObj); - const config = this.processRequest(requestObj, isBroker, processedPath, endpoint, method, requestJson, args); - - return this.doWithRetry(config).then(response => { - return this.processResponse(response, responseObj); - }).catch(error => { - console.error('[CALL ERROR]', error); - throw error; - }); + return Promise.resolve() + .then((): AxiosRequestConfig => { + const endpoint = this.getEndpoint(domain); + const processedPath = this.processPathVariable(path, requestObj); + return this.processRequest( + requestObj, + isBroker, + processedPath, + endpoint, + method, + requestJson, + args, + ); + }) + .then((config: AxiosRequestConfig) => { + return this.httpClient.request(config); + }) + .then((response: AxiosResponse) => { + return this.processResponse(response, responseObj); + }) + .catch((err: any) => { + throw err; + }); } private getEndpoint(domain: string): string { From a59859e3b5e54095f4d69b6d9a4a4504c3978fd9 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 14:39:50 +0800 Subject: [PATCH 033/106] feat(nodejs): add more example --- sdk/node/example/example_get_started.ts | 60 +++++++++++++++++ sdk/node/package-lock.json | 88 ++++++++++++------------- sdk/node/package.json | 2 +- sdk/node/src/api/api_ws.ts | 13 ++-- sdk/node/src/index.ts | 2 + 5 files changed, 113 insertions(+), 52 deletions(-) create mode 100644 sdk/node/example/example_get_started.ts diff --git a/sdk/node/example/example_get_started.ts b/sdk/node/example/example_get_started.ts new file mode 100644 index 00000000..0f8f50a2 --- /dev/null +++ b/sdk/node/example/example_get_started.ts @@ -0,0 +1,60 @@ +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder +} from 'kucoin-universal-sdk'; + +function example() { + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + + const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); + + // Create request by interface + let request = Spot.GetPartOrderBookReq.create({ + 'symbol': 'BTC-USDT', + 'size': '20', + }) + + // Or create request by builder + request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + + // Query for part orderbook depth data. (aggregated by price) + spotMarketApi.getPartOrderBook(request).then((result) => { + console.log(`Time: ${result.time}, Seq: ${result.sequence}, Bids: ${result.bids}, Asks: ${result.asks}`); + }).catch((err) => { + console.error('fail to get part order book', err); + }) +} + + +example() \ No newline at end of file diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 5f057f32..69f2bd57 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -26,9 +26,9 @@ } }, "@babel/compat-data": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", - "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.5.tgz", + "integrity": "sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg==", "dev": true }, "@babel/core": { @@ -63,25 +63,25 @@ } }, "@babel/generator": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", - "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.5.tgz", + "integrity": "sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw==", "dev": true, "requires": { - "@babel/parser": "^7.26.3", - "@babel/types": "^7.26.3", + "@babel/parser": "^7.26.5", + "@babel/types": "^7.26.5", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dev": true, "requires": { - "@babel/compat-data": "^7.25.9", + "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -118,9 +118,9 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", - "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true }, "@babel/helper-string-parser": { @@ -152,12 +152,12 @@ } }, "@babel/parser": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", - "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.5.tgz", + "integrity": "sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw==", "dev": true, "requires": { - "@babel/types": "^7.26.3" + "@babel/types": "^7.26.5" } }, "@babel/plugin-syntax-async-generators": { @@ -325,24 +325,24 @@ } }, "@babel/traverse": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", - "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.5.tgz", + "integrity": "sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ==", "dev": true, "requires": { "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.3", - "@babel/parser": "^7.26.3", + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.5", "@babel/template": "^7.25.9", - "@babel/types": "^7.26.3", + "@babel/types": "^7.26.5", "debug": "^4.3.1", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", - "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.5.tgz", + "integrity": "sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.25.9", @@ -1015,9 +1015,9 @@ "dev": true }, "@types/node": { - "version": "22.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", - "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", + "version": "22.10.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz", + "integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==", "dev": true, "requires": { "undici-types": "~6.20.0" @@ -1372,9 +1372,9 @@ } }, "browserslist": { - "version": "4.24.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", - "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "requires": { "caniuse-lite": "^1.0.30001688", @@ -1420,9 +1420,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001690", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", - "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", + "version": "1.0.30001692", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz", + "integrity": "sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A==", "dev": true }, "chalk": { @@ -1627,9 +1627,9 @@ } }, "electron-to-chromium": { - "version": "1.5.76", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.76.tgz", - "integrity": "sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==", + "version": "1.5.83", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.83.tgz", + "integrity": "sha512-LcUDPqSt+V0QmI47XLzZrz5OqILSMGsPFkDYus22rIbgorSvBYEFqq854ltTmUdHkY92FSdAAvsh4jWEULMdfQ==", "dev": true }, "emittery": { @@ -3626,13 +3626,13 @@ "dev": true }, "update-browserslist-db": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", - "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", "dev": true, "requires": { "escalade": "^3.2.0", - "picocolors": "^1.1.0" + "picocolors": "^1.1.1" } }, "uri-js": { diff --git a/sdk/node/package.json b/sdk/node/package.json index 703ddd91..be1917c6 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -42,7 +42,7 @@ }, "peerDependencies": {}, "engines": { - "node": ">=18" + "node": ">=14" }, "dependencies": { "agentkeepalive": "^4.6.0", diff --git a/sdk/node/src/api/api_ws.ts b/sdk/node/src/api/api_ws.ts index 9d84c87e..89fa272e 100644 --- a/sdk/node/src/api/api_ws.ts +++ b/sdk/node/src/api/api_ws.ts @@ -1,10 +1,9 @@ -import { SpotPublicWS } from '@generate/spot/spotpublic/ws_spot_public'; -import { SpotPrivateWS } from '@generate/spot/spotprivate/ws_spot_private'; -import { MarginPublicWS } from '@generate/margin/marginpublic/ws_margin_public'; -import { MarginPrivateWS } from '@generate/margin/marginprivate/ws_margin_private'; -import { FuturesPublicWS } from '@generate/futures/futurespublic/ws_futures_public'; -import { FuturesPrivateWS } from '@generate/futures/futuresprivate/ws_futures_private'; - +import { SpotPublicWS } from '@generate/spot/spotpublic'; +import { SpotPrivateWS } from '@generate/spot/spotprivate'; +import { MarginPublicWS } from '@generate/margin/marginpublic'; +import { MarginPrivateWS } from '@generate/margin/marginprivate'; +import { FuturesPublicWS } from '@generate/futures/futurespublic'; +import { FuturesPrivateWS } from '@generate/futures/futuresprivate'; export interface KucoinWSService { /** diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index 99f23c9b..8c810c02 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -1,3 +1,5 @@ +import 'reflect-metadata'; + // Exporting from api export * from './api'; export * from './model'; From d15b44272c927b2ebb680078d08a79108e2e5edc Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 17 Jan 2025 15:11:29 +0800 Subject: [PATCH 034/106] feat(nodejs): update websocket implements --- .../src/internal/infra/default_ws_client.ts | 374 +++++++++++------- .../src/internal/infra/default_ws_service.ts | 140 +++---- 2 files changed, 301 insertions(+), 213 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 4eb710a2..a75d10c1 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -14,7 +14,7 @@ export class WriteMsg { public ts: number; public timeout: number; public exception: Error | null; - private eventEmitter: EventEmitter; + public eventEmitter: EventEmitter; constructor(msg: WsMessage, timeout: number) { this.msg = msg; @@ -24,28 +24,9 @@ export class WriteMsg { this.eventEmitter = new EventEmitter(); } - // TODO: setException(exception: Error): void { this.exception = exception; - this.eventEmitter.emit('complete'); - } - - // TODO: - waitForCompletion(): Promise { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - reject(new Error('Operation timed out')); - }, this.timeout); - - this.eventEmitter.once('complete', () => { - clearTimeout(timeout); - if (this.exception) { - reject(this.exception); - } else { - resolve(); - } - }); - }); + this.eventEmitter.emit('error', exception); } complete(): void { @@ -111,22 +92,23 @@ export class WebSocketClient { } // # Start the WebSocket client - async start(): Promise { + start(): Promise { if (this.connected) { console.warn("WebSocket client is already connected."); - return; + return Promise.resolve(); } - try { - await this.dial(); - this.connected = true; - this.notifyEvent(WebSocketEvent.EventConnected, ""); - this.run(); - this.reconnect(); - } catch (err) { - console.error("Failed to start WebSocket client:", err); - throw err; - } + return this.dial() + .then(() => { + this.connected = true; + this.notifyEvent(WebSocketEvent.EventConnected, ""); + this.run(); + this.reconnect(); + }) + .catch(err => { + console.error("Failed to start WebSocket client:", err); + throw err; + }); } // Start the message processing and keep-alive @@ -142,52 +124,73 @@ export class WebSocketClient { } // Stop the WebSocket client - async stop(): Promise { - this.notifyEvent(WebSocketEvent.EventClientShutdown, ""); + public async stop(): Promise { + // Set shutdown flag to prevent reconnection attempts this.shutdown = true; - await this.close(); + this.reconnectClosed = true; + + // Clear intervals + if (this.keepAliveInterval) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = null; + } + if (this.writeInterval) { + clearInterval(this.writeInterval); + this.writeInterval = null; + } + + // Wait for any pending messages to be processed + await new Promise((resolve) => { + setTimeout(async () => { + try { + await this.close(); + } catch (error) { + console.error('Error during WebSocket close:', error); + } + resolve(); + }, 100); + }); } // dial connects to the WebSocket server - private async dial(): Promise { - try { - // get token - const tokenInfos = await this.tokenProvider.getToken(); - this.tokenInfo = this.randomEndpoint(tokenInfos); - - // create WebSocket connection - const queryParams = new URLSearchParams({ - connectId: Date.now().toString(), - token: this.tokenInfo.token - }); + private dial(): Promise { + return this.tokenProvider.getToken() + .then(tokenInfos => { + this.tokenInfo = this.randomEndpoint(tokenInfos); + + // create WebSocket connection + const queryParams = new URLSearchParams({ + connectId: Date.now().toString(), + token: this.tokenInfo.token + }); - // create WebSocket connection - const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; - this.conn = new WebSocket(wsUrl); + // create WebSocket connection + const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; + this.conn = new WebSocket(wsUrl); - await new Promise((resolve, reject) => { - if (!this.conn) return reject(new Error('No connection')); + return new Promise((resolve, reject) => { + if (!this.conn) return reject(new Error('No connection')); - this.conn.on('open', () => { - this.onOpen(); - resolve(); - }); + this.conn.on('open', () => { + this.onOpen(); + resolve(); + }); - this.conn.on('message', (data) => this.onMessage(data.toString())); - this.conn.on('error', (error) => this.onError(error)); - this.conn.on('close', (code, reason) => this.onClose(code, reason.toString())); + this.conn.on('message', (data) => this.onMessage(data.toString())); + this.conn.on('error', (error) => this.onError(error)); + this.conn.on('close', (code, reason) => this.onClose(code, reason.toString())); - setTimeout(() => { - if (!this.welcomeReceived) { - reject(new Error("Did not receive welcome message")); - } - }, 5000); + setTimeout(() => { + if (!this.welcomeReceived) { + reject(new Error("Did not receive welcome message")); + } + }, 5000); + }); + }) + .catch(err => { + console.error("Failed to dial WebSocket server:", err); + throw err; }); - } catch (err) { - this.connected = false; - console.error("Failed to connect or validate welcome message:", err); - throw err; - } } // open callback @@ -204,15 +207,40 @@ export class WebSocketClient { // close callback private onClose(code: number, reason: string): void { + console.log(`WebSocket closed with status code ${code}, message: ${reason}`); this.connected = false; this.disconnected = true; - console.log(`WebSocket closed with status code ${code}, message: ${reason}`); + + // Clear any pending messages and intervals + this.clearMessageQueues(); + if (this.keepAliveInterval) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = null; + } + if (this.writeInterval) { + clearInterval(this.writeInterval); + this.writeInterval = null; + } + + // Notify event + this.notifyEvent(WebSocketEvent.EventDisconnected, reason); } // receive message callback private onMessage(message: string): void { - console.debug("Received message:", message); - const m = WsMessage.fromJson(message); + if (this.shutdown || this.closed) { + console.debug("Ignoring message as client is shutting down or closed"); + return; + } + + console.debug("onMessage Received type:message message:" + message); + let m: WsMessage; + try { + m = JSON.parse(message); + } catch (e) { + console.error("Failed to parse message:", e); + return; + } switch (m.type) { case MessageType.WelcomeMessage: @@ -221,13 +249,15 @@ export class WebSocketClient { break; case MessageType.Message: - this.notifyEvent(WebSocketEvent.EventMessageReceived, ""); - // queue message - if (this.readMsg.length < this.readMsgMaxSize) { - this.readMsg.enqueue(m); - } else { - this.notifyEvent(WebSocketEvent.EventReadBufferFull, ""); - console.warn("Read buffer full"); + if (!this.shutdown && !this.closed) { + this.notifyEvent(WebSocketEvent.EventMessageReceived, ""); + // queue message + if (this.readMsg.length < this.readMsgMaxSize) { + this.readMsg.enqueue(m); + } else { + this.notifyEvent(WebSocketEvent.EventReadBufferFull, ""); + console.warn("Read buffer full"); + } } break; @@ -247,71 +277,100 @@ export class WebSocketClient { } } - // TODO: + // Handle acknowledgment events (pong, ack, error) private handleAckEvent(m: WsMessage): void { - const data = m.id ? this.ackEvents.get(m.id) : undefined; - if (!data) { - console.warn("Cannot find ack event, id:", m.id); + if (!m.id) return; + + const data = this.ackEvents.get(m.id); + if (!data) return; + + this.ackEvents.delete(m.id); + + if (m.type === MessageType.PongMessage) { + console.debug('[HandleAckEvent] Handling pong message'); + this.metric.pingSuccess++; + data.complete(); return; } - if (m.id) { - this.ackEvents.delete(m.id); - } if (m.type === MessageType.ErrorMessage) { const error = m.data; this.notifyEvent(WebSocketEvent.EventErrorReceived, error); data.setException(new Error(error)); + this.metric.pingErr++; } else { data.complete(); } } - // read message - read(): WsMessage[] { - return this.readMsg.toArray(); + /** + * Read a single message from the queue and remove it + * @returns The first message in the queue, or undefined if queue is empty + */ + read(): WsMessage | undefined { + if (this.readMsg.length === 0) { + return undefined; + } + return this.readMsg.dequeue(); } // write message - async write(ms: WsMessage, timeout: number): Promise { - console.log("Write message:", ms); - if (!this.connected) { - throw new Error("Not connected"); - } + write(ms: WsMessage, timeout: number): Promise { + return new Promise((resolve, reject) => { + console.log("Write message:", ms); + if (!this.connected) { + reject(new Error("Not connected")); + return; + } - const msg = new WriteMsg(ms, timeout); - if (ms.id) { - this.ackEvents.set(ms.id, msg); - } else { - throw new Error("Message ID is undefined"); - } + const msg = new WriteMsg(ms, timeout); + if (!ms.id) { + reject(new Error("Message ID is undefined")); + return; + } - try { // write message to queue and check if it reaches the max size if (this.writeMsg.length < this.writeMsgMaxSize) { this.writeMsg.enqueue(msg); + this.ackEvents.set(ms.id, msg); + + // Listen for message completion + msg.eventEmitter.once('complete', () => { + resolve(); + }); + + msg.eventEmitter.once('error', (error) => { + reject(error); + }); + + // Trigger message sending + setImmediate(() => this.writeMessage()); } else { - throw new Error("Write buffer is full"); + reject(new Error("Write buffer is full")); } - await msg.waitForCompletion(); - } catch (e) { - this.ackEvents.delete(ms.id); - throw e; - } + }); } - // send message TODO: + // send message private writeMessage(): void { if (this.closed || !this.conn) return; - const msg = this.writeMsg.dequeue(); - if (msg) { + // Process all messages in the queue + while (this.writeMsg.length > 0) { + const msg = this.writeMsg.dequeue(); + if (!msg) break; + try { // Send the complete message as JSON string this.conn.send(JSON.stringify(msg.msg)); console.debug("Message sent:", msg.msg); msg.ts = Date.now(); - msg.complete(); + + // Only complete non-ping messages immediately + // Ping messages will be completed when we receive the pong response + if (msg.msg.type !== MessageType.PingMessage) { + msg.complete(); + } } catch (e) { console.error("Failed to send message:", e); if (msg.msg.id) { @@ -323,23 +382,34 @@ export class WebSocketClient { } // keep-alive - private async keepAlive(): Promise { - if (!this.tokenInfo || this.shutdown || this.closed) return; + private keepAlive(): void { + console.debug('[KeepAlive] Start checking...'); + + if (!this.tokenInfo || this.shutdown || this.closed) { + console.debug('[KeepAlive] Skip - tokenInfo/shutdown/closed check failed'); + return; + } const interval = this.tokenInfo.pingInterval / 1000; const timeout = this.tokenInfo.pingTimeout / 1000; const currentTime = Date.now() / 1000; + const timeSinceLastPing = currentTime - (this.lastPingTime || 0); + + console.debug(`[KeepAlive] Current: ${currentTime}, LastPing: ${this.lastPingTime}, Interval: ${interval}, TimeSince: ${timeSinceLastPing}`); - if (currentTime - (this.lastPingTime || 0) >= interval) { + if (timeSinceLastPing >= interval) { + console.debug('[KeepAlive] Sending ping message...'); const pingMsg = this.newPingMessage(); try { - await this.write(pingMsg, timeout); - this.metric.pingSuccess++; + this.write(pingMsg, timeout).catch((e) => console.error("[KeepAlive] Heartbeat ping error:", e)); + console.debug('[KeepAlive] Ping sent'); } catch (e) { - console.error("Heartbeat ping error:", e); + console.error("[KeepAlive] Heartbeat ping error:", e); this.metric.pingErr++; } this.lastPingTime = currentTime; + } else { + console.debug('[KeepAlive] Skip - interval not reached'); } } @@ -388,47 +458,65 @@ export class WebSocketClient { }); } - // TODO: + // Clear all message queues and cleanup resources private clearMessageQueues(): void { - // clear message queues + // Clear read message queue while (this.readMsg.length > 0) { this.readMsg.dequeue(); } - + + // Clear write message queue and reject pending promises while (this.writeMsg.length > 0) { - this.writeMsg.dequeue(); + const writeMsg = this.writeMsg.dequeue(); + if (writeMsg) { + writeMsg.setException(new Error('WebSocket connection closed')); + writeMsg.complete(); + } } + + // Clear ack events + this.ackEvents.forEach((writeMsg) => { + writeMsg.setException(new Error('WebSocket connection closed')); + writeMsg.complete(); + }); + this.ackEvents.clear(); } - // close the WebSocket connection - // TODO: need to confirm the logic of closing the connection, and release the resources that have been opened - private async close(): Promise { - if (this.connected) { - this.shutdown = true; - this.disconnected = true; - this.reconnectClosed = true; - this.connected = false; + // close the WebSocket connection and clean up resources + close(): Promise { + return new Promise((resolve) => { + // Clear intervals + if (this.keepAliveInterval) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = null; + } + if (this.writeInterval) { + clearInterval(this.writeInterval); + this.writeInterval = null; + } - this.ackEvents.forEach(msg => msg.complete()); - this.ackEvents.clear(); + // Clear message queues this.clearMessageQueues(); + // Close WebSocket connection if (this.conn) { + // Listen for close event before closing + this.conn.once('close', () => { + this.conn = null; + this.connected = false; + this.closed = true; + resolve(); + }); + + // Close the connection this.conn.close(); - this.conn = null; + } else { + // If no connection exists, resolve immediately + this.connected = false; this.closed = true; - console.log("WebSocket connection closed."); + resolve(); } - - if (this.keepAliveInterval) clearInterval(this.keepAliveInterval); - if (this.writeInterval) clearInterval(this.writeInterval); - - - console.log("Closing token provider..."); - this.tokenProvider.close(); - this.notifyEvent(WebSocketEvent.EventDisconnected, ""); - console.log("WebSocket client closed."); - } + }); } // TODO: diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 897066b9..05203567 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -20,6 +20,7 @@ import { v4 as uuidv4 } from 'uuid'; */ export class DefaultWsService implements WebSocketService { private readonly option: ClientOption; + private readonly wsOption: WebSocketClientOption; private readonly domain: DomainType; private readonly privateChannel: boolean; private readonly versionString: string; @@ -95,9 +96,10 @@ export class DefaultWsService implements WebSocketService { /** * Starts the message processing loop * Continuously reads messages from the WebSocket connection and dispatches them to appropriate callbacks - * Messages are processed every 1000ms (1 second) + * Messages are processed every 1ms */ private startMessageLoop(): void { + // Process all messages in queue every 1ms this.messageLoop = setInterval(async () => { if (this.stopSignal) { if (this.messageLoop) clearInterval(this.messageLoop); @@ -105,11 +107,11 @@ export class DefaultWsService implements WebSocketService { } try { - // Read messages from the WebSocket client - const messages = await this.client.read(); - if (!messages || messages.length === 0) return; - - for (const msg of messages) { + // Process all messages in the queue + while (true) { + const msg = await this.client.read(); + if (!msg) break; // Exit loop when queue is empty + if (msg.type !== MessageType.Message) continue; const callbackManager = this.topicManager.getCallbackManager(msg.topic); @@ -134,7 +136,7 @@ export class DefaultWsService implements WebSocketService { } catch (err) { console.error('Error in message loop:', err); } - }, 1000); + }, 1); } /** @@ -175,28 +177,28 @@ export class DefaultWsService implements WebSocketService { * Initializes the client connection and starts message processing and recovery loops * @throws Error if client initialization fails */ - async start(): Promise { - try { - await this.client.start(); - this.stopSignal = false; - this.startMessageLoop(); - this.startRecoveryLoop(); - } catch (err) { - console.error('Failed to start client:', err); - throw err; - } + start(): Promise { + return this.client.start() + .then(() => { + this.stopSignal = false; + this.startMessageLoop(); + this.startRecoveryLoop(); + }) + .catch(err => { + console.error('Failed to start client:', err); + throw err; + }); } /** * Stops the WebSocket service - * Cleans up resources by stopping message and recovery loops - * Closes the WebSocket connection + * Clears all intervals and stops the client */ - async stop(): Promise { + stop(): Promise { this.stopSignal = true; if (this.messageLoop) clearInterval(this.messageLoop); if (this.recoveryLoop) clearInterval(this.recoveryLoop); - await this.client.stop(); + return this.client.stop(); } /** @@ -207,44 +209,38 @@ export class DefaultWsService implements WebSocketService { * @returns Promise resolving to subscription ID * @throws Error if subscription fails or is already subscribed */ - async subscribe(prefix: string, args: string[], callback: WebSocketMessageCallback): Promise { - try { - // Create subscription info with prefix, args, and callback - const subInfo = new SubInfo(prefix, args || [], callback); - const subId = subInfo.toId(); - - // Get callback manager for the prefix and attempt to add subscription - const callbackManager = this.topicManager.getCallbackManager(prefix); - const created = callbackManager.add(subInfo); - - // Check if already subscribed - if (!created) { - console.info(`Already subscribed: ${subId}`); - throw new Error('Already subscribed'); - } - - // Create subscription message - const subEvent = new WsMessage(); - subEvent.id = subId; - subEvent.type = MessageType.SubscribeMessage; - subEvent.topic = subInfo.subTopic(); - subEvent.privateChannel = this.privateChannel; - subEvent.response = true; - - try { - // Send subscription request - await this.client.write(subEvent, this.wsOption.writeTimeout); - return subId; - } catch (err) { + subscribe(prefix: string, args: string[], callback: WebSocketMessageCallback): Promise { + // Create subscription info with prefix, args, and callback + const subInfo = new SubInfo(prefix, args || [], callback); + const subId = subInfo.toId(); + + // Get callback manager for the prefix and attempt to add subscription + const callbackManager = this.topicManager.getCallbackManager(prefix); + const created = callbackManager.add(subInfo); + + // Check if already subscribed + if (!created) { + console.info(`Already subscribed: ${subId}`); + return Promise.reject(new Error('Already subscribed')); + } + + // Create subscription message + const subEvent = new WsMessage(); + subEvent.id = subId; + subEvent.type = MessageType.SubscribeMessage; + subEvent.topic = subInfo.subTopic(); + subEvent.privateChannel = this.privateChannel; + subEvent.response = true; + + return this.client.write(subEvent, this.wsOption.writeTimeout) + .then(() => subId) + .catch(err => { // Clean up on failure const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); callbackManager.remove(subId); + console.error(`Subscribe error: ${err}`); throw err; - } - } catch (err) { - console.error(`Subscribe error: ${err}`); - throw err; - } + }); } /** @@ -252,12 +248,12 @@ export class DefaultWsService implements WebSocketService { * @param id - Subscription ID to unsubscribe * @throws Error if unsubscribe operation fails */ - async unsubscribe(id: string): Promise { - return new Promise(async (resolve, reject) => { + unsubscribe(id: string): Promise { + return new Promise((resolve, reject) => { try { const subInfo = SubInfo.fromId(id); const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); - + const subEvent = new WsMessage(); subEvent.id = uuidv4().toString(); @@ -265,18 +261,22 @@ export class DefaultWsService implements WebSocketService { subEvent.topic = subInfo.subTopic(); subEvent.privateChannel = this.privateChannel; subEvent.response = true; - - try { - await this.client.write(subEvent, this.wsOption.writeTimeout); - callbackManager.remove(id); - console.info(`Unsubscribe success: ${id}`); - resolve(); - } catch (err) { - console.error(`Unsubscribe error: ${id}, error: ${err}`); - reject(err); - } - } catch (err) { - reject(err); + + callbackManager.remove(id); + console.log('[DEBUG] callback removed for id:', id); + + this.client.write(subEvent, this.wsOption.writeTimeout) + .then(() => { + console.log('[DEBUG] unsubscribe message sent successfully'); + resolve(); + }) + .catch((e) => { + console.error('[DEBUG] Failed to send unsubscribe message:', e); + reject(e); + }); + } catch (e) { + console.error('[DEBUG] unsubscribe error:', e); + reject(e); } }); } From 7e657a2e6cd0e7e30b186f8ecfbda17ff6036e4f Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 17 Jan 2025 15:16:51 +0800 Subject: [PATCH 035/106] style: Code formatting --- sdk/node/src/internal/infra/default_signer.ts | 27 ++-- .../src/internal/infra/default_ws_callback.ts | 24 ++-- .../src/internal/infra/default_ws_client.ts | 132 ++++++++++-------- .../src/internal/infra/default_ws_service.ts | 54 ++++--- .../infra/default_ws_token_provider.ts | 32 ++--- 5 files changed, 141 insertions(+), 128 deletions(-) diff --git a/sdk/node/src/internal/infra/default_signer.ts b/sdk/node/src/internal/infra/default_signer.ts index d1efb907..8eb2feb6 100644 --- a/sdk/node/src/internal/infra/default_signer.ts +++ b/sdk/node/src/internal/infra/default_signer.ts @@ -18,19 +18,22 @@ export class KcSigner { apiPassphrase: string = '', brokerName: string = '', brokerPartner: string = '', - brokerKey: string = '' + brokerKey: string = '', ) { this.apiKey = apiKey; this.apiSecret = apiSecret; - this.apiPassphrase = apiPassphrase && apiSecret - ? this.sign(Buffer.from(apiPassphrase), Buffer.from(apiSecret)) - : apiPassphrase; + this.apiPassphrase = + apiPassphrase && apiSecret + ? this.sign(Buffer.from(apiPassphrase), Buffer.from(apiSecret)) + : apiPassphrase; this.brokerName = brokerName; this.brokerPartner = brokerPartner; this.brokerKey = brokerKey; if (!apiKey || !apiSecret || !apiPassphrase) { - console.warn('[AUTH WARNING] API credentials incomplete. Access is restricted to public interfaces only.'); + console.warn( + '[AUTH WARNING] API credentials incomplete. Access is restricted to public interfaces only.', + ); } } @@ -58,7 +61,7 @@ export class KcSigner { 'KC-API-PASSPHRASE': this.apiPassphrase, 'KC-API-TIMESTAMP': timestamp, 'KC-API-SIGN': signature, - 'KC-API-KEY-VERSION': '2' + 'KC-API-KEY-VERSION': '2', }; return headers; @@ -75,16 +78,10 @@ export class KcSigner { const timestamp = Date.now().toString(); const signatureInput = timestamp + plain; - const signature = this.sign( - Buffer.from(signatureInput), - Buffer.from(this.apiSecret) - ); + const signature = this.sign(Buffer.from(signatureInput), Buffer.from(this.apiSecret)); const partnerInput = timestamp + this.brokerPartner + this.apiKey; - const partnerSignature = this.sign( - Buffer.from(partnerInput), - Buffer.from(this.apiSecret) - ); + const partnerSignature = this.sign(Buffer.from(partnerInput), Buffer.from(this.apiSecret)); const headers = { 'KC-API-KEY': this.apiKey, @@ -95,7 +92,7 @@ export class KcSigner { 'KC-API-PARTNER': this.brokerPartner, 'KC-BROKER-NAME': this.brokerName, 'KC-API-PARTNER-VERIFY': 'true', - 'KC-API-PARTNER-SIGN': partnerSignature + 'KC-API-PARTNER-SIGN': partnerSignature, }; return headers; diff --git a/sdk/node/src/internal/infra/default_ws_callback.ts b/sdk/node/src/internal/infra/default_ws_callback.ts index 94d4b33d..d57380f2 100644 --- a/sdk/node/src/internal/infra/default_ws_callback.ts +++ b/sdk/node/src/internal/infra/default_ws_callback.ts @@ -2,14 +2,14 @@ import { WebSocketMessageCallback } from '../interfaces/websocket'; import { SubInfo } from '@internal/util/sub'; // callback class, used to store callback function and related info -// callback: callback function +// callback: callback function // id:function id // topic:topic related class Callback { constructor( public callback: WebSocketMessageCallback, public id: string, - public topic: string + public topic: string, ) {} } @@ -25,7 +25,7 @@ export class CallbackManager { this.topicPrefix = topicPrefix; } - // + // isEmpty(): boolean { return this.idTopicMapping.size === 0 && this.topicCallbackMapping.size === 0; } @@ -33,16 +33,15 @@ export class CallbackManager { // get sub info getSubInfo(): SubInfo[] { const subInfoList: SubInfo[] = []; - - + for (const topics of this.idTopicMapping.values()) { - // + // const info = new SubInfo(this.topicPrefix, [], null); - + // for (const topic of topics.keys()) { // split topic - const parts = topic.split(":"); + const parts = topic.split(':'); // if split into 2 parts, then it's a valid topic if (parts.length === 2) { // add the second part to info.args @@ -61,7 +60,7 @@ export class CallbackManager { // add to list subInfoList.push(info); } - + // return list of sub info return subInfoList; } @@ -89,10 +88,7 @@ export class CallbackManager { // add topic to map topicMap.set(topic, true); // add new Callback object to topicCallbackMapping - this.topicCallbackMapping.set( - topic, - new Callback(subInfo.callback!, id, topic) - ); + this.topicCallbackMapping.set(topic, new Callback(subInfo.callback!, id, topic)); } // add id and topic map to idTopicMapping @@ -132,7 +128,7 @@ export class TopicManager { getCallbackManager(topic: string): CallbackManager { const parts = topic.split(':'); let prefix = topic; - if (parts.length === 2 && parts[1] !== "all") { + if (parts.length === 2 && parts[1] !== 'all') { prefix = parts[0]; } diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index a75d10c1..acf59b1d 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -8,7 +8,6 @@ import { WebSocketClientOption } from '../../model/websocket_option'; import { WebSocketEvent } from '../../model/websocket_option'; import { WsToken, WsTokenProvider } from '../interfaces/websocket'; - export class WriteMsg { public msg: WsMessage; public ts: number; @@ -62,7 +61,6 @@ export class WebSocketClient { private eventEmitter: EventEmitter; private lastPingTime: number | null; - constructor(tokenProvider: WsTokenProvider, options: WebSocketClientOption) { this.options = options; this.conn = null; @@ -94,26 +92,26 @@ export class WebSocketClient { // # Start the WebSocket client start(): Promise { if (this.connected) { - console.warn("WebSocket client is already connected."); + console.warn('WebSocket client is already connected.'); return Promise.resolve(); } return this.dial() .then(() => { this.connected = true; - this.notifyEvent(WebSocketEvent.EventConnected, ""); + this.notifyEvent(WebSocketEvent.EventConnected, ''); this.run(); this.reconnect(); }) - .catch(err => { - console.error("Failed to start WebSocket client:", err); + .catch((err) => { + console.error('Failed to start WebSocket client:', err); throw err; }); } // Start the message processing and keep-alive private run(): void { - // + // if (!this.keepAliveInterval) { this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); } @@ -128,7 +126,7 @@ export class WebSocketClient { // Set shutdown flag to prevent reconnection attempts this.shutdown = true; this.reconnectClosed = true; - + // Clear intervals if (this.keepAliveInterval) { clearInterval(this.keepAliveInterval); @@ -154,14 +152,15 @@ export class WebSocketClient { // dial connects to the WebSocket server private dial(): Promise { - return this.tokenProvider.getToken() - .then(tokenInfos => { + return this.tokenProvider + .getToken() + .then((tokenInfos) => { this.tokenInfo = this.randomEndpoint(tokenInfos); - + // create WebSocket connection const queryParams = new URLSearchParams({ connectId: Date.now().toString(), - token: this.tokenInfo.token + token: this.tokenInfo.token, }); // create WebSocket connection @@ -182,26 +181,26 @@ export class WebSocketClient { setTimeout(() => { if (!this.welcomeReceived) { - reject(new Error("Did not receive welcome message")); + reject(new Error('Did not receive welcome message')); } }, 5000); }); }) - .catch(err => { - console.error("Failed to dial WebSocket server:", err); + .catch((err) => { + console.error('Failed to dial WebSocket server:', err); throw err; }); } // open callback private onOpen(): void { - console.log("WebSocket connection opened."); - this.notifyEvent(WebSocketEvent.EventConnected, "WebSocket connection opened."); + console.log('WebSocket connection opened.'); + this.notifyEvent(WebSocketEvent.EventConnected, 'WebSocket connection opened.'); } // error callback private onError(error: Error): void { - console.error("WebSocket error:", error); + console.error('WebSocket error:', error); this.disconnected = true; } @@ -229,41 +228,41 @@ export class WebSocketClient { // receive message callback private onMessage(message: string): void { if (this.shutdown || this.closed) { - console.debug("Ignoring message as client is shutting down or closed"); + console.debug('Ignoring message as client is shutting down or closed'); return; } - console.debug("onMessage Received type:message message:" + message); + console.debug('onMessage Received type:message message:' + message); let m: WsMessage; try { m = JSON.parse(message); } catch (e) { - console.error("Failed to parse message:", e); + console.error('Failed to parse message:', e); return; } switch (m.type) { case MessageType.WelcomeMessage: this.welcomeReceived = true; - console.log("Welcome message received."); + console.log('Welcome message received.'); break; case MessageType.Message: if (!this.shutdown && !this.closed) { - this.notifyEvent(WebSocketEvent.EventMessageReceived, ""); + this.notifyEvent(WebSocketEvent.EventMessageReceived, ''); // queue message if (this.readMsg.length < this.readMsgMaxSize) { this.readMsg.enqueue(m); } else { - this.notifyEvent(WebSocketEvent.EventReadBufferFull, ""); - console.warn("Read buffer full"); + this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); + console.warn('Read buffer full'); } } break; case MessageType.PongMessage: - this.notifyEvent(WebSocketEvent.EventPongReceived, ""); - console.debug("PONG received"); + this.notifyEvent(WebSocketEvent.EventPongReceived, ''); + console.debug('PONG received'); this.handleAckEvent(m); break; @@ -273,7 +272,7 @@ export class WebSocketClient { break; default: - console.warn("Unknown message type:", m.type); + console.warn('Unknown message type:', m.type); } } @@ -317,15 +316,15 @@ export class WebSocketClient { // write message write(ms: WsMessage, timeout: number): Promise { return new Promise((resolve, reject) => { - console.log("Write message:", ms); + console.log('Write message:', ms); if (!this.connected) { - reject(new Error("Not connected")); + reject(new Error('Not connected')); return; } const msg = new WriteMsg(ms, timeout); if (!ms.id) { - reject(new Error("Message ID is undefined")); + reject(new Error('Message ID is undefined')); return; } @@ -333,7 +332,7 @@ export class WebSocketClient { if (this.writeMsg.length < this.writeMsgMaxSize) { this.writeMsg.enqueue(msg); this.ackEvents.set(ms.id, msg); - + // Listen for message completion msg.eventEmitter.once('complete', () => { resolve(); @@ -346,12 +345,12 @@ export class WebSocketClient { // Trigger message sending setImmediate(() => this.writeMessage()); } else { - reject(new Error("Write buffer is full")); + reject(new Error('Write buffer is full')); } }); } - // send message + // send message private writeMessage(): void { if (this.closed || !this.conn) return; @@ -363,16 +362,16 @@ export class WebSocketClient { try { // Send the complete message as JSON string this.conn.send(JSON.stringify(msg.msg)); - console.debug("Message sent:", msg.msg); + console.debug('Message sent:', msg.msg); msg.ts = Date.now(); - + // Only complete non-ping messages immediately // Ping messages will be completed when we receive the pong response if (msg.msg.type !== MessageType.PingMessage) { msg.complete(); } } catch (e) { - console.error("Failed to send message:", e); + console.error('Failed to send message:', e); if (msg.msg.id) { this.ackEvents.delete(msg.msg.id); } @@ -384,7 +383,7 @@ export class WebSocketClient { // keep-alive private keepAlive(): void { console.debug('[KeepAlive] Start checking...'); - + if (!this.tokenInfo || this.shutdown || this.closed) { console.debug('[KeepAlive] Skip - tokenInfo/shutdown/closed check failed'); return; @@ -395,16 +394,20 @@ export class WebSocketClient { const currentTime = Date.now() / 1000; const timeSinceLastPing = currentTime - (this.lastPingTime || 0); - console.debug(`[KeepAlive] Current: ${currentTime}, LastPing: ${this.lastPingTime}, Interval: ${interval}, TimeSince: ${timeSinceLastPing}`); + console.debug( + `[KeepAlive] Current: ${currentTime}, LastPing: ${this.lastPingTime}, Interval: ${interval}, TimeSince: ${timeSinceLastPing}`, + ); if (timeSinceLastPing >= interval) { console.debug('[KeepAlive] Sending ping message...'); const pingMsg = this.newPingMessage(); try { - this.write(pingMsg, timeout).catch((e) => console.error("[KeepAlive] Heartbeat ping error:", e)); + this.write(pingMsg, timeout).catch((e) => + console.error('[KeepAlive] Heartbeat ping error:', e), + ); console.debug('[KeepAlive] Ping sent'); } catch (e) { - console.error("[KeepAlive] Heartbeat ping error:", e); + console.error('[KeepAlive] Heartbeat ping error:', e); this.metric.pingErr++; } this.lastPingTime = currentTime; @@ -417,23 +420,30 @@ export class WebSocketClient { const reconnectLoop = async () => { while (!this.reconnectClosed) { if (this.disconnected && !this.shutdown) { - console.log("Broken WebSocket connection, starting reconnection"); + console.log('Broken WebSocket connection, starting reconnection'); await this.close(); - this.notifyEvent(WebSocketEvent.EventTryReconnect, ""); + this.notifyEvent(WebSocketEvent.EventTryReconnect, ''); this.disconnected = false; let attempt = 0; let reconnected = false; - while (!reconnected && - this.options.reconnect && - (this.options.reconnectAttempts === -1 || attempt < this.options.reconnectAttempts)) { - console.log(`Reconnecting in ${this.options.reconnectInterval} seconds... (attempt ${attempt})`); - await new Promise(resolve => setTimeout(resolve, this.options.reconnectInterval * 1000)); + while ( + !reconnected && + this.options.reconnect && + (this.options.reconnectAttempts === -1 || + attempt < this.options.reconnectAttempts) + ) { + console.log( + `Reconnecting in ${this.options.reconnectInterval} seconds... (attempt ${attempt})`, + ); + await new Promise((resolve) => + setTimeout(resolve, this.options.reconnectInterval * 1000), + ); try { await this.dial(); - this.notifyEvent(WebSocketEvent.EventConnected, ""); + this.notifyEvent(WebSocketEvent.EventConnected, ''); this.connected = true; this.run(); reconnected = true; @@ -445,16 +455,16 @@ export class WebSocketClient { } if (!reconnected) { - this.notifyEvent(WebSocketEvent.EventClientFail, ""); - console.error("Failed to reconnect after all attempts."); + this.notifyEvent(WebSocketEvent.EventClientFail, ''); + console.error('Failed to reconnect after all attempts.'); } } - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); } }; - reconnectLoop().catch(err => { - console.error("Error in reconnect loop:", err); + reconnectLoop().catch((err) => { + console.error('Error in reconnect loop:', err); }); } @@ -464,7 +474,7 @@ export class WebSocketClient { while (this.readMsg.length > 0) { this.readMsg.dequeue(); } - + // Clear write message queue and reject pending promises while (this.writeMsg.length > 0) { const writeMsg = this.writeMsg.dequeue(); @@ -473,7 +483,7 @@ export class WebSocketClient { writeMsg.complete(); } } - + // Clear ack events this.ackEvents.forEach((writeMsg) => { writeMsg.setException(new Error('WebSocket connection closed')); @@ -520,25 +530,25 @@ export class WebSocketClient { } // TODO: - private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ""): void { + private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { try { if (this.options.eventCallback) { this.options.eventCallback(event, msg); } } catch (e) { - console.error("Exception in notify_event:", e); + console.error('Exception in notify_event:', e); } } - // + // private randomEndpoint(tokens: WsToken[]): WsToken { if (!tokens.length) { - throw new Error("Tokens list is empty"); + throw new Error('Tokens list is empty'); } return tokens[Math.floor(Math.random() * tokens.length)]; } - // + // private newPingMessage(): WsMessage { const pingMessage = new WsMessage(); pingMessage.id = Date.now().toString(); diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 05203567..7ccd4cfe 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -55,7 +55,7 @@ export class DefaultWsService implements WebSocketService { this.topicManager = new TopicManager(); this.client = new WebSocketClient( new DefaultWsTokenProvider(this.tokenTransport, domain, privateChannel), - this.wsOption + this.wsOption, ); } @@ -88,7 +88,10 @@ export class DefaultWsService implements WebSocketService { this.notifyEvent(WebSocketEvent.EventReSubscribeOK, subId); } } catch (err) { - this.notifyEvent(WebSocketEvent.EventReSubscribeError, `id: ${sub.toId()}, err: ${err}`); + this.notifyEvent( + WebSocketEvent.EventReSubscribeError, + `id: ${sub.toId()}, err: ${err}`, + ); } } } @@ -110,19 +113,23 @@ export class DefaultWsService implements WebSocketService { // Process all messages in the queue while (true) { const msg = await this.client.read(); - if (!msg) break; // Exit loop when queue is empty - + if (!msg) break; // Exit loop when queue is empty + if (msg.type !== MessageType.Message) continue; const callbackManager = this.topicManager.getCallbackManager(msg.topic); if (!callbackManager) { - console.error(`Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`); + console.error( + `Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`, + ); continue; } const cb = callbackManager.get(msg.topic); if (!cb) { - console.error(`Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`); + console.error( + `Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`, + ); continue; } @@ -153,20 +160,20 @@ export class DefaultWsService implements WebSocketService { if (this.client.isReconnected()) { console.info('WebSocket client reconnected, resubscribe...'); - + const oldTopicManager = this.topicManager; this.topicManager = new TopicManager(); - + // Create an array of promises for all resubscribe operations const resubscribePromises: Promise[] = []; oldTopicManager.range((key, value) => { resubscribePromises.push(this.resubscribe(value)); return true; }); - + // Wait for all resubscribe operations to complete await Promise.all(resubscribePromises); - + this.client.clearReconnectedFlag(); } }, 1000); @@ -178,13 +185,14 @@ export class DefaultWsService implements WebSocketService { * @throws Error if client initialization fails */ start(): Promise { - return this.client.start() + return this.client + .start() .then(() => { this.stopSignal = false; this.startMessageLoop(); this.startRecoveryLoop(); }) - .catch(err => { + .catch((err) => { console.error('Failed to start client:', err); throw err; }); @@ -213,17 +221,17 @@ export class DefaultWsService implements WebSocketService { // Create subscription info with prefix, args, and callback const subInfo = new SubInfo(prefix, args || [], callback); const subId = subInfo.toId(); - + // Get callback manager for the prefix and attempt to add subscription const callbackManager = this.topicManager.getCallbackManager(prefix); const created = callbackManager.add(subInfo); - + // Check if already subscribed if (!created) { console.info(`Already subscribed: ${subId}`); return Promise.reject(new Error('Already subscribed')); } - + // Create subscription message const subEvent = new WsMessage(); subEvent.id = subId; @@ -231,10 +239,11 @@ export class DefaultWsService implements WebSocketService { subEvent.topic = subInfo.subTopic(); subEvent.privateChannel = this.privateChannel; subEvent.response = true; - - return this.client.write(subEvent, this.wsOption.writeTimeout) + + return this.client + .write(subEvent, this.wsOption.writeTimeout) .then(() => subId) - .catch(err => { + .catch((err) => { // Clean up on failure const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); callbackManager.remove(subId); @@ -253,7 +262,7 @@ export class DefaultWsService implements WebSocketService { try { const subInfo = SubInfo.fromId(id); const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); - + const subEvent = new WsMessage(); subEvent.id = uuidv4().toString(); @@ -261,11 +270,12 @@ export class DefaultWsService implements WebSocketService { subEvent.topic = subInfo.subTopic(); subEvent.privateChannel = this.privateChannel; subEvent.response = true; - + callbackManager.remove(id); console.log('[DEBUG] callback removed for id:', id); - - this.client.write(subEvent, this.wsOption.writeTimeout) + + this.client + .write(subEvent, this.wsOption.writeTimeout) .then(() => { console.log('[DEBUG] unsubscribe message sent successfully'); resolve(); diff --git a/sdk/node/src/internal/infra/default_ws_token_provider.ts b/sdk/node/src/internal/infra/default_ws_token_provider.ts index d4670708..b2b527d9 100644 --- a/sdk/node/src/internal/infra/default_ws_token_provider.ts +++ b/sdk/node/src/internal/infra/default_ws_token_provider.ts @@ -64,14 +64,14 @@ export class TokenResponseImpl implements TokenResponse { token: obj.token, instanceServers: Array.isArray(obj.instanceServers) ? obj.instanceServers.map((item: any) => ({ - token: item.token || '', - pingInterval: item.pingInterval || 0, - endpoint: item.endpoint || '', - protocol: item.protocol || '', - encrypt: item.encrypt || false, - pingTimeout: item.pingTimeout || 0 - })) - : undefined + token: item.token || '', + pingInterval: item.pingInterval || 0, + endpoint: item.endpoint || '', + protocol: item.protocol || '', + encrypt: item.encrypt || false, + pingTimeout: item.pingTimeout || 0, + })) + : undefined, }); } @@ -83,7 +83,7 @@ export class TokenResponseImpl implements TokenResponse { toJson(): string { return JSON.stringify({ token: this.token, - instanceServers: this.instanceServers + instanceServers: this.instanceServers, }); } @@ -115,28 +115,28 @@ export class DefaultWsTokenProvider implements WsTokenProvider { */ async getToken(): Promise { const path = this.isPrivate ? PATH_PRIVATE : PATH_PUBLIC; - + try { const response = new TokenResponseImpl(); - const result = await this.transport.call( + const result = (await this.transport.call( this.domain, false, 'POST', path, null, response, - false - ) as TokenResponseImpl; + false, + )) as TokenResponseImpl; if (result.instanceServers && result.token) { // Assign token to each instance server - const token: string = result.token; - result.instanceServers.forEach(server => { + const token: string = result.token; + result.instanceServers.forEach((server) => { server.token = token; }); return result.instanceServers; } - + return []; } catch (error) { throw error; From ab45c6a96d6c1518ebd38ad2cd90176d7e00973c Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 15:25:21 +0800 Subject: [PATCH 036/106] feat(nodejs): update api --- .../node-sdk/api_test_template.mustache | 1 + sdk/node/CHANGELOG.md | 10 + .../account/account/api_account.template | 317 ++--- .../account/account/api_account.test.ts | 362 ++--- .../generate/account/account/api_account.ts | 346 ++--- .../account/deposit/api_deposit.template | 123 +- .../account/deposit/api_deposit.test.ts | 156 +-- .../generate/account/deposit/api_deposit.ts | 110 +- .../src/generate/account/fee/api_fee.template | 3 + .../subaccount/api_sub_account.template | 213 +-- .../subaccount/api_sub_account.test.ts | 340 ++--- .../account/subaccount/api_sub_account.ts | 310 ++--- .../account/transfer/api_transfer.template | 103 +- .../account/transfer/api_transfer.test.ts | 130 +- .../generate/account/transfer/api_transfer.ts | 160 +-- .../withdrawal/api_withdrawal.template | 126 +- .../account/withdrawal/api_withdrawal.test.ts | 154 +-- .../account/withdrawal/api_withdrawal.ts | 104 +- .../affiliate/api_affiliate.template | 1 + .../broker/apibroker/api_api_broker.template | 1 + .../broker/ndbroker/api_nd_broker.template | 223 +-- .../broker/ndbroker/api_nd_broker.test.ts | 272 ++-- .../generate/broker/ndbroker/api_nd_broker.ts | 174 +-- .../copytrading/futures/api_futures.template | 224 +++ .../copytrading/futures/api_futures.test.ts | 389 ++++++ .../copytrading/futures/api_futures.ts | 343 +++++ .../src/generate/copytrading/futures/index.ts | 23 + .../futures/model_add_isolated_margin_req.ts | 95 ++ .../futures/model_add_isolated_margin_resp.ts | 175 +++ .../futures/model_add_order_req.ts | 451 +++++++ .../futures/model_add_order_resp.ts | 39 + .../futures/model_add_order_test_req.ts | 452 +++++++ .../futures/model_add_order_test_resp.ts | 39 + .../futures/model_add_tpsl_order_req.ts | 442 ++++++ .../futures/model_add_tpsl_order_resp.ts | 39 + .../model_cancel_order_by_client_oid_req.ts | 78 ++ .../model_cancel_order_by_client_oid_resp.ts | 37 + .../futures/model_cancel_order_by_id_req.ts | 61 + .../futures/model_cancel_order_by_id_resp.ts | 35 + .../futures/model_get_max_open_size_req.ts | 95 ++ .../futures/model_get_max_open_size_resp.ts | 43 + .../model_get_max_withdraw_margin_req.ts | 61 + .../model_get_max_withdraw_margin_resp.ts | 35 + .../model_modify_auto_deposit_status_req.ts | 78 ++ .../model_modify_auto_deposit_status_resp.ts | 37 + ...el_modify_isolated_margin_risk_limt_req.ts | 80 ++ ...l_modify_isolated_margin_risk_limt_resp.ts | 37 + .../model_remove_isolated_margin_req.ts | 78 ++ .../model_remove_isolated_margin_resp.ts | 35 + sdk/node/src/generate/copytrading/index.ts | 4 + .../src/generate/earn/earn/api_earn.template | 149 +- .../src/generate/earn/earn/api_earn.test.ts | 210 +-- sdk/node/src/generate/earn/earn/api_earn.ts | 148 +- .../fundingfees/api_funding_fees.template | 45 +- .../fundingfees/api_funding_fees.test.ts | 66 +- .../futures/fundingfees/api_funding_fees.ts | 54 +- .../futures/market/api_market.template | 285 ++-- .../futures/market/api_market.test.ts | 366 ++--- .../src/generate/futures/market/api_market.ts | 266 ++-- .../generate/futures/order/api_order.template | 346 ++--- .../generate/futures/order/api_order.test.ts | 382 +++--- .../src/generate/futures/order/api_order.ts | 282 ++-- .../order/model_cancel_all_orders_v3_req.ts | 6 +- .../futures/positions/api_positions.template | 274 ++-- .../futures/positions/api_positions.test.ts | 340 ++--- .../futures/positions/api_positions.ts | 260 ++-- sdk/node/src/generate/index.ts | 1 + .../margin/credit/api_credit.template | 81 +- .../generate/margin/credit/api_credit.test.ts | 142 +- .../src/generate/margin/credit/api_credit.ts | 106 +- .../generate/margin/debit/api_debit.template | 78 +- .../generate/margin/debit/api_debit.test.ts | 90 +- .../src/generate/margin/debit/api_debit.ts | 64 +- .../margin/market/api_market.template | 78 +- .../generate/margin/market/api_market.test.ts | 124 +- .../src/generate/margin/market/api_market.ts | 84 +- .../generate/margin/order/api_order.template | 257 ++-- .../generate/margin/order/api_order.test.ts | 304 ++--- .../src/generate/margin/order/api_order.ts | 208 +-- .../margin/risklimit/api_risk_limit.template | 1 + .../src/generate/service/copytrading_api.ts | 23 + sdk/node/src/generate/service/index.ts | 1 + .../generate/spot/market/api_market.template | 374 +++--- .../generate/spot/market/api_market.test.ts | 454 +++---- .../src/generate/spot/market/api_market.ts | 322 ++--- .../generate/spot/order/api_order.template | 1110 +++++++-------- .../src/generate/spot/order/api_order.test.ts | 1196 ++++++++--------- sdk/node/src/generate/spot/order/api_order.ts | 942 ++++++------- sdk/node/src/generate/version.ts | 2 +- .../viplending/api_vip_lending.template | 26 +- .../viplending/api_vip_lending.test.ts | 30 +- .../viplending/viplending/api_vip_lending.ts | 28 +- sdk/node/tsconfig.json | 1 + 93 files changed, 10310 insertions(+), 6540 deletions(-) create mode 100644 sdk/node/CHANGELOG.md create mode 100644 sdk/node/src/generate/copytrading/futures/api_futures.template create mode 100644 sdk/node/src/generate/copytrading/futures/api_futures.test.ts create mode 100644 sdk/node/src/generate/copytrading/futures/api_futures.ts create mode 100644 sdk/node/src/generate/copytrading/futures/index.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_order_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts create mode 100644 sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts create mode 100644 sdk/node/src/generate/copytrading/index.ts create mode 100644 sdk/node/src/generate/service/copytrading_api.ts diff --git a/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache b/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache index 5e02adfb..702c816b 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_test_template.mustache @@ -29,6 +29,7 @@ describe('Auto Test', ()=> { {{#vars}} expect(result.{{name}}).toEqual(expect.anything()); {{/vars}} + console.log(resp); {{/vendorExtensions.x-response-model}} }); }) diff --git a/sdk/node/CHANGELOG.md b/sdk/node/CHANGELOG.md new file mode 100644 index 00000000..b078f665 --- /dev/null +++ b/sdk/node/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## 2025-01-16(1.1.0) +- Updated the API sequence to be consistent with the documentation. +- Updated the license. +- Added Copy Trading API. + +## 2024-12-31(1.0.0) + +- Released the official version 1.0.0. \ No newline at end of file diff --git a/sdk/node/src/generate/account/account/api_account.template b/sdk/node/src/generate/account/account/api_account.template index 8cda5c02..954eed56 100644 --- a/sdk/node/src/generate/account/account/api_account.template +++ b/sdk/node/src/generate/account/account/api_account.template @@ -5,26 +5,77 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getFuturesAccount request test', ()=> { + test('getAccountInfo request test', ()=> { /** - * getFuturesAccount - * Get Account - Futures - * /api/v1/account-overview + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info */ - let builder = GetFuturesAccountReq.builder(); - builder.setCurrency(?); + let resp = api.getAccountInfo(); + return resp.then(result => { + expect(result.level).toEqual(expect.anything()); + expect(result.subQuantity).toEqual(expect.anything()); + expect(result.spotSubQuantity).toEqual(expect.anything()); + expect(result.marginSubQuantity).toEqual(expect.anything()); + expect(result.futuresSubQuantity).toEqual(expect.anything()); + expect(result.optionSubQuantity).toEqual(expect.anything()); + expect(result.maxSubQuantity).toEqual(expect.anything()); + expect(result.maxDefaultSubQuantity).toEqual(expect.anything()); + expect(result.maxSpotSubQuantity).toEqual(expect.anything()); + expect(result.maxMarginSubQuantity).toEqual(expect.anything()); + expect(result.maxFuturesSubQuantity).toEqual(expect.anything()); + expect(result.maxOptionSubQuantity).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getApikeyInfo request test', ()=> { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + let resp = api.getApikeyInfo(); + return resp.then(result => { + expect(result.remark).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.isMaster).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getSpotAccountType request test', ()=> { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + let resp = api.getSpotAccountType(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getSpotAccountList request test', ()=> { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let builder = GetSpotAccountListReq.builder(); + builder.setCurrency(?).setType(?); let req = builder.build(); - let resp = api.getFuturesAccount(req); + let resp = api.getSpotAccountList(req); return resp.then(result => { - expect(result.accountEquity).toEqual(expect.anything()); - expect(result.unrealisedPNL).toEqual(expect.anything()); - expect(result.marginBalance).toEqual(expect.anything()); - expect(result.positionMargin).toEqual(expect.anything()); - expect(result.orderMargin).toEqual(expect.anything()); - expect(result.frozenFunds).toEqual(expect.anything()); - expect(result.availableBalance).toEqual(expect.anything()); - expect(result.currency).toEqual(expect.anything()); - expect(result.riskRatio).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -43,21 +94,70 @@ describe('Auto Test', ()=> { expect(result.balance).toEqual(expect.anything()); expect(result.available).toEqual(expect.anything()); expect(result.holds).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSpotAccountList request test', ()=> { + test('getCrossMarginAccount request test', ()=> { /** - * getSpotAccountList - * Get Account List - Spot - * /api/v1/accounts + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts */ - let builder = GetSpotAccountListReq.builder(); - builder.setCurrency(?).setType(?); + let builder = GetCrossMarginAccountReq.builder(); + builder.setQuoteCurrency(?).setQueryType(?); let req = builder.build(); - let resp = api.getSpotAccountList(req); + let resp = api.getCrossMarginAccount(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getIsolatedMarginAccount request test', ()=> { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let builder = GetIsolatedMarginAccountReq.builder(); + builder.setSymbol(?).setQuoteCurrency(?).setQueryType(?); + let req = builder.build(); + let resp = api.getIsolatedMarginAccount(req); + return resp.then(result => { + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.timestamp).toEqual(expect.anything()); + expect(result.assets).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getFuturesAccount request test', ()=> { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let builder = GetFuturesAccountReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getFuturesAccount(req); + return resp.then(result => { + expect(result.accountEquity).toEqual(expect.anything()); + expect(result.unrealisedPNL).toEqual(expect.anything()); + expect(result.marginBalance).toEqual(expect.anything()); + expect(result.positionMargin).toEqual(expect.anything()); + expect(result.orderMargin).toEqual(expect.anything()); + expect(result.frozenFunds).toEqual(expect.anything()); + expect(result.availableBalance).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.riskRatio).toEqual(expect.anything()); + console.log(resp); }); }) @@ -77,6 +177,7 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -92,67 +193,23 @@ describe('Auto Test', ()=> { let resp = api.getSpotHFLedger(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSpotAccountType request test', ()=> { - /** - * getSpotAccountType - * Get Account Type - Spot - * /api/v1/hf/accounts/opened - */ - let resp = api.getSpotAccountType(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getIsolatedMarginAccountDetailV1 request test', ()=> { - /** - * getIsolatedMarginAccountDetailV1 - * Get Account Detail - Isolated Margin - V1 - * /api/v1/isolated/account/{symbol} - */ - let builder = GetIsolatedMarginAccountDetailV1Req.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getIsolatedMarginAccountDetailV1(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - expect(result.debtRatio).toEqual(expect.anything()); - expect(result.baseAsset).toEqual(expect.anything()); - expect(result.quoteAsset).toEqual(expect.anything()); - }); - }) - - test('getIsolatedMarginAccountListV1 request test', ()=> { + test('getMarginHFLedger request test', ()=> { /** - * getIsolatedMarginAccountListV1 - * Get Account List - Isolated Margin - V1 - * /api/v1/isolated/accounts + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers */ - let builder = GetIsolatedMarginAccountListV1Req.builder(); - builder.setBalanceCurrency(?); + let builder = GetMarginHFLedgerReq.builder(); + builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); let req = builder.build(); - let resp = api.getIsolatedMarginAccountListV1(req); - return resp.then(result => { - expect(result.totalConversionBalance).toEqual(expect.anything()); - expect(result.liabilityConversionBalance).toEqual(expect.anything()); - expect(result.assets).toEqual(expect.anything()); - }); - }) - - test('getMarginAccountDetail request test', ()=> { - /** - * getMarginAccountDetail - * Get Account Detail - Margin - * /api/v1/margin/account - */ - let resp = api.getMarginAccountDetail(); + let resp = api.getMarginHFLedger(req); return resp.then(result => { - expect(result.debtRatio).toEqual(expect.anything()); - expect(result.accounts).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -169,101 +226,59 @@ describe('Auto Test', ()=> { return resp.then(result => { expect(result.dataList).toEqual(expect.anything()); expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); }); }) - test('getApikeyInfo request test', ()=> { - /** - * getApikeyInfo - * Get Apikey Info - * /api/v1/user/api-key - */ - let resp = api.getApikeyInfo(); - return resp.then(result => { - expect(result.remark).toEqual(expect.anything()); - expect(result.apiKey).toEqual(expect.anything()); - expect(result.apiVersion).toEqual(expect.anything()); - expect(result.permission).toEqual(expect.anything()); - expect(result.ipWhitelist).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); - expect(result.uid).toEqual(expect.anything()); - expect(result.isMaster).toEqual(expect.anything()); - expect(result.subName).toEqual(expect.anything()); - }); - }) - - test('getAccountInfo request test', ()=> { - /** - * getAccountInfo - * Get Account Summary Info - * /api/v2/user-info - */ - let resp = api.getAccountInfo(); - return resp.then(result => { - expect(result.level).toEqual(expect.anything()); - expect(result.subQuantity).toEqual(expect.anything()); - expect(result.spotSubQuantity).toEqual(expect.anything()); - expect(result.marginSubQuantity).toEqual(expect.anything()); - expect(result.futuresSubQuantity).toEqual(expect.anything()); - expect(result.optionSubQuantity).toEqual(expect.anything()); - expect(result.maxSubQuantity).toEqual(expect.anything()); - expect(result.maxDefaultSubQuantity).toEqual(expect.anything()); - expect(result.maxSpotSubQuantity).toEqual(expect.anything()); - expect(result.maxMarginSubQuantity).toEqual(expect.anything()); - expect(result.maxFuturesSubQuantity).toEqual(expect.anything()); - expect(result.maxOptionSubQuantity).toEqual(expect.anything()); - }); - }) - - test('getMarginHFLedger request test', ()=> { + test('getMarginAccountDetail request test', ()=> { /** - * getMarginHFLedger - * Get Account Ledgers - Margin_hf - * /api/v3/hf/margin/account/ledgers + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account */ - let builder = GetMarginHFLedgerReq.builder(); - builder.setCurrency(?).setDirection(?).setBizType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); - let req = builder.build(); - let resp = api.getMarginHFLedger(req); + let resp = api.getMarginAccountDetail(); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); }); }) - test('getIsolatedMarginAccount request test', ()=> { + test('getIsolatedMarginAccountListV1 request test', ()=> { /** - * getIsolatedMarginAccount - * Get Account - Isolated Margin - * /api/v3/isolated/accounts + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts */ - let builder = GetIsolatedMarginAccountReq.builder(); - builder.setSymbol(?).setQuoteCurrency(?).setQueryType(?); + let builder = GetIsolatedMarginAccountListV1Req.builder(); + builder.setBalanceCurrency(?); let req = builder.build(); - let resp = api.getIsolatedMarginAccount(req); + let resp = api.getIsolatedMarginAccountListV1(req); return resp.then(result => { - expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); - expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); - expect(result.timestamp).toEqual(expect.anything()); + expect(result.totalConversionBalance).toEqual(expect.anything()); + expect(result.liabilityConversionBalance).toEqual(expect.anything()); expect(result.assets).toEqual(expect.anything()); + console.log(resp); }); }) - test('getCrossMarginAccount request test', ()=> { + test('getIsolatedMarginAccountDetailV1 request test', ()=> { /** - * getCrossMarginAccount - * Get Account - Cross Margin - * /api/v3/margin/accounts + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} */ - let builder = GetCrossMarginAccountReq.builder(); - builder.setQuoteCurrency(?).setQueryType(?); + let builder = GetIsolatedMarginAccountDetailV1Req.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.getCrossMarginAccount(req); + let resp = api.getIsolatedMarginAccountDetailV1(req); return resp.then(result => { - expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); - expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); - expect(result.debtRatio).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); - expect(result.accounts).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.baseAsset).toEqual(expect.anything()); + expect(result.quoteAsset).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/account/api_account.test.ts b/sdk/node/src/generate/account/account/api_account.test.ts index 185c3806..9e221f7e 100644 --- a/sdk/node/src/generate/account/account/api_account.test.ts +++ b/sdk/node/src/generate/account/account/api_account.test.ts @@ -8,33 +8,78 @@ import { GetSpotLedgerReq } from './model_get_spot_ledger_req'; import { GetSpotAccountListReq } from './model_get_spot_account_list_req'; import { GetSpotAccountDetailReq } from './model_get_spot_account_detail_req'; import { GetMarginHFLedgerResp } from './model_get_margin_hf_ledger_resp'; -import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; import { GetFuturesAccountResp } from './model_get_futures_account_resp'; +import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; import { GetIsolatedMarginAccountDetailV1Req } from './model_get_isolated_margin_account_detail_v1_req'; import { GetSpotHFLedgerResp } from './model_get_spot_hf_ledger_resp'; import { GetSpotLedgerResp } from './model_get_spot_ledger_resp'; import { GetIsolatedMarginAccountDetailV1Resp } from './model_get_isolated_margin_account_detail_v1_resp'; import { GetIsolatedMarginAccountResp } from './model_get_isolated_margin_account_resp'; import { GetSpotHFLedgerReq } from './model_get_spot_hf_ledger_req'; -import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; import { GetFuturesLedgerResp } from './model_get_futures_ledger_resp'; +import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; import { GetSpotAccountListResp } from './model_get_spot_account_list_resp'; import { GetMarginAccountDetailResp } from './model_get_margin_account_detail_resp'; -import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; import { GetIsolatedMarginAccountListV1Resp } from './model_get_isolated_margin_account_list_v1_resp'; +import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; import { GetSpotAccountDetailResp } from './model_get_spot_account_detail_resp'; import { GetSpotAccountTypeResp } from './model_get_spot_account_type_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getFuturesAccount request test', () => { + test('getAccountInfo request test', () => { /** - * getFuturesAccount - * Get Account - Futures - * /api/v1/account-overview + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info */ - let data = '{"currency": "USDT"}'; - let req = new GetFuturesAccountReq(); + }); + + test('getAccountInfo response test', () => { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + }); + test('getApikeyInfo request test', () => { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + }); + + test('getApikeyInfo response test', () => { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + }); + test('getSpotAccountType request test', () => { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + }); + + test('getSpotAccountType response test', () => { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + }); + test('getSpotAccountList request test', () => { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let data = '{"currency": "USDT", "type": "main"}'; + let req = new GetSpotAccountListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -42,16 +87,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getFuturesAccount response test', () => { + test('getSpotAccountList response test', () => { /** - * getFuturesAccount - * Get Account - Futures - * /api/v1/account-overview + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts */ let data = - '{\n "code": "200000",\n "data": {\n "currency": "USDT",\n "accountEquity": 48.921913718,\n "unrealisedPNL": 1.59475,\n "marginBalance": 47.548728628,\n "positionMargin": 34.1577964733,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 14.7876172447,\n "riskRatio": 0.0090285199\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "548674591753",\n "currency": "USDT",\n "type": "trade",\n "balance": "26.66759503",\n "available": "26.66759503",\n "holds": "0"\n },\n {\n "id": "63355cd156298d0001b66e61",\n "currency": "USDT",\n "type": "main",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesAccountResp(); + let resp = new GetSpotAccountListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -93,14 +138,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotAccountList request test', () => { + test('getCrossMarginAccount request test', () => { /** - * getSpotAccountList - * Get Account List - Spot - * /api/v1/accounts + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts */ - let data = '{"currency": "USDT", "type": "main"}'; - let req = new GetSpotAccountListReq(); + let data = '{"quoteCurrency": "USDT", "queryType": "MARGIN"}'; + let req = new GetCrossMarginAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -108,16 +153,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotAccountList response test', () => { + test('getCrossMarginAccount response test', () => { /** - * getSpotAccountList - * Get Account List - Spot - * /api/v1/accounts + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "548674591753",\n "currency": "USDT",\n "type": "trade",\n "balance": "26.66759503",\n "available": "26.66759503",\n "holds": "0"\n },\n {\n "id": "63355cd156298d0001b66e61",\n "currency": "USDT",\n "type": "main",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0"\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.02",\n "totalLiabilityOfQuoteCurrency": "0",\n "debtRatio": "0",\n "status": "EFFECTIVE",\n "accounts": [\n {\n "currency": "USDT",\n "total": "0.02",\n "available": "0.02",\n "hold": "0",\n "liability": "0",\n "maxBorrowSize": "0",\n "borrowEnabled": true,\n "transferInEnabled": true\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotAccountListResp(); + let resp = new GetCrossMarginAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -126,15 +171,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotLedger request test', () => { + test('getIsolatedMarginAccount request test', () => { /** - * getSpotLedger - * Get Account Ledgers - Spot/Margin - * /api/v1/accounts/ledgers + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts */ let data = - '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetSpotLedgerReq(); + '{"symbol": "example_string_default_value", "quoteCurrency": "USDT", "queryType": "ISOLATED"}'; + let req = new GetIsolatedMarginAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -142,16 +187,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotLedger response test', () => { + test('getIsolatedMarginAccount response test', () => { /** - * getSpotLedger - * Get Account Ledgers - Spot/Margin - * /api/v1/accounts/ledgers + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "265329987780896",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "balance": "0",\n "accountType": "TRADE",\n "bizType": "SUB_TRANSFER",\n "direction": "out",\n "createdAt": 1728658481484,\n "context": ""\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.01",\n "totalLiabilityOfQuoteCurrency": "0",\n "timestamp": 1728725465994,\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "EFFECTIVE",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0",\n "available": "0",\n "hold": "0",\n "maxBorrowSize": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0.01",\n "available": "0.01",\n "hold": "0",\n "maxBorrowSize": "0"\n }\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotLedgerResp(); + let resp = new GetIsolatedMarginAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -160,15 +205,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotHFLedger request test', () => { + test('getFuturesAccount request test', () => { /** - * getSpotHFLedger - * Get Account Ledgers - Trade_hf - * /api/v1/hf/accounts/ledgers + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview */ - let data = - '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetSpotHFLedgerReq(); + let data = '{"currency": "USDT"}'; + let req = new GetFuturesAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -176,16 +220,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotHFLedger response test', () => { + test('getFuturesAccount response test', () => { /** - * getSpotHFLedger - * Get Account Ledgers - Trade_hf - * /api/v1/hf/accounts/ledgers + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "254062248624417",\n "currency": "USDT",\n "amount": "1.59760080",\n "fee": "0.00159920",\n "tax": "0",\n "balance": "26.73759503",\n "accountType": "TRADE_HF",\n "bizType": "TRADE_EXCHANGE",\n "direction": "in",\n "createdAt": "1728443957539",\n "context": "{\\"symbol\\":\\"KCS-USDT\\",\\"orderId\\":\\"6705f6350dc7210007d6a36d\\",\\"tradeId\\":\\"10046097631627265\\"}"\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "currency": "USDT",\n "accountEquity": 48.921913718,\n "unrealisedPNL": 1.59475,\n "marginBalance": 47.548728628,\n "positionMargin": 34.1577964733,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 14.7876172447,\n "riskRatio": 0.0090285199\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotHFLedgerResp(); + let resp = new GetFuturesAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -194,29 +238,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotAccountType request test', () => { - /** - * getSpotAccountType - * Get Account Type - Spot - * /api/v1/hf/accounts/opened - */ - }); - - test('getSpotAccountType response test', () => { - /** - * getSpotAccountType - * Get Account Type - Spot - * /api/v1/hf/accounts/opened - */ - }); - test('getIsolatedMarginAccountDetailV1 request test', () => { + test('getSpotLedger request test', () => { /** - * getIsolatedMarginAccountDetailV1 - * Get Account Detail - Isolated Margin - V1 - * /api/v1/isolated/account/{symbol} + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers */ - let data = '{"symbol": "example_string_default_value"}'; - let req = new GetIsolatedMarginAccountDetailV1Req(); + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetSpotLedgerReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -224,16 +254,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getIsolatedMarginAccountDetailV1 response test', () => { + test('getSpotLedger response test', () => { /** - * getIsolatedMarginAccountDetailV1 - * Get Account Detail - Isolated Margin - V1 - * /api/v1/isolated/account/{symbol} + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers */ let data = - '{\n "code": "200000",\n "data": {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "265329987780896",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "balance": "0",\n "accountType": "TRADE",\n "bizType": "SUB_TRANSFER",\n "direction": "out",\n "createdAt": 1728658481484,\n "context": ""\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountDetailV1Resp(); + let resp = new GetSpotLedgerResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -242,14 +272,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getIsolatedMarginAccountListV1 request test', () => { + test('getSpotHFLedger request test', () => { /** - * getIsolatedMarginAccountListV1 - * Get Account List - Isolated Margin - V1 - * /api/v1/isolated/accounts + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers */ - let data = '{"balanceCurrency": "USDT"}'; - let req = new GetIsolatedMarginAccountListV1Req(); + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetSpotHFLedgerReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -257,16 +288,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getIsolatedMarginAccountListV1 response test', () => { + test('getSpotHFLedger response test', () => { /** - * getIsolatedMarginAccountListV1 - * Get Account List - Isolated Margin - V1 - * /api/v1/isolated/accounts + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers */ let data = - '{\n "code": "200000",\n "data": {\n "totalConversionBalance": "0.01",\n "liabilityConversionBalance": "0",\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "254062248624417",\n "currency": "USDT",\n "amount": "1.59760080",\n "fee": "0.00159920",\n "tax": "0",\n "balance": "26.73759503",\n "accountType": "TRADE_HF",\n "bizType": "TRADE_EXCHANGE",\n "direction": "in",\n "createdAt": "1728443957539",\n "context": "{\\"symbol\\":\\"KCS-USDT\\",\\"orderId\\":\\"6705f6350dc7210007d6a36d\\",\\"tradeId\\":\\"10046097631627265\\"}"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountListV1Resp(); + let resp = new GetSpotHFLedgerResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -275,20 +306,39 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMarginAccountDetail request test', () => { + test('getMarginHFLedger request test', () => { /** - * getMarginAccountDetail - * Get Account Detail - Margin - * /api/v1/margin/account + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers */ + let data = + '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetMarginHFLedgerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getMarginAccountDetail response test', () => { + test('getMarginHFLedger response test', () => { /** - * getMarginAccountDetail - * Get Account Detail - Margin - * /api/v1/margin/account + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers */ + let data = + '{"code":"200000","data":[{"id":1949641706720,"currency":"USDT","amount":"0.01000000","fee":"0.00000000","balance":"0.01000000","accountType":"MARGIN_V2","bizType":"TRANSFER","direction":"in","createdAt":1728664091208,"context":"{}","tax":"0.00000000"}]}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMarginHFLedgerResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getFuturesLedger request test', () => { /** @@ -324,79 +374,29 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getApikeyInfo request test', () => { - /** - * getApikeyInfo - * Get Apikey Info - * /api/v1/user/api-key - */ - }); - - test('getApikeyInfo response test', () => { - /** - * getApikeyInfo - * Get Apikey Info - * /api/v1/user/api-key - */ - }); - test('getAccountInfo request test', () => { - /** - * getAccountInfo - * Get Account Summary Info - * /api/v2/user-info - */ - }); - - test('getAccountInfo response test', () => { - /** - * getAccountInfo - * Get Account Summary Info - * /api/v2/user-info - */ - }); - test('getMarginHFLedger request test', () => { + test('getMarginAccountDetail request test', () => { /** - * getMarginHFLedger - * Get Account Ledgers - Margin_hf - * /api/v3/hf/margin/account/ledgers + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account */ - let data = - '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetMarginHFLedgerReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('getMarginHFLedger response test', () => { + test('getMarginAccountDetail response test', () => { /** - * getMarginHFLedger - * Get Account Ledgers - Margin_hf - * /api/v3/hf/margin/account/ledgers + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account */ - let data = - '{"code":"200000","data":[{"id":1949641706720,"currency":"USDT","amount":"0.01000000","fee":"0.00000000","balance":"0.01000000","accountType":"MARGIN_V2","bizType":"TRANSFER","direction":"in","createdAt":1728664091208,"context":"{}","tax":"0.00000000"}]}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetMarginHFLedgerResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); - test('getIsolatedMarginAccount request test', () => { + test('getIsolatedMarginAccountListV1 request test', () => { /** - * getIsolatedMarginAccount - * Get Account - Isolated Margin - * /api/v3/isolated/accounts + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts */ - let data = - '{"symbol": "example_string_default_value", "quoteCurrency": "USDT", "queryType": "ISOLATED"}'; - let req = new GetIsolatedMarginAccountReq(); + let data = '{"balanceCurrency": "USDT"}'; + let req = new GetIsolatedMarginAccountListV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -404,16 +404,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getIsolatedMarginAccount response test', () => { + test('getIsolatedMarginAccountListV1 response test', () => { /** - * getIsolatedMarginAccount - * Get Account - Isolated Margin - * /api/v3/isolated/accounts + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts */ let data = - '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.01",\n "totalLiabilityOfQuoteCurrency": "0",\n "timestamp": 1728725465994,\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "EFFECTIVE",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0",\n "available": "0",\n "hold": "0",\n "maxBorrowSize": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0.01",\n "available": "0.01",\n "hold": "0",\n "maxBorrowSize": "0"\n }\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "totalConversionBalance": "0.01",\n "liabilityConversionBalance": "0",\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountResp(); + let resp = new GetIsolatedMarginAccountListV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -422,14 +422,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getCrossMarginAccount request test', () => { + test('getIsolatedMarginAccountDetailV1 request test', () => { /** - * getCrossMarginAccount - * Get Account - Cross Margin - * /api/v3/margin/accounts + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} */ - let data = '{"quoteCurrency": "USDT", "queryType": "MARGIN"}'; - let req = new GetCrossMarginAccountReq(); + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetIsolatedMarginAccountDetailV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -437,16 +437,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getCrossMarginAccount response test', () => { + test('getIsolatedMarginAccountDetailV1 response test', () => { /** - * getCrossMarginAccount - * Get Account - Cross Margin - * /api/v3/margin/accounts + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} */ let data = - '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.02",\n "totalLiabilityOfQuoteCurrency": "0",\n "debtRatio": "0",\n "status": "EFFECTIVE",\n "accounts": [\n {\n "currency": "USDT",\n "total": "0.02",\n "available": "0.02",\n "hold": "0",\n "liability": "0",\n "maxBorrowSize": "0",\n "borrowEnabled": true,\n "transferInEnabled": true\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginAccountResp(); + let resp = new GetIsolatedMarginAccountDetailV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/account/account/api_account.ts b/sdk/node/src/generate/account/account/api_account.ts index 5ebcd871..0405c07f 100644 --- a/sdk/node/src/generate/account/account/api_account.ts +++ b/sdk/node/src/generate/account/account/api_account.ts @@ -11,44 +11,44 @@ import { GetSpotLedgerReq } from './model_get_spot_ledger_req'; import { GetSpotAccountListReq } from './model_get_spot_account_list_req'; import { GetSpotAccountDetailReq } from './model_get_spot_account_detail_req'; import { GetMarginHFLedgerResp } from './model_get_margin_hf_ledger_resp'; -import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; import { GetFuturesAccountResp } from './model_get_futures_account_resp'; +import { GetIsolatedMarginAccountReq } from './model_get_isolated_margin_account_req'; import { GetIsolatedMarginAccountDetailV1Req } from './model_get_isolated_margin_account_detail_v1_req'; import { GetSpotHFLedgerResp } from './model_get_spot_hf_ledger_resp'; import { GetSpotLedgerResp } from './model_get_spot_ledger_resp'; import { GetIsolatedMarginAccountDetailV1Resp } from './model_get_isolated_margin_account_detail_v1_resp'; import { GetIsolatedMarginAccountResp } from './model_get_isolated_margin_account_resp'; import { GetSpotHFLedgerReq } from './model_get_spot_hf_ledger_req'; -import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; import { GetFuturesLedgerResp } from './model_get_futures_ledger_resp'; +import { GetApikeyInfoResp } from './model_get_apikey_info_resp'; import { GetSpotAccountListResp } from './model_get_spot_account_list_resp'; import { GetMarginAccountDetailResp } from './model_get_margin_account_detail_resp'; -import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; import { GetIsolatedMarginAccountListV1Resp } from './model_get_isolated_margin_account_list_v1_resp'; +import { GetMarginHFLedgerReq } from './model_get_margin_hf_ledger_req'; import { GetSpotAccountDetailResp } from './model_get_spot_account_detail_resp'; import { GetSpotAccountTypeResp } from './model_get_spot_account_type_resp'; export interface AccountAPI { /** - * getFuturesAccount Get Account - Futures - * Description: Request via this endpoint to get the info of the futures account. - * Documentation: https://www.kucoin.com/docs-new/api-3470129 - * +---------------------+---------+ - * | Extra API Info | Value | - * +---------------------+---------+ - * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | - * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 5 | - * +---------------------+---------+ + * getAccountInfo Get Account Summary Info + * Description: This endpoint can be used to obtain account summary information. + * Documentation: https://www.kucoin.com/docs-new/api-3470119 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ */ - getFuturesAccount(req: GetFuturesAccountReq): Promise; + getAccountInfo(): Promise; /** - * getSpotAccountDetail Get Account Detail - Spot - * Description: get Information for a single spot account. Use this endpoint when you know the accountId. - * Documentation: https://www.kucoin.com/docs-new/api-3470126 + * getApikeyInfo Get Apikey Info + * Description: Get the information of the api key. Use the api key pending to be checked to call the endpoint. Both master and sub user\'s api key are applicable. + * Documentation: https://www.kucoin.com/docs-new/api-3470130 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -56,10 +56,26 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise; + getApikeyInfo(): Promise; + + /** + * getSpotAccountType Get Account Type - Spot + * Description: This interface determines whether the current user is a spot high-frequency user or a spot low-frequency user. + * Documentation: https://www.kucoin.com/docs-new/api-3470120 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 30 | + * +---------------------+---------+ + */ + getSpotAccountType(): Promise; /** * getSpotAccountList Get Account List - Spot @@ -78,9 +94,9 @@ export interface AccountAPI { getSpotAccountList(req: GetSpotAccountListReq): Promise; /** - * getSpotLedger Get Account Ledgers - Spot/Margin - * Description: This interface is for transaction records from all types of your accounts, supporting inquiry of various currencies. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. - * Documentation: https://www.kucoin.com/docs-new/api-3470121 + * getSpotAccountDetail Get Account Detail - Spot + * Description: get Information for a single spot account. Use this endpoint when you know the accountId. + * Documentation: https://www.kucoin.com/docs-new/api-3470126 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -88,15 +104,15 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - getSpotLedger(req: GetSpotLedgerReq): Promise; + getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise; /** - * getSpotHFLedger Get Account Ledgers - Trade_hf - * Description: This API endpoint returns all transfer (in and out) records in high-frequency trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. - * Documentation: https://www.kucoin.com/docs-new/api-3470122 + * getCrossMarginAccount Get Account - Cross Margin + * Description: Request via this endpoint to get the info of the cross margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470127 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -104,15 +120,15 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - getSpotHFLedger(req: GetSpotHFLedgerReq): Promise; + getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise; /** - * getSpotAccountType Get Account Type - Spot - * Description: This interface determines whether the current user is a spot high-frequency user or a spot low-frequency user. - * Documentation: https://www.kucoin.com/docs-new/api-3470120 + * getIsolatedMarginAccount Get Account - Isolated Margin + * Description: Request via this endpoint to get the info of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470128 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -120,35 +136,49 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - getSpotAccountType(): Promise; + getIsolatedMarginAccount( + req: GetIsolatedMarginAccountReq, + ): Promise; /** - * @deprecated - * getIsolatedMarginAccountDetailV1 Get Account Detail - Isolated Margin - V1 - * Description: Request via this endpoint to get the info of the isolated margin account. - * Documentation: https://www.kucoin.com/docs-new/api-3470315 + * getFuturesAccount Get Account - Futures + * Description: Request via this endpoint to get the info of the futures account. + * Documentation: https://www.kucoin.com/docs-new/api-3470129 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ - * | API-DOMAIN | SPOT | + * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 50 | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getIsolatedMarginAccountDetailV1( - req: GetIsolatedMarginAccountDetailV1Req, - ): Promise; + getFuturesAccount(req: GetFuturesAccountReq): Promise; /** - * @deprecated - * getIsolatedMarginAccountListV1 Get Account List - Isolated Margin - V1 - * Description: Request via this endpoint to get the info list of the isolated margin account. - * Documentation: https://www.kucoin.com/docs-new/api-3470314 + * getSpotLedger Get Account Ledgers - Spot/Margin + * Description: This interface is for transaction records from all types of your accounts, supporting inquiry of various currencies. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470121 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 2 | + * +---------------------+------------+ + */ + getSpotLedger(req: GetSpotLedgerReq): Promise; + + /** + * getSpotHFLedger Get Account Ledgers - Trade_hf + * Description: This API endpoint returns all transfer (in and out) records in high-frequency trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. + * Documentation: https://www.kucoin.com/docs-new/api-3470122 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -156,18 +186,15 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 50 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getIsolatedMarginAccountListV1( - req: GetIsolatedMarginAccountListV1Req, - ): Promise; + getSpotHFLedger(req: GetSpotHFLedgerReq): Promise; /** - * @deprecated - * getMarginAccountDetail Get Account Detail - Margin - * Description: Request via this endpoint to get the info of the margin account. - * Documentation: https://www.kucoin.com/docs-new/api-3470311 + * getMarginHFLedger Get Account Ledgers - Margin_hf + * Description: This API endpoint returns all transfer (in and out) records in high-frequency margin trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. + * Documentation: https://www.kucoin.com/docs-new/api-3470123 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -175,10 +202,10 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 40 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getMarginAccountDetail(): Promise; + getMarginHFLedger(req: GetMarginHFLedgerReq): Promise; /** * getFuturesLedger Get Account Ledgers - Futures @@ -197,41 +224,10 @@ export interface AccountAPI { getFuturesLedger(req: GetFuturesLedgerReq): Promise; /** - * getApikeyInfo Get Apikey Info - * Description: Get the information of the api key. Use the api key pending to be checked to call the endpoint. Both master and sub user\'s api key are applicable. - * Documentation: https://www.kucoin.com/docs-new/api-3470130 - * +---------------------+------------+ - * | Extra API Info | Value | - * +---------------------+------------+ - * | API-DOMAIN | SPOT | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | - * +---------------------+------------+ - */ - getApikeyInfo(): Promise; - - /** - * getAccountInfo Get Account Summary Info - * Description: This endpoint can be used to obtain account summary information. - * Documentation: https://www.kucoin.com/docs-new/api-3470119 - * +---------------------+------------+ - * | Extra API Info | Value | - * +---------------------+------------+ - * | API-DOMAIN | SPOT | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | - * +---------------------+------------+ - */ - getAccountInfo(): Promise; - - /** - * getMarginHFLedger Get Account Ledgers - Margin_hf - * Description: This API endpoint returns all transfer (in and out) records in high-frequency margin trading account and supports multi-coin queries. The query results are sorted in descending order by createdAt and id. - * Documentation: https://www.kucoin.com/docs-new/api-3470123 + * @deprecated + * getMarginAccountDetail Get Account Detail - Margin + * Description: Request via this endpoint to get the info of the margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470311 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -239,15 +235,16 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 40 | * +---------------------+---------+ */ - getMarginHFLedger(req: GetMarginHFLedgerReq): Promise; + getMarginAccountDetail(): Promise; /** - * getIsolatedMarginAccount Get Account - Isolated Margin - * Description: Request via this endpoint to get the info of the isolated margin account. - * Documentation: https://www.kucoin.com/docs-new/api-3470128 + * @deprecated + * getIsolatedMarginAccountListV1 Get Account List - Isolated Margin - V1 + * Description: Request via this endpoint to get the info list of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470314 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -255,17 +252,18 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 50 | * +---------------------+---------+ */ - getIsolatedMarginAccount( - req: GetIsolatedMarginAccountReq, - ): Promise; + getIsolatedMarginAccountListV1( + req: GetIsolatedMarginAccountListV1Req, + ): Promise; /** - * getCrossMarginAccount Get Account - Cross Margin - * Description: Request via this endpoint to get the info of the cross margin account. - * Documentation: https://www.kucoin.com/docs-new/api-3470127 + * @deprecated + * getIsolatedMarginAccountDetailV1 Get Account Detail - Isolated Margin - V1 + * Description: Request via this endpoint to get the info of the isolated margin account. + * Documentation: https://www.kucoin.com/docs-new/api-3470315 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -273,197 +271,199 @@ export interface AccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 50 | * +---------------------+---------+ */ - getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise; + getIsolatedMarginAccountDetailV1( + req: GetIsolatedMarginAccountDetailV1Req, + ): Promise; } export class AccountAPIImpl implements AccountAPI { constructor(private transport: Transport) {} - getFuturesAccount(req: GetFuturesAccountReq): Promise { + getAccountInfo(): Promise { return this.transport.call( - 'futures', + 'spot', false, 'GET', - '/api/v1/account-overview', - req, - new GetFuturesAccountResp(), + '/api/v2/user-info', + null, + new GetAccountInfoResp(), false, ); } - getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise { + getApikeyInfo(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/accounts/{accountId}', - req, - new GetSpotAccountDetailResp(), + '/api/v1/user/api-key', + null, + new GetApikeyInfoResp(), false, ); } - getSpotAccountList(req: GetSpotAccountListReq): Promise { + getSpotAccountType(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/accounts', - req, - new GetSpotAccountListResp(), + '/api/v1/hf/accounts/opened', + null, + new GetSpotAccountTypeResp(), false, ); } - getSpotLedger(req: GetSpotLedgerReq): Promise { + getSpotAccountList(req: GetSpotAccountListReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/accounts/ledgers', + '/api/v1/accounts', req, - new GetSpotLedgerResp(), + new GetSpotAccountListResp(), false, ); } - getSpotHFLedger(req: GetSpotHFLedgerReq): Promise { + getSpotAccountDetail(req: GetSpotAccountDetailReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/hf/accounts/ledgers', + '/api/v1/accounts/{accountId}', req, - new GetSpotHFLedgerResp(), + new GetSpotAccountDetailResp(), false, ); } - getSpotAccountType(): Promise { + getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/hf/accounts/opened', - null, - new GetSpotAccountTypeResp(), + '/api/v3/margin/accounts', + req, + new GetCrossMarginAccountResp(), false, ); } - getIsolatedMarginAccountDetailV1( - req: GetIsolatedMarginAccountDetailV1Req, - ): Promise { + getIsolatedMarginAccount( + req: GetIsolatedMarginAccountReq, + ): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/isolated/account/{symbol}', + '/api/v3/isolated/accounts', req, - new GetIsolatedMarginAccountDetailV1Resp(), + new GetIsolatedMarginAccountResp(), false, ); } - getIsolatedMarginAccountListV1( - req: GetIsolatedMarginAccountListV1Req, - ): Promise { + getFuturesAccount(req: GetFuturesAccountReq): Promise { return this.transport.call( - 'spot', + 'futures', false, 'GET', - '/api/v1/isolated/accounts', + '/api/v1/account-overview', req, - new GetIsolatedMarginAccountListV1Resp(), + new GetFuturesAccountResp(), false, ); } - getMarginAccountDetail(): Promise { + getSpotLedger(req: GetSpotLedgerReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/margin/account', - null, - new GetMarginAccountDetailResp(), + '/api/v1/accounts/ledgers', + req, + new GetSpotLedgerResp(), false, ); } - getFuturesLedger(req: GetFuturesLedgerReq): Promise { + getSpotHFLedger(req: GetSpotHFLedgerReq): Promise { return this.transport.call( - 'futures', + 'spot', false, 'GET', - '/api/v1/transaction-history', + '/api/v1/hf/accounts/ledgers', req, - new GetFuturesLedgerResp(), + new GetSpotHFLedgerResp(), false, ); } - getApikeyInfo(): Promise { + getMarginHFLedger(req: GetMarginHFLedgerReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/user/api-key', - null, - new GetApikeyInfoResp(), + '/api/v3/hf/margin/account/ledgers', + req, + new GetMarginHFLedgerResp(), false, ); } - getAccountInfo(): Promise { + getFuturesLedger(req: GetFuturesLedgerReq): Promise { return this.transport.call( - 'spot', + 'futures', false, 'GET', - '/api/v2/user-info', - null, - new GetAccountInfoResp(), + '/api/v1/transaction-history', + req, + new GetFuturesLedgerResp(), false, ); } - getMarginHFLedger(req: GetMarginHFLedgerReq): Promise { + getMarginAccountDetail(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/hf/margin/account/ledgers', - req, - new GetMarginHFLedgerResp(), + '/api/v1/margin/account', + null, + new GetMarginAccountDetailResp(), false, ); } - getIsolatedMarginAccount( - req: GetIsolatedMarginAccountReq, - ): Promise { + getIsolatedMarginAccountListV1( + req: GetIsolatedMarginAccountListV1Req, + ): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/isolated/accounts', + '/api/v1/isolated/accounts', req, - new GetIsolatedMarginAccountResp(), + new GetIsolatedMarginAccountListV1Resp(), false, ); } - getCrossMarginAccount(req: GetCrossMarginAccountReq): Promise { + getIsolatedMarginAccountDetailV1( + req: GetIsolatedMarginAccountDetailV1Req, + ): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/margin/accounts', + '/api/v1/isolated/account/{symbol}', req, - new GetCrossMarginAccountResp(), + new GetIsolatedMarginAccountDetailV1Resp(), false, ); } diff --git a/sdk/node/src/generate/account/deposit/api_deposit.template b/sdk/node/src/generate/account/deposit/api_deposit.template index 66ccd556..2e222cdc 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.template +++ b/sdk/node/src/generate/account/deposit/api_deposit.template @@ -5,44 +5,41 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getDepositAddressV1 request test', ()=> { + test('addDepositAddressV3 request test', ()=> { /** - * getDepositAddressV1 - * Get Deposit Addresses - V1 - * /api/v1/deposit-addresses + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create */ - let builder = GetDepositAddressV1Req.builder(); - builder.setCurrency(?).setChain(?); + let builder = AddDepositAddressV3Req.builder(); + builder.setCurrency(?).setChain(?).setTo(?).setAmount(?); let req = builder.build(); - let resp = api.getDepositAddressV1(req); + let resp = api.addDepositAddressV3(req); return resp.then(result => { expect(result.address).toEqual(expect.anything()); expect(result.memo).toEqual(expect.anything()); - expect(result.chain).toEqual(expect.anything()); expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); + expect(result.expirationDate).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); - expect(result.contractAddress).toEqual(expect.anything()); + expect(result.chainName).toEqual(expect.anything()); + console.log(resp); }); }) - test('addDepositAddressV1 request test', ()=> { + test('getDepositAddressV3 request test', ()=> { /** - * addDepositAddressV1 - * Add Deposit Address - V1 - * /api/v1/deposit-addresses + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses */ - let builder = AddDepositAddressV1Req.builder(); - builder.setCurrency(?).setChain(?); + let builder = GetDepositAddressV3Req.builder(); + builder.setCurrency(?).setAmount(?).setChain(?); let req = builder.build(); - let resp = api.addDepositAddressV1(req); + let resp = api.getDepositAddressV3(req); return resp.then(result => { - expect(result.address).toEqual(expect.anything()); - expect(result.memo).toEqual(expect.anything()); - expect(result.chain).toEqual(expect.anything()); - expect(result.chainId).toEqual(expect.anything()); - expect(result.to).toEqual(expect.anything()); - expect(result.currency).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -62,25 +59,7 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - }); - }) - - test('getDepositHistoryOld request test', ()=> { - /** - * getDepositHistoryOld - * Get Deposit History - Old - * /api/v1/hist-deposits - */ - let builder = GetDepositHistoryOldReq.builder(); - builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?); - let req = builder.build(); - let resp = api.getDepositHistoryOld(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -96,42 +75,70 @@ describe('Auto Test', ()=> { let resp = api.getDepositAddressV2(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('addDepositAddressV3 request test', ()=> { + test('getDepositAddressV1 request test', ()=> { /** - * addDepositAddressV3 - * Add Deposit Address(V3) - * /api/v3/deposit-address/create + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses */ - let builder = AddDepositAddressV3Req.builder(); - builder.setCurrency(?).setChain(?).setTo(?).setAmount(?); + let builder = GetDepositAddressV1Req.builder(); + builder.setCurrency(?).setChain(?); let req = builder.build(); - let resp = api.addDepositAddressV3(req); + let resp = api.getDepositAddressV1(req); return resp.then(result => { expect(result.address).toEqual(expect.anything()); expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); - expect(result.expirationDate).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); - expect(result.chainName).toEqual(expect.anything()); + expect(result.contractAddress).toEqual(expect.anything()); + console.log(resp); }); }) - test('getDepositAddressV3 request test', ()=> { + test('getDepositHistoryOld request test', ()=> { /** - * getDepositAddressV3 - * Get Deposit Address(V3) - * /api/v3/deposit-addresses + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits */ - let builder = GetDepositAddressV3Req.builder(); - builder.setCurrency(?).setAmount(?).setChain(?); + let builder = GetDepositHistoryOldReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?); let req = builder.build(); - let resp = api.getDepositAddressV3(req); + let resp = api.getDepositHistoryOld(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addDepositAddressV1 request test', ()=> { + /** + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses + */ + let builder = AddDepositAddressV1Req.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.addDepositAddressV1(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/deposit/api_deposit.test.ts b/sdk/node/src/generate/account/deposit/api_deposit.test.ts index a25c037b..23c84bc7 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.test.ts +++ b/sdk/node/src/generate/account/deposit/api_deposit.test.ts @@ -1,28 +1,28 @@ import { AddDepositAddressV3Resp } from './model_add_deposit_address_v3_resp'; import { GetDepositAddressV1Resp } from './model_get_deposit_address_v1_resp'; -import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; import { GetDepositHistoryOldResp } from './model_get_deposit_history_old_resp'; +import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; import { AddDepositAddressV1Req } from './model_add_deposit_address_v1_req'; -import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; import { GetDepositHistoryOldReq } from './model_get_deposit_history_old_req'; +import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; import { GetDepositHistoryResp } from './model_get_deposit_history_resp'; +import { GetDepositHistoryReq } from './model_get_deposit_history_req'; import { GetDepositAddressV3Resp } from './model_get_deposit_address_v3_resp'; import { GetDepositAddressV3Req } from './model_get_deposit_address_v3_req'; -import { GetDepositHistoryReq } from './model_get_deposit_history_req'; import { AddDepositAddressV1Resp } from './model_add_deposit_address_v1_resp'; -import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; import { GetDepositAddressV1Req } from './model_get_deposit_address_v1_req'; +import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getDepositAddressV1 request test', () => { + test('addDepositAddressV3 request test', () => { /** - * getDepositAddressV1 - * Get Deposit Addresses - V1 - * /api/v1/deposit-addresses + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create */ - let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetDepositAddressV1Req(); + let data = '{"currency": "TON", "chain": "ton", "to": "trade"}'; + let req = new AddDepositAddressV3Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -30,16 +30,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getDepositAddressV1 response test', () => { + test('addDepositAddressV3 response test', () => { /** - * getDepositAddressV1 - * Get Deposit Addresses - V1 - * /api/v1/deposit-addresses + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create */ let data = - '{\n "code": "200000",\n "data": {\n "address": "0xea220bf61c3c2b0adc2cfa29fec3d2677745a379",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "USDT"\n }\n}'; + '{"code":"200000","data":{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2090821203","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"TON","chainName":"TON"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV1Resp(); + let resp = new AddDepositAddressV3Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -48,14 +48,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addDepositAddressV1 request test', () => { + test('getDepositAddressV3 request test', () => { /** - * addDepositAddressV1 - * Add Deposit Address - V1 - * /api/v1/deposit-addresses + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses */ - let data = '{"currency": "ETH", "chain": "eth"}'; - let req = new AddDepositAddressV1Req(); + let data = + '{"currency": "BTC", "amount": "example_string_default_value", "chain": "example_string_default_value"}'; + let req = new GetDepositAddressV3Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -63,16 +64,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addDepositAddressV1 response test', () => { + test('getDepositAddressV3 response test', () => { /** - * addDepositAddressV1 - * Add Deposit Address - V1 - * /api/v1/deposit-addresses + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses */ let data = - '{"code":"200000","data":{"address":"0x02028456f38e78609904e8a002c787ede7a73d7c","memo":null,"chain":"ERC20","chainId":"eth","to":"MAIN","currency":"ETH"}}'; + '{"code":"200000","data":[{"address":"TSv3L1fS7yA3SxzKD8c1qdX4nLP6rqNxYz","memo":"","chainId":"trx","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","chainName":"TRC20"},{"address":"0x551e823a3b36865e8c5dc6e6ac6cc0b00d98533e","memo":"","chainId":"kcc","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48","chainName":"KCC"},{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2085202643","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs","chainName":"TON"},{"address":"0x0a2586d5a901c8e7e68f6b0dc83bfd8bd8600ff5","memo":"","chainId":"eth","to":"MAIN","expirationDate":0,"currency":"USDT","contractAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7","chainName":"ERC20"}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddDepositAddressV1Resp(); + let resp = new GetDepositAddressV3Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -115,15 +116,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getDepositHistoryOld request test', () => { + test('getDepositAddressV2 request test', () => { /** - * getDepositHistoryOld - * Get Deposit History - Old - * /api/v1/hist-deposits + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses */ - let data = - '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetDepositHistoryOldReq(); + let data = '{"currency": "BTC"}'; + let req = new GetDepositAddressV2Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -131,16 +131,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getDepositHistoryOld response test', () => { + test('getDepositAddressV2 response test', () => { /** - * getDepositHistoryOld - * Get Deposit History - Old - * /api/v1/hist-deposits + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 0,\n "totalPage": 0,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1528536998,\n "amount": "0.03266638",\n "walletTxId": "55c643bc2c68d6f17266383ac1be9e454038864b929ae7cee0bc408cc5c869e8@12ffGWmMMD1zA1WbFm7Ho3JZ1w6NYXjpFk@234",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "address": "0x02028456*****87ede7a73d7c",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "ETH",\n "contractAddress": ""\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositHistoryOldResp(); + let resp = new GetDepositAddressV2Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -149,14 +149,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getDepositAddressV2 request test', () => { + test('getDepositAddressV1 request test', () => { /** - * getDepositAddressV2 - * Get Deposit Addresses(V2) - * /api/v2/deposit-addresses + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses */ - let data = '{"currency": "BTC"}'; - let req = new GetDepositAddressV2Req(); + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetDepositAddressV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -164,16 +164,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getDepositAddressV2 response test', () => { + test('getDepositAddressV1 response test', () => { /** - * getDepositAddressV2 - * Get Deposit Addresses(V2) - * /api/v2/deposit-addresses + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses */ let data = - '{\n "code": "200000",\n "data": [\n {\n "address": "0x02028456*****87ede7a73d7c",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "ETH",\n "contractAddress": ""\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "address": "0xea220bf61c3c2b0adc2cfa29fec3d2677745a379",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV2Resp(); + let resp = new GetDepositAddressV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -182,14 +182,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addDepositAddressV3 request test', () => { + test('getDepositHistoryOld request test', () => { /** - * addDepositAddressV3 - * Add Deposit Address(V3) - * /api/v3/deposit-address/create + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits */ - let data = '{"currency": "TON", "chain": "ton", "to": "trade"}'; - let req = new AddDepositAddressV3Req(); + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetDepositHistoryOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -197,16 +198,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addDepositAddressV3 response test', () => { + test('getDepositHistoryOld response test', () => { /** - * addDepositAddressV3 - * Add Deposit Address(V3) - * /api/v3/deposit-address/create + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits */ let data = - '{"code":"200000","data":{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2090821203","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"TON","chainName":"TON"}}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 0,\n "totalPage": 0,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1528536998,\n "amount": "0.03266638",\n "walletTxId": "55c643bc2c68d6f17266383ac1be9e454038864b929ae7cee0bc408cc5c869e8@12ffGWmMMD1zA1WbFm7Ho3JZ1w6NYXjpFk@234",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddDepositAddressV3Resp(); + let resp = new GetDepositHistoryOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -215,15 +216,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getDepositAddressV3 request test', () => { + test('addDepositAddressV1 request test', () => { /** - * getDepositAddressV3 - * Get Deposit Address(V3) - * /api/v3/deposit-addresses + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses */ - let data = - '{"currency": "BTC", "amount": "example_string_default_value", "chain": "example_string_default_value"}'; - let req = new GetDepositAddressV3Req(); + let data = '{"currency": "ETH", "chain": "eth"}'; + let req = new AddDepositAddressV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -231,16 +231,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getDepositAddressV3 response test', () => { + test('addDepositAddressV1 response test', () => { /** - * getDepositAddressV3 - * Get Deposit Address(V3) - * /api/v3/deposit-addresses + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses */ let data = - '{"code":"200000","data":[{"address":"TSv3L1fS7yA3SxzKD8c1qdX4nLP6rqNxYz","memo":"","chainId":"trx","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","chainName":"TRC20"},{"address":"0x551e823a3b36865e8c5dc6e6ac6cc0b00d98533e","memo":"","chainId":"kcc","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48","chainName":"KCC"},{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2085202643","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs","chainName":"TON"},{"address":"0x0a2586d5a901c8e7e68f6b0dc83bfd8bd8600ff5","memo":"","chainId":"eth","to":"MAIN","expirationDate":0,"currency":"USDT","contractAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7","chainName":"ERC20"}]}'; + '{"code":"200000","data":{"address":"0x02028456f38e78609904e8a002c787ede7a73d7c","memo":null,"chain":"ERC20","chainId":"eth","to":"MAIN","currency":"ETH"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV3Resp(); + let resp = new AddDepositAddressV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/account/deposit/api_deposit.ts b/sdk/node/src/generate/account/deposit/api_deposit.ts index 4ae9e185..c53c414b 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.ts +++ b/sdk/node/src/generate/account/deposit/api_deposit.ts @@ -3,25 +3,24 @@ import { Transport } from '@internal/interfaces/transport'; import { AddDepositAddressV3Resp } from './model_add_deposit_address_v3_resp'; import { GetDepositAddressV1Resp } from './model_get_deposit_address_v1_resp'; -import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; import { GetDepositHistoryOldResp } from './model_get_deposit_history_old_resp'; +import { AddDepositAddressV3Req } from './model_add_deposit_address_v3_req'; import { AddDepositAddressV1Req } from './model_add_deposit_address_v1_req'; -import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; import { GetDepositHistoryOldReq } from './model_get_deposit_history_old_req'; +import { GetDepositAddressV2Req } from './model_get_deposit_address_v2_req'; import { GetDepositHistoryResp } from './model_get_deposit_history_resp'; +import { GetDepositHistoryReq } from './model_get_deposit_history_req'; import { GetDepositAddressV3Resp } from './model_get_deposit_address_v3_resp'; import { GetDepositAddressV3Req } from './model_get_deposit_address_v3_req'; -import { GetDepositHistoryReq } from './model_get_deposit_history_req'; import { AddDepositAddressV1Resp } from './model_add_deposit_address_v1_resp'; -import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; import { GetDepositAddressV1Req } from './model_get_deposit_address_v1_req'; +import { GetDepositAddressV2Resp } from './model_get_deposit_address_v2_resp'; export interface DepositAPI { /** - * @deprecated - * getDepositAddressV1 Get Deposit Addresses - V1 - * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. - * Documentation: https://www.kucoin.com/docs-new/api-3470305 + * addDepositAddressV3 Add Deposit Address(V3) + * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. + * Documentation: https://www.kucoin.com/docs-new/api-3470142 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -29,16 +28,15 @@ export interface DepositAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getDepositAddressV1(req: GetDepositAddressV1Req): Promise; + addDepositAddressV3(req: AddDepositAddressV3Req): Promise; /** - * @deprecated - * addDepositAddressV1 Add Deposit Address - V1 - * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. - * Documentation: https://www.kucoin.com/docs-new/api-3470309 + * getDepositAddressV3 Get Deposit Address(V3) + * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. + * Documentation: https://www.kucoin.com/docs-new/api-3470140 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -46,10 +44,10 @@ export interface DepositAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - addDepositAddressV1(req: AddDepositAddressV1Req): Promise; + getDepositAddressV3(req: GetDepositAddressV3Req): Promise; /** * getDepositHistory Get Deposit History @@ -69,9 +67,9 @@ export interface DepositAPI { /** * @deprecated - * getDepositHistoryOld Get Deposit History - Old - * Description: Request via this endpoint to get the V1 historical deposits list on KuCoin. The return value is the data after Pagination, sorted in descending order according to time. - * Documentation: https://www.kucoin.com/docs-new/api-3470306 + * getDepositAddressV2 Get Deposit Addresses(V2) + * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. + * Documentation: https://www.kucoin.com/docs-new/api-3470300 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -82,13 +80,13 @@ export interface DepositAPI { * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise; + getDepositAddressV2(req: GetDepositAddressV2Req): Promise; /** * @deprecated - * getDepositAddressV2 Get Deposit Addresses(V2) + * getDepositAddressV1 Get Deposit Addresses - V1 * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. - * Documentation: https://www.kucoin.com/docs-new/api-3470300 + * Documentation: https://www.kucoin.com/docs-new/api-3470305 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -99,12 +97,13 @@ export interface DepositAPI { * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - getDepositAddressV2(req: GetDepositAddressV2Req): Promise; + getDepositAddressV1(req: GetDepositAddressV1Req): Promise; /** - * addDepositAddressV3 Add Deposit Address(V3) - * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. - * Documentation: https://www.kucoin.com/docs-new/api-3470142 + * @deprecated + * getDepositHistoryOld Get Deposit History - Old + * Description: Request via this endpoint to get the V1 historical deposits list on KuCoin. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470306 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -112,15 +111,16 @@ export interface DepositAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - addDepositAddressV3(req: AddDepositAddressV3Req): Promise; + getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise; /** - * getDepositAddressV3 Get Deposit Address(V3) - * Description: Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to Add Deposit Address first. - * Documentation: https://www.kucoin.com/docs-new/api-3470140 + * @deprecated + * addDepositAddressV1 Add Deposit Address - V1 + * Description: Request via this endpoint to create a deposit address for a currency you intend to deposit. + * Documentation: https://www.kucoin.com/docs-new/api-3470309 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -128,35 +128,35 @@ export interface DepositAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getDepositAddressV3(req: GetDepositAddressV3Req): Promise; + addDepositAddressV1(req: AddDepositAddressV1Req): Promise; } export class DepositAPIImpl implements DepositAPI { constructor(private transport: Transport) {} - getDepositAddressV1(req: GetDepositAddressV1Req): Promise { + addDepositAddressV3(req: AddDepositAddressV3Req): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/deposit-addresses', + 'POST', + '/api/v3/deposit-address/create', req, - new GetDepositAddressV1Resp(), + new AddDepositAddressV3Resp(), false, ); } - addDepositAddressV1(req: AddDepositAddressV1Req): Promise { + getDepositAddressV3(req: GetDepositAddressV3Req): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/deposit-addresses', + 'GET', + '/api/v3/deposit-addresses', req, - new AddDepositAddressV1Resp(), + new GetDepositAddressV3Resp(), false, ); } @@ -173,50 +173,50 @@ export class DepositAPIImpl implements DepositAPI { ); } - getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise { + getDepositAddressV2(req: GetDepositAddressV2Req): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/hist-deposits', + '/api/v2/deposit-addresses', req, - new GetDepositHistoryOldResp(), + new GetDepositAddressV2Resp(), false, ); } - getDepositAddressV2(req: GetDepositAddressV2Req): Promise { + getDepositAddressV1(req: GetDepositAddressV1Req): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v2/deposit-addresses', + '/api/v1/deposit-addresses', req, - new GetDepositAddressV2Resp(), + new GetDepositAddressV1Resp(), false, ); } - addDepositAddressV3(req: AddDepositAddressV3Req): Promise { + getDepositHistoryOld(req: GetDepositHistoryOldReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/deposit-address/create', + 'GET', + '/api/v1/hist-deposits', req, - new AddDepositAddressV3Resp(), + new GetDepositHistoryOldResp(), false, ); } - getDepositAddressV3(req: GetDepositAddressV3Req): Promise { + addDepositAddressV1(req: AddDepositAddressV1Req): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/deposit-addresses', + 'POST', + '/api/v1/deposit-addresses', req, - new GetDepositAddressV3Resp(), + new AddDepositAddressV1Resp(), false, ); } diff --git a/sdk/node/src/generate/account/fee/api_fee.template b/sdk/node/src/generate/account/fee/api_fee.template index 1ff5b3e1..efc2d377 100644 --- a/sdk/node/src/generate/account/fee/api_fee.template +++ b/sdk/node/src/generate/account/fee/api_fee.template @@ -18,6 +18,7 @@ describe('Auto Test', ()=> { return resp.then(result => { expect(result.takerFeeRate).toEqual(expect.anything()); expect(result.makerFeeRate).toEqual(expect.anything()); + console.log(resp); }); }) @@ -33,6 +34,7 @@ describe('Auto Test', ()=> { let resp = api.getSpotActualFee(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -50,6 +52,7 @@ describe('Auto Test', ()=> { expect(result.symbol).toEqual(expect.anything()); expect(result.takerFeeRate).toEqual(expect.anything()); expect(result.makerFeeRate).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.template b/sdk/node/src/generate/account/subaccount/api_sub_account.template index cb1623ce..42245413 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.template +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.template @@ -5,31 +5,74 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getFuturesSubAccountListV2 request test', ()=> { + test('addSubAccount request test', ()=> { /** - * getFuturesSubAccountListV2 - * Get SubAccount List - Futures Balance(V2) - * /api/v1/account-overview-all + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created */ - let builder = GetFuturesSubAccountListV2Req.builder(); - builder.setCurrency(?); + let builder = AddSubAccountReq.builder(); + builder.setPassword(?).setRemarks(?).setSubName(?).setAccess(?); let req = builder.build(); - let resp = api.getFuturesSubAccountListV2(req); + let resp = api.addSubAccount(req); return resp.then(result => { - expect(result.summary).toEqual(expect.anything()); - expect(result.accounts).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + expect(result.remarks).toEqual(expect.anything()); + expect(result.access).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSpotSubAccountListV1 request test', ()=> { + test('addSubAccountMarginPermission request test', ()=> { /** - * getSpotSubAccountListV1 - * Get SubAccount List - Spot Balance(V1) - * /api/v1/sub-accounts + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable */ - let resp = api.getSpotSubAccountListV1(); + let builder = AddSubAccountMarginPermissionReq.builder(); + builder.setUid(?); + let req = builder.build(); + let resp = api.addSubAccountMarginPermission(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addSubAccountFuturesPermission request test', ()=> { + /** + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable + */ + let builder = AddSubAccountFuturesPermissionReq.builder(); + builder.setUid(?); + let req = builder.build(); + let resp = api.addSubAccountFuturesPermission(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getSpotSubAccountsSummaryV2 request test', ()=> { + /** + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user + */ + let builder = GetSpotSubAccountsSummaryV2Req.builder(); + builder.setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getSpotSubAccountsSummaryV2(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -50,37 +93,44 @@ describe('Auto Test', ()=> { expect(result.tradeAccounts).toEqual(expect.anything()); expect(result.marginAccounts).toEqual(expect.anything()); expect(result.tradeHFAccounts).toEqual(expect.anything()); + console.log(resp); }); }) - test('deleteSubAccountApi request test', ()=> { + test('getSpotSubAccountListV2 request test', ()=> { /** - * deleteSubAccountApi - * Delete SubAccount API - * /api/v1/sub/api-key + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts */ - let builder = DeleteSubAccountApiReq.builder(); - builder.setApiKey(?).setSubName(?).setPassphrase(?); + let builder = GetSpotSubAccountListV2Req.builder(); + builder.setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.deleteSubAccountApi(req); + let resp = api.getSpotSubAccountListV2(req); return resp.then(result => { - expect(result.subName).toEqual(expect.anything()); - expect(result.apiKey).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSubAccountApiList request test', ()=> { + test('getFuturesSubAccountListV2 request test', ()=> { /** - * getSubAccountApiList - * Get SubAccount API List - * /api/v1/sub/api-key + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all */ - let builder = GetSubAccountApiListReq.builder(); - builder.setApiKey(?).setSubName(?); + let builder = GetFuturesSubAccountListV2Req.builder(); + builder.setCurrency(?); let req = builder.build(); - let resp = api.getSubAccountApiList(req); + let resp = api.getFuturesSubAccountListV2(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.summary).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); }); }) @@ -104,6 +154,7 @@ describe('Auto Test', ()=> { expect(result.permission).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); }); }) @@ -122,104 +173,66 @@ describe('Auto Test', ()=> { expect(result.apiKey).toEqual(expect.anything()); expect(result.permission).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSpotSubAccountsSummaryV1 request test', ()=> { - /** - * getSpotSubAccountsSummaryV1 - * Get SubAccount List - Summary Info(V1) - * /api/v1/sub/user - */ - let resp = api.getSpotSubAccountsSummaryV1(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getSpotSubAccountListV2 request test', ()=> { + test('getSubAccountApiList request test', ()=> { /** - * getSpotSubAccountListV2 - * Get SubAccount List - Spot Balance(V2) - * /api/v2/sub-accounts + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key */ - let builder = GetSpotSubAccountListV2Req.builder(); - builder.setCurrentPage(?).setPageSize(?); + let builder = GetSubAccountApiListReq.builder(); + builder.setApiKey(?).setSubName(?); let req = builder.build(); - let resp = api.getSpotSubAccountListV2(req); + let resp = api.getSubAccountApiList(req); return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('addSubAccount request test', ()=> { + test('deleteSubAccountApi request test', ()=> { /** - * addSubAccount - * Add SubAccount - * /api/v2/sub/user/created + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key */ - let builder = AddSubAccountReq.builder(); - builder.setPassword(?).setRemarks(?).setSubName(?).setAccess(?); + let builder = DeleteSubAccountApiReq.builder(); + builder.setApiKey(?).setSubName(?).setPassphrase(?); let req = builder.build(); - let resp = api.addSubAccount(req); + let resp = api.deleteSubAccountApi(req); return resp.then(result => { - expect(result.uid).toEqual(expect.anything()); expect(result.subName).toEqual(expect.anything()); - expect(result.remarks).toEqual(expect.anything()); - expect(result.access).toEqual(expect.anything()); - }); - }) - - test('getSpotSubAccountsSummaryV2 request test', ()=> { - /** - * getSpotSubAccountsSummaryV2 - * Get SubAccount List - Summary Info - * /api/v2/sub/user - */ - let builder = GetSpotSubAccountsSummaryV2Req.builder(); - builder.setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getSpotSubAccountsSummaryV2(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + console.log(resp); }); }) - test('addSubAccountFuturesPermission request test', ()=> { + test('getSpotSubAccountsSummaryV1 request test', ()=> { /** - * addSubAccountFuturesPermission - * Add SubAccount Futures Permission - * /api/v3/sub/user/futures/enable + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user */ - let builder = AddSubAccountFuturesPermissionReq.builder(); - builder.setUid(?); - let req = builder.build(); - let resp = api.addSubAccountFuturesPermission(req); + let resp = api.getSpotSubAccountsSummaryV1(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('addSubAccountMarginPermission request test', ()=> { + test('getSpotSubAccountListV1 request test', ()=> { /** - * addSubAccountMarginPermission - * Add SubAccount Margin Permission - * /api/v3/sub/user/margin/enable + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts */ - let builder = AddSubAccountMarginPermissionReq.builder(); - builder.setUid(?); - let req = builder.build(); - let resp = api.addSubAccountMarginPermission(req); + let resp = api.getSpotSubAccountListV1(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts index a53dd3e2..c788490f 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts @@ -1,10 +1,10 @@ import { GetSpotSubAccountListV2Resp } from './model_get_spot_sub_account_list_v2_resp'; import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; -import { AddSubAccountReq } from './model_add_sub_account_req'; import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; -import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; +import { AddSubAccountReq } from './model_add_sub_account_req'; import { GetSubAccountApiListResp } from './model_get_sub_account_api_list_resp'; +import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; import { GetSpotSubAccountDetailResp } from './model_get_spot_sub_account_detail_resp'; import { DeleteSubAccountApiReq } from './model_delete_sub_account_api_req'; import { GetSpotSubAccountListV1Resp } from './model_get_spot_sub_account_list_v1_resp'; @@ -17,22 +17,23 @@ import { GetSpotSubAccountsSummaryV1Resp } from './model_get_spot_sub_accounts_s import { GetSpotSubAccountsSummaryV2Req } from './model_get_spot_sub_accounts_summary_v2_req'; import { AddSubAccountFuturesPermissionResp } from './model_add_sub_account_futures_permission_resp'; import { AddSubAccountResp } from './model_add_sub_account_resp'; -import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; import { DeleteSubAccountApiResp } from './model_delete_sub_account_api_resp'; +import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; import { GetSpotSubAccountDetailReq } from './model_get_spot_sub_account_detail_req'; import { GetSpotSubAccountsSummaryV2Resp } from './model_get_spot_sub_accounts_summary_v2_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getFuturesSubAccountListV2 request test', () => { + test('addSubAccount request test', () => { /** - * getFuturesSubAccountListV2 - * Get SubAccount List - Futures Balance(V2) - * /api/v1/account-overview-all + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created */ - let data = '{"currency": "USDT"}'; - let req = new GetFuturesSubAccountListV2Req(); + let data = + '{"password": "1234567", "remarks": "TheRemark", "subName": "Name1234567", "access": "Spot"}'; + let req = new AddSubAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -40,16 +41,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getFuturesSubAccountListV2 response test', () => { + test('addSubAccount response test', () => { /** - * getFuturesSubAccountListV2 - * Get SubAccount List - Futures Balance(V2) - * /api/v1/account-overview-all + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created */ let data = - '{\n "code": "200000",\n "data": {\n "summary": {\n "accountEquityTotal": 103.899081508,\n "unrealisedPNLTotal": 38.81075,\n "marginBalanceTotal": 65.336985668,\n "positionMarginTotal": 68.9588320683,\n "orderMarginTotal": 0,\n "frozenFundsTotal": 0,\n "availableBalanceTotal": 67.2492494397,\n "currency": "USDT"\n },\n "accounts": [\n {\n "accountName": "Name1234567",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "LTkucoin1491",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "manage112233",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "testapi6",\n "accountEquity": 27.30545128,\n "unrealisedPNL": 22.549,\n "marginBalance": 4.75645128,\n "positionMargin": 24.1223749975,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 25.7320762825,\n "currency": "USDT"\n },\n {\n "accountName": "main",\n "accountEquity": 76.593630228,\n "unrealisedPNL": 16.26175,\n "marginBalance": 60.580534388,\n "positionMargin": 44.8364570708,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 41.5171731572,\n "currency": "USDT"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesSubAccountListV2Resp(); + let resp = new AddSubAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -58,29 +59,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotSubAccountListV1 request test', () => { - /** - * getSpotSubAccountListV1 - * Get SubAccount List - Spot Balance(V1) - * /api/v1/sub-accounts - */ - }); - - test('getSpotSubAccountListV1 response test', () => { - /** - * getSpotSubAccountListV1 - * Get SubAccount List - Spot Balance(V1) - * /api/v1/sub-accounts - */ - }); - test('getSpotSubAccountDetail request test', () => { + test('addSubAccountMarginPermission request test', () => { /** - * getSpotSubAccountDetail - * Get SubAccount Detail - Balance - * /api/v1/sub-accounts/{subUserId} + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable */ - let data = '{"subUserId": "63743f07e0c5230001761d08", "includeBaseAmount": true}'; - let req = new GetSpotSubAccountDetailReq(); + let data = '{"uid": "169579801"}'; + let req = new AddSubAccountMarginPermissionReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -88,16 +74,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotSubAccountDetail response test', () => { + test('addSubAccountMarginPermission response test', () => { /** - * getSpotSubAccountDetail - * Get SubAccount Detail - Balance - * /api/v1/sub-accounts/{subUserId} + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable */ - let data = - '{\n "code": "200000",\n "data": {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n }\n}'; + let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountDetailResp(); + let resp = new AddSubAccountMarginPermissionResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -106,15 +91,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('deleteSubAccountApi request test', () => { + test('addSubAccountFuturesPermission request test', () => { /** - * deleteSubAccountApi - * Delete SubAccount API - * /api/v1/sub/api-key + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable */ - let data = - '{"apiKey": "670621e3a25958000159c82f", "subName": "testapi6", "passphrase": "11223344"}'; - let req = new DeleteSubAccountApiReq(); + let data = '{"uid": "169579801"}'; + let req = new AddSubAccountFuturesPermissionReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -122,16 +106,15 @@ describe('Auto Test', () => { console.log(req); }); - test('deleteSubAccountApi response test', () => { + test('addSubAccountFuturesPermission response test', () => { /** - * deleteSubAccountApi - * Delete SubAccount API - * /api/v1/sub/api-key + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable */ - let data = - '{"code":"200000","data":{"subName":"testapi6","apiKey":"670621e3a25958000159c82f"}}'; + let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new DeleteSubAccountApiResp(); + let resp = new AddSubAccountFuturesPermissionResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -140,14 +123,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSubAccountApiList request test', () => { + test('getSpotSubAccountsSummaryV2 request test', () => { /** - * getSubAccountApiList - * Get SubAccount API List - * /api/v1/sub/api-key + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user */ - let data = '{"apiKey": "example_string_default_value", "subName": "testapi6"}'; - let req = new GetSubAccountApiListReq(); + let data = '{"currentPage": 1, "pageSize": 10}'; + let req = new GetSpotSubAccountsSummaryV2Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -155,16 +138,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSubAccountApiList response test', () => { + test('getSpotSubAccountsSummaryV2 response test', () => { /** - * getSubAccountApiList - * Get SubAccount API List - * /api/v1/sub/api-key + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user */ let data = - '{\n "code": "200000",\n "data": [\n {\n "subName": "apiSdkTest",\n "remark": "sdk_test_integration",\n "apiKey": "673eab2a955ebf000195d7e4",\n "apiVersion": 3,\n "permission": "General",\n "ipWhitelist": "10.**.1",\n "createdAt": 1732160298000,\n "uid": 215112467,\n "isMaster": false\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountApiListResp(); + let resp = new GetSpotSubAccountsSummaryV2Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -173,15 +156,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addSubAccountApi request test', () => { + test('getSpotSubAccountDetail request test', () => { /** - * addSubAccountApi - * Add SubAccount API - * /api/v1/sub/api-key + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} */ - let data = - '{"subName": "testapi6", "passphrase": "11223344", "remark": "TheRemark", "permission": "General,Spot,Futures"}'; - let req = new AddSubAccountApiReq(); + let data = '{"subUserId": "63743f07e0c5230001761d08", "includeBaseAmount": true}'; + let req = new GetSpotSubAccountDetailReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -189,16 +171,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addSubAccountApi response test', () => { + test('getSpotSubAccountDetail response test', () => { /** - * addSubAccountApi - * Add SubAccount API - * /api/v1/sub/api-key + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} */ let data = - '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "remark": "TheRemark",\n "apiKey": "670621e3a25958000159c82f",\n "apiSecret": "46fd8974******896f005b2340",\n "apiVersion": 3,\n "passphrase": "11223344",\n "permission": "General,Futures",\n "createdAt": 1728455139000\n }\n}'; + '{\n "code": "200000",\n "data": {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountApiResp(); + let resp = new GetSpotSubAccountDetailResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -207,15 +189,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('modifySubAccountApi request test', () => { + test('getSpotSubAccountListV2 request test', () => { /** - * modifySubAccountApi - * Modify SubAccount API - * /api/v1/sub/api-key/update + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts */ - let data = - '{"subName": "testapi6", "apiKey": "670621e3a25958000159c82f", "passphrase": "11223344", "permission": "General,Spot,Futures"}'; - let req = new ModifySubAccountApiReq(); + let data = '{"currentPage": 1, "pageSize": 10}'; + let req = new GetSpotSubAccountListV2Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -223,16 +204,16 @@ describe('Auto Test', () => { console.log(req); }); - test('modifySubAccountApi response test', () => { + test('getSpotSubAccountListV2 response test', () => { /** - * modifySubAccountApi - * Modify SubAccount API - * /api/v1/sub/api-key/update + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts */ let data = - '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "apiKey": "670621e3a25958000159c82f",\n "permission": "General,Futures,Spot"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "670538a31037eb000115b076",\n "subName": "Name1234567",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "66b0c0905fc1480001c14c36",\n "subName": "LTkucoin1491",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifySubAccountApiResp(); + let resp = new GetSpotSubAccountListV2Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -241,29 +222,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotSubAccountsSummaryV1 request test', () => { - /** - * getSpotSubAccountsSummaryV1 - * Get SubAccount List - Summary Info(V1) - * /api/v1/sub/user - */ - }); - - test('getSpotSubAccountsSummaryV1 response test', () => { - /** - * getSpotSubAccountsSummaryV1 - * Get SubAccount List - Summary Info(V1) - * /api/v1/sub/user - */ - }); - test('getSpotSubAccountListV2 request test', () => { + test('getFuturesSubAccountListV2 request test', () => { /** - * getSpotSubAccountListV2 - * Get SubAccount List - Spot Balance(V2) - * /api/v2/sub-accounts + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all */ - let data = '{"currentPage": 1, "pageSize": 10}'; - let req = new GetSpotSubAccountListV2Req(); + let data = '{"currency": "USDT"}'; + let req = new GetFuturesSubAccountListV2Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -271,16 +237,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotSubAccountListV2 response test', () => { + test('getFuturesSubAccountListV2 response test', () => { /** - * getSpotSubAccountListV2 - * Get SubAccount List - Spot Balance(V2) - * /api/v2/sub-accounts + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "670538a31037eb000115b076",\n "subName": "Name1234567",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "66b0c0905fc1480001c14c36",\n "subName": "LTkucoin1491",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "summary": {\n "accountEquityTotal": 103.899081508,\n "unrealisedPNLTotal": 38.81075,\n "marginBalanceTotal": 65.336985668,\n "positionMarginTotal": 68.9588320683,\n "orderMarginTotal": 0,\n "frozenFundsTotal": 0,\n "availableBalanceTotal": 67.2492494397,\n "currency": "USDT"\n },\n "accounts": [\n {\n "accountName": "Name1234567",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "LTkucoin1491",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "manage112233",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "testapi6",\n "accountEquity": 27.30545128,\n "unrealisedPNL": 22.549,\n "marginBalance": 4.75645128,\n "positionMargin": 24.1223749975,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 25.7320762825,\n "currency": "USDT"\n },\n {\n "accountName": "main",\n "accountEquity": 76.593630228,\n "unrealisedPNL": 16.26175,\n "marginBalance": 60.580534388,\n "positionMargin": 44.8364570708,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 41.5171731572,\n "currency": "USDT"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountListV2Resp(); + let resp = new GetFuturesSubAccountListV2Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -289,15 +255,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addSubAccount request test', () => { + test('addSubAccountApi request test', () => { /** - * addSubAccount - * Add SubAccount - * /api/v2/sub/user/created + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key */ let data = - '{"password": "1234567", "remarks": "TheRemark", "subName": "Name1234567", "access": "Spot"}'; - let req = new AddSubAccountReq(); + '{"subName": "testapi6", "passphrase": "11223344", "remark": "TheRemark", "permission": "General,Spot,Futures"}'; + let req = new AddSubAccountApiReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -305,16 +271,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addSubAccount response test', () => { + test('addSubAccountApi response test', () => { /** - * addSubAccount - * Add SubAccount - * /api/v2/sub/user/created + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "remark": "TheRemark",\n "apiKey": "670621e3a25958000159c82f",\n "apiSecret": "46fd8974******896f005b2340",\n "apiVersion": 3,\n "passphrase": "11223344",\n "permission": "General,Futures",\n "createdAt": 1728455139000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountResp(); + let resp = new AddSubAccountApiResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -323,14 +289,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotSubAccountsSummaryV2 request test', () => { + test('modifySubAccountApi request test', () => { /** - * getSpotSubAccountsSummaryV2 - * Get SubAccount List - Summary Info - * /api/v2/sub/user + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update */ - let data = '{"currentPage": 1, "pageSize": 10}'; - let req = new GetSpotSubAccountsSummaryV2Req(); + let data = + '{"subName": "testapi6", "apiKey": "670621e3a25958000159c82f", "passphrase": "11223344", "permission": "General,Spot,Futures"}'; + let req = new ModifySubAccountApiReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -338,16 +305,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotSubAccountsSummaryV2 response test', () => { + test('modifySubAccountApi response test', () => { /** - * getSpotSubAccountsSummaryV2 - * Get SubAccount List - Summary Info - * /api/v2/sub/user + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "apiKey": "670621e3a25958000159c82f",\n "permission": "General,Futures,Spot"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountsSummaryV2Resp(); + let resp = new ModifySubAccountApiResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -356,14 +323,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addSubAccountFuturesPermission request test', () => { + test('getSubAccountApiList request test', () => { /** - * addSubAccountFuturesPermission - * Add SubAccount Futures Permission - * /api/v3/sub/user/futures/enable + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key */ - let data = '{"uid": "169579801"}'; - let req = new AddSubAccountFuturesPermissionReq(); + let data = '{"apiKey": "example_string_default_value", "subName": "testapi6"}'; + let req = new GetSubAccountApiListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -371,15 +338,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addSubAccountFuturesPermission response test', () => { + test('getSubAccountApiList response test', () => { /** - * addSubAccountFuturesPermission - * Add SubAccount Futures Permission - * /api/v3/sub/user/futures/enable + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key */ - let data = '{\n "code": "200000",\n "data": null\n}'; + let data = + '{\n "code": "200000",\n "data": [\n {\n "subName": "apiSdkTest",\n "remark": "sdk_test_integration",\n "apiKey": "673eab2a955ebf000195d7e4",\n "apiVersion": 3,\n "permission": "General",\n "ipWhitelist": "10.**.1",\n "createdAt": 1732160298000,\n "uid": 215112467,\n "isMaster": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountFuturesPermissionResp(); + let resp = new GetSubAccountApiListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -388,14 +356,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addSubAccountMarginPermission request test', () => { + test('deleteSubAccountApi request test', () => { /** - * addSubAccountMarginPermission - * Add SubAccount Margin Permission - * /api/v3/sub/user/margin/enable + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key */ - let data = '{"uid": "169579801"}'; - let req = new AddSubAccountMarginPermissionReq(); + let data = + '{"apiKey": "670621e3a25958000159c82f", "subName": "testapi6", "passphrase": "11223344"}'; + let req = new DeleteSubAccountApiReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -403,15 +372,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addSubAccountMarginPermission response test', () => { + test('deleteSubAccountApi response test', () => { /** - * addSubAccountMarginPermission - * Add SubAccount Margin Permission - * /api/v3/sub/user/margin/enable + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key */ - let data = '{\n "code": "200000",\n "data": null\n}'; + let data = + '{"code":"200000","data":{"subName":"testapi6","apiKey":"670621e3a25958000159c82f"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountMarginPermissionResp(); + let resp = new DeleteSubAccountApiResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -420,4 +390,34 @@ describe('Auto Test', () => { console.log(resp); } }); + test('getSpotSubAccountsSummaryV1 request test', () => { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + }); + + test('getSpotSubAccountsSummaryV1 response test', () => { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + }); + test('getSpotSubAccountListV1 request test', () => { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + }); + + test('getSpotSubAccountListV1 response test', () => { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + }); }); diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.ts index d022f474..8995258b 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.ts +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.ts @@ -4,10 +4,10 @@ import { Transport } from '@internal/interfaces/transport'; import { GetSpotSubAccountListV2Resp } from './model_get_spot_sub_account_list_v2_resp'; import { AddSubAccountApiResp } from './model_add_sub_account_api_resp'; import { AddSubAccountApiReq } from './model_add_sub_account_api_req'; -import { AddSubAccountReq } from './model_add_sub_account_req'; import { ModifySubAccountApiResp } from './model_modify_sub_account_api_resp'; -import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; +import { AddSubAccountReq } from './model_add_sub_account_req'; import { GetSubAccountApiListResp } from './model_get_sub_account_api_list_resp'; +import { AddSubAccountMarginPermissionReq } from './model_add_sub_account_margin_permission_req'; import { GetSpotSubAccountDetailResp } from './model_get_spot_sub_account_detail_resp'; import { DeleteSubAccountApiReq } from './model_delete_sub_account_api_req'; import { GetSpotSubAccountListV1Resp } from './model_get_spot_sub_account_list_v1_resp'; @@ -20,36 +20,17 @@ import { GetSpotSubAccountsSummaryV1Resp } from './model_get_spot_sub_accounts_s import { GetSpotSubAccountsSummaryV2Req } from './model_get_spot_sub_accounts_summary_v2_req'; import { AddSubAccountFuturesPermissionResp } from './model_add_sub_account_futures_permission_resp'; import { AddSubAccountResp } from './model_add_sub_account_resp'; -import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; import { DeleteSubAccountApiResp } from './model_delete_sub_account_api_resp'; +import { GetSubAccountApiListReq } from './model_get_sub_account_api_list_req'; import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; import { GetSpotSubAccountDetailReq } from './model_get_spot_sub_account_detail_req'; import { GetSpotSubAccountsSummaryV2Resp } from './model_get_spot_sub_accounts_summary_v2_resp'; export interface SubAccountAPI { /** - * getFuturesSubAccountListV2 Get SubAccount List - Futures Balance(V2) - * Description: This endpoint can be used to get Futures sub-account information. - * Documentation: https://www.kucoin.com/docs-new/api-3470134 - * +---------------------+---------+ - * | Extra API Info | Value | - * +---------------------+---------+ - * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 6 | - * +---------------------+---------+ - */ - getFuturesSubAccountListV2( - req: GetFuturesSubAccountListV2Req, - ): Promise; - - /** - * @deprecated - * getSpotSubAccountListV1 Get SubAccount List - Spot Balance(V1) - * Description: This endpoint returns the account info of all sub-users. - * Documentation: https://www.kucoin.com/docs-new/api-3470299 + * addSubAccount Add SubAccount + * Description: This endpoint can be used to create sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470135 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -57,47 +38,51 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 15 | * +---------------------+------------+ */ - getSpotSubAccountListV1(): Promise; + addSubAccount(req: AddSubAccountReq): Promise; /** - * getSpotSubAccountDetail Get SubAccount Detail - Balance - * Description: This endpoint returns the account info of a sub-user specified by the subUserId. - * Documentation: https://www.kucoin.com/docs-new/api-3470132 + * addSubAccountMarginPermission Add SubAccount Margin Permission + * Description: This endpoint can be used to add sub-accounts Margin permission. Before using this endpoints, you need to ensure that the master account apikey has Margin permissions and the Margin function has been activated. + * Documentation: https://www.kucoin.com/docs-new/api-3470331 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | MANAGEMENT | * | API-RATE-LIMIT | 15 | * +---------------------+------------+ */ - getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise; + addSubAccountMarginPermission( + req: AddSubAccountMarginPermissionReq, + ): Promise; /** - * deleteSubAccountApi Delete SubAccount API - * Description: This endpoint can be used to delete sub-account APIs. - * Documentation: https://www.kucoin.com/docs-new/api-3470137 + * addSubAccountFuturesPermission Add SubAccount Futures Permission + * Description: This endpoint can be used to add sub-accounts Futures permission. Before using this endpoints, you need to ensure that the master account apikey has Futures permissions and the Futures function has been activated. + * Documentation: https://www.kucoin.com/docs-new/api-3470332 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 15 | * +---------------------+------------+ */ - deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise; + addSubAccountFuturesPermission( + req: AddSubAccountFuturesPermissionReq, + ): Promise; /** - * getSubAccountApiList Get SubAccount API List - * Description: This endpoint can be used to obtain a list of APIs pertaining to a sub-account.(Not contain ND Broker Sub Account) - * Documentation: https://www.kucoin.com/docs-new/api-3470136 + * getSpotSubAccountsSummaryV2 Get SubAccount List - Summary Info + * Description: This endpoint can be used to get a paginated list of sub-accounts. Pagination is required. + * Documentation: https://www.kucoin.com/docs-new/api-3470131 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -108,12 +93,14 @@ export interface SubAccountAPI { * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getSubAccountApiList(req: GetSubAccountApiListReq): Promise; + getSpotSubAccountsSummaryV2( + req: GetSpotSubAccountsSummaryV2Req, + ): Promise; /** - * addSubAccountApi Add SubAccount API - * Description: This endpoint can be used to create APIs for sub-accounts. - * Documentation: https://www.kucoin.com/docs-new/api-3470138 + * getSpotSubAccountDetail Get SubAccount Detail - Balance + * Description: This endpoint returns the account info of a sub-user specified by the subUserId. + * Documentation: https://www.kucoin.com/docs-new/api-3470132 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -121,15 +108,15 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 15 | * +---------------------+------------+ */ - addSubAccountApi(req: AddSubAccountApiReq): Promise; + getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise; /** - * modifySubAccountApi Modify SubAccount API - * Description: This endpoint can be used to modify sub-account APIs. - * Documentation: https://www.kucoin.com/docs-new/api-3470139 + * getSpotSubAccountListV2 Get SubAccount List - Spot Balance(V2) + * Description: This endpoint can be used to get paginated Spot sub-account information. Pagination is required. + * Documentation: https://www.kucoin.com/docs-new/api-3470133 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -137,16 +124,33 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - modifySubAccountApi(req: ModifySubAccountApiReq): Promise; + getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise; /** - * @deprecated - * getSpotSubAccountsSummaryV1 Get SubAccount List - Summary Info(V1) - * Description: You can get the user info of all sub-account via this interface It is recommended to use the GET /api/v2/sub/user interface for paging query - * Documentation: https://www.kucoin.com/docs-new/api-3470298 + * getFuturesSubAccountListV2 Get SubAccount List - Futures Balance(V2) + * Description: This endpoint can be used to get Futures sub-account information. + * Documentation: https://www.kucoin.com/docs-new/api-3470134 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 6 | + * +---------------------+---------+ + */ + getFuturesSubAccountListV2( + req: GetFuturesSubAccountListV2Req, + ): Promise; + + /** + * addSubAccountApi Add SubAccount API + * Description: This endpoint can be used to create APIs for sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470138 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -157,12 +161,12 @@ export interface SubAccountAPI { * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getSpotSubAccountsSummaryV1(): Promise; + addSubAccountApi(req: AddSubAccountApiReq): Promise; /** - * getSpotSubAccountListV2 Get SubAccount List - Spot Balance(V2) - * Description: This endpoint can be used to get paginated Spot sub-account information. Pagination is required. - * Documentation: https://www.kucoin.com/docs-new/api-3470133 + * modifySubAccountApi Modify SubAccount API + * Description: This endpoint can be used to modify sub-account APIs. + * Documentation: https://www.kucoin.com/docs-new/api-3470139 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -170,15 +174,15 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 30 | * +---------------------+------------+ */ - getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise; + modifySubAccountApi(req: ModifySubAccountApiReq): Promise; /** - * addSubAccount Add SubAccount - * Description: This endpoint can be used to create sub-accounts. - * Documentation: https://www.kucoin.com/docs-new/api-3470135 + * getSubAccountApiList Get SubAccount API List + * Description: This endpoint can be used to obtain a list of APIs pertaining to a sub-account.(Not contain ND Broker Sub Account) + * Documentation: https://www.kucoin.com/docs-new/api-3470136 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -186,15 +190,15 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - addSubAccount(req: AddSubAccountReq): Promise; + getSubAccountApiList(req: GetSubAccountApiListReq): Promise; /** - * getSpotSubAccountsSummaryV2 Get SubAccount List - Summary Info - * Description: This endpoint can be used to get a paginated list of sub-accounts. Pagination is required. - * Documentation: https://www.kucoin.com/docs-new/api-3470131 + * deleteSubAccountApi Delete SubAccount API + * Description: This endpoint can be used to delete sub-account APIs. + * Documentation: https://www.kucoin.com/docs-new/api-3470137 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -202,213 +206,209 @@ export interface SubAccountAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 30 | * +---------------------+------------+ */ - getSpotSubAccountsSummaryV2( - req: GetSpotSubAccountsSummaryV2Req, - ): Promise; + deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise; /** - * addSubAccountFuturesPermission Add SubAccount Futures Permission - * Description: This endpoint can be used to add sub-accounts Futures permission. Before using this endpoints, you need to ensure that the master account apikey has Futures permissions and the Futures function has been activated. - * Documentation: https://www.kucoin.com/docs-new/api-3470332 + * @deprecated + * getSpotSubAccountsSummaryV1 Get SubAccount List - Summary Info(V1) + * Description: You can get the user info of all sub-account via this interface It is recommended to use the GET /api/v2/sub/user interface for paging query + * Documentation: https://www.kucoin.com/docs-new/api-3470298 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - addSubAccountFuturesPermission( - req: AddSubAccountFuturesPermissionReq, - ): Promise; + getSpotSubAccountsSummaryV1(): Promise; /** - * addSubAccountMarginPermission Add SubAccount Margin Permission - * Description: This endpoint can be used to add sub-accounts Margin permission. Before using this endpoints, you need to ensure that the master account apikey has Margin permissions and the Margin function has been activated. - * Documentation: https://www.kucoin.com/docs-new/api-3470331 + * @deprecated + * getSpotSubAccountListV1 Get SubAccount List - Spot Balance(V1) + * Description: This endpoint returns the account info of all sub-users. + * Documentation: https://www.kucoin.com/docs-new/api-3470299 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | MARGIN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - addSubAccountMarginPermission( - req: AddSubAccountMarginPermissionReq, - ): Promise; + getSpotSubAccountListV1(): Promise; } export class SubAccountAPIImpl implements SubAccountAPI { constructor(private transport: Transport) {} - getFuturesSubAccountListV2( - req: GetFuturesSubAccountListV2Req, - ): Promise { + addSubAccount(req: AddSubAccountReq): Promise { return this.transport.call( - 'futures', + 'spot', false, - 'GET', - '/api/v1/account-overview-all', + 'POST', + '/api/v2/sub/user/created', req, - new GetFuturesSubAccountListV2Resp(), + new AddSubAccountResp(), false, ); } - getSpotSubAccountListV1(): Promise { + addSubAccountMarginPermission( + req: AddSubAccountMarginPermissionReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/sub-accounts', - null, - new GetSpotSubAccountListV1Resp(), + 'POST', + '/api/v3/sub/user/margin/enable', + req, + new AddSubAccountMarginPermissionResp(), false, ); } - getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise { + addSubAccountFuturesPermission( + req: AddSubAccountFuturesPermissionReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/sub-accounts/{subUserId}', + 'POST', + '/api/v3/sub/user/futures/enable', req, - new GetSpotSubAccountDetailResp(), + new AddSubAccountFuturesPermissionResp(), false, ); } - deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise { + getSpotSubAccountsSummaryV2( + req: GetSpotSubAccountsSummaryV2Req, + ): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/sub/api-key', + 'GET', + '/api/v2/sub/user', req, - new DeleteSubAccountApiResp(), + new GetSpotSubAccountsSummaryV2Resp(), false, ); } - getSubAccountApiList(req: GetSubAccountApiListReq): Promise { + getSpotSubAccountDetail(req: GetSpotSubAccountDetailReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/sub/api-key', + '/api/v1/sub-accounts/{subUserId}', req, - new GetSubAccountApiListResp(), + new GetSpotSubAccountDetailResp(), false, ); } - addSubAccountApi(req: AddSubAccountApiReq): Promise { + getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/sub/api-key', + 'GET', + '/api/v2/sub-accounts', req, - new AddSubAccountApiResp(), + new GetSpotSubAccountListV2Resp(), false, ); } - modifySubAccountApi(req: ModifySubAccountApiReq): Promise { + getFuturesSubAccountListV2( + req: GetFuturesSubAccountListV2Req, + ): Promise { return this.transport.call( - 'spot', + 'futures', false, - 'POST', - '/api/v1/sub/api-key/update', + 'GET', + '/api/v1/account-overview-all', req, - new ModifySubAccountApiResp(), + new GetFuturesSubAccountListV2Resp(), false, ); } - getSpotSubAccountsSummaryV1(): Promise { + addSubAccountApi(req: AddSubAccountApiReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/sub/user', - null, - new GetSpotSubAccountsSummaryV1Resp(), + 'POST', + '/api/v1/sub/api-key', + req, + new AddSubAccountApiResp(), false, ); } - getSpotSubAccountListV2(req: GetSpotSubAccountListV2Req): Promise { + modifySubAccountApi(req: ModifySubAccountApiReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v2/sub-accounts', + 'POST', + '/api/v1/sub/api-key/update', req, - new GetSpotSubAccountListV2Resp(), + new ModifySubAccountApiResp(), false, ); } - addSubAccount(req: AddSubAccountReq): Promise { + getSubAccountApiList(req: GetSubAccountApiListReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v2/sub/user/created', + 'GET', + '/api/v1/sub/api-key', req, - new AddSubAccountResp(), + new GetSubAccountApiListResp(), false, ); } - getSpotSubAccountsSummaryV2( - req: GetSpotSubAccountsSummaryV2Req, - ): Promise { + deleteSubAccountApi(req: DeleteSubAccountApiReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v2/sub/user', + 'DELETE', + '/api/v1/sub/api-key', req, - new GetSpotSubAccountsSummaryV2Resp(), + new DeleteSubAccountApiResp(), false, ); } - addSubAccountFuturesPermission( - req: AddSubAccountFuturesPermissionReq, - ): Promise { + getSpotSubAccountsSummaryV1(): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/sub/user/futures/enable', - req, - new AddSubAccountFuturesPermissionResp(), + 'GET', + '/api/v1/sub/user', + null, + new GetSpotSubAccountsSummaryV1Resp(), false, ); } - addSubAccountMarginPermission( - req: AddSubAccountMarginPermissionReq, - ): Promise { + getSpotSubAccountListV1(): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/sub/user/margin/enable', - req, - new AddSubAccountMarginPermissionResp(), + 'GET', + '/api/v1/sub-accounts', + null, + new GetSpotSubAccountListV1Resp(), false, ); } diff --git a/sdk/node/src/generate/account/transfer/api_transfer.template b/sdk/node/src/generate/account/transfer/api_transfer.template index 3d031742..8f776289 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.template +++ b/sdk/node/src/generate/account/transfer/api_transfer.template @@ -21,55 +21,23 @@ describe('Auto Test', ()=> { expect(result.available).toEqual(expect.anything()); expect(result.holds).toEqual(expect.anything()); expect(result.transferable).toEqual(expect.anything()); + console.log(resp); }); }) - test('futuresAccountTransferIn request test', ()=> { - /** - * futuresAccountTransferIn - * Futures Account Transfer In - * /api/v1/transfer-in - */ - let builder = FuturesAccountTransferInReq.builder(); - builder.setCurrency(?).setAmount(?).setPayAccountType(?); - let req = builder.build(); - let resp = api.futuresAccountTransferIn(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getFuturesAccountTransferOutLedger request test', ()=> { - /** - * getFuturesAccountTransferOutLedger - * Get Futures Account Transfer Out Ledger - * /api/v1/transfer-list - */ - let builder = GetFuturesAccountTransferOutLedgerReq.builder(); - builder.setCurrency(?).setType(?).setTag(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getFuturesAccountTransferOutLedger(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('innerTransfer request test', ()=> { + test('flexTransfer request test', ()=> { /** - * innerTransfer - * Inner Transfer - * /api/v2/accounts/inner-transfer + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer */ - let builder = InnerTransferReq.builder(); - builder.setClientOid(?).setCurrency(?).setAmount(?).setTo(?).setFromTag(?).setToTag(?).setFrom(?); + let builder = FlexTransferReq.builder(); + builder.setClientOid(?).setCurrency(?).setAmount(?).setFromUserId(?).setFromAccountType(?).setFromAccountTag(?).setType(?).setToUserId(?).setToAccountType(?).setToAccountTag(?); let req = builder.build(); - let resp = api.innerTransfer(req); + let resp = api.flexTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); + console.log(resp); }); }) @@ -85,21 +53,23 @@ describe('Auto Test', ()=> { let resp = api.subAccountTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); + console.log(resp); }); }) - test('flexTransfer request test', ()=> { + test('innerTransfer request test', ()=> { /** - * flexTransfer - * Flex Transfer - * /api/v3/accounts/universal-transfer + * innerTransfer + * Inner Transfer + * /api/v2/accounts/inner-transfer */ - let builder = FlexTransferReq.builder(); - builder.setClientOid(?).setCurrency(?).setAmount(?).setFromUserId(?).setFromAccountType(?).setFromAccountTag(?).setType(?).setToUserId(?).setToAccountType(?).setToAccountTag(?); + let builder = InnerTransferReq.builder(); + builder.setClientOid(?).setCurrency(?).setAmount(?).setTo(?).setFromTag(?).setToTag(?).setFrom(?); let req = builder.build(); - let resp = api.flexTransfer(req); + let resp = api.innerTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); + console.log(resp); }); }) @@ -131,6 +101,43 @@ describe('Auto Test', ()=> { expect(result.reason).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); expect(result.updatedAt).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('futuresAccountTransferIn request test', ()=> { + /** + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in + */ + let builder = FuturesAccountTransferInReq.builder(); + builder.setCurrency(?).setAmount(?).setPayAccountType(?); + let req = builder.build(); + let resp = api.futuresAccountTransferIn(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getFuturesAccountTransferOutLedger request test', ()=> { + /** + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list + */ + let builder = GetFuturesAccountTransferOutLedgerReq.builder(); + builder.setCurrency(?).setType(?).setTag(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getFuturesAccountTransferOutLedger(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/transfer/api_transfer.test.ts b/sdk/node/src/generate/account/transfer/api_transfer.test.ts index df21292d..eb90c566 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.test.ts +++ b/sdk/node/src/generate/account/transfer/api_transfer.test.ts @@ -1,8 +1,8 @@ import { GetFuturesAccountTransferOutLedgerResp } from './model_get_futures_account_transfer_out_ledger_resp'; import { FuturesAccountTransferInResp } from './model_futures_account_transfer_in_resp'; import { InnerTransferResp } from './model_inner_transfer_resp'; -import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; import { InnerTransferReq } from './model_inner_transfer_req'; +import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; import { FlexTransferResp } from './model_flex_transfer_resp'; import { SubAccountTransferReq } from './model_sub_account_transfer_req'; import { GetTransferQuotasResp } from './model_get_transfer_quotas_resp'; @@ -48,14 +48,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('futuresAccountTransferIn request test', () => { + test('flexTransfer request test', () => { /** - * futuresAccountTransferIn - * Futures Account Transfer In - * /api/v1/transfer-in + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer */ - let data = '{"currency": "USDT", "amount": 0.01, "payAccountType": "MAIN"}'; - let req = new FuturesAccountTransferInReq(); + let data = + '{"clientOid": "64ccc0f164781800010d8c09", "type": "PARENT_TO_SUB", "currency": "USDT", "amount": "0.01", "fromAccountType": "TRADE", "toUserId": "63743f07e0c5230001761d08", "toAccountType": "TRADE"}'; + let req = new FlexTransferReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -63,15 +64,16 @@ describe('Auto Test', () => { console.log(req); }); - test('futuresAccountTransferIn response test', () => { + test('flexTransfer response test', () => { /** - * futuresAccountTransferIn - * Futures Account Transfer In - * /api/v1/transfer-in + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer */ - let data = '{"code":"200000","data":null}'; + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "6705f7248c6954000733ecac"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new FuturesAccountTransferInResp(); + let resp = new FlexTransferResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -80,15 +82,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getFuturesAccountTransferOutLedger request test', () => { + test('subAccountTransfer request test', () => { /** - * getFuturesAccountTransferOutLedger - * Get Futures Account Transfer Out Ledger - * /api/v1/transfer-list + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer */ let data = - '{"currency": "XBT", "type": "MAIN", "tag": ["mock_a", "mock_b"], "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetFuturesAccountTransferOutLedgerReq(); + '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "direction": "OUT", "accountType": "MAIN", "subAccountType": "MAIN", "subUserId": "63743f07e0c5230001761d08"}'; + let req = new SubAccountTransferReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -96,16 +98,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getFuturesAccountTransferOutLedger response test', () => { + test('subAccountTransfer response test', () => { /** - * getFuturesAccountTransferOutLedger - * Get Futures Account Transfer Out Ledger - * /api/v1/transfer-list + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer */ - let data = - '{"code":"200000","data":{"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"applyId":"670bf84c577f6c00017a1c48","currency":"USDT","recRemark":"","recSystem":"KUCOIN","status":"SUCCESS","amount":"0.01","reason":"","offset":1519769124134806,"createdAt":1728837708000,"remark":""}]}}'; + let data = '{"code":"200000","data":{"orderId":"670be6b0b1b9080007040a9b"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesAccountTransferOutLedgerResp(); + let resp = new SubAccountTransferResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -147,15 +148,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('subAccountTransfer request test', () => { + test('futuresAccountTransferOut request test', () => { /** - * subAccountTransfer - * SubAccount Transfer - * /api/v2/accounts/sub-transfer + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out */ - let data = - '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "direction": "OUT", "accountType": "MAIN", "subAccountType": "MAIN", "subUserId": "63743f07e0c5230001761d08"}'; - let req = new SubAccountTransferReq(); + let data = '{"currency": "USDT", "amount": 0.01, "recAccountType": "MAIN"}'; + let req = new FuturesAccountTransferOutReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -163,15 +163,16 @@ describe('Auto Test', () => { console.log(req); }); - test('subAccountTransfer response test', () => { + test('futuresAccountTransferOut response test', () => { /** - * subAccountTransfer - * SubAccount Transfer - * /api/v2/accounts/sub-transfer + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out */ - let data = '{"code":"200000","data":{"orderId":"670be6b0b1b9080007040a9b"}}'; + let data = + '{\n "code": "200000",\n "data": {\n "applyId": "670bf84c577f6c00017a1c48",\n "bizNo": "670bf84c577f6c00017a1c47",\n "payAccountType": "CONTRACT",\n "payTag": "DEFAULT",\n "remark": "",\n "recAccountType": "MAIN",\n "recTag": "DEFAULT",\n "recRemark": "",\n "recSystem": "KUCOIN",\n "status": "PROCESSING",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "sn": 1519769124134806,\n "reason": "",\n "createdAt": 1728837708000,\n "updatedAt": 1728837708000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new SubAccountTransferResp(); + let resp = new FuturesAccountTransferOutResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -180,15 +181,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('flexTransfer request test', () => { + test('futuresAccountTransferIn request test', () => { /** - * flexTransfer - * Flex Transfer - * /api/v3/accounts/universal-transfer + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in */ - let data = - '{"clientOid": "64ccc0f164781800010d8c09", "type": "PARENT_TO_SUB", "currency": "USDT", "amount": "0.01", "fromAccountType": "TRADE", "toUserId": "63743f07e0c5230001761d08", "toAccountType": "TRADE"}'; - let req = new FlexTransferReq(); + let data = '{"currency": "USDT", "amount": 0.01, "payAccountType": "MAIN"}'; + let req = new FuturesAccountTransferInReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -196,16 +196,15 @@ describe('Auto Test', () => { console.log(req); }); - test('flexTransfer response test', () => { + test('futuresAccountTransferIn response test', () => { /** - * flexTransfer - * Flex Transfer - * /api/v3/accounts/universal-transfer + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in */ - let data = - '{\n "code": "200000",\n "data": {\n "orderId": "6705f7248c6954000733ecac"\n }\n}'; + let data = '{"code":"200000","data":null}'; let commonResp = RestResponse.fromJson(data); - let resp = new FlexTransferResp(); + let resp = new FuturesAccountTransferInResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -214,14 +213,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('futuresAccountTransferOut request test', () => { + test('getFuturesAccountTransferOutLedger request test', () => { /** - * futuresAccountTransferOut - * Futures Account Transfer Out - * /api/v3/transfer-out + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list */ - let data = '{"currency": "USDT", "amount": 0.01, "recAccountType": "MAIN"}'; - let req = new FuturesAccountTransferOutReq(); + let data = + '{"currency": "XBT", "type": "MAIN", "tag": ["mock_a", "mock_b"], "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetFuturesAccountTransferOutLedgerReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -229,16 +229,16 @@ describe('Auto Test', () => { console.log(req); }); - test('futuresAccountTransferOut response test', () => { + test('getFuturesAccountTransferOutLedger response test', () => { /** - * futuresAccountTransferOut - * Futures Account Transfer Out - * /api/v3/transfer-out + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list */ let data = - '{\n "code": "200000",\n "data": {\n "applyId": "670bf84c577f6c00017a1c48",\n "bizNo": "670bf84c577f6c00017a1c47",\n "payAccountType": "CONTRACT",\n "payTag": "DEFAULT",\n "remark": "",\n "recAccountType": "MAIN",\n "recTag": "DEFAULT",\n "recRemark": "",\n "recSystem": "KUCOIN",\n "status": "PROCESSING",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "sn": 1519769124134806,\n "reason": "",\n "createdAt": 1728837708000,\n "updatedAt": 1728837708000\n }\n}'; + '{"code":"200000","data":{"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"applyId":"670bf84c577f6c00017a1c48","currency":"USDT","recRemark":"","recSystem":"KUCOIN","status":"SUCCESS","amount":"0.01","reason":"","offset":1519769124134806,"createdAt":1728837708000,"remark":""}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new FuturesAccountTransferOutResp(); + let resp = new GetFuturesAccountTransferOutLedgerResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/account/transfer/api_transfer.ts b/sdk/node/src/generate/account/transfer/api_transfer.ts index bb3bf51c..25d3ecc4 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.ts +++ b/sdk/node/src/generate/account/transfer/api_transfer.ts @@ -4,8 +4,8 @@ import { Transport } from '@internal/interfaces/transport'; import { GetFuturesAccountTransferOutLedgerResp } from './model_get_futures_account_transfer_out_ledger_resp'; import { FuturesAccountTransferInResp } from './model_futures_account_transfer_in_resp'; import { InnerTransferResp } from './model_inner_transfer_resp'; -import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; import { InnerTransferReq } from './model_inner_transfer_req'; +import { SubAccountTransferResp } from './model_sub_account_transfer_resp'; import { FlexTransferResp } from './model_flex_transfer_resp'; import { SubAccountTransferReq } from './model_sub_account_transfer_req'; import { GetTransferQuotasResp } from './model_get_transfer_quotas_resp'; @@ -34,42 +34,37 @@ export interface TransferAPI { getTransferQuotas(req: GetTransferQuotasReq): Promise; /** - * @deprecated - * futuresAccountTransferIn Futures Account Transfer In - * Description: The amount to be transferred will be deducted from the payAccount. Please ensure that you have sufficient funds in your payAccount Account, or the transfer will fail. - * Documentation: https://www.kucoin.com/docs-new/api-3470304 - * +---------------------+------------+ - * | Extra API Info | Value | - * +---------------------+------------+ - * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | - * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | - * +---------------------+------------+ + * flexTransfer Flex Transfer + * Description: This interface can be used for transfers between master and sub accounts and inner transfers + * Documentation: https://www.kucoin.com/docs-new/api-3470147 + * +---------------------+---------------+ + * | Extra API Info | Value | + * +---------------------+---------------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FLEXTRANSFERS | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 4 | + * +---------------------+---------------+ */ - futuresAccountTransferIn( - req: FuturesAccountTransferInReq, - ): Promise; + flexTransfer(req: FlexTransferReq): Promise; /** * @deprecated - * getFuturesAccountTransferOutLedger Get Futures Account Transfer Out Ledger - * Description: This endpoint can get futures account transfer out ledger - * Documentation: https://www.kucoin.com/docs-new/api-3470307 + * subAccountTransfer SubAccount Transfer + * Description: Funds in the main account, trading account and margin account of a Master Account can be transferred to the main account, trading account, futures account and margin account of its Sub-Account. The futures account of both the Master Account and Sub-Account can only accept funds transferred in from the main account, trading account and margin account and cannot transfer out to these accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470301 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ - * | API-DOMAIN | FUTURES | + * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 30 | * +---------------------+------------+ */ - getFuturesAccountTransferOutLedger( - req: GetFuturesAccountTransferOutLedgerReq, - ): Promise; + subAccountTransfer(req: SubAccountTransferReq): Promise; /** * @deprecated @@ -90,55 +85,60 @@ export interface TransferAPI { /** * @deprecated - * subAccountTransfer SubAccount Transfer - * Description: Funds in the main account, trading account and margin account of a Master Account can be transferred to the main account, trading account, futures account and margin account of its Sub-Account. The futures account of both the Master Account and Sub-Account can only accept funds transferred in from the main account, trading account and margin account and cannot transfer out to these accounts. - * Documentation: https://www.kucoin.com/docs-new/api-3470301 + * futuresAccountTransferOut Futures Account Transfer Out + * Description: The amount to be transferred will be deducted from the KuCoin Futures Account. Please ensure that you have sufficient funds in your KuCoin Futures Account, or the transfer will fail. + * Documentation: https://www.kucoin.com/docs-new/api-3470303 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ - * | API-DOMAIN | SPOT | + * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - subAccountTransfer(req: SubAccountTransferReq): Promise; + futuresAccountTransferOut( + req: FuturesAccountTransferOutReq, + ): Promise; /** - * flexTransfer Flex Transfer - * Description: This interface can be used for transfers between master and sub accounts and inner transfers - * Documentation: https://www.kucoin.com/docs-new/api-3470147 - * +---------------------+---------------+ - * | Extra API Info | Value | - * +---------------------+---------------+ - * | API-DOMAIN | SPOT | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FLEXTRANSFERS | - * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 4 | - * +---------------------+---------------+ + * @deprecated + * futuresAccountTransferIn Futures Account Transfer In + * Description: The amount to be transferred will be deducted from the payAccount. Please ensure that you have sufficient funds in your payAccount Account, or the transfer will fail. + * Documentation: https://www.kucoin.com/docs-new/api-3470304 + * +---------------------+------------+ + * | Extra API Info | Value | + * +---------------------+------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | MANAGEMENT | + * | API-RATE-LIMIT | 20 | + * +---------------------+------------+ */ - flexTransfer(req: FlexTransferReq): Promise; + futuresAccountTransferIn( + req: FuturesAccountTransferInReq, + ): Promise; /** * @deprecated - * futuresAccountTransferOut Futures Account Transfer Out - * Description: The amount to be transferred will be deducted from the KuCoin Futures Account. Please ensure that you have sufficient funds in your KuCoin Futures Account, or the transfer will fail. - * Documentation: https://www.kucoin.com/docs-new/api-3470303 + * getFuturesAccountTransferOutLedger Get Futures Account Transfer Out Ledger + * Description: This endpoint can get futures account transfer out ledger + * Documentation: https://www.kucoin.com/docs-new/api-3470307 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - futuresAccountTransferOut( - req: FuturesAccountTransferOutReq, - ): Promise; + getFuturesAccountTransferOutLedger( + req: GetFuturesAccountTransferOutLedgerReq, + ): Promise; } export class TransferAPIImpl implements TransferAPI { @@ -156,30 +156,26 @@ export class TransferAPIImpl implements TransferAPI { ); } - futuresAccountTransferIn( - req: FuturesAccountTransferInReq, - ): Promise { + flexTransfer(req: FlexTransferReq): Promise { return this.transport.call( - 'futures', + 'spot', false, 'POST', - '/api/v1/transfer-in', + '/api/v3/accounts/universal-transfer', req, - new FuturesAccountTransferInResp(), + new FlexTransferResp(), false, ); } - getFuturesAccountTransferOutLedger( - req: GetFuturesAccountTransferOutLedgerReq, - ): Promise { + subAccountTransfer(req: SubAccountTransferReq): Promise { return this.transport.call( - 'futures', + 'spot', false, - 'GET', - '/api/v1/transfer-list', + 'POST', + '/api/v2/accounts/sub-transfer', req, - new GetFuturesAccountTransferOutLedgerResp(), + new SubAccountTransferResp(), false, ); } @@ -196,40 +192,44 @@ export class TransferAPIImpl implements TransferAPI { ); } - subAccountTransfer(req: SubAccountTransferReq): Promise { + futuresAccountTransferOut( + req: FuturesAccountTransferOutReq, + ): Promise { return this.transport.call( - 'spot', + 'futures', false, 'POST', - '/api/v2/accounts/sub-transfer', + '/api/v3/transfer-out', req, - new SubAccountTransferResp(), + new FuturesAccountTransferOutResp(), false, ); } - flexTransfer(req: FlexTransferReq): Promise { + futuresAccountTransferIn( + req: FuturesAccountTransferInReq, + ): Promise { return this.transport.call( - 'spot', + 'futures', false, 'POST', - '/api/v3/accounts/universal-transfer', + '/api/v1/transfer-in', req, - new FlexTransferResp(), + new FuturesAccountTransferInResp(), false, ); } - futuresAccountTransferOut( - req: FuturesAccountTransferOutReq, - ): Promise { + getFuturesAccountTransferOutLedger( + req: GetFuturesAccountTransferOutLedgerReq, + ): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v3/transfer-out', + 'GET', + '/api/v1/transfer-list', req, - new FuturesAccountTransferOutResp(), + new GetFuturesAccountTransferOutLedgerResp(), false, ); } diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.template b/sdk/node/src/generate/account/withdrawal/api_withdrawal.template index ff6b304e..ea8f4053 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.template +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.template @@ -5,59 +5,6 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getWithdrawalHistoryOld request test', ()=> { - /** - * getWithdrawalHistoryOld - * Get Withdrawal History - Old - * /api/v1/hist-withdrawals - */ - let builder = GetWithdrawalHistoryOldReq.builder(); - builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getWithdrawalHistoryOld(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('getWithdrawalHistory request test', ()=> { - /** - * getWithdrawalHistory - * Get Withdrawal History - * /api/v1/withdrawals - */ - let builder = GetWithdrawalHistoryReq.builder(); - builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getWithdrawalHistory(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('withdrawalV1 request test', ()=> { - /** - * withdrawalV1 - * Withdraw - V1 - * /api/v1/withdrawals - */ - let builder = WithdrawalV1Req.builder(); - builder.setCurrency(?).setChain(?).setAddress(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?); - let req = builder.build(); - let resp = api.withdrawalV1(req); - return resp.then(result => { - expect(result.withdrawalId).toEqual(expect.anything()); - }); - }) - test('getWithdrawalQuotas request test', ()=> { /** * getWithdrawalQuotas @@ -85,6 +32,23 @@ describe('Auto Test', ()=> { expect(result.chain).toEqual(expect.anything()); expect(result.reason).toEqual(expect.anything()); expect(result.lockedAmount).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('withdrawalV3 request test', ()=> { + /** + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals + */ + let builder = WithdrawalV3Req.builder(); + builder.setCurrency(?).setChain(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?).setToAddress(?).setWithdrawType(?); + let req = builder.build(); + let resp = api.withdrawalV3(req); + return resp.then(result => { + expect(result.withdrawalId).toEqual(expect.anything()); + console.log(resp); }); }) @@ -100,21 +64,63 @@ describe('Auto Test', ()=> { let resp = api.cancelWithdrawal(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('withdrawalV3 request test', ()=> { + test('getWithdrawalHistory request test', ()=> { /** - * withdrawalV3 - * Withdraw(V3) - * /api/v3/withdrawals + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals */ - let builder = WithdrawalV3Req.builder(); - builder.setCurrency(?).setChain(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?).setToAddress(?).setWithdrawType(?); + let builder = GetWithdrawalHistoryReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.withdrawalV3(req); + let resp = api.getWithdrawalHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getWithdrawalHistoryOld request test', ()=> { + /** + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals + */ + let builder = GetWithdrawalHistoryOldReq.builder(); + builder.setCurrency(?).setStatus(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getWithdrawalHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('withdrawalV1 request test', ()=> { + /** + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals + */ + let builder = WithdrawalV1Req.builder(); + builder.setCurrency(?).setChain(?).setAddress(?).setAmount(?).setMemo(?).setIsInner(?).setRemark(?).setFeeDeductType(?); + let req = builder.build(); + let resp = api.withdrawalV1(req); return resp.then(result => { expect(result.withdrawalId).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts index 4671957e..6c62661e 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts @@ -1,27 +1,26 @@ import { WithdrawalV1Req } from './model_withdrawal_v1_req'; import { GetWithdrawalHistoryOldResp } from './model_get_withdrawal_history_old_resp'; import { GetWithdrawalQuotasResp } from './model_get_withdrawal_quotas_resp'; -import { WithdrawalV3Req } from './model_withdrawal_v3_req'; import { CancelWithdrawalResp } from './model_cancel_withdrawal_resp'; +import { WithdrawalV3Req } from './model_withdrawal_v3_req'; import { GetWithdrawalHistoryOldReq } from './model_get_withdrawal_history_old_req'; import { WithdrawalV3Resp } from './model_withdrawal_v3_resp'; import { CancelWithdrawalReq } from './model_cancel_withdrawal_req'; -import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; import { GetWithdrawalHistoryReq } from './model_get_withdrawal_history_req'; +import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; import { WithdrawalV1Resp } from './model_withdrawal_v1_resp'; import { GetWithdrawalHistoryResp } from './model_get_withdrawal_history_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getWithdrawalHistoryOld request test', () => { + test('getWithdrawalQuotas request test', () => { /** - * getWithdrawalHistoryOld - * Get Withdrawal History - Old - * /api/v1/hist-withdrawals + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas */ - let data = - '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetWithdrawalHistoryOldReq(); + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetWithdrawalQuotasReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -29,16 +28,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getWithdrawalHistoryOld response test', () => { + test('getWithdrawalQuotas response test', () => { /** - * getWithdrawalHistoryOld - * Get Withdrawal History - Old - * /api/v1/hist-withdrawals + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1526723468,\n "amount": "0.534",\n "address": "33xW37ZSW4tQvg443Pc7NLCAs167Yc2XUV",\n "walletTxId": "aeacea864c020acf58e51606169240e96774838dcd4f7ce48acf38e3651323f4",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; + '{"code":"200000","data":{"currency":"BTC","limitBTCAmount":"15.79590095","usedBTCAmount":"0.00000000","quotaCurrency":"USDT","limitQuotaCurrencyAmount":"999999.00000000","usedQuotaCurrencyAmount":"0","remainAmount":"15.79590095","availableAmount":"0","withdrawMinFee":"0.0005","innerWithdrawMinFee":"0","withdrawMinSize":"0.001","isWithdrawEnabled":true,"precision":8,"chain":"BTC","reason":null,"lockedAmount":"0"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalHistoryOldResp(); + let resp = new GetWithdrawalQuotasResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -47,15 +46,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getWithdrawalHistory request test', () => { + test('withdrawalV3 request test', () => { /** - * getWithdrawalHistory - * Get Withdrawal History - * /api/v1/withdrawals + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals */ let data = - '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetWithdrawalHistoryReq(); + '{"currency": "USDT", "toAddress": "TKFRQXSDcY****GmLrjJggwX8", "amount": 3, "withdrawType": "ADDRESS", "chain": "trx", "isInner": true, "remark": "this is Remark"}'; + let req = new WithdrawalV3Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -63,16 +62,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getWithdrawalHistory response test', () => { + test('withdrawalV3 response test', () => { /** - * getWithdrawalHistory - * Get Withdrawal History - * /api/v1/withdrawals + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals */ - let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; + let data = '{"code":"200000","data":{"withdrawalId":"670deec84d64da0007d7c946"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalHistoryResp(); + let resp = new WithdrawalV3Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -81,15 +79,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('withdrawalV1 request test', () => { + test('cancelWithdrawal request test', () => { /** - * withdrawalV1 - * Withdraw - V1 - * /api/v1/withdrawals + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} */ - let data = - '{"currency": "USDT", "address": "TKFRQXSDc****16GmLrjJggwX8", "amount": 3, "chain": "trx", "isInner": true}'; - let req = new WithdrawalV1Req(); + let data = '{"withdrawalId": "670b891f7e0f440007730692"}'; + let req = new CancelWithdrawalReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -97,15 +94,15 @@ describe('Auto Test', () => { console.log(req); }); - test('withdrawalV1 response test', () => { + test('cancelWithdrawal response test', () => { /** - * withdrawalV1 - * Withdraw - V1 - * /api/v1/withdrawals + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} */ - let data = '{"code":"200000","data":{"withdrawalId":"670a973cf07b3800070e216c"}}'; + let data = '{"code":"200000","data":null}'; let commonResp = RestResponse.fromJson(data); - let resp = new WithdrawalV1Resp(); + let resp = new CancelWithdrawalResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -114,14 +111,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getWithdrawalQuotas request test', () => { + test('getWithdrawalHistory request test', () => { /** - * getWithdrawalQuotas - * Get Withdrawal Quotas - * /api/v1/withdrawals/quotas + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals */ - let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetWithdrawalQuotasReq(); + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetWithdrawalHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -129,16 +127,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getWithdrawalQuotas response test', () => { + test('getWithdrawalHistory response test', () => { /** - * getWithdrawalQuotas - * Get Withdrawal Quotas - * /api/v1/withdrawals/quotas + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals */ let data = - '{"code":"200000","data":{"currency":"BTC","limitBTCAmount":"15.79590095","usedBTCAmount":"0.00000000","quotaCurrency":"USDT","limitQuotaCurrencyAmount":"999999.00000000","usedQuotaCurrencyAmount":"0","remainAmount":"15.79590095","availableAmount":"0","withdrawMinFee":"0.0005","innerWithdrawMinFee":"0","withdrawMinSize":"0.001","isWithdrawEnabled":true,"precision":8,"chain":"BTC","reason":null,"lockedAmount":"0"}}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalQuotasResp(); + let resp = new GetWithdrawalHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -147,14 +145,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelWithdrawal request test', () => { + test('getWithdrawalHistoryOld request test', () => { /** - * cancelWithdrawal - * Cancel Withdrawal - * /api/v1/withdrawals/{withdrawalId} + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals */ - let data = '{"withdrawalId": "670b891f7e0f440007730692"}'; - let req = new CancelWithdrawalReq(); + let data = + '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetWithdrawalHistoryOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -162,15 +161,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelWithdrawal response test', () => { + test('getWithdrawalHistoryOld response test', () => { /** - * cancelWithdrawal - * Cancel Withdrawal - * /api/v1/withdrawals/{withdrawalId} + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals */ - let data = '{"code":"200000","data":null}'; + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1526723468,\n "amount": "0.534",\n "address": "33xW37ZSW4tQvg443Pc7NLCAs167Yc2XUV",\n "walletTxId": "aeacea864c020acf58e51606169240e96774838dcd4f7ce48acf38e3651323f4",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelWithdrawalResp(); + let resp = new GetWithdrawalHistoryOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -179,15 +179,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('withdrawalV3 request test', () => { + test('withdrawalV1 request test', () => { /** - * withdrawalV3 - * Withdraw(V3) - * /api/v3/withdrawals + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals */ let data = - '{"currency": "USDT", "toAddress": "TKFRQXSDcY****GmLrjJggwX8", "amount": 3, "withdrawType": "ADDRESS", "chain": "trx", "isInner": true, "remark": "this is Remark"}'; - let req = new WithdrawalV3Req(); + '{"currency": "USDT", "address": "TKFRQXSDc****16GmLrjJggwX8", "amount": 3, "chain": "trx", "isInner": true}'; + let req = new WithdrawalV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -195,15 +195,15 @@ describe('Auto Test', () => { console.log(req); }); - test('withdrawalV3 response test', () => { + test('withdrawalV1 response test', () => { /** - * withdrawalV3 - * Withdraw(V3) - * /api/v3/withdrawals + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals */ - let data = '{"code":"200000","data":{"withdrawalId":"670deec84d64da0007d7c946"}}'; + let data = '{"code":"200000","data":{"withdrawalId":"670a973cf07b3800070e216c"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new WithdrawalV3Resp(); + let resp = new WithdrawalV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts index 8b57dd4c..d144c781 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.ts @@ -4,22 +4,21 @@ import { Transport } from '@internal/interfaces/transport'; import { WithdrawalV1Req } from './model_withdrawal_v1_req'; import { GetWithdrawalHistoryOldResp } from './model_get_withdrawal_history_old_resp'; import { GetWithdrawalQuotasResp } from './model_get_withdrawal_quotas_resp'; -import { WithdrawalV3Req } from './model_withdrawal_v3_req'; import { CancelWithdrawalResp } from './model_cancel_withdrawal_resp'; +import { WithdrawalV3Req } from './model_withdrawal_v3_req'; import { GetWithdrawalHistoryOldReq } from './model_get_withdrawal_history_old_req'; import { WithdrawalV3Resp } from './model_withdrawal_v3_resp'; import { CancelWithdrawalReq } from './model_cancel_withdrawal_req'; -import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; import { GetWithdrawalHistoryReq } from './model_get_withdrawal_history_req'; +import { GetWithdrawalQuotasReq } from './model_get_withdrawal_quotas_req'; import { WithdrawalV1Resp } from './model_withdrawal_v1_resp'; import { GetWithdrawalHistoryResp } from './model_get_withdrawal_history_resp'; export interface WithdrawalAPI { /** - * @deprecated - * getWithdrawalHistoryOld Get Withdrawal History - Old - * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. - * Documentation: https://www.kucoin.com/docs-new/api-3470308 + * getWithdrawalQuotas Get Withdrawal Quotas + * Description: This interface can obtain the withdrawal quotas information of this currency. + * Documentation: https://www.kucoin.com/docs-new/api-3470143 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -30,29 +29,28 @@ export interface WithdrawalAPI { * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise; + getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise; /** - * getWithdrawalHistory Get Withdrawal History - * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. - * Documentation: https://www.kucoin.com/docs-new/api-3470145 + * withdrawalV3 Withdraw(V3) + * Description: Use this interface to withdraw the specified currency + * Documentation: https://www.kucoin.com/docs-new/api-3470146 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | WITHDRAWAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise; + withdrawalV3(req: WithdrawalV3Req): Promise; /** - * @deprecated - * withdrawalV1 Withdraw - V1 - * Description: Use this interface to withdraw the specified currency - * Documentation: https://www.kucoin.com/docs-new/api-3470310 + * cancelWithdrawal Cancel Withdrawal + * Description: This interface can cancel the withdrawal, Only withdrawals requests of PROCESSING status could be canceled. + * Documentation: https://www.kucoin.com/docs-new/api-3470144 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -60,15 +58,15 @@ export interface WithdrawalAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | WITHDRAWAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - withdrawalV1(req: WithdrawalV1Req): Promise; + cancelWithdrawal(req: CancelWithdrawalReq): Promise; /** - * getWithdrawalQuotas Get Withdrawal Quotas - * Description: This interface can obtain the withdrawal quotas information of this currency. - * Documentation: https://www.kucoin.com/docs-new/api-3470143 + * getWithdrawalHistory Get Withdrawal History + * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470145 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -79,28 +77,30 @@ export interface WithdrawalAPI { * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise; + getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise; /** - * cancelWithdrawal Cancel Withdrawal - * Description: This interface can cancel the withdrawal, Only withdrawals requests of PROCESSING status could be canceled. - * Documentation: https://www.kucoin.com/docs-new/api-3470144 + * @deprecated + * getWithdrawalHistoryOld Get Withdrawal History - Old + * Description: Request via this endpoint to get deposit list Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470308 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | WITHDRAWAL | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | MANAGEMENT | * | API-RATE-LIMIT | 20 | * +---------------------+------------+ */ - cancelWithdrawal(req: CancelWithdrawalReq): Promise; + getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise; /** - * withdrawalV3 Withdraw(V3) + * @deprecated + * withdrawalV1 Withdraw - V1 * Description: Use this interface to withdraw the specified currency - * Documentation: https://www.kucoin.com/docs-new/api-3470146 + * Documentation: https://www.kucoin.com/docs-new/api-3470310 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -111,80 +111,80 @@ export interface WithdrawalAPI { * | API-RATE-LIMIT | 5 | * +---------------------+------------+ */ - withdrawalV3(req: WithdrawalV3Req): Promise; + withdrawalV1(req: WithdrawalV1Req): Promise; } export class WithdrawalAPIImpl implements WithdrawalAPI { constructor(private transport: Transport) {} - getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise { + getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/hist-withdrawals', + '/api/v1/withdrawals/quotas', req, - new GetWithdrawalHistoryOldResp(), + new GetWithdrawalQuotasResp(), false, ); } - getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise { + withdrawalV3(req: WithdrawalV3Req): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/withdrawals', + 'POST', + '/api/v3/withdrawals', req, - new GetWithdrawalHistoryResp(), + new WithdrawalV3Resp(), false, ); } - withdrawalV1(req: WithdrawalV1Req): Promise { + cancelWithdrawal(req: CancelWithdrawalReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/withdrawals', + 'DELETE', + '/api/v1/withdrawals/{withdrawalId}', req, - new WithdrawalV1Resp(), + new CancelWithdrawalResp(), false, ); } - getWithdrawalQuotas(req: GetWithdrawalQuotasReq): Promise { + getWithdrawalHistory(req: GetWithdrawalHistoryReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/withdrawals/quotas', + '/api/v1/withdrawals', req, - new GetWithdrawalQuotasResp(), + new GetWithdrawalHistoryResp(), false, ); } - cancelWithdrawal(req: CancelWithdrawalReq): Promise { + getWithdrawalHistoryOld(req: GetWithdrawalHistoryOldReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/withdrawals/{withdrawalId}', + 'GET', + '/api/v1/hist-withdrawals', req, - new CancelWithdrawalResp(), + new GetWithdrawalHistoryOldResp(), false, ); } - withdrawalV3(req: WithdrawalV3Req): Promise { + withdrawalV1(req: WithdrawalV1Req): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v3/withdrawals', + '/api/v1/withdrawals', req, - new WithdrawalV3Resp(), + new WithdrawalV1Resp(), false, ); } diff --git a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template index 920648be..3211383f 100644 --- a/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template +++ b/sdk/node/src/generate/affiliate/affiliate/api_affiliate.template @@ -19,6 +19,7 @@ describe('Auto Test', ()=> { expect(result.totalMarginAmount).toEqual(expect.anything()); expect(result.transferMarginAmount).toEqual(expect.anything()); expect(result.margins).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.template b/sdk/node/src/generate/broker/apibroker/api_api_broker.template index eccf2010..de8d8597 100644 --- a/sdk/node/src/generate/broker/apibroker/api_api_broker.template +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.template @@ -17,6 +17,7 @@ describe('Auto Test', ()=> { let resp = api.getRebase(req); return resp.then(result => { expect(result.url).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template index 215fcdad..9502b9b2 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.template @@ -5,48 +5,60 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getDepositList request test', ()=> { + test('getBrokerInfo request test', ()=> { /** - * getDepositList - * Get Deposit List - * /api/v1/asset/ndbroker/deposit/list + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info */ - let builder = GetDepositListReq.builder(); - builder.setCurrency(?).setStatus(?).setHash(?).setStartTimestamp(?).setEndTimestamp(?).setLimit(?); + let builder = GetBrokerInfoReq.builder(); + builder.setBegin(?).setEnd(?).setTradeType(?); let req = builder.build(); - let resp = api.getDepositList(req); + let resp = api.getBrokerInfo(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.accountSize).toEqual(expect.anything()); + expect(result.maxAccountSize).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + console.log(resp); }); }) - test('deleteSubAccountAPI request test', ()=> { + test('addSubAccount request test', ()=> { /** - * deleteSubAccountAPI - * Delete SubAccount API - * /api/v1/broker/nd/account/apikey + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account */ - let builder = DeleteSubAccountAPIReq.builder(); - builder.setUid(?).setApiKey(?); + let builder = AddSubAccountReq.builder(); + builder.setAccountName(?); let req = builder.build(); - let resp = api.deleteSubAccountAPI(req); + let resp = api.addSubAccount(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.accountName).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSubAccountAPI request test', ()=> { + test('getSubAccount request test', ()=> { /** - * getSubAccountAPI - * Get SubAccount API - * /api/v1/broker/nd/account/apikey + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account */ - let builder = GetSubAccountAPIReq.builder(); - builder.setUid(?).setApiKey(?); + let builder = GetSubAccountReq.builder(); + builder.setUid(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getSubAccountAPI(req); + let resp = api.getSubAccount(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -69,43 +81,23 @@ describe('Auto Test', ()=> { expect(result.permissions).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSubAccount request test', ()=> { - /** - * getSubAccount - * Get SubAccount - * /api/v1/broker/nd/account - */ - let builder = GetSubAccountReq.builder(); - builder.setUid(?).setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getSubAccount(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('addSubAccount request test', ()=> { + test('getSubAccountAPI request test', ()=> { /** - * addSubAccount - * Add SubAccount - * /api/v1/broker/nd/account + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey */ - let builder = AddSubAccountReq.builder(); - builder.setAccountName(?); + let builder = GetSubAccountAPIReq.builder(); + builder.setUid(?).setApiKey(?); let req = builder.build(); - let resp = api.addSubAccount(req); + let resp = api.getSubAccountAPI(req); return resp.then(result => { - expect(result.accountName).toEqual(expect.anything()); - expect(result.uid).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); - expect(result.level).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -127,38 +119,23 @@ describe('Auto Test', ()=> { expect(result.permissions).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); }); }) - test('getBrokerInfo request test', ()=> { - /** - * getBrokerInfo - * Get Broker Info - * /api/v1/broker/nd/info - */ - let builder = GetBrokerInfoReq.builder(); - builder.setBegin(?).setEnd(?).setTradeType(?); - let req = builder.build(); - let resp = api.getBrokerInfo(req); - return resp.then(result => { - expect(result.accountSize).toEqual(expect.anything()); - expect(result.maxAccountSize).toEqual(expect.anything()); - expect(result.level).toEqual(expect.anything()); - }); - }) - - test('getRebase request test', ()=> { + test('deleteSubAccountAPI request test', ()=> { /** - * getRebase - * Get Broker Rebate - * /api/v1/broker/nd/rebase/download + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey */ - let builder = GetRebaseReq.builder(); - builder.setBegin(?).setEnd(?).setTradeType(?); + let builder = DeleteSubAccountAPIReq.builder(); + builder.setUid(?).setApiKey(?); let req = builder.build(); - let resp = api.getRebase(req); + let resp = api.deleteSubAccountAPI(req); return resp.then(result => { - expect(result.url).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -174,6 +151,50 @@ describe('Auto Test', ()=> { let resp = api.transfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getTransferHistory request test', ()=> { + /** + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail + */ + let builder = GetTransferHistoryReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getTransferHistory(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.fromUid).toEqual(expect.anything()); + expect(result.fromAccountType).toEqual(expect.anything()); + expect(result.fromAccountTag).toEqual(expect.anything()); + expect(result.toUid).toEqual(expect.anything()); + expect(result.toAccountType).toEqual(expect.anything()); + expect(result.toAccountTag).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getDepositList request test', ()=> { + /** + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list + */ + let builder = GetDepositListReq.builder(); + builder.setCurrency(?).setStatus(?).setHash(?).setStartTimestamp(?).setEndTimestamp(?).setLimit(?); + let req = builder.build(); + let resp = api.getDepositList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -202,32 +223,7 @@ describe('Auto Test', ()=> { expect(result.currency).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); - }); - }) - - test('getTransferHistory request test', ()=> { - /** - * getTransferHistory - * Get Transfer History - * /api/v3/broker/nd/transfer/detail - */ - let builder = GetTransferHistoryReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.getTransferHistory(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.currency).toEqual(expect.anything()); - expect(result.amount).toEqual(expect.anything()); - expect(result.fromUid).toEqual(expect.anything()); - expect(result.fromAccountType).toEqual(expect.anything()); - expect(result.fromAccountTag).toEqual(expect.anything()); - expect(result.toUid).toEqual(expect.anything()); - expect(result.toAccountType).toEqual(expect.anything()); - expect(result.toAccountTag).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - expect(result.reason).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); }); }) @@ -256,6 +252,23 @@ describe('Auto Test', ()=> { expect(result.currency).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getRebase request test', ()=> { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download + */ + let builder = GetRebaseReq.builder(); + builder.setBegin(?).setEnd(?).setTradeType(?); + let req = builder.build(); + let resp = api.getRebase(req); + return resp.then(result => { + expect(result.url).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts index 4e3d2b7e..00d9bc00 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts @@ -20,22 +20,21 @@ import { GetSubAccountAPIResp } from './model_get_sub_account_api_resp'; import { GetBrokerInfoResp } from './model_get_broker_info_resp'; import { GetTransferHistoryReq } from './model_get_transfer_history_req'; import { AddSubAccountResp } from './model_add_sub_account_resp'; -import { GetBrokerInfoReq } from './model_get_broker_info_req'; import { GetDepositListReq } from './model_get_deposit_list_req'; +import { GetBrokerInfoReq } from './model_get_broker_info_req'; import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; import { TransferReq } from './model_transfer_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getDepositList request test', () => { + test('getBrokerInfo request test', () => { /** - * getDepositList - * Get Deposit List - * /api/v1/asset/ndbroker/deposit/list + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info */ - let data = - '{"currency": "USDT", "status": "SUCCESS", "hash": "example_string_default_value", "startTimestamp": 123456, "endTimestamp": 123456, "limit": 100}'; - let req = new GetDepositListReq(); + let data = '{"begin": "20240510", "end": "20241010", "tradeType": "1"}'; + let req = new GetBrokerInfoReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -43,16 +42,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getDepositList response test', () => { + test('getBrokerInfo response test', () => { /** - * getDepositList - * Get Deposit List - * /api/v1/asset/ndbroker/deposit/list + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info */ let data = - '{\n "code": "200000",\n "data": [\n {\n "uid": 165111215,\n "hash": "6724e363a492800007ec602b",\n "address": "xxxxxxx@gmail.com",\n "memo": "",\n "amount": "3.0",\n "fee": "0.0",\n "currency": "USDT",\n "isInner": true,\n "walletTxId": "bbbbbbbbb",\n "status": "SUCCESS",\n "chain": "",\n "remark": "",\n "createdAt": 1730470760000,\n "updatedAt": 1730470760000\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "accountSize": 0,\n "maxAccountSize": null,\n "level": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositListResp(); + let resp = new GetBrokerInfoResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -61,14 +60,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('deleteSubAccountAPI request test', () => { + test('addSubAccount request test', () => { /** - * deleteSubAccountAPI - * Delete SubAccount API - * /api/v1/broker/nd/account/apikey + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account */ - let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; - let req = new DeleteSubAccountAPIReq(); + let data = '{"accountName": "Account1"}'; + let req = new AddSubAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -76,15 +75,16 @@ describe('Auto Test', () => { console.log(req); }); - test('deleteSubAccountAPI response test', () => { + test('addSubAccount response test', () => { /** - * deleteSubAccountAPI - * Delete SubAccount API - * /api/v1/broker/nd/account/apikey + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account */ - let data = '{\n "code": "200000",\n "data": true\n}'; + let data = + '{\n "code": "200000",\n "data": {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819381908,\n "level": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new DeleteSubAccountAPIResp(); + let resp = new AddSubAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -93,14 +93,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSubAccountAPI request test', () => { + test('getSubAccount request test', () => { /** - * getSubAccountAPI - * Get SubAccount API - * /api/v1/broker/nd/account/apikey + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account */ - let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; - let req = new GetSubAccountAPIReq(); + let data = '{"uid": "226383154", "currentPage": 1, "pageSize": 20}'; + let req = new GetSubAccountReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -108,16 +108,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSubAccountAPI response test', () => { + test('getSubAccount response test', () => { /** - * getSubAccountAPI - * Get SubAccount API - * /api/v1/broker/nd/account/apikey + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account */ let data = - '{\n "code": "200000",\n "data": [\n {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "203.**.154"\n ],\n "createdAt": 1729821494000\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 20,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819382000,\n "level": 0\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountAPIResp(); + let resp = new GetSubAccountResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -160,14 +160,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSubAccount request test', () => { + test('getSubAccountAPI request test', () => { /** - * getSubAccount - * Get SubAccount - * /api/v1/broker/nd/account + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey */ - let data = '{"uid": "226383154", "currentPage": 1, "pageSize": 20}'; - let req = new GetSubAccountReq(); + let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; + let req = new GetSubAccountAPIReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -175,16 +175,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSubAccount response test', () => { + test('getSubAccountAPI response test', () => { /** - * getSubAccount - * Get SubAccount - * /api/v1/broker/nd/account + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 20,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819382000,\n "level": 0\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "203.**.154"\n ],\n "createdAt": 1729821494000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountResp(); + let resp = new GetSubAccountAPIResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -193,14 +193,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addSubAccount request test', () => { + test('modifySubAccountApi request test', () => { /** - * addSubAccount - * Add SubAccount - * /api/v1/broker/nd/account + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey */ - let data = '{"accountName": "Account1"}'; - let req = new AddSubAccountReq(); + let data = + '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; + let req = new ModifySubAccountApiReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -208,16 +209,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addSubAccount response test', () => { + test('modifySubAccountApi response test', () => { /** - * addSubAccount - * Add SubAccount - * /api/v1/broker/nd/account + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey */ let data = - '{\n "code": "200000",\n "data": {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819381908,\n "level": 0\n }\n}'; + '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "123.**.123"\n ],\n "createdAt": 1729821494000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountResp(); + let resp = new ModifySubAccountApiResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -226,15 +227,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('modifySubAccountApi request test', () => { + test('deleteSubAccountAPI request test', () => { /** - * modifySubAccountApi - * Modify SubAccount API - * /api/v1/broker/nd/account/update-apikey + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey */ - let data = - '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; - let req = new ModifySubAccountApiReq(); + let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; + let req = new DeleteSubAccountAPIReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -242,16 +242,15 @@ describe('Auto Test', () => { console.log(req); }); - test('modifySubAccountApi response test', () => { + test('deleteSubAccountAPI response test', () => { /** - * modifySubAccountApi - * Modify SubAccount API - * /api/v1/broker/nd/account/update-apikey + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey */ - let data = - '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "123.**.123"\n ],\n "createdAt": 1729821494000\n }\n}'; + let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifySubAccountApiResp(); + let resp = new DeleteSubAccountAPIResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -260,14 +259,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getBrokerInfo request test', () => { + test('transfer request test', () => { /** - * getBrokerInfo - * Get Broker Info - * /api/v1/broker/nd/info + * transfer + * Transfer + * /api/v1/broker/nd/transfer */ - let data = '{"begin": "20240510", "end": "20241010", "tradeType": "1"}'; - let req = new GetBrokerInfoReq(); + let data = + '{"currency": "USDT", "amount": "1", "clientOid": "e6c24d23-6bc2-401b-bf9e-55e2daddfbc1", "direction": "OUT", "accountType": "MAIN", "specialUid": "226383154", "specialAccountType": "MAIN"}'; + let req = new TransferReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -275,16 +275,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getBrokerInfo response test', () => { + test('transfer response test', () => { /** - * getBrokerInfo - * Get Broker Info - * /api/v1/broker/nd/info + * transfer + * Transfer + * /api/v1/broker/nd/transfer */ let data = - '{\n "code": "200000",\n "data": {\n "accountSize": 0,\n "maxAccountSize": null,\n "level": 0\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetBrokerInfoResp(); + let resp = new TransferResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -293,14 +293,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRebase request test', () => { + test('getTransferHistory request test', () => { /** - * getRebase - * Get Broker Rebate - * /api/v1/broker/nd/rebase/download + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail */ - let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; - let req = new GetRebaseReq(); + let data = '{"orderId": "671b4600c1e3dd000726866d"}'; + let req = new GetTransferHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -308,16 +308,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRebase response test', () => { + test('getTransferHistory response test', () => { /** - * getRebase - * Get Broker Rebate - * /api/v1/broker/nd/rebase/download + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail */ let data = - '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d",\n "currency": "USDT",\n "amount": "1",\n "fromUid": 165111215,\n "fromAccountType": "MAIN",\n "fromAccountTag": "DEFAULT",\n "toUid": 226383154,\n "toAccountType": "MAIN",\n "toAccountTag": "DEFAULT",\n "status": "SUCCESS",\n "reason": null,\n "createdAt": 1729840640000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRebaseResp(); + let resp = new GetTransferHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -326,15 +326,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('transfer request test', () => { + test('getDepositList request test', () => { /** - * transfer - * Transfer - * /api/v1/broker/nd/transfer + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list */ let data = - '{"currency": "USDT", "amount": "1", "clientOid": "e6c24d23-6bc2-401b-bf9e-55e2daddfbc1", "direction": "OUT", "accountType": "MAIN", "specialUid": "226383154", "specialAccountType": "MAIN"}'; - let req = new TransferReq(); + '{"currency": "USDT", "status": "SUCCESS", "hash": "example_string_default_value", "startTimestamp": 123456, "endTimestamp": 123456, "limit": 100}'; + let req = new GetDepositListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -342,16 +342,16 @@ describe('Auto Test', () => { console.log(req); }); - test('transfer response test', () => { + test('getDepositList response test', () => { /** - * transfer - * Transfer - * /api/v1/broker/nd/transfer + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d"\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "uid": 165111215,\n "hash": "6724e363a492800007ec602b",\n "address": "xxxxxxx@gmail.com",\n "memo": "",\n "amount": "3.0",\n "fee": "0.0",\n "currency": "USDT",\n "isInner": true,\n "walletTxId": "bbbbbbbbb",\n "status": "SUCCESS",\n "chain": "",\n "remark": "",\n "createdAt": 1730470760000,\n "updatedAt": 1730470760000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new TransferResp(); + let resp = new GetDepositListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -393,14 +393,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getTransferHistory request test', () => { + test('getWithdrawDetail request test', () => { /** - * getTransferHistory - * Get Transfer History - * /api/v3/broker/nd/transfer/detail + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail */ - let data = '{"orderId": "671b4600c1e3dd000726866d"}'; - let req = new GetTransferHistoryReq(); + let data = '{"withdrawalId": "66617a2***3c9a"}'; + let req = new GetWithdrawDetailReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -408,16 +408,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getTransferHistory response test', () => { + test('getWithdrawDetail response test', () => { /** - * getTransferHistory - * Get Transfer History - * /api/v3/broker/nd/transfer/detail + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d",\n "currency": "USDT",\n "amount": "1",\n "fromUid": 165111215,\n "fromAccountType": "MAIN",\n "fromAccountTag": "DEFAULT",\n "toUid": 226383154,\n "toAccountType": "MAIN",\n "toAccountTag": "DEFAULT",\n "status": "SUCCESS",\n "reason": null,\n "createdAt": 1729840640000\n }\n}'; + '{\n "data": {\n "id": "66617a2***3c9a",\n "chain": "ton",\n "walletTxId": "AJ***eRI=",\n "uid": 157267400,\n "amount": "1.00000000",\n "memo": "7025734",\n "fee": "0.00000000",\n "address": "EQDn***dKbGzr",\n "remark": "",\n "isInner": false,\n "currency": "USDT",\n "status": "SUCCESS",\n "createdAt": 1717664288000,\n "updatedAt": 1717664375000\n },\n "code": "200000"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTransferHistoryResp(); + let resp = new GetWithdrawDetailResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -426,14 +426,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getWithdrawDetail request test', () => { + test('getRebase request test', () => { /** - * getWithdrawDetail - * Get Withdraw Detail - * /api/v3/broker/nd/withdraw/detail + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download */ - let data = '{"withdrawalId": "66617a2***3c9a"}'; - let req = new GetWithdrawDetailReq(); + let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; + let req = new GetRebaseReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -441,16 +441,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getWithdrawDetail response test', () => { + test('getRebase response test', () => { /** - * getWithdrawDetail - * Get Withdraw Detail - * /api/v3/broker/nd/withdraw/detail + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download */ let data = - '{\n "data": {\n "id": "66617a2***3c9a",\n "chain": "ton",\n "walletTxId": "AJ***eRI=",\n "uid": 157267400,\n "amount": "1.00000000",\n "memo": "7025734",\n "fee": "0.00000000",\n "address": "EQDn***dKbGzr",\n "remark": "",\n "isInner": false,\n "currency": "USDT",\n "status": "SUCCESS",\n "createdAt": 1717664288000,\n "updatedAt": 1717664375000\n },\n "code": "200000"\n}'; + '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawDetailResp(); + let resp = new GetRebaseResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts index b1327f95..7acb74a9 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts @@ -23,16 +23,16 @@ import { GetSubAccountAPIResp } from './model_get_sub_account_api_resp'; import { GetBrokerInfoResp } from './model_get_broker_info_resp'; import { GetTransferHistoryReq } from './model_get_transfer_history_req'; import { AddSubAccountResp } from './model_add_sub_account_resp'; -import { GetBrokerInfoReq } from './model_get_broker_info_req'; import { GetDepositListReq } from './model_get_deposit_list_req'; +import { GetBrokerInfoReq } from './model_get_broker_info_req'; import { ModifySubAccountApiReq } from './model_modify_sub_account_api_req'; import { TransferReq } from './model_transfer_req'; export interface NDBrokerAPI { /** - * getDepositList Get Deposit List - * Description: This endpoint can obtain the deposit records of each sub-account under the ND Broker. - * Documentation: https://www.kucoin.com/docs-new/api-3470285 + * getBrokerInfo Get Broker Info + * Description: This endpoint supports querying the basic information of the current Broker + * Documentation: https://www.kucoin.com/docs-new/api-3470282 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -40,15 +40,15 @@ export interface NDBrokerAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | BROKER | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getDepositList(req: GetDepositListReq): Promise; + getBrokerInfo(req: GetBrokerInfoReq): Promise; /** - * deleteSubAccountAPI Delete SubAccount API - * Description: This interface supports deleting Broker’s sub-account APIKEY - * Documentation: https://www.kucoin.com/docs-new/api-3470289 + * addSubAccount Add SubAccount + * Description: This endpoint supports Broker users to create sub-accounts + * Documentation: https://www.kucoin.com/docs-new/api-3470290 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -59,12 +59,12 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise; + addSubAccount(req: AddSubAccountReq): Promise; /** - * getSubAccountAPI Get SubAccount API - * Description: This interface supports querying the Broker’s sub-account APIKEY - * Documentation: https://www.kucoin.com/docs-new/api-3470284 + * getSubAccount Get SubAccount + * Description: This interface supports querying sub-accounts created by Broker + * Documentation: https://www.kucoin.com/docs-new/api-3470283 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -75,7 +75,7 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getSubAccountAPI(req: GetSubAccountAPIReq): Promise; + getSubAccount(req: GetSubAccountReq): Promise; /** * addSubAccountApi Add SubAccount API @@ -94,9 +94,9 @@ export interface NDBrokerAPI { addSubAccountApi(req: AddSubAccountApiReq): Promise; /** - * getSubAccount Get SubAccount - * Description: This interface supports querying sub-accounts created by Broker - * Documentation: https://www.kucoin.com/docs-new/api-3470283 + * getSubAccountAPI Get SubAccount API + * Description: This interface supports querying the Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470284 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -107,12 +107,12 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getSubAccount(req: GetSubAccountReq): Promise; + getSubAccountAPI(req: GetSubAccountAPIReq): Promise; /** - * addSubAccount Add SubAccount - * Description: This endpoint supports Broker users to create sub-accounts - * Documentation: https://www.kucoin.com/docs-new/api-3470290 + * modifySubAccountApi Modify SubAccount API + * Description: This interface supports modify the Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470292 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -123,12 +123,12 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - addSubAccount(req: AddSubAccountReq): Promise; + modifySubAccountApi(req: ModifySubAccountApiReq): Promise; /** - * modifySubAccountApi Modify SubAccount API - * Description: This interface supports modify the Broker’s sub-account APIKEY - * Documentation: https://www.kucoin.com/docs-new/api-3470292 + * deleteSubAccountAPI Delete SubAccount API + * Description: This interface supports deleting Broker’s sub-account APIKEY + * Documentation: https://www.kucoin.com/docs-new/api-3470289 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -139,12 +139,12 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - modifySubAccountApi(req: ModifySubAccountApiReq): Promise; + deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise; /** - * getBrokerInfo Get Broker Info - * Description: This endpoint supports querying the basic information of the current Broker - * Documentation: https://www.kucoin.com/docs-new/api-3470282 + * transfer Transfer + * Description: This endpoint supports fund transfer between Broker account and Broker sub-accounts. Please be aware that withdrawal from sub-account is not directly supported. Broker has to transfer funds from broker sub-account to broker account to initiate the withdrawals. + * Documentation: https://www.kucoin.com/docs-new/api-3470293 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -152,15 +152,15 @@ export interface NDBrokerAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | BROKER | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getBrokerInfo(req: GetBrokerInfoReq): Promise; + transfer(req: TransferReq): Promise; /** - * getRebase Get Broker Rebate - * Description: This interface supports downloading Broker rebate orders - * Documentation: https://www.kucoin.com/docs-new/api-3470281 + * getTransferHistory Get Transfer History + * Description: This endpoint supports querying transfer records of the broker itself and its created sub-accounts. + * Documentation: https://www.kucoin.com/docs-new/api-3470286 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -168,15 +168,15 @@ export interface NDBrokerAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | BROKER | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getRebase(req: GetRebaseReq): Promise; + getTransferHistory(req: GetTransferHistoryReq): Promise; /** - * transfer Transfer - * Description: This endpoint supports fund transfer between Broker account and Broker sub-accounts. Please be aware that withdrawal from sub-account is not directly supported. Broker has to transfer funds from broker sub-account to broker account to initiate the withdrawals. - * Documentation: https://www.kucoin.com/docs-new/api-3470293 + * getDepositList Get Deposit List + * Description: This endpoint can obtain the deposit records of each sub-account under the ND Broker. + * Documentation: https://www.kucoin.com/docs-new/api-3470285 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -184,10 +184,10 @@ export interface NDBrokerAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | BROKER | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - transfer(req: TransferReq): Promise; + getDepositList(req: GetDepositListReq): Promise; /** * getDepositDetail Get Deposit Detail @@ -206,9 +206,9 @@ export interface NDBrokerAPI { getDepositDetail(req: GetDepositDetailReq): Promise; /** - * getTransferHistory Get Transfer History - * Description: This endpoint supports querying transfer records of the broker itself and its created sub-accounts. - * Documentation: https://www.kucoin.com/docs-new/api-3470286 + * getWithdrawDetail Get Withdraw Detail + * Description: This endpoint supports querying the withdrawal records of sub-accounts created by a Broker (excluding main account of nd broker). + * Documentation: https://www.kucoin.com/docs-new/api-3470287 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -219,12 +219,12 @@ export interface NDBrokerAPI { * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getTransferHistory(req: GetTransferHistoryReq): Promise; + getWithdrawDetail(req: GetWithdrawDetailReq): Promise; /** - * getWithdrawDetail Get Withdraw Detail - * Description: This endpoint supports querying the withdrawal records of sub-accounts created by a Broker (excluding main account of nd broker). - * Documentation: https://www.kucoin.com/docs-new/api-3470287 + * getRebase Get Broker Rebate + * Description: This interface supports downloading Broker rebate orders + * Documentation: https://www.kucoin.com/docs-new/api-3470281 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -232,47 +232,47 @@ export interface NDBrokerAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | BROKER | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getWithdrawDetail(req: GetWithdrawDetailReq): Promise; + getRebase(req: GetRebaseReq): Promise; } export class NDBrokerAPIImpl implements NDBrokerAPI { constructor(private transport: Transport) {} - getDepositList(req: GetDepositListReq): Promise { + getBrokerInfo(req: GetBrokerInfoReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v1/asset/ndbroker/deposit/list', + '/api/v1/broker/nd/info', req, - new GetDepositListResp(), + new GetBrokerInfoResp(), false, ); } - deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise { + addSubAccount(req: AddSubAccountReq): Promise { return this.transport.call( 'broker', true, - 'DELETE', - '/api/v1/broker/nd/account/apikey', + 'POST', + '/api/v1/broker/nd/account', req, - new DeleteSubAccountAPIResp(), + new AddSubAccountResp(), false, ); } - getSubAccountAPI(req: GetSubAccountAPIReq): Promise { + getSubAccount(req: GetSubAccountReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v1/broker/nd/account/apikey', + '/api/v1/broker/nd/account', req, - new GetSubAccountAPIResp(), + new GetSubAccountResp(), false, ); } @@ -289,74 +289,74 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { ); } - getSubAccount(req: GetSubAccountReq): Promise { + getSubAccountAPI(req: GetSubAccountAPIReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v1/broker/nd/account', + '/api/v1/broker/nd/account/apikey', req, - new GetSubAccountResp(), + new GetSubAccountAPIResp(), false, ); } - addSubAccount(req: AddSubAccountReq): Promise { + modifySubAccountApi(req: ModifySubAccountApiReq): Promise { return this.transport.call( 'broker', true, 'POST', - '/api/v1/broker/nd/account', + '/api/v1/broker/nd/account/update-apikey', req, - new AddSubAccountResp(), + new ModifySubAccountApiResp(), false, ); } - modifySubAccountApi(req: ModifySubAccountApiReq): Promise { + deleteSubAccountAPI(req: DeleteSubAccountAPIReq): Promise { return this.transport.call( 'broker', true, - 'POST', - '/api/v1/broker/nd/account/update-apikey', + 'DELETE', + '/api/v1/broker/nd/account/apikey', req, - new ModifySubAccountApiResp(), + new DeleteSubAccountAPIResp(), false, ); } - getBrokerInfo(req: GetBrokerInfoReq): Promise { + transfer(req: TransferReq): Promise { return this.transport.call( 'broker', true, - 'GET', - '/api/v1/broker/nd/info', + 'POST', + '/api/v1/broker/nd/transfer', req, - new GetBrokerInfoResp(), + new TransferResp(), false, ); } - getRebase(req: GetRebaseReq): Promise { + getTransferHistory(req: GetTransferHistoryReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v1/broker/nd/rebase/download', + '/api/v3/broker/nd/transfer/detail', req, - new GetRebaseResp(), + new GetTransferHistoryResp(), false, ); } - transfer(req: TransferReq): Promise { + getDepositList(req: GetDepositListReq): Promise { return this.transport.call( 'broker', true, - 'POST', - '/api/v1/broker/nd/transfer', + 'GET', + '/api/v1/asset/ndbroker/deposit/list', req, - new TransferResp(), + new GetDepositListResp(), false, ); } @@ -373,26 +373,26 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { ); } - getTransferHistory(req: GetTransferHistoryReq): Promise { + getWithdrawDetail(req: GetWithdrawDetailReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v3/broker/nd/transfer/detail', + '/api/v3/broker/nd/withdraw/detail', req, - new GetTransferHistoryResp(), + new GetWithdrawDetailResp(), false, ); } - getWithdrawDetail(req: GetWithdrawDetailReq): Promise { + getRebase(req: GetRebaseReq): Promise { return this.transport.call( 'broker', true, 'GET', - '/api/v3/broker/nd/withdraw/detail', + '/api/v1/broker/nd/rebase/download', req, - new GetWithdrawDetailResp(), + new GetRebaseResp(), false, ); } diff --git a/sdk/node/src/generate/copytrading/futures/api_futures.template b/sdk/node/src/generate/copytrading/futures/api_futures.template new file mode 100644 index 00000000..848c36ce --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/api_futures.template @@ -0,0 +1,224 @@ + +describe('Auto Test', ()=> { + let api: FuturesAPI; + + beforeAll(()=> { + api = ?? + }); + test('addOrder request test', ()=> { + /** + * addOrder + * Add Order + * /api/v1/copy-trade/futures/orders + */ + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addOrderTest request test', ()=> { + /** + * addOrderTest + * Add Order Test + * /api/v1/copy-trade/futures/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addTPSLOrder request test', ()=> { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/copy-trade/futures/st-orders + */ + let builder = AddTPSLOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStopPriceType(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTriggerStopUpPrice(?).setTriggerStopDownPrice(?); + let req = builder.build(); + let resp = api.addTPSLOrder(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOrderById request test', ()=> { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/copy-trade/futures/orders + */ + let builder = CancelOrderByIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.cancelOrderById(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOrderByClientOid request test', ()=> { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/copy-trade/futures/orders/client-order + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then(result => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMaxOpenSize request test', ()=> { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v1/copy-trade/futures/get-max-open-size + */ + let builder = GetMaxOpenSizeReq.builder(); + builder.setSymbol(?).setPrice(?).setLeverage(?); + let req = builder.build(); + let resp = api.getMaxOpenSize(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.maxBuyOpenSize).toEqual(expect.anything()); + expect(result.maxSellOpenSize).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMaxWithdrawMargin request test', ()=> { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/copy-trade/futures/position/margin/max-withdraw-margin + */ + let builder = GetMaxWithdrawMarginReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMaxWithdrawMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addIsolatedMargin request test', ()=> { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/copy-trade/futures/position/margin/deposit-margin + */ + let builder = AddIsolatedMarginReq.builder(); + builder.setSymbol(?).setMargin(?).setBizNo(?); + let req = builder.build(); + let resp = api.addIsolatedMargin(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('removeIsolatedMargin request test', ()=> { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/copy-trade/futures/position/margin/withdraw-margin + */ + let builder = RemoveIsolatedMarginReq.builder(); + builder.setSymbol(?).setWithdrawAmount(?); + let req = builder.build(); + let resp = api.removeIsolatedMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyIsolatedMarginRiskLimt request test', ()=> { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/copy-trade/futures/position/risk-limit-level/change + */ + let builder = ModifyIsolatedMarginRiskLimtReq.builder(); + builder.setSymbol(?).setLevel(?); + let req = builder.build(); + let resp = api.modifyIsolatedMarginRiskLimt(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyAutoDepositStatus request test', ()=> { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/copy-trade/futures/position/margin/auto-deposit-status + */ + let builder = ModifyAutoDepositStatusReq.builder(); + builder.setSymbol(?).setStatus(?); + let req = builder.build(); + let resp = api.modifyAutoDepositStatus(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + +}) \ No newline at end of file diff --git a/sdk/node/src/generate/copytrading/futures/api_futures.test.ts b/sdk/node/src/generate/copytrading/futures/api_futures.test.ts new file mode 100644 index 00000000..367bff8f --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/api_futures.test.ts @@ -0,0 +1,389 @@ +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { RemoveIsolatedMarginReq } from './model_remove_isolated_margin_req'; +import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; +import { AddIsolatedMarginReq } from './model_add_isolated_margin_req'; +import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_req'; +import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; +import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { AddOrderReq } from './model_add_order_req'; +import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; +import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; +import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; +import { AddOrderResp } from './model_add_order_resp'; +import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; +import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; +import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; +import { CancelOrderByIdReq } from './model_cancel_order_by_id_req'; +import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; +import { RestResponse } from '@model/common'; + +describe('Auto Test', () => { + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/copy-trade/futures/orders + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrder response test', () => { + /** + * addOrder + * Add Order + * /api/v1/copy-trade/futures/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "263485113055133696",\n "clientOid": "5c52e11203aa677f331e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/copy-trade/futures/orders/test + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderTestReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addOrderTest response test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/copy-trade/futures/orders/test + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddOrderTestResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('addTPSLOrder request test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/copy-trade/futures/st-orders + */ + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; + let req = new AddTPSLOrderReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addTPSLOrder response test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/copy-trade/futures/st-orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddTPSLOrderResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('cancelOrderById request test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/copy-trade/futures/orders + */ + let data = '{"orderId": "263485113055133696"}'; + let req = new CancelOrderByIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderById response test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/copy-trade/futures/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "263485113055133696"\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByIdResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/copy-trade/futures/orders/client-order + */ + let data = '{"symbol": "XBTUSDTM", "clientOid": "5c52e11203aa677f331e493fb"}'; + let req = new CancelOrderByClientOidReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('cancelOrderByClientOid response test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/copy-trade/futures/orders/client-order + */ + let data = + '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f331e4913fb"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByClientOidResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('getMaxOpenSize request test', () => { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v1/copy-trade/futures/get-max-open-size + */ + let data = + '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; + let req = new GetMaxOpenSizeReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMaxOpenSize response test', () => { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v1/copy-trade/futures/get-max-open-size + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": "8",\n "maxSellOpenSize": "5"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMaxOpenSizeResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('getMaxWithdrawMargin request test', () => { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/copy-trade/futures/position/margin/max-withdraw-margin + */ + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetMaxWithdrawMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getMaxWithdrawMargin response test', () => { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/copy-trade/futures/position/margin/max-withdraw-margin + */ + let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetMaxWithdrawMarginResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('addIsolatedMargin request test', () => { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/copy-trade/futures/position/margin/deposit-margin + */ + let data = '{"symbol": "XBTUSDTM", "margin": 3, "bizNo": "112233"}'; + let req = new AddIsolatedMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('addIsolatedMargin response test', () => { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/copy-trade/futures/position/margin/deposit-margin + */ + let data = + '{\n "code": "200000",\n "data": {\n "id": "400000000000974886",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "maintMarginReq": "0.004",\n "riskLimit": 100000,\n "realLeverage": "1.83",\n "crossMode": false,\n "marginMode": "",\n "positionSide": "",\n "leverage": "1.83",\n "delevPercentage": 0.2,\n "openingTimestamp": 1736932881164,\n "currentTimestamp": 1736933530230,\n "currentQty": 1,\n "currentCost": "97.302",\n "currentComm": "0.0583812",\n "unrealisedCost": "97.302",\n "realisedGrossCost": "0.0000000000",\n "realisedCost": "0.0583812000",\n "isOpen": true,\n "markPrice": "96939.98",\n "markValue": "96.9399800000",\n "posCost": "97.302",\n "posCross": "20.9874",\n "posInit": "32.4339999967",\n "posComm": "0.0904415999",\n "posLoss": "0",\n "posMargin": "53.5118415966",\n "posMaint": "0.4796495999",\n "maintMargin": "53.1498215966",\n "realisedGrossPnl": "0.0000000000",\n "realisedPnl": "-0.0583812000",\n "unrealisedPnl": "-0.3620200000",\n "unrealisedPnlPcnt": "-0.0037",\n "unrealisedRoePcnt": "-0.0112",\n "avgEntryPrice": "97302.00",\n "liquidationPrice": "44269.81",\n "bankruptPrice": "43880.61",\n "settleCurrency": "USDT"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new AddIsolatedMarginResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('removeIsolatedMargin request test', () => { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/copy-trade/futures/position/margin/withdraw-margin + */ + let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; + let req = new RemoveIsolatedMarginReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('removeIsolatedMargin response test', () => { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/copy-trade/futures/position/margin/withdraw-margin + */ + let data = '{\n "code": "200000",\n "data": "0.1"\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new RemoveIsolatedMarginResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('modifyIsolatedMarginRiskLimt request test', () => { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/copy-trade/futures/position/risk-limit-level/change + */ + let data = '{"symbol": "XBTUSDTM", "level": 1}'; + let req = new ModifyIsolatedMarginRiskLimtReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyIsolatedMarginRiskLimt response test', () => { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/copy-trade/futures/position/risk-limit-level/change + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyIsolatedMarginRiskLimtResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('modifyAutoDepositStatus request test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/copy-trade/futures/position/margin/auto-deposit-status + */ + let data = '{"symbol": "XBTUSDTM", "status": true}'; + let req = new ModifyAutoDepositStatusReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyAutoDepositStatus response test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/copy-trade/futures/position/margin/auto-deposit-status + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyAutoDepositStatusResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); +}); diff --git a/sdk/node/src/generate/copytrading/futures/api_futures.ts b/sdk/node/src/generate/copytrading/futures/api_futures.ts new file mode 100644 index 00000000..ec6a6b9c --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/api_futures.ts @@ -0,0 +1,343 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { RemoveIsolatedMarginReq } from './model_remove_isolated_margin_req'; +import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; +import { AddIsolatedMarginReq } from './model_add_isolated_margin_req'; +import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_req'; +import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; +import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; +import { AddOrderTestReq } from './model_add_order_test_req'; +import { AddOrderReq } from './model_add_order_req'; +import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; +import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; +import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; +import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; +import { AddOrderResp } from './model_add_order_resp'; +import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; +import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; +import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; +import { CancelOrderByIdReq } from './model_cancel_order_by_id_req'; +import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; + +export interface FuturesAPI { + /** + * addOrder Add Order + * Description: Place order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470363 + * +---------------------+------------------+ + * | Extra API Info | Value | + * +---------------------+------------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | LEADTRADEFUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 2 | + * +---------------------+------------------+ + */ + addOrder(req: AddOrderReq): Promise; + + /** + * addOrderTest Add Order Test + * Description: Place order to the futures trading system just for validation + * Documentation: https://www.kucoin.com/docs-new/api-3470618 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 2 | + * +---------------------+-------------+ + */ + addOrderTest(req: AddOrderTestReq): Promise; + + /** + * addTPSLOrder Add Take Profit And Stop Loss Order + * Description: Place take profit and stop loss order supports both take-profit and stop-loss functions, and other functions are exactly the same as the place order interface. + * Documentation: https://www.kucoin.com/docs-new/api-3470619 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 2 | + * +---------------------+-------------+ + */ + addTPSLOrder(req: AddTPSLOrderReq): Promise; + + /** + * cancelOrderById Cancel Order By OrderId + * Description: Cancel order by system generated orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470620 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 1 | + * +---------------------+-------------+ + */ + cancelOrderById(req: CancelOrderByIdReq): Promise; + + /** + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: Cancel order by client defined orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470621 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 1 | + * +---------------------+-------------+ + */ + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + + /** + * getMaxOpenSize Get Max Open Size + * Description: Get Maximum Open Position Size. + * Documentation: https://www.kucoin.com/docs-new/api-3470612 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 2 | + * +---------------------+-------------+ + */ + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; + + /** + * getMaxWithdrawMargin Get Max Withdraw Margin + * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. + * Documentation: https://www.kucoin.com/docs-new/api-3470616 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 10 | + * +---------------------+-------------+ + */ + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; + + /** + * addIsolatedMargin Add Isolated Margin + * Description: Add Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470614 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 4 | + * +---------------------+-------------+ + */ + addIsolatedMargin(req: AddIsolatedMarginReq): Promise; + + /** + * removeIsolatedMargin Remove Isolated Margin + * Description: Remove Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470615 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 10 | + * +---------------------+-------------+ + */ + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; + + /** + * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit + * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). + * Documentation: https://www.kucoin.com/docs-new/api-3470613 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 4 | + * +---------------------+-------------+ + */ + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise; + + /** + * modifyAutoDepositStatus Modify Isolated Margin Auto-Deposit Status + * Description: This endpoint is only applicable to isolated margin and is no longer recommended. It is recommended to use cross margin instead. + * Documentation: https://www.kucoin.com/docs-new/api-3470617 + * +---------------------+-------------+ + * | Extra API Info | Value | + * +---------------------+-------------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | COPYTRADING | + * | API-RATE-LIMIT | 4 | + * +---------------------+-------------+ + */ + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; +} + +export class FuturesAPIImpl implements FuturesAPI { + constructor(private transport: Transport) {} + + addOrder(req: AddOrderReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/orders', + req, + new AddOrderResp(), + false, + ); + } + + addOrderTest(req: AddOrderTestReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/orders/test', + req, + new AddOrderTestResp(), + false, + ); + } + + addTPSLOrder(req: AddTPSLOrderReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/st-orders', + req, + new AddTPSLOrderResp(), + false, + ); + } + + cancelOrderById(req: CancelOrderByIdReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/copy-trade/futures/orders', + req, + new CancelOrderByIdResp(), + false, + ); + } + + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + return this.transport.call( + 'futures', + false, + 'DELETE', + '/api/v1/copy-trade/futures/orders/client-order', + req, + new CancelOrderByClientOidResp(), + false, + ); + } + + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/copy-trade/futures/get-max-open-size', + req, + new GetMaxOpenSizeResp(), + false, + ); + } + + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'GET', + '/api/v1/copy-trade/futures/position/margin/max-withdraw-margin', + req, + new GetMaxWithdrawMarginResp(), + false, + ); + } + + addIsolatedMargin(req: AddIsolatedMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/position/margin/deposit-margin', + req, + new AddIsolatedMarginResp(), + false, + ); + } + + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/position/margin/withdraw-margin', + req, + new RemoveIsolatedMarginResp(), + false, + ); + } + + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/position/risk-limit-level/change', + req, + new ModifyIsolatedMarginRiskLimtResp(), + false, + ); + } + + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise { + return this.transport.call( + 'futures', + false, + 'POST', + '/api/v1/copy-trade/futures/position/margin/auto-deposit-status', + req, + new ModifyAutoDepositStatusResp(), + false, + ); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/index.ts b/sdk/node/src/generate/copytrading/futures/index.ts new file mode 100644 index 00000000..a491edc3 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/index.ts @@ -0,0 +1,23 @@ +export * from './model_add_isolated_margin_req'; +export * from './model_add_isolated_margin_resp'; +export * from './model_add_order_req'; +export * from './model_add_order_resp'; +export * from './model_add_order_test_req'; +export * from './model_add_order_test_resp'; +export * from './model_add_tpsl_order_req'; +export * from './model_add_tpsl_order_resp'; +export * from './model_cancel_order_by_client_oid_req'; +export * from './model_cancel_order_by_client_oid_resp'; +export * from './model_cancel_order_by_id_req'; +export * from './model_cancel_order_by_id_resp'; +export * from './model_get_max_open_size_req'; +export * from './model_get_max_open_size_resp'; +export * from './model_get_max_withdraw_margin_req'; +export * from './model_get_max_withdraw_margin_resp'; +export * from './model_modify_auto_deposit_status_req'; +export * from './model_modify_auto_deposit_status_resp'; +export * from './model_modify_isolated_margin_risk_limt_req'; +export * from './model_modify_isolated_margin_risk_limt_resp'; +export * from './model_remove_isolated_margin_req'; +export * from './model_remove_isolated_margin_resp'; +export * from './api_futures'; diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts new file mode 100644 index 00000000..470ebc19 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts @@ -0,0 +1,95 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class AddIsolatedMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + margin?: number; + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + bizNo?: string; + + /** + * Creates a new instance of the `AddIsolatedMarginReq` class. + * The builder pattern allows step-by-step construction of a `AddIsolatedMarginReq` object. + */ + static builder(): AddIsolatedMarginReqBuilder { + return new AddIsolatedMarginReqBuilder(); + } + + /** + * Creates a new instance of the `AddIsolatedMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + margin?: number; + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + bizNo?: string; + }): AddIsolatedMarginReq { + let obj = new AddIsolatedMarginReq(); + obj.symbol = data.symbol; + obj.margin = data.margin; + obj.bizNo = data.bizNo; + return obj; + } + + fromJson(input: string): AddIsolatedMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddIsolatedMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddIsolatedMarginReq { + return plainToInstance(AddIsolatedMarginReq, jsonObject); + } +} + +export class AddIsolatedMarginReqBuilder { + obj: AddIsolatedMarginReq = new AddIsolatedMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddIsolatedMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Margin amount (min. margin amount≥0.00001667XBT) + */ + setMargin(value: number): AddIsolatedMarginReqBuilder { + this.obj.margin = value; + return this; + } + + /** + * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 + */ + setBizNo(value: string): AddIsolatedMarginReqBuilder { + this.obj.bizNo = value; + return this; + } + + build(): AddIsolatedMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts new file mode 100644 index 00000000..6da78ec9 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts @@ -0,0 +1,175 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class AddIsolatedMarginResp implements Response { + /** + * Position ID + */ + id?: string; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Auto deposit margin or not + */ + autoDeposit?: boolean; + /** + * Maintenance margin requirement + */ + maintMarginReq?: string; + /** + * Risk limit + */ + riskLimit?: number; + /** + * Leverage o the order + */ + realLeverage?: string; + /** + * Cross mode or not + */ + crossMode?: boolean; + /** + * ADL ranking percentile + */ + delevPercentage?: number; + /** + * Open time + */ + openingTimestamp?: number; + /** + * Current timestamp + */ + currentTimestamp?: number; + /** + * Current postion quantity + */ + currentQty?: number; + /** + * Current postion value + */ + currentCost?: string; + /** + * Current commission + */ + currentComm?: string; + /** + * Unrealised value + */ + unrealisedCost?: string; + /** + * Accumulated realised gross profit value + */ + realisedGrossCost?: string; + /** + * Current realised position value + */ + realisedCost?: string; + /** + * Opened position or not + */ + isOpen?: boolean; + /** + * Mark price + */ + markPrice?: string; + /** + * Mark value + */ + markValue?: string; + /** + * Position value + */ + posCost?: string; + /** + * added margin + */ + posCross?: string; + /** + * Leverage margin + */ + posInit?: string; + /** + * Bankruptcy cost + */ + posComm?: string; + /** + * Funding fees paid out + */ + posLoss?: string; + /** + * Position margin + */ + posMargin?: string; + /** + * Maintenance margin + */ + posMaint?: string; + /** + * Position margin + */ + maintMargin?: string; + /** + * Accumulated realised gross profit value + */ + realisedGrossPnl?: string; + /** + * Realised profit and loss + */ + realisedPnl?: string; + /** + * Unrealised profit and loss + */ + unrealisedPnl?: string; + /** + * Profit-loss ratio of the position + */ + unrealisedPnlPcnt?: string; + /** + * Rate of return on investment + */ + unrealisedRoePcnt?: string; + /** + * Average entry price + */ + avgEntryPrice?: string; + /** + * Liquidation price + */ + liquidationPrice?: string; + /** + * Bankruptcy price + */ + bankruptPrice?: string; + /** + * Currency used to clear and settle the trades + */ + settleCurrency?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddIsolatedMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddIsolatedMarginResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddIsolatedMarginResp { + return plainToInstance(AddIsolatedMarginResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts new file mode 100644 index 00000000..2958a35b --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts @@ -0,0 +1,451 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class AddOrderReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderReq.MarginModeEnum = AddOrderReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + + /** + * Creates a new instance of the `AddOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderReq` object. + */ + static builder(): AddOrderReqBuilder { + return new AddOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + }): AddOrderReq { + let obj = new AddOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stop = data.stop; + obj.stopPriceType = data.stopPriceType; + obj.stopPrice = data.stopPrice; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + return obj; + } + + fromJson(input: string): AddOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderReq { + return plainToInstance(AddOrderReq, jsonObject); + } +} + +export namespace AddOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice. + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum MarginModeEnum { + /** + * Isolated Margin + */ + ISOLATED = 'ISOLATED', + /** + * Cross Margin + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddOrderReqBuilder { + obj: AddOrderReq = new AddOrderReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderReq.SideEnum): AddOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddOrderReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddOrderReq.TypeEnum): AddOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + setStop(value: AddOrderReq.StopEnum): AddOrderReqBuilder { + this.obj.stop = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + setStopPriceType(value: AddOrderReq.StopPriceTypeEnum): AddOrderReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * Need to be defined if stop is specified. + */ + setStopPrice(value: string): AddOrderReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddOrderReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddOrderReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddOrderReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddOrderReq.MarginModeEnum): AddOrderReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddOrderReq.TimeInForceEnum): AddOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + build(): AddOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts new file mode 100644 index 00000000..b221e43d --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class AddOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderResp { + return plainToInstance(AddOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts new file mode 100644 index 00000000..5538c491 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts @@ -0,0 +1,452 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class AddOrderTestReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderTestReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderTestReq.MarginModeEnum = AddOrderTestReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum = + AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + + /** + * Creates a new instance of the `AddOrderTestReq` class. + * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. + */ + static builder(): AddOrderTestReqBuilder { + return new AddOrderTestReqBuilder(); + } + + /** + * Creates a new instance of the `AddOrderTestReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddOrderTestReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddOrderTestReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + stop?: AddOrderTestReq.StopEnum; + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** + * Need to be defined if stop is specified. + */ + stopPrice?: string; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddOrderTestReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddOrderTestReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + }): AddOrderTestReq { + let obj = new AddOrderTestReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stop = data.stop; + obj.stopPriceType = data.stopPriceType; + obj.stopPrice = data.stopPrice; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + return obj; + } + + fromJson(input: string): AddOrderTestReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestReq { + return plainToInstance(AddOrderTestReq, jsonObject); + } +} + +export namespace AddOrderTestReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * + */ + LIMIT = 'limit', + /** + * + */ + MARKET = 'market', + } + export enum StopEnum { + /** + * Triggers when the price reaches or goes below the stopPrice. + */ + DOWN = 'down', + /** + * Triggers when the price reaches or goes above the stopPrice + */ + UP = 'up', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum MarginModeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddOrderTestReqBuilder { + obj: AddOrderTestReq = new AddOrderTestReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddOrderTestReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddOrderTestReq.SideEnum): AddOrderTestReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddOrderTestReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddOrderTestReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddOrderTestReq.TypeEnum): AddOrderTestReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddOrderTestReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. + */ + setStop(value: AddOrderTestReq.StopEnum): AddOrderTestReqBuilder { + this.obj.stop = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. + */ + setStopPriceType(value: AddOrderTestReq.StopPriceTypeEnum): AddOrderTestReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * Need to be defined if stop is specified. + */ + setStopPrice(value: string): AddOrderTestReqBuilder { + this.obj.stopPrice = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddOrderTestReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddOrderTestReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddOrderTestReq.MarginModeEnum): AddOrderTestReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddOrderTestReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddOrderTestReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddOrderTestReq.TimeInForceEnum): AddOrderTestReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddOrderTestReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddOrderTestReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddOrderTestReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddOrderTestReqBuilder { + this.obj.visibleSize = value; + return this; + } + + build(): AddOrderTestReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts new file mode 100644 index 00000000..9eae886c --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class AddOrderTestResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddOrderTestResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddOrderTestResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddOrderTestResp { + return plainToInstance(AddOrderTestResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts new file mode 100644 index 00000000..0ec5c25a --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts @@ -0,0 +1,442 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class AddTPSLOrderReq implements Serializable { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddTPSLOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean = false; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean = false; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean = false; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddTPSLOrderReq.MarginModeEnum = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddTPSLOrderReq.TimeInForceEnum = + AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean = false; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean = false; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean = false; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * Take profit price + */ + triggerStopUpPrice?: string; + /** + * Stop loss price + */ + triggerStopDownPrice?: string; + + /** + * Creates a new instance of the `AddTPSLOrderReq` class. + * The builder pattern allows step-by-step construction of a `AddTPSLOrderReq` object. + */ + static builder(): AddTPSLOrderReqBuilder { + return new AddTPSLOrderReqBuilder(); + } + + /** + * Creates a new instance of the `AddTPSLOrderReq` class with the given data. + */ + static create(data: { + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + clientOid?: string; + /** + * specify if the order is to \'buy\' or \'sell\' + */ + side?: AddTPSLOrderReq.SideEnum; + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + leverage?: number; + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + type?: AddTPSLOrderReq.TypeEnum; + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + remark?: string; + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + reduceOnly?: boolean; + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + closeOrder?: boolean; + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + forceHold?: boolean; + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + marginMode?: AddTPSLOrderReq.MarginModeEnum; + /** + * Required for type is \'limit\' order, indicating the operating price + */ + price?: string; + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + size?: number; + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + timeInForce?: AddTPSLOrderReq.TimeInForceEnum; + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + postOnly?: boolean; + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + hidden?: boolean; + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + iceberg?: boolean; + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + visibleSize?: string; + /** + * Take profit price + */ + triggerStopUpPrice?: string; + /** + * Stop loss price + */ + triggerStopDownPrice?: string; + }): AddTPSLOrderReq { + let obj = new AddTPSLOrderReq(); + obj.clientOid = data.clientOid; + obj.side = data.side; + obj.symbol = data.symbol; + obj.leverage = data.leverage; + obj.type = data.type; + obj.remark = data.remark; + obj.stopPriceType = data.stopPriceType; + obj.reduceOnly = data.reduceOnly; + obj.closeOrder = data.closeOrder; + obj.forceHold = data.forceHold; + obj.marginMode = data.marginMode; + obj.price = data.price; + obj.size = data.size; + obj.timeInForce = data.timeInForce; + obj.postOnly = data.postOnly; + obj.hidden = data.hidden; + obj.iceberg = data.iceberg; + obj.visibleSize = data.visibleSize; + obj.triggerStopUpPrice = data.triggerStopUpPrice; + obj.triggerStopDownPrice = data.triggerStopDownPrice; + return obj; + } + + fromJson(input: string): AddTPSLOrderReq { + const jsonObject = JSON.parse(input); + return plainToInstance(AddTPSLOrderReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddTPSLOrderReq { + return plainToInstance(AddTPSLOrderReq, jsonObject); + } +} + +export namespace AddTPSLOrderReq { + export enum SideEnum { + /** + * + */ + BUY = 'buy', + /** + * + */ + SELL = 'sell', + } + export enum TypeEnum { + /** + * limit order + */ + LIMIT = 'limit', + /** + * market order + */ + MARKET = 'market', + } + export enum StopPriceTypeEnum { + /** + * TP for trade price, The last trade price is the last price at which an order was filled. This price can be found in the latest match message. + */ + TRADE_PRICE = 'TP', + /** + * MP for mark price, The mark price can be obtained through relevant OPEN API for index services + */ + MARK_PRICE = 'MP', + /** + * IP for index price, The index price can be obtained through relevant OPEN API for index services + */ + INDEX_PRICE = 'IP', + } + export enum MarginModeEnum { + /** + * + */ + ISOLATED = 'ISOLATED', + /** + * + */ + CROSS = 'CROSS', + } + export enum TimeInForceEnum { + /** + * order remains open on the order book until canceled. This is the default type if the field is left empty. + */ + GOOD_TILL_CANCELED = 'GTC', + /** + * being matched or not, the remaining size of the order will be instantly canceled instead of entering the order book. + */ + IMMEDIATE_OR_CANCEL = 'IOC', + } +} + +export class AddTPSLOrderReqBuilder { + obj: AddTPSLOrderReq = new AddTPSLOrderReq(); + /** + * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) + */ + setClientOid(value: string): AddTPSLOrderReqBuilder { + this.obj.clientOid = value; + return this; + } + + /** + * specify if the order is to \'buy\' or \'sell\' + */ + setSide(value: AddTPSLOrderReq.SideEnum): AddTPSLOrderReqBuilder { + this.obj.side = value; + return this; + } + + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): AddTPSLOrderReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. + */ + setLeverage(value: number): AddTPSLOrderReqBuilder { + this.obj.leverage = value; + return this; + } + + /** + * specify if the order is an \'limit\' order or \'market\' order + */ + setType(value: AddTPSLOrderReq.TypeEnum): AddTPSLOrderReqBuilder { + this.obj.type = value; + return this; + } + + /** + * remark for the order, length cannot exceed 100 utf8 characters + */ + setRemark(value: string): AddTPSLOrderReqBuilder { + this.obj.remark = value; + return this; + } + + /** + * Either \'TP\', \'IP\' or \'MP\' + */ + setStopPriceType(value: AddTPSLOrderReq.StopPriceTypeEnum): AddTPSLOrderReqBuilder { + this.obj.stopPriceType = value; + return this; + } + + /** + * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. + */ + setReduceOnly(value: boolean): AddTPSLOrderReqBuilder { + this.obj.reduceOnly = value; + return this; + } + + /** + * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. + */ + setCloseOrder(value: boolean): AddTPSLOrderReqBuilder { + this.obj.closeOrder = value; + return this; + } + + /** + * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. + */ + setForceHold(value: boolean): AddTPSLOrderReqBuilder { + this.obj.forceHold = value; + return this; + } + + /** + * Margin mode: ISOLATED, CROSS, default: ISOLATED + */ + setMarginMode(value: AddTPSLOrderReq.MarginModeEnum): AddTPSLOrderReqBuilder { + this.obj.marginMode = value; + return this; + } + + /** + * Required for type is \'limit\' order, indicating the operating price + */ + setPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. + */ + setSize(value: number): AddTPSLOrderReqBuilder { + this.obj.size = value; + return this; + } + + /** + * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC + */ + setTimeInForce(value: AddTPSLOrderReq.TimeInForceEnum): AddTPSLOrderReqBuilder { + this.obj.timeInForce = value; + return this; + } + + /** + * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. + */ + setPostOnly(value: boolean): AddTPSLOrderReqBuilder { + this.obj.postOnly = value; + return this; + } + + /** + * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. + */ + setHidden(value: boolean): AddTPSLOrderReqBuilder { + this.obj.hidden = value; + return this; + } + + /** + * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. + */ + setIceberg(value: boolean): AddTPSLOrderReqBuilder { + this.obj.iceberg = value; + return this; + } + + /** + * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. + */ + setVisibleSize(value: string): AddTPSLOrderReqBuilder { + this.obj.visibleSize = value; + return this; + } + + /** + * Take profit price + */ + setTriggerStopUpPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.triggerStopUpPrice = value; + return this; + } + + /** + * Stop loss price + */ + setTriggerStopDownPrice(value: string): AddTPSLOrderReqBuilder { + this.obj.triggerStopDownPrice = value; + return this; + } + + build(): AddTPSLOrderReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts new file mode 100644 index 00000000..c73bce1a --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts @@ -0,0 +1,39 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class AddTPSLOrderResp implements Response { + /** + * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. + */ + orderId?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): AddTPSLOrderResp { + const jsonObject = JSON.parse(input); + return plainToInstance(AddTPSLOrderResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): AddTPSLOrderResp { + return plainToInstance(AddTPSLOrderResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts new file mode 100644 index 00000000..c8f8b074 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class CancelOrderByClientOidReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. + */ + static builder(): CancelOrderByClientOidReqBuilder { + return new CancelOrderByClientOidReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByClientOidReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The user self-defined order id. + */ + clientOid?: string; + }): CancelOrderByClientOidReq { + let obj = new CancelOrderByClientOidReq(); + obj.symbol = data.symbol; + obj.clientOid = data.clientOid; + return obj; + } + + fromJson(input: string): CancelOrderByClientOidReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidReq { + return plainToInstance(CancelOrderByClientOidReq, jsonObject); + } +} + +export class CancelOrderByClientOidReqBuilder { + obj: CancelOrderByClientOidReq = new CancelOrderByClientOidReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): CancelOrderByClientOidReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The user self-defined order id. + */ + setClientOid(value: string): CancelOrderByClientOidReqBuilder { + this.obj.clientOid = value; + return this; + } + + build(): CancelOrderByClientOidReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts new file mode 100644 index 00000000..f9efd6f8 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class CancelOrderByClientOidResp + implements Response +{ + /** + * + */ + clientOid?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByClientOidResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToInstance(CancelOrderByClientOidResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts new file mode 100644 index 00000000..082ac8ec --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class CancelOrderByIdReq implements Serializable { + /** + * Order id + */ + orderId?: string; + + /** + * Creates a new instance of the `CancelOrderByIdReq` class. + * The builder pattern allows step-by-step construction of a `CancelOrderByIdReq` object. + */ + static builder(): CancelOrderByIdReqBuilder { + return new CancelOrderByIdReqBuilder(); + } + + /** + * Creates a new instance of the `CancelOrderByIdReq` class with the given data. + */ + static create(data: { + /** + * Order id + */ + orderId?: string; + }): CancelOrderByIdReq { + let obj = new CancelOrderByIdReq(); + obj.orderId = data.orderId; + return obj; + } + + fromJson(input: string): CancelOrderByIdReq { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByIdReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByIdReq { + return plainToInstance(CancelOrderByIdReq, jsonObject); + } +} + +export class CancelOrderByIdReqBuilder { + obj: CancelOrderByIdReq = new CancelOrderByIdReq(); + /** + * Order id + */ + setOrderId(value: string): CancelOrderByIdReqBuilder { + this.obj.orderId = value; + return this; + } + + build(): CancelOrderByIdReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts new file mode 100644 index 00000000..a5478a89 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class CancelOrderByIdResp implements Response { + /** + * The orderId that is to be canceled + */ + cancelledOrderIds?: Array; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): CancelOrderByIdResp { + const jsonObject = JSON.parse(input); + return plainToInstance(CancelOrderByIdResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): CancelOrderByIdResp { + return plainToInstance(CancelOrderByIdResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts new file mode 100644 index 00000000..71e785ca --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts @@ -0,0 +1,95 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class GetMaxOpenSizeReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order price + */ + price?: string; + /** + * Leverage + */ + leverage?: number; + + /** + * Creates a new instance of the `GetMaxOpenSizeReq` class. + * The builder pattern allows step-by-step construction of a `GetMaxOpenSizeReq` object. + */ + static builder(): GetMaxOpenSizeReqBuilder { + return new GetMaxOpenSizeReqBuilder(); + } + + /** + * Creates a new instance of the `GetMaxOpenSizeReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Order price + */ + price?: string; + /** + * Leverage + */ + leverage?: number; + }): GetMaxOpenSizeReq { + let obj = new GetMaxOpenSizeReq(); + obj.symbol = data.symbol; + obj.price = data.price; + obj.leverage = data.leverage; + return obj; + } + + fromJson(input: string): GetMaxOpenSizeReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxOpenSizeReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxOpenSizeReq { + return plainToInstance(GetMaxOpenSizeReq, jsonObject); + } +} + +export class GetMaxOpenSizeReqBuilder { + obj: GetMaxOpenSizeReq = new GetMaxOpenSizeReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMaxOpenSizeReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Order price + */ + setPrice(value: string): GetMaxOpenSizeReqBuilder { + this.obj.price = value; + return this; + } + + /** + * Leverage + */ + setLeverage(value: number): GetMaxOpenSizeReqBuilder { + this.obj.leverage = value; + return this; + } + + build(): GetMaxOpenSizeReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts new file mode 100644 index 00000000..7b48dfc9 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts @@ -0,0 +1,43 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class GetMaxOpenSizeResp implements Response { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * Maximum buy size + */ + maxBuyOpenSize?: string; + /** + * Maximum buy size + */ + maxSellOpenSize?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMaxOpenSizeResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxOpenSizeResp, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxOpenSizeResp { + return plainToInstance(GetMaxOpenSizeResp, jsonObject); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts new file mode 100644 index 00000000..3cf5efbb --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts @@ -0,0 +1,61 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class GetMaxWithdrawMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + + /** + * Creates a new instance of the `GetMaxWithdrawMarginReq` class. + * The builder pattern allows step-by-step construction of a `GetMaxWithdrawMarginReq` object. + */ + static builder(): GetMaxWithdrawMarginReqBuilder { + return new GetMaxWithdrawMarginReqBuilder(); + } + + /** + * Creates a new instance of the `GetMaxWithdrawMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + }): GetMaxWithdrawMarginReq { + let obj = new GetMaxWithdrawMarginReq(); + obj.symbol = data.symbol; + return obj; + } + + fromJson(input: string): GetMaxWithdrawMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxWithdrawMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): GetMaxWithdrawMarginReq { + return plainToInstance(GetMaxWithdrawMarginReq, jsonObject); + } +} + +export class GetMaxWithdrawMarginReqBuilder { + obj: GetMaxWithdrawMarginReq = new GetMaxWithdrawMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): GetMaxWithdrawMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + build(): GetMaxWithdrawMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts new file mode 100644 index 00000000..a8afb7e1 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class GetMaxWithdrawMarginResp implements Response { + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + data?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): GetMaxWithdrawMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(GetMaxWithdrawMarginResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): GetMaxWithdrawMarginResp { + return plainToInstance(GetMaxWithdrawMarginResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts new file mode 100644 index 00000000..176d45b8 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class ModifyAutoDepositStatusReq implements Serializable { + /** + * Symbol of the contract + */ + symbol?: string; + /** + * Status + */ + status?: boolean; + + /** + * Creates a new instance of the `ModifyAutoDepositStatusReq` class. + * The builder pattern allows step-by-step construction of a `ModifyAutoDepositStatusReq` object. + */ + static builder(): ModifyAutoDepositStatusReqBuilder { + return new ModifyAutoDepositStatusReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyAutoDepositStatusReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract + */ + symbol?: string; + /** + * Status + */ + status?: boolean; + }): ModifyAutoDepositStatusReq { + let obj = new ModifyAutoDepositStatusReq(); + obj.symbol = data.symbol; + obj.status = data.status; + return obj; + } + + fromJson(input: string): ModifyAutoDepositStatusReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyAutoDepositStatusReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyAutoDepositStatusReq { + return plainToInstance(ModifyAutoDepositStatusReq, jsonObject); + } +} + +export class ModifyAutoDepositStatusReqBuilder { + obj: ModifyAutoDepositStatusReq = new ModifyAutoDepositStatusReq(); + /** + * Symbol of the contract + */ + setSymbol(value: string): ModifyAutoDepositStatusReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * Status + */ + setStatus(value: boolean): ModifyAutoDepositStatusReqBuilder { + this.obj.status = value; + return this; + } + + build(): ModifyAutoDepositStatusReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts new file mode 100644 index 00000000..d53a4408 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class ModifyAutoDepositStatusResp + implements Response +{ + /** + * + */ + data?: boolean; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyAutoDepositStatusResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { + return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts new file mode 100644 index 00000000..21e522a1 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts @@ -0,0 +1,80 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class ModifyIsolatedMarginRiskLimtReq + implements Serializable +{ + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * level + */ + level?: number; + + /** + * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class. + * The builder pattern allows step-by-step construction of a `ModifyIsolatedMarginRiskLimtReq` object. + */ + static builder(): ModifyIsolatedMarginRiskLimtReqBuilder { + return new ModifyIsolatedMarginRiskLimtReqBuilder(); + } + + /** + * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * level + */ + level?: number; + }): ModifyIsolatedMarginRiskLimtReq { + let obj = new ModifyIsolatedMarginRiskLimtReq(); + obj.symbol = data.symbol; + obj.level = data.level; + return obj; + } + + fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { + return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + } +} + +export class ModifyIsolatedMarginRiskLimtReqBuilder { + obj: ModifyIsolatedMarginRiskLimtReq = new ModifyIsolatedMarginRiskLimtReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): ModifyIsolatedMarginRiskLimtReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * level + */ + setLevel(value: number): ModifyIsolatedMarginRiskLimtReqBuilder { + this.obj.level = value; + return this; + } + + build(): ModifyIsolatedMarginRiskLimtReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts new file mode 100644 index 00000000..ed84f474 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts @@ -0,0 +1,37 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class ModifyIsolatedMarginRiskLimtResp + implements Response +{ + /** + * To adjust the level will cancel the open order, the response can only indicate whether the submit of the adjustment request is successful or not. + */ + data?: boolean; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { + const jsonObject = JSON.parse(input); + return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { + return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts new file mode 100644 index 00000000..f79475a4 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts @@ -0,0 +1,78 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { Serializable } from '@internal/interfaces/serializable'; + +export class RemoveIsolatedMarginReq implements Serializable { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + withdrawAmount?: string; + + /** + * Creates a new instance of the `RemoveIsolatedMarginReq` class. + * The builder pattern allows step-by-step construction of a `RemoveIsolatedMarginReq` object. + */ + static builder(): RemoveIsolatedMarginReqBuilder { + return new RemoveIsolatedMarginReqBuilder(); + } + + /** + * Creates a new instance of the `RemoveIsolatedMarginReq` class with the given data. + */ + static create(data: { + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + symbol?: string; + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + withdrawAmount?: string; + }): RemoveIsolatedMarginReq { + let obj = new RemoveIsolatedMarginReq(); + obj.symbol = data.symbol; + obj.withdrawAmount = data.withdrawAmount; + return obj; + } + + fromJson(input: string): RemoveIsolatedMarginReq { + const jsonObject = JSON.parse(input); + return plainToInstance(RemoveIsolatedMarginReq, jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + fromObject(jsonObject: Object): RemoveIsolatedMarginReq { + return plainToInstance(RemoveIsolatedMarginReq, jsonObject); + } +} + +export class RemoveIsolatedMarginReqBuilder { + obj: RemoveIsolatedMarginReq = new RemoveIsolatedMarginReq(); + /** + * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + */ + setSymbol(value: string): RemoveIsolatedMarginReqBuilder { + this.obj.symbol = value; + return this; + } + + /** + * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + setWithdrawAmount(value: string): RemoveIsolatedMarginReqBuilder { + this.obj.withdrawAmount = value; + return this; + } + + build(): RemoveIsolatedMarginReq { + return this.obj; + } +} diff --git a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts new file mode 100644 index 00000000..79132079 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts @@ -0,0 +1,35 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { RestResponse } from '@model/common'; +import { Response } from '@internal/interfaces/response'; + +export class RemoveIsolatedMarginResp implements Response { + /** + * The size of the position deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins + */ + data?: string; + + /** + * common response + */ + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } + + fromJson(input: string): RemoveIsolatedMarginResp { + const jsonObject = JSON.parse(input); + return plainToInstance(RemoveIsolatedMarginResp, { data: jsonObject }); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this.data)); + } + + fromObject(jsonObject: Object): RemoveIsolatedMarginResp { + return plainToInstance(RemoveIsolatedMarginResp, { data: jsonObject }); + } +} diff --git a/sdk/node/src/generate/copytrading/index.ts b/sdk/node/src/generate/copytrading/index.ts new file mode 100644 index 00000000..a2c99777 --- /dev/null +++ b/sdk/node/src/generate/copytrading/index.ts @@ -0,0 +1,4 @@ +import * as FUTURES from './futures'; +export const Copytrading = { + ...FUTURES, +}; diff --git a/sdk/node/src/generate/earn/earn/api_earn.template b/sdk/node/src/generate/earn/earn/api_earn.template index cddf738f..5d1b55bf 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.template +++ b/sdk/node/src/generate/earn/earn/api_earn.template @@ -5,52 +5,42 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getETHStakingProducts request test', ()=> { - /** - * getETHStakingProducts - * Get ETH Staking Products - * /api/v1/earn/eth-staking/products - */ - let builder = GetETHStakingProductsReq.builder(); - builder.setCurrency(?); - let req = builder.build(); - let resp = api.getETHStakingProducts(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getAccountHolding request test', ()=> { + test('purchase request test', ()=> { /** - * getAccountHolding - * Get Account Holding - * /api/v1/earn/hold-assets + * purchase + * purchase + * /api/v1/earn/orders */ - let builder = GetAccountHoldingReq.builder(); - builder.setCurrency(?).setProductId(?).setProductCategory(?).setCurrentPage(?).setPageSize(?); + let builder = PurchaseReq.builder(); + builder.setProductId(?).setAmount(?).setAccountType(?); let req = builder.build(); - let resp = api.getAccountHolding(req); + let resp = api.purchase(req); return resp.then(result => { - expect(result.totalNum).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTxId).toEqual(expect.anything()); + console.log(resp); }); }) - test('getKcsStakingProducts request test', ()=> { + test('getRedeemPreview request test', ()=> { /** - * getKcsStakingProducts - * Get KCS Staking Products - * /api/v1/earn/kcs-staking/products + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview */ - let builder = GetKcsStakingProductsReq.builder(); - builder.setCurrency(?); + let builder = GetRedeemPreviewReq.builder(); + builder.setOrderId(?).setFromAccountType(?); let req = builder.build(); - let resp = api.getKcsStakingProducts(req); + let resp = api.getRedeemPreview(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.redeemAmount).toEqual(expect.anything()); + expect(result.penaltyInterestAmount).toEqual(expect.anything()); + expect(result.redeemPeriod).toEqual(expect.anything()); + expect(result.deliverTime).toEqual(expect.anything()); + expect(result.manualRedeemable).toEqual(expect.anything()); + expect(result.redeemAll).toEqual(expect.anything()); + console.log(resp); }); }) @@ -69,22 +59,23 @@ describe('Auto Test', ()=> { expect(result.deliverTime).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.amount).toEqual(expect.anything()); + console.log(resp); }); }) - test('purchase request test', ()=> { + test('getSavingsProducts request test', ()=> { /** - * purchase - * purchase - * /api/v1/earn/orders + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products */ - let builder = PurchaseReq.builder(); - builder.setProductId(?).setAmount(?).setAccountType(?); + let builder = GetSavingsProductsReq.builder(); + builder.setCurrency(?); let req = builder.build(); - let resp = api.purchase(req); + let resp = api.getSavingsProducts(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.orderTxId).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -100,57 +91,75 @@ describe('Auto Test', ()=> { let resp = api.getPromotionProducts(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getRedeemPreview request test', ()=> { + test('getAccountHolding request test', ()=> { /** - * getRedeemPreview - * Get Redeem Preview - * /api/v1/earn/redeem-preview + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets */ - let builder = GetRedeemPreviewReq.builder(); - builder.setOrderId(?).setFromAccountType(?); + let builder = GetAccountHoldingReq.builder(); + builder.setCurrency(?).setProductId(?).setProductCategory(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getRedeemPreview(req); + let resp = api.getAccountHolding(req); return resp.then(result => { - expect(result.currency).toEqual(expect.anything()); - expect(result.redeemAmount).toEqual(expect.anything()); - expect(result.penaltyInterestAmount).toEqual(expect.anything()); - expect(result.redeemPeriod).toEqual(expect.anything()); - expect(result.deliverTime).toEqual(expect.anything()); - expect(result.manualRedeemable).toEqual(expect.anything()); - expect(result.redeemAll).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSavingsProducts request test', ()=> { + test('getStakingProducts request test', ()=> { /** - * getSavingsProducts - * Get Savings Products - * /api/v1/earn/saving/products + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products */ - let builder = GetSavingsProductsReq.builder(); + let builder = GetStakingProductsReq.builder(); builder.setCurrency(?); let req = builder.build(); - let resp = api.getSavingsProducts(req); + let resp = api.getStakingProducts(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getStakingProducts request test', ()=> { + test('getKcsStakingProducts request test', ()=> { /** - * getStakingProducts - * Get Staking Products - * /api/v1/earn/staking/products + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products */ - let builder = GetStakingProductsReq.builder(); + let builder = GetKcsStakingProductsReq.builder(); builder.setCurrency(?); let req = builder.build(); - let resp = api.getStakingProducts(req); + let resp = api.getKcsStakingProducts(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getETHStakingProducts request test', ()=> { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let builder = GetETHStakingProductsReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getETHStakingProducts(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/earn/earn/api_earn.test.ts b/sdk/node/src/generate/earn/earn/api_earn.test.ts index 52335bfa..05dfe04b 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.test.ts +++ b/sdk/node/src/generate/earn/earn/api_earn.test.ts @@ -1,6 +1,6 @@ import { GetStakingProductsReq } from './model_get_staking_products_req'; -import { GetSavingsProductsReq } from './model_get_savings_products_req'; import { GetPromotionProductsReq } from './model_get_promotion_products_req'; +import { GetSavingsProductsReq } from './model_get_savings_products_req'; import { GetPromotionProductsResp } from './model_get_promotion_products_resp'; import { PurchaseReq } from './model_purchase_req'; import { GetAccountHoldingResp } from './model_get_account_holding_resp'; @@ -19,48 +19,14 @@ import { GetKcsStakingProductsResp } from './model_get_kcs_staking_products_resp import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getETHStakingProducts request test', () => { - /** - * getETHStakingProducts - * Get ETH Staking Products - * /api/v1/earn/eth-staking/products - */ - let data = '{"currency": "BTC"}'; - let req = new GetETHStakingProductsReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('getETHStakingProducts response test', () => { - /** - * getETHStakingProducts - * Get ETH Staking Products - * /api/v1/earn/eth-staking/products - */ - let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "ETH2",\n "category": "ETH2",\n "type": "DEMAND",\n "precision": 8,\n "currency": "ETH",\n "incomeCurrency": "ETH2",\n "returnRate": "0.028",\n "userLowerLimit": "0.01",\n "userUpperLimit": "8557.3597075",\n "productUpperLimit": "8557.3597075",\n "productRemainAmount": "8557.3597075",\n "redeemPeriod": 5,\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "applyStartTime": 1729255485000,\n "applyEndTime": null,\n "lockStartTime": 1729255485000,\n "lockEndTime": null,\n "interestDate": 1729267200000,\n "newUserOnly": 0,\n "earlyRedeemSupported": 0,\n "duration": 0,\n "status": "ONGOING"\n }\n ]\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetETHStakingProductsResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } - }); - test('getAccountHolding request test', () => { + test('purchase request test', () => { /** - * getAccountHolding - * Get Account Holding - * /api/v1/earn/hold-assets + * purchase + * purchase + * /api/v1/earn/orders */ - let data = - '{"currency": "KCS", "productId": "example_string_default_value", "productCategory": "DEMAND", "currentPage": 1, "pageSize": 10}'; - let req = new GetAccountHoldingReq(); + let data = '{"productId": "2611", "amount": "1", "accountType": "TRADE"}'; + let req = new PurchaseReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -68,16 +34,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getAccountHolding response test', () => { + test('purchase response test', () => { /** - * getAccountHolding - * Get Account Holding - * /api/v1/earn/hold-assets + * purchase + * purchase + * /api/v1/earn/orders */ let data = - '{\n "code": "200000",\n "data": {\n "totalNum": 1,\n "totalPage": 1,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "orderId": "2767291",\n "productId": "2611",\n "productCategory": "KCS_STAKING",\n "productType": "DEMAND",\n "currency": "KCS",\n "incomeCurrency": "KCS",\n "returnRate": "0.03471727",\n "holdAmount": "1",\n "redeemedAmount": "0",\n "redeemingAmount": "1",\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "purchaseTime": 1729257513000,\n "redeemPeriod": 3,\n "status": "REDEEMING",\n "earlyRedeemSupported": 0\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "2767291",\n "orderTxId": "6603694"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAccountHoldingResp(); + let resp = new PurchaseResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -86,14 +52,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getKcsStakingProducts request test', () => { + test('getRedeemPreview request test', () => { /** - * getKcsStakingProducts - * Get KCS Staking Products - * /api/v1/earn/kcs-staking/products + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview */ - let data = '{"currency": "BTC"}'; - let req = new GetKcsStakingProductsReq(); + let data = '{"orderId": "2767291", "fromAccountType": "MAIN"}'; + let req = new GetRedeemPreviewReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -101,16 +67,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getKcsStakingProducts response test', () => { + test('getRedeemPreview response test', () => { /** - * getKcsStakingProducts - * Get KCS Staking Products - * /api/v1/earn/kcs-staking/products + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "2611",\n "currency": "KCS",\n "category": "KCS_STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "100000000",\n "userUpperLimit": "100000000",\n "userLowerLimit": "1",\n "redeemPeriod": 3,\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "applyStartTime": 1701252000000,\n "applyEndTime": null,\n "returnRate": "0.03471727",\n "incomeCurrency": "KCS",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "58065850.54998251",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "currency": "KCS",\n "redeemAmount": "1",\n "penaltyInterestAmount": "0",\n "redeemPeriod": 3,\n "deliverTime": 1729518951000,\n "manualRedeemable": true,\n "redeemAll": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetKcsStakingProductsResp(); + let resp = new GetRedeemPreviewResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -153,14 +119,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('purchase request test', () => { + test('getSavingsProducts request test', () => { /** - * purchase - * purchase - * /api/v1/earn/orders + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products */ - let data = '{"productId": "2611", "amount": "1", "accountType": "TRADE"}'; - let req = new PurchaseReq(); + let data = '{"currency": "BTC"}'; + let req = new GetSavingsProductsReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -168,16 +134,16 @@ describe('Auto Test', () => { console.log(req); }); - test('purchase response test', () => { + test('getSavingsProducts response test', () => { /** - * purchase - * purchase - * /api/v1/earn/orders + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "2767291",\n "orderTxId": "6603694"\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "2172",\n "currency": "BTC",\n "category": "DEMAND",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "480",\n "productRemainAmount": "132.36153083",\n "userUpperLimit": "20",\n "userLowerLimit": "0.01",\n "redeemPeriod": 0,\n "lockStartTime": 1644807600000,\n "lockEndTime": null,\n "applyStartTime": 1644807600000,\n "applyEndTime": null,\n "returnRate": "0.00047208",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new PurchaseResp(); + let resp = new GetSavingsProductsResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -219,14 +185,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRedeemPreview request test', () => { + test('getAccountHolding request test', () => { /** - * getRedeemPreview - * Get Redeem Preview - * /api/v1/earn/redeem-preview + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets */ - let data = '{"orderId": "2767291", "fromAccountType": "MAIN"}'; - let req = new GetRedeemPreviewReq(); + let data = + '{"currency": "KCS", "productId": "example_string_default_value", "productCategory": "DEMAND", "currentPage": 1, "pageSize": 10}'; + let req = new GetAccountHoldingReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -234,16 +201,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRedeemPreview response test', () => { + test('getAccountHolding response test', () => { /** - * getRedeemPreview - * Get Redeem Preview - * /api/v1/earn/redeem-preview + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets */ let data = - '{\n "code": "200000",\n "data": {\n "currency": "KCS",\n "redeemAmount": "1",\n "penaltyInterestAmount": "0",\n "redeemPeriod": 3,\n "deliverTime": 1729518951000,\n "manualRedeemable": true,\n "redeemAll": false\n }\n}'; + '{\n "code": "200000",\n "data": {\n "totalNum": 1,\n "totalPage": 1,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "orderId": "2767291",\n "productId": "2611",\n "productCategory": "KCS_STAKING",\n "productType": "DEMAND",\n "currency": "KCS",\n "incomeCurrency": "KCS",\n "returnRate": "0.03471727",\n "holdAmount": "1",\n "redeemedAmount": "0",\n "redeemingAmount": "1",\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "purchaseTime": 1729257513000,\n "redeemPeriod": 3,\n "status": "REDEEMING",\n "earlyRedeemSupported": 0\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRedeemPreviewResp(); + let resp = new GetAccountHoldingResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -252,14 +219,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSavingsProducts request test', () => { + test('getStakingProducts request test', () => { /** - * getSavingsProducts - * Get Savings Products - * /api/v1/earn/saving/products + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products */ let data = '{"currency": "BTC"}'; - let req = new GetSavingsProductsReq(); + let req = new GetStakingProductsReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -267,16 +234,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSavingsProducts response test', () => { + test('getStakingProducts response test', () => { /** - * getSavingsProducts - * Get Savings Products - * /api/v1/earn/saving/products + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "2172",\n "currency": "BTC",\n "category": "DEMAND",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "480",\n "productRemainAmount": "132.36153083",\n "userUpperLimit": "20",\n "userLowerLimit": "0.01",\n "redeemPeriod": 0,\n "lockStartTime": 1644807600000,\n "lockEndTime": null,\n "applyStartTime": 1644807600000,\n "applyEndTime": null,\n "returnRate": "0.00047208",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "2535",\n "currency": "STX",\n "category": "STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "1000000",\n "userUpperLimit": "10000",\n "userLowerLimit": "1",\n "redeemPeriod": 14,\n "lockStartTime": 1688614514000,\n "lockEndTime": null,\n "applyStartTime": 1688614512000,\n "applyEndTime": null,\n "returnRate": "0.045",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "254032.90178701",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSavingsProductsResp(); + let resp = new GetStakingProductsResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -285,14 +252,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getStakingProducts request test', () => { + test('getKcsStakingProducts request test', () => { /** - * getStakingProducts - * Get Staking Products - * /api/v1/earn/staking/products + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products */ let data = '{"currency": "BTC"}'; - let req = new GetStakingProductsReq(); + let req = new GetKcsStakingProductsReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -300,16 +267,49 @@ describe('Auto Test', () => { console.log(req); }); - test('getStakingProducts response test', () => { + test('getKcsStakingProducts response test', () => { /** - * getStakingProducts - * Get Staking Products - * /api/v1/earn/staking/products + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "2535",\n "currency": "STX",\n "category": "STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "1000000",\n "userUpperLimit": "10000",\n "userLowerLimit": "1",\n "redeemPeriod": 14,\n "lockStartTime": 1688614514000,\n "lockEndTime": null,\n "applyStartTime": 1688614512000,\n "applyEndTime": null,\n "returnRate": "0.045",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "254032.90178701",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "2611",\n "currency": "KCS",\n "category": "KCS_STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "100000000",\n "userUpperLimit": "100000000",\n "userLowerLimit": "1",\n "redeemPeriod": 3,\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "applyStartTime": 1701252000000,\n "applyEndTime": null,\n "returnRate": "0.03471727",\n "incomeCurrency": "KCS",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "58065850.54998251",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStakingProductsResp(); + let resp = new GetKcsStakingProductsResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('getETHStakingProducts request test', () => { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let data = '{"currency": "BTC"}'; + let req = new GetETHStakingProductsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getETHStakingProducts response test', () => { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "ETH2",\n "category": "ETH2",\n "type": "DEMAND",\n "precision": 8,\n "currency": "ETH",\n "incomeCurrency": "ETH2",\n "returnRate": "0.028",\n "userLowerLimit": "0.01",\n "userUpperLimit": "8557.3597075",\n "productUpperLimit": "8557.3597075",\n "productRemainAmount": "8557.3597075",\n "redeemPeriod": 5,\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "applyStartTime": 1729255485000,\n "applyEndTime": null,\n "lockStartTime": 1729255485000,\n "lockEndTime": null,\n "interestDate": 1729267200000,\n "newUserOnly": 0,\n "earlyRedeemSupported": 0,\n "duration": 0,\n "status": "ONGOING"\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetETHStakingProductsResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/earn/earn/api_earn.ts b/sdk/node/src/generate/earn/earn/api_earn.ts index 02345bcb..38cba65b 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.ts +++ b/sdk/node/src/generate/earn/earn/api_earn.ts @@ -2,8 +2,8 @@ import { Transport } from '@internal/interfaces/transport'; import { GetStakingProductsReq } from './model_get_staking_products_req'; -import { GetSavingsProductsReq } from './model_get_savings_products_req'; import { GetPromotionProductsReq } from './model_get_promotion_products_req'; +import { GetSavingsProductsReq } from './model_get_savings_products_req'; import { GetPromotionProductsResp } from './model_get_promotion_products_resp'; import { PurchaseReq } from './model_purchase_req'; import { GetAccountHoldingResp } from './model_get_account_holding_resp'; @@ -22,89 +22,89 @@ import { GetKcsStakingProductsResp } from './model_get_kcs_staking_products_resp export interface EarnAPI { /** - * getETHStakingProducts Get ETH Staking Products - * Description: This endpoint can get available ETH staking products. If no products are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470276 + * purchase purchase + * Description: This endpoint allows subscribing earn product + * Documentation: https://www.kucoin.com/docs-new/api-3470268 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | EARN | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getETHStakingProducts(req: GetETHStakingProductsReq): Promise; + purchase(req: PurchaseReq): Promise; /** - * getAccountHolding Get Account Holding - * Description: This endpoint can get current holding assets information. If no current holding assets are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470273 + * getRedeemPreview Get Redeem Preview + * Description: This endpoint allows subscribing earn products + * Documentation: https://www.kucoin.com/docs-new/api-3470269 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | EARN | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getAccountHolding(req: GetAccountHoldingReq): Promise; + getRedeemPreview(req: GetRedeemPreviewReq): Promise; /** - * getKcsStakingProducts Get KCS Staking Products - * Description: This endpoint can get available KCS staking products. If no products are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470275 + * redeem Redeem + * Description: This endpoint allows initiating redemption by holding ID. If the current holding is fully redeemed or in the process of being redeemed, it indicates that the holding does not exist. + * Documentation: https://www.kucoin.com/docs-new/api-3470270 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | EARN | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise; + redeem(req: RedeemReq): Promise; /** - * redeem Redeem - * Description: This endpoint allows initiating redemption by holding ID. If the current holding is fully redeemed or in the process of being redeemed, it indicates that the holding does not exist. - * Documentation: https://www.kucoin.com/docs-new/api-3470270 + * getSavingsProducts Get Savings Products + * Description: This endpoint can get available savings products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470271 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | EARN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - redeem(req: RedeemReq): Promise; + getSavingsProducts(req: GetSavingsProductsReq): Promise; /** - * purchase purchase - * Description: This endpoint allows subscribing earn product - * Documentation: https://www.kucoin.com/docs-new/api-3470268 + * getPromotionProducts Get Promotion Products + * Description: This endpoint can get available limited-time promotion products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470272 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | EARN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - purchase(req: PurchaseReq): Promise; + getPromotionProducts(req: GetPromotionProductsReq): Promise; /** - * getPromotionProducts Get Promotion Products - * Description: This endpoint can get available limited-time promotion products. If no products are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470272 + * getAccountHolding Get Account Holding + * Description: This endpoint can get current holding assets information. If no current holding assets are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470273 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -115,28 +115,28 @@ export interface EarnAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getPromotionProducts(req: GetPromotionProductsReq): Promise; + getAccountHolding(req: GetAccountHoldingReq): Promise; /** - * getRedeemPreview Get Redeem Preview - * Description: This endpoint allows subscribing earn products - * Documentation: https://www.kucoin.com/docs-new/api-3470269 + * getStakingProducts Get Staking Products + * Description: This endpoint can get available staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470274 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | EARN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | EARN | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getRedeemPreview(req: GetRedeemPreviewReq): Promise; + getStakingProducts(req: GetStakingProductsReq): Promise; /** - * getSavingsProducts Get Savings Products - * Description: This endpoint can get available savings products. If no products are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470271 + * getKcsStakingProducts Get KCS Staking Products + * Description: This endpoint can get available KCS staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470275 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -147,12 +147,12 @@ export interface EarnAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getSavingsProducts(req: GetSavingsProductsReq): Promise; + getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise; /** - * getStakingProducts Get Staking Products - * Description: This endpoint can get available staking products. If no products are available, an empty list is returned. - * Documentation: https://www.kucoin.com/docs-new/api-3470274 + * getETHStakingProducts Get ETH Staking Products + * Description: This endpoint can get available ETH staking products. If no products are available, an empty list is returned. + * Documentation: https://www.kucoin.com/docs-new/api-3470276 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -163,116 +163,116 @@ export interface EarnAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getStakingProducts(req: GetStakingProductsReq): Promise; + getETHStakingProducts(req: GetETHStakingProductsReq): Promise; } export class EarnAPIImpl implements EarnAPI { constructor(private transport: Transport) {} - getETHStakingProducts(req: GetETHStakingProductsReq): Promise { + purchase(req: PurchaseReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/earn/eth-staking/products', + 'POST', + '/api/v1/earn/orders', req, - new GetETHStakingProductsResp(), + new PurchaseResp(), false, ); } - getAccountHolding(req: GetAccountHoldingReq): Promise { + getRedeemPreview(req: GetRedeemPreviewReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/earn/hold-assets', + '/api/v1/earn/redeem-preview', req, - new GetAccountHoldingResp(), + new GetRedeemPreviewResp(), false, ); } - getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise { + redeem(req: RedeemReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/earn/kcs-staking/products', + 'DELETE', + '/api/v1/earn/orders', req, - new GetKcsStakingProductsResp(), + new RedeemResp(), false, ); } - redeem(req: RedeemReq): Promise { + getSavingsProducts(req: GetSavingsProductsReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/earn/orders', + 'GET', + '/api/v1/earn/saving/products', req, - new RedeemResp(), + new GetSavingsProductsResp(), false, ); } - purchase(req: PurchaseReq): Promise { + getPromotionProducts(req: GetPromotionProductsReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/earn/orders', + 'GET', + '/api/v1/earn/promotion/products', req, - new PurchaseResp(), + new GetPromotionProductsResp(), false, ); } - getPromotionProducts(req: GetPromotionProductsReq): Promise { + getAccountHolding(req: GetAccountHoldingReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/earn/promotion/products', + '/api/v1/earn/hold-assets', req, - new GetPromotionProductsResp(), + new GetAccountHoldingResp(), false, ); } - getRedeemPreview(req: GetRedeemPreviewReq): Promise { + getStakingProducts(req: GetStakingProductsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/earn/redeem-preview', + '/api/v1/earn/staking/products', req, - new GetRedeemPreviewResp(), + new GetStakingProductsResp(), false, ); } - getSavingsProducts(req: GetSavingsProductsReq): Promise { + getKcsStakingProducts(req: GetKcsStakingProductsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/earn/saving/products', + '/api/v1/earn/kcs-staking/products', req, - new GetSavingsProductsResp(), + new GetKcsStakingProductsResp(), false, ); } - getStakingProducts(req: GetStakingProductsReq): Promise { + getETHStakingProducts(req: GetETHStakingProductsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/earn/staking/products', + '/api/v1/earn/eth-staking/products', req, - new GetStakingProductsResp(), + new GetETHStakingProductsResp(), false, ); } diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template index bb30bf2c..c5cdeaff 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.template @@ -5,6 +5,28 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); + test('getCurrentFundingRate request test', ()=> { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let builder = GetCurrentFundingRateReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCurrentFundingRate(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.granularity).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.predictedValue).toEqual(expect.anything()); + expect(result.fundingRateCap).toEqual(expect.anything()); + expect(result.fundingRateFloor).toEqual(expect.anything()); + console.log(resp); + }); + }) + test('getPublicFundingHistory request test', ()=> { /** * getPublicFundingHistory @@ -17,6 +39,7 @@ describe('Auto Test', ()=> { let resp = api.getPublicFundingHistory(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -33,27 +56,7 @@ describe('Auto Test', ()=> { return resp.then(result => { expect(result.dataList).toEqual(expect.anything()); expect(result.hasMore).toEqual(expect.anything()); - }); - }) - - test('getCurrentFundingRate request test', ()=> { - /** - * getCurrentFundingRate - * Get Current Funding Rate - * /api/v1/funding-rate/{symbol}/current - */ - let builder = GetCurrentFundingRateReq.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getCurrentFundingRate(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.granularity).toEqual(expect.anything()); - expect(result.timePoint).toEqual(expect.anything()); - expect(result.value).toEqual(expect.anything()); - expect(result.predictedValue).toEqual(expect.anything()); - expect(result.fundingRateCap).toEqual(expect.anything()); - expect(result.fundingRateFloor).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts index 7124f323..b55410ef 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -7,6 +7,39 @@ import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { + test('getCurrentFundingRate request test', () => { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetCurrentFundingRateReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getCurrentFundingRate response test', () => { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": ".XBTUSDTMFPI8H",\n "granularity": 28800000,\n "timePoint": 1731441600000,\n "value": 6.41E-4,\n "predictedValue": 5.2E-5,\n "fundingRateCap": 0.003,\n "fundingRateFloor": -0.003\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCurrentFundingRateResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); test('getPublicFundingHistory request test', () => { /** * getPublicFundingHistory @@ -74,37 +107,4 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getCurrentFundingRate request test', () => { - /** - * getCurrentFundingRate - * Get Current Funding Rate - * /api/v1/funding-rate/{symbol}/current - */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetCurrentFundingRateReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('getCurrentFundingRate response test', () => { - /** - * getCurrentFundingRate - * Get Current Funding Rate - * /api/v1/funding-rate/{symbol}/current - */ - let data = - '{\n "code": "200000",\n "data": {\n "symbol": ".XBTUSDTMFPI8H",\n "granularity": 28800000,\n "timePoint": 1731441600000,\n "value": 6.41E-4,\n "predictedValue": 5.2E-5,\n "fundingRateCap": 0.003,\n "fundingRateFloor": -0.003\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetCurrentFundingRateResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } - }); }); diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts index 206d0455..303ea43f 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts @@ -9,6 +9,22 @@ import { GetPrivateFundingHistoryReq } from './model_get_private_funding_history import { GetCurrentFundingRateReq } from './model_get_current_funding_rate_req'; export interface FundingFeesAPI { + /** + * getCurrentFundingRate Get Current Funding Rate + * Description: get Current Funding Rate + * Documentation: https://www.kucoin.com/docs-new/api-3470265 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | FUTURES | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | FUTURES | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 2 | + * +---------------------+---------+ + */ + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; + /** * getPublicFundingHistory Get Public Funding History * Description: Query the funding rate at each settlement time point within a certain time range of the corresponding contract @@ -42,61 +58,45 @@ export interface FundingFeesAPI { getPrivateFundingHistory( req: GetPrivateFundingHistoryReq, ): Promise; - - /** - * getCurrentFundingRate Get Current Funding Rate - * Description: get Current Funding Rate - * Documentation: https://www.kucoin.com/docs-new/api-3470265 - * +---------------------+---------+ - * | Extra API Info | Value | - * +---------------------+---------+ - * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | - * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 2 | - * +---------------------+---------+ - */ - getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise; } export class FundingFeesAPIImpl implements FundingFeesAPI { constructor(private transport: Transport) {} - getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { + getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/contract/funding-rates', + '/api/v1/funding-rate/{symbol}/current', req, - new GetPublicFundingHistoryResp(), + new GetCurrentFundingRateResp(), false, ); } - getPrivateFundingHistory( - req: GetPrivateFundingHistoryReq, - ): Promise { + getPublicFundingHistory(req: GetPublicFundingHistoryReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/funding-history', + '/api/v1/contract/funding-rates', req, - new GetPrivateFundingHistoryResp(), + new GetPublicFundingHistoryResp(), false, ); } - getCurrentFundingRate(req: GetCurrentFundingRateReq): Promise { + getPrivateFundingHistory( + req: GetPrivateFundingHistoryReq, + ): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/funding-rate/{symbol}/current', + '/api/v1/funding-history', req, - new GetCurrentFundingRateResp(), + new GetPrivateFundingHistoryResp(), false, ); } diff --git a/sdk/node/src/generate/futures/market/api_market.template b/sdk/node/src/generate/futures/market/api_market.template index ca6bb2a9..f3575606 100644 --- a/sdk/node/src/generate/futures/market/api_market.template +++ b/sdk/node/src/generate/futures/market/api_market.template @@ -5,56 +5,6 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getAllTickers request test', ()=> { - /** - * getAllTickers - * Get All Tickers - * /api/v1/allTickers - */ - let resp = api.getAllTickers(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getPrivateToken request test', ()=> { - /** - * getPrivateToken - * Get Private Token - Futures - * /api/v1/bullet-private - */ - let resp = api.getPrivateToken(); - return resp.then(result => { - expect(result.token).toEqual(expect.anything()); - expect(result.instanceServers).toEqual(expect.anything()); - }); - }) - - test('getPublicToken request test', ()=> { - /** - * getPublicToken - * Get Public Token - Futures - * /api/v1/bullet-public - */ - let resp = api.getPublicToken(); - return resp.then(result => { - expect(result.token).toEqual(expect.anything()); - expect(result.instanceServers).toEqual(expect.anything()); - }); - }) - - test('getAllSymbols request test', ()=> { - /** - * getAllSymbols - * Get All Symbols - * /api/v1/contracts/active - */ - let resp = api.getAllSymbols(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - test('getSymbol request test', ()=> { /** * getSymbol @@ -128,53 +78,79 @@ describe('Auto Test', ()=> { expect(result.mmrLimit).toEqual(expect.anything()); expect(result.mmrLevConstant).toEqual(expect.anything()); expect(result.supportCross).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSpotIndexPrice request test', ()=> { + test('getAllSymbols request test', ()=> { /** - * getSpotIndexPrice - * Get Spot Index Price - * /api/v1/index/query + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active */ - let builder = GetSpotIndexPriceReq.builder(); - builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); - let req = builder.build(); - let resp = api.getSpotIndexPrice(req); + let resp = api.getAllSymbols(); return resp.then(result => { - expect(result.dataList).toEqual(expect.anything()); - expect(result.hasMore).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getInterestRateIndex request test', ()=> { + test('getTicker request test', ()=> { /** - * getInterestRateIndex - * Get Interest Rate Index - * /api/v1/interest/query + * getTicker + * Get Ticker + * /api/v1/ticker */ - let builder = GetInterestRateIndexReq.builder(); - builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let builder = GetTickerReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.getInterestRateIndex(req); + let resp = api.getTicker(req); return resp.then(result => { - expect(result.dataList).toEqual(expect.anything()); - expect(result.hasMore).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.tradeId).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.bestBidPrice).toEqual(expect.anything()); + expect(result.bestBidSize).toEqual(expect.anything()); + expect(result.bestAskPrice).toEqual(expect.anything()); + expect(result.bestAskSize).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + console.log(resp); }); }) - test('getKlines request test', ()=> { + test('getAllTickers request test', ()=> { /** - * getKlines - * Get Klines - * /api/v1/kline/query + * getAllTickers + * Get All Tickers + * /api/v1/allTickers */ - let builder = GetKlinesReq.builder(); - builder.setSymbol(?).setGranularity(?).setFrom(?).setTo(?); - let req = builder.build(); - let resp = api.getKlines(req); + let resp = api.getAllTickers(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getFullOrderBook request test', ()=> { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot + */ + let builder = GetFullOrderBookReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getFullOrderBook(req); + return resp.then(result => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + console.log(resp); }); }) @@ -194,25 +170,39 @@ describe('Auto Test', ()=> { expect(result.bids).toEqual(expect.anything()); expect(result.asks).toEqual(expect.anything()); expect(result.ts).toEqual(expect.anything()); + console.log(resp); }); }) - test('getFullOrderBook request test', ()=> { + test('getTradeHistory request test', ()=> { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v1/level2/snapshot + * getTradeHistory + * Get Trade History + * /api/v1/trade/history */ - let builder = GetFullOrderBookReq.builder(); + let builder = GetTradeHistoryReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.getFullOrderBook(req); + let resp = api.getTradeHistory(req); return resp.then(result => { - expect(result.sequence).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.bids).toEqual(expect.anything()); - expect(result.asks).toEqual(expect.anything()); - expect(result.ts).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getKlines request test', ()=> { + /** + * getKlines + * Get Klines + * /api/v1/kline/query + */ + let builder = GetKlinesReq.builder(); + builder.setSymbol(?).setGranularity(?).setFrom(?).setTo(?); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -232,60 +222,71 @@ describe('Auto Test', ()=> { expect(result.timePoint).toEqual(expect.anything()); expect(result.value).toEqual(expect.anything()); expect(result.indexPrice).toEqual(expect.anything()); + console.log(resp); }); }) - test('getPremiumIndex request test', ()=> { + test('getSpotIndexPrice request test', ()=> { /** - * getPremiumIndex - * Get Premium Index - * /api/v1/premium/query + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query */ - let builder = GetPremiumIndexReq.builder(); + let builder = GetSpotIndexPriceReq.builder(); builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); let req = builder.build(); - let resp = api.getPremiumIndex(req); + let resp = api.getSpotIndexPrice(req); return resp.then(result => { expect(result.dataList).toEqual(expect.anything()); expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); }); }) - test('getServiceStatus request test', ()=> { + test('getInterestRateIndex request test', ()=> { /** - * getServiceStatus - * Get Service Status - * /api/v1/status + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query */ - let resp = api.getServiceStatus(); + let builder = GetInterestRateIndexReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); + let req = builder.build(); + let resp = api.getInterestRateIndex(req); return resp.then(result => { - expect(result.msg).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); }); }) - test('getTicker request test', ()=> { + test('getPremiumIndex request test', ()=> { /** - * getTicker - * Get Ticker - * /api/v1/ticker + * getPremiumIndex + * Get Premium Index + * /api/v1/premium/query */ - let builder = GetTickerReq.builder(); - builder.setSymbol(?); + let builder = GetPremiumIndexReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setReverse(?).setOffset(?).setForward(?).setMaxCount(?); let req = builder.build(); - let resp = api.getTicker(req); + let resp = api.getPremiumIndex(req); return resp.then(result => { - expect(result.sequence).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.side).toEqual(expect.anything()); - expect(result.size).toEqual(expect.anything()); - expect(result.tradeId).toEqual(expect.anything()); - expect(result.price).toEqual(expect.anything()); - expect(result.bestBidPrice).toEqual(expect.anything()); - expect(result.bestBidSize).toEqual(expect.anything()); - expect(result.bestAskPrice).toEqual(expect.anything()); - expect(result.bestAskSize).toEqual(expect.anything()); - expect(result.ts).toEqual(expect.anything()); + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('get24hrStats request test', ()=> { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics + */ + let resp = api.get24hrStats(); + return resp.then(result => { + expect(result.turnoverOf24h).toEqual(expect.anything()); + console.log(resp); }); }) @@ -298,33 +299,49 @@ describe('Auto Test', ()=> { let resp = api.getServerTime(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getTradeHistory request test', ()=> { + test('getServiceStatus request test', ()=> { /** - * getTradeHistory - * Get Trade History - * /api/v1/trade/history + * getServiceStatus + * Get Service Status + * /api/v1/status */ - let builder = GetTradeHistoryReq.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getTradeHistory(req); + let resp = api.getServiceStatus(); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.msg).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); }); }) - test('get24hrStats request test', ()=> { + test('getPublicToken request test', ()=> { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/trade-statistics + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public */ - let resp = api.get24hrStats(); + let resp = api.getPublicToken(); return resp.then(result => { - expect(result.turnoverOf24h).toEqual(expect.anything()); + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getPrivateToken request test', ()=> { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + let resp = api.getPrivateToken(); + return resp.then(result => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts index 5c2280b8..e0613a39 100644 --- a/sdk/node/src/generate/futures/market/api_market.test.ts +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -11,12 +11,12 @@ import { GetPartOrderBookReq } from './model_get_part_order_book_req'; import { GetPremiumIndexReq } from './model_get_premium_index_req'; import { GetSymbolReq } from './model_get_symbol_req'; import { GetSymbolResp } from './model_get_symbol_resp'; -import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookReq } from './model_get_full_order_book_req'; import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; -import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetInterestRateIndexResp } from './model_get_interest_rate_index_resp'; import { Get24hrStatsResp } from './model_get24hr_stats_resp'; import { GetKlinesReq } from './model_get_klines_req'; @@ -28,74 +28,110 @@ import { GetKlinesResp } from './model_get_klines_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getAllTickers request test', () => { + test('getSymbol request test', () => { /** - * getAllTickers - * Get All Tickers - * /api/v1/allTickers + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetSymbolReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getAllTickers response test', () => { + test('getSymbol response test', () => { /** - * getAllTickers - * Get All Tickers - * /api/v1/allTickers + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} */ + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDM",\n "rootSymbol": "XBT",\n "type": "FFWCSX",\n "firstOpenDate": 1552638575000,\n "expireDate": null,\n "settleDate": null,\n "baseCurrency": "XBT",\n "quoteCurrency": "USD",\n "settleCurrency": "XBT",\n "maxOrderQty": 10000000,\n "maxPrice": 1000000.0,\n "lotSize": 1,\n "tickSize": 0.1,\n "indexPriceTickSize": 0.1,\n "multiplier": -1.0,\n "initialMargin": 0.014,\n "maintainMargin": 0.007,\n "maxRiskLimit": 1,\n "minRiskLimit": 1,\n "riskStep": 0,\n "makerFeeRate": 2.0E-4,\n "takerFeeRate": 6.0E-4,\n "takerFixFee": 0.0,\n "makerFixFee": 0.0,\n "settlementFee": null,\n "isDeleverage": true,\n "isQuanto": false,\n "isInverse": true,\n "markMethod": "FairPrice",\n "fairMethod": "FundingRate",\n "fundingBaseSymbol": ".XBTINT8H",\n "fundingQuoteSymbol": ".USDINT8H",\n "fundingRateSymbol": ".XBTUSDMFPI8H",\n "indexSymbol": ".BXBT",\n "settlementSymbol": null,\n "status": "Open",\n "fundingFeeRate": 1.75E-4,\n "predictedFundingFeeRate": 1.76E-4,\n "fundingRateGranularity": 28800000,\n "openInterest": "61725904",\n "turnoverOf24h": 209.56303473,\n "volumeOf24h": 1.4354731E7,\n "markPrice": 68336.7,\n "indexPrice": 68335.29,\n "lastTradePrice": 68349.3,\n "nextFundingRateTime": 17402942,\n "maxLeverage": 75,\n "sourceExchanges": [\n "kraken",\n "bitstamp",\n "crypto"\n ],\n "premiumsSymbol1M": ".XBTUSDMPI",\n "premiumsSymbol8H": ".XBTUSDMPI8H",\n "fundingBaseSymbol1M": ".XBTINT",\n "fundingQuoteSymbol1M": ".USDINT",\n "lowPrice": 67436.7,\n "highPrice": 69471.8,\n "priceChgPct": 0.0097,\n "priceChg": 658.7,\n "k": 2645000.0,\n "m": 1640000.0,\n "f": 1.3,\n "mmrLimit": 0.3,\n "mmrLevConstant": 75.0,\n "supportCross": true\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetSymbolResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('getPrivateToken request test', () => { + test('getAllSymbols request test', () => { /** - * getPrivateToken - * Get Private Token - Futures - * /api/v1/bullet-private + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active */ }); - test('getPrivateToken response test', () => { + test('getAllSymbols response test', () => { /** - * getPrivateToken - * Get Private Token - Futures - * /api/v1/bullet-private + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active */ }); - test('getPublicToken request test', () => { + test('getTicker request test', () => { /** - * getPublicToken - * Get Public Token - Futures - * /api/v1/bullet-public + * getTicker + * Get Ticker + * /api/v1/ticker */ + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetTickerReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getPublicToken response test', () => { + test('getTicker response test', () => { /** - * getPublicToken - * Get Public Token - Futures - * /api/v1/bullet-public + * getTicker + * Get Ticker + * /api/v1/ticker */ + let data = + '{"code":"200000","data":{"sequence":1697895100310,"symbol":"XBTUSDM","side":"sell","size":2936,"tradeId":"1697901180000","price":"67158.4","bestBidPrice":"67169.6","bestBidSize":32345,"bestAskPrice":"67169.7","bestAskSize":7251,"ts":1729163001780000000}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetTickerResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('getAllSymbols request test', () => { + test('getAllTickers request test', () => { /** - * getAllSymbols - * Get All Symbols - * /api/v1/contracts/active + * getAllTickers + * Get All Tickers + * /api/v1/allTickers */ }); - test('getAllSymbols response test', () => { + test('getAllTickers response test', () => { /** - * getAllSymbols - * Get All Symbols - * /api/v1/contracts/active + * getAllTickers + * Get All Tickers + * /api/v1/allTickers */ }); - test('getSymbol request test', () => { + test('getFullOrderBook request test', () => { /** - * getSymbol - * Get Symbol - * /api/v1/contracts/{symbol} + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetSymbolReq(); + let data = '{"symbol": "XBTUSDM"}'; + let req = new GetFullOrderBookReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -103,16 +139,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSymbol response test', () => { + test('getFullOrderBook response test', () => { /** - * getSymbol - * Get Symbol - * /api/v1/contracts/{symbol} + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot */ let data = - '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDM",\n "rootSymbol": "XBT",\n "type": "FFWCSX",\n "firstOpenDate": 1552638575000,\n "expireDate": null,\n "settleDate": null,\n "baseCurrency": "XBT",\n "quoteCurrency": "USD",\n "settleCurrency": "XBT",\n "maxOrderQty": 10000000,\n "maxPrice": 1000000.0,\n "lotSize": 1,\n "tickSize": 0.1,\n "indexPriceTickSize": 0.1,\n "multiplier": -1.0,\n "initialMargin": 0.014,\n "maintainMargin": 0.007,\n "maxRiskLimit": 1,\n "minRiskLimit": 1,\n "riskStep": 0,\n "makerFeeRate": 2.0E-4,\n "takerFeeRate": 6.0E-4,\n "takerFixFee": 0.0,\n "makerFixFee": 0.0,\n "settlementFee": null,\n "isDeleverage": true,\n "isQuanto": false,\n "isInverse": true,\n "markMethod": "FairPrice",\n "fairMethod": "FundingRate",\n "fundingBaseSymbol": ".XBTINT8H",\n "fundingQuoteSymbol": ".USDINT8H",\n "fundingRateSymbol": ".XBTUSDMFPI8H",\n "indexSymbol": ".BXBT",\n "settlementSymbol": null,\n "status": "Open",\n "fundingFeeRate": 1.75E-4,\n "predictedFundingFeeRate": 1.76E-4,\n "fundingRateGranularity": 28800000,\n "openInterest": "61725904",\n "turnoverOf24h": 209.56303473,\n "volumeOf24h": 1.4354731E7,\n "markPrice": 68336.7,\n "indexPrice": 68335.29,\n "lastTradePrice": 68349.3,\n "nextFundingRateTime": 17402942,\n "maxLeverage": 75,\n "sourceExchanges": [\n "kraken",\n "bitstamp",\n "crypto"\n ],\n "premiumsSymbol1M": ".XBTUSDMPI",\n "premiumsSymbol8H": ".XBTUSDMPI8H",\n "fundingBaseSymbol1M": ".XBTINT",\n "fundingQuoteSymbol1M": ".USDINT",\n "lowPrice": 67436.7,\n "highPrice": 69471.8,\n "priceChgPct": 0.0097,\n "priceChg": 658.7,\n "k": 2645000.0,\n "m": 1640000.0,\n "f": 1.3,\n "mmrLimit": 0.3,\n "mmrLevConstant": 75.0,\n "supportCross": true\n }\n}'; + '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolResp(); + let resp = new GetFullOrderBookResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -121,15 +157,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSpotIndexPrice request test', () => { + test('getPartOrderBook request test', () => { /** - * getSpotIndexPrice - * Get Spot Index Price - * /api/v1/index/query + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} */ - let data = - '{"symbol": ".KXBTUSDT", "startAt": 123456, "endAt": 123456, "reverse": true, "offset": 123456, "forward": true, "maxCount": 10}'; - let req = new GetSpotIndexPriceReq(); + let data = '{"symbol": "XBTUSDM", "size": "20"}'; + let req = new GetPartOrderBookReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -137,16 +172,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSpotIndexPrice response test', () => { + test('getPartOrderBook response test', () => { /** - * getSpotIndexPrice - * Get Spot Index Price - * /api/v1/index/query + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} */ let data = - '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557515000,\n "value": 69202.94,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69209.27,\n "weight": 0.0533\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0128\n },\n {\n "exchange": "okex",\n "price": 69195.34,\n "weight": 0.11\n },\n {\n "exchange": "bybit",\n "price": 69190.33,\n "weight": 0.0676\n },\n {\n "exchange": "binance",\n "price": 69204.55,\n "weight": 0.6195\n },\n {\n "exchange": "kucoin",\n "price": 69202.91,\n "weight": 0.1368\n }\n ]\n },\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557514000,\n "value": 69204.98,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69212.71,\n "weight": 0.0808\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0134\n },\n {\n "exchange": "okex",\n "price": 69195.49,\n "weight": 0.0536\n },\n {\n "exchange": "bybit",\n "price": 69195.97,\n "weight": 0.0921\n },\n {\n "exchange": "binance",\n "price": 69204.56,\n "weight": 0.5476\n },\n {\n "exchange": "kucoin",\n "price": 69207.8,\n "weight": 0.2125\n }\n ]\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotIndexPriceResp(); + let resp = new GetPartOrderBookResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -155,15 +190,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getInterestRateIndex request test', () => { + test('getTradeHistory request test', () => { /** - * getInterestRateIndex - * Get Interest Rate Index - * /api/v1/interest/query + * getTradeHistory + * Get Trade History + * /api/v1/trade/history */ - let data = - '{"symbol": ".XBTINT8H", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; - let req = new GetInterestRateIndexReq(); + let data = '{"symbol": "XBTUSDM"}'; + let req = new GetTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -171,16 +205,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getInterestRateIndex response test', () => { + test('getTradeHistory response test', () => { /** - * getInterestRateIndex - * Get Interest Rate Index - * /api/v1/interest/query + * getTradeHistory + * Get Trade History + * /api/v1/trade/history */ let data = - '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692100000,\n "value": 3.0E-4\n },\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692040000,\n "value": 3.0E-4\n }\n ],\n "hasMore": true\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "sequence": 1697915257909,\n "contractId": 1,\n "tradeId": "1697915257909",\n "makerOrderId": "236679665752801280",\n "takerOrderId": "236679667975745536",\n "ts": 1729242032152000000,\n "size": 1,\n "price": "67878",\n "side": "sell"\n },\n {\n "sequence": 1697915257749,\n "contractId": 1,\n "tradeId": "1697915257749",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679665400492032",\n "ts": 1729242031535000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n },\n {\n "sequence": 1697915257701,\n "contractId": 1,\n "tradeId": "1697915257701",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679661919211521",\n "ts": 1729242030932000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetInterestRateIndexResp(); + let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -223,14 +257,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getPartOrderBook request test', () => { + test('getMarkPrice request test', () => { /** - * getPartOrderBook - * Get Part OrderBook - * /api/v1/level2/depth{size} + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current */ - let data = '{"symbol": "XBTUSDM", "size": "20"}'; - let req = new GetPartOrderBookReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetMarkPriceReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -238,16 +272,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getPartOrderBook response test', () => { + test('getMarkPrice response test', () => { /** - * getPartOrderBook - * Get Part OrderBook - * /api/v1/level2/depth{size} + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current */ let data = - '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; + '{"code":"200000","data":{"symbol":"XBTUSDTM","granularity":1000,"timePoint":1729254307000,"value":67687.08,"indexPrice":67683.58}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPartOrderBookResp(); + let resp = new GetMarkPriceResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -256,14 +290,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getFullOrderBook request test', () => { + test('getSpotIndexPrice request test', () => { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v1/level2/snapshot + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query */ - let data = '{"symbol": "XBTUSDM"}'; - let req = new GetFullOrderBookReq(); + let data = + '{"symbol": ".KXBTUSDT", "startAt": 123456, "endAt": 123456, "reverse": true, "offset": 123456, "forward": true, "maxCount": 10}'; + let req = new GetSpotIndexPriceReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -271,16 +306,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getFullOrderBook response test', () => { + test('getSpotIndexPrice response test', () => { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v1/level2/snapshot + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query */ let data = - '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; + '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557515000,\n "value": 69202.94,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69209.27,\n "weight": 0.0533\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0128\n },\n {\n "exchange": "okex",\n "price": 69195.34,\n "weight": 0.11\n },\n {\n "exchange": "bybit",\n "price": 69190.33,\n "weight": 0.0676\n },\n {\n "exchange": "binance",\n "price": 69204.55,\n "weight": 0.6195\n },\n {\n "exchange": "kucoin",\n "price": 69202.91,\n "weight": 0.1368\n }\n ]\n },\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557514000,\n "value": 69204.98,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69212.71,\n "weight": 0.0808\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0134\n },\n {\n "exchange": "okex",\n "price": 69195.49,\n "weight": 0.0536\n },\n {\n "exchange": "bybit",\n "price": 69195.97,\n "weight": 0.0921\n },\n {\n "exchange": "binance",\n "price": 69204.56,\n "weight": 0.5476\n },\n {\n "exchange": "kucoin",\n "price": 69207.8,\n "weight": 0.2125\n }\n ]\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFullOrderBookResp(); + let resp = new GetSpotIndexPriceResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -289,14 +324,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMarkPrice request test', () => { + test('getInterestRateIndex request test', () => { /** - * getMarkPrice - * Get Mark Price - * /api/v1/mark-price/{symbol}/current + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetMarkPriceReq(); + let data = + '{"symbol": ".XBTINT8H", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; + let req = new GetInterestRateIndexReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -304,16 +340,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getMarkPrice response test', () => { + test('getInterestRateIndex response test', () => { /** - * getMarkPrice - * Get Mark Price - * /api/v1/mark-price/{symbol}/current + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query */ let data = - '{"code":"200000","data":{"symbol":"XBTUSDTM","granularity":1000,"timePoint":1729254307000,"value":67687.08,"indexPrice":67683.58}}'; + '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692100000,\n "value": 3.0E-4\n },\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692040000,\n "value": 3.0E-4\n }\n ],\n "hasMore": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarkPriceResp(); + let resp = new GetInterestRateIndexResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -356,53 +392,20 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getServiceStatus request test', () => { + test('get24hrStats request test', () => { /** - * getServiceStatus - * Get Service Status - * /api/v1/status + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics */ }); - test('getServiceStatus response test', () => { - /** - * getServiceStatus - * Get Service Status - * /api/v1/status - */ - }); - test('getTicker request test', () => { - /** - * getTicker - * Get Ticker - * /api/v1/ticker - */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetTickerReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('getTicker response test', () => { + test('get24hrStats response test', () => { /** - * getTicker - * Get Ticker - * /api/v1/ticker + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics */ - let data = - '{"code":"200000","data":{"sequence":1697895100310,"symbol":"XBTUSDM","side":"sell","size":2936,"tradeId":"1697901180000","price":"67158.4","bestBidPrice":"67169.6","bestBidSize":32345,"bestAskPrice":"67169.7","bestAskSize":7251,"ts":1729163001780000000}}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetTickerResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); test('getServerTime request test', () => { /** @@ -419,52 +422,49 @@ describe('Auto Test', () => { * /api/v1/timestamp */ }); - test('getTradeHistory request test', () => { + test('getServiceStatus request test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/trade/history + * getServiceStatus + * Get Service Status + * /api/v1/status */ - let data = '{"symbol": "XBTUSDM"}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('getTradeHistory response test', () => { + test('getServiceStatus response test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/trade/history + * getServiceStatus + * Get Service Status + * /api/v1/status */ - let data = - '{\n "code": "200000",\n "data": [\n {\n "sequence": 1697915257909,\n "contractId": 1,\n "tradeId": "1697915257909",\n "makerOrderId": "236679665752801280",\n "takerOrderId": "236679667975745536",\n "ts": 1729242032152000000,\n "size": 1,\n "price": "67878",\n "side": "sell"\n },\n {\n "sequence": 1697915257749,\n "contractId": 1,\n "tradeId": "1697915257749",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679665400492032",\n "ts": 1729242031535000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n },\n {\n "sequence": 1697915257701,\n "contractId": 1,\n "tradeId": "1697915257701",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679661919211521",\n "ts": 1729242030932000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n }\n ]\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); - test('get24hrStats request test', () => { + test('getPublicToken request test', () => { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/trade-statistics + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public */ }); - test('get24hrStats response test', () => { + test('getPublicToken response test', () => { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/trade-statistics + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public + */ + }); + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + }); + + test('getPrivateToken response test', () => { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private */ }); }); diff --git a/sdk/node/src/generate/futures/market/api_market.ts b/sdk/node/src/generate/futures/market/api_market.ts index 198c6d9d..bd27058b 100644 --- a/sdk/node/src/generate/futures/market/api_market.ts +++ b/sdk/node/src/generate/futures/market/api_market.ts @@ -14,12 +14,12 @@ import { GetPartOrderBookReq } from './model_get_part_order_book_req'; import { GetPremiumIndexReq } from './model_get_premium_index_req'; import { GetSymbolReq } from './model_get_symbol_req'; import { GetSymbolResp } from './model_get_symbol_resp'; -import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; +import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookReq } from './model_get_full_order_book_req'; import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; -import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetInterestRateIndexResp } from './model_get_interest_rate_index_resp'; import { Get24hrStatsResp } from './model_get24hr_stats_resp'; import { GetKlinesReq } from './model_get_klines_req'; @@ -31,9 +31,9 @@ import { GetKlinesResp } from './model_get_klines_resp'; export interface MarketAPI { /** - * getAllTickers Get All Tickers - * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470223 + * getSymbol Get Symbol + * Description: Get information of specified contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. + * Documentation: https://www.kucoin.com/docs-new/api-3470221 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -41,31 +41,31 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getAllTickers(): Promise; + getSymbol(req: GetSymbolReq): Promise; /** - * getPrivateToken Get Private Token - Futures - * Description: This interface can obtain the token required for websocket to establish a Futures private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token - * Documentation: https://www.kucoin.com/docs-new/api-3470296 + * getAllSymbols Get All Symbols + * Description: Get detailed information of all contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. + * Documentation: https://www.kucoin.com/docs-new/api-3470220 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 10 | + * | API-CHANNEL | PUBLIC | + * | API-PERMISSION | NULL | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getPrivateToken(): Promise; + getAllSymbols(): Promise; /** - * getPublicToken Get Public Token - Futures - * Description: This interface can obtain the token required for websocket to establish a Futures connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token - * Documentation: https://www.kucoin.com/docs-new/api-3470297 + * getTicker Get Ticker + * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470222 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -73,15 +73,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPublicToken(): Promise; + getTicker(req: GetTickerReq): Promise; /** - * getAllSymbols Get All Symbols - * Description: Get detailed information of all contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. - * Documentation: https://www.kucoin.com/docs-new/api-3470220 + * getAllTickers Get All Tickers + * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470223 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -89,15 +89,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getAllSymbols(): Promise; + getAllTickers(): Promise; /** - * getSymbol Get Symbol - * Description: Get information of specified contracts that can be traded. This API will return a list of tradable contracts, including some key parameters of the contract such as the symbol name, tick size, mark price,etc. - * Documentation: https://www.kucoin.com/docs-new/api-3470221 + * getFullOrderBook Get Full OrderBook + * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. + * Documentation: https://www.kucoin.com/docs-new/api-3470224 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -108,12 +108,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getSymbol(req: GetSymbolReq): Promise; + getFullOrderBook(req: GetFullOrderBookReq): Promise; /** - * getSpotIndexPrice Get Spot Index Price - * Description: Get Spot Index Price - * Documentation: https://www.kucoin.com/docs-new/api-3470231 + * getPartOrderBook Get Part OrderBook + * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. + * Documentation: https://www.kucoin.com/docs-new/api-3470225 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -121,15 +121,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise; + getPartOrderBook(req: GetPartOrderBookReq): Promise; /** - * getInterestRateIndex Get Interest Rate Index - * Description: Get interest rate Index. - * Documentation: https://www.kucoin.com/docs-new/api-3470226 + * getTradeHistory Get Trade History + * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. + * Documentation: https://www.kucoin.com/docs-new/api-3470232 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -140,7 +140,7 @@ export interface MarketAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getInterestRateIndex(req: GetInterestRateIndexReq): Promise; + getTradeHistory(req: GetTradeHistoryReq): Promise; /** * getKlines Get Klines @@ -159,9 +159,9 @@ export interface MarketAPI { getKlines(req: GetKlinesReq): Promise; /** - * getPartOrderBook Get Part OrderBook - * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. - * Documentation: https://www.kucoin.com/docs-new/api-3470225 + * getMarkPrice Get Mark Price + * Description: Get current mark price + * Documentation: https://www.kucoin.com/docs-new/api-3470233 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -169,15 +169,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getPartOrderBook(req: GetPartOrderBookReq): Promise; + getMarkPrice(req: GetMarkPriceReq): Promise; /** - * getFullOrderBook Get Full OrderBook - * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. - * Documentation: https://www.kucoin.com/docs-new/api-3470224 + * getSpotIndexPrice Get Spot Index Price + * Description: Get Spot Index Price + * Documentation: https://www.kucoin.com/docs-new/api-3470231 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -185,15 +185,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getFullOrderBook(req: GetFullOrderBookReq): Promise; + getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise; /** - * getMarkPrice Get Mark Price - * Description: Get current mark price - * Documentation: https://www.kucoin.com/docs-new/api-3470233 + * getInterestRateIndex Get Interest Rate Index + * Description: Get interest rate Index. + * Documentation: https://www.kucoin.com/docs-new/api-3470226 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -201,10 +201,10 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getMarkPrice(req: GetMarkPriceReq): Promise; + getInterestRateIndex(req: GetInterestRateIndexReq): Promise; /** * getPremiumIndex Get Premium Index @@ -223,25 +223,25 @@ export interface MarketAPI { getPremiumIndex(req: GetPremiumIndexReq): Promise; /** - * getServiceStatus Get Service Status - * Description: Get the service status. - * Documentation: https://www.kucoin.com/docs-new/api-3470230 + * get24hrStats Get 24hr Stats + * Description: Get the statistics of the platform futures trading volume in the last 24 hours. + * Documentation: https://www.kucoin.com/docs-new/api-3470228 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | - * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 4 | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getServiceStatus(): Promise; + get24hrStats(): Promise; /** - * getTicker Get Ticker - * Description: This endpoint returns \"last traded price/size\"、\"best bid/ask price/size\" etc. of a single symbol. These messages can also be obtained through Websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470222 + * getServerTime Get Server Time + * Description: Get the API server time. This is the Unix timestamp. + * Documentation: https://www.kucoin.com/docs-new/api-3470229 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -252,12 +252,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getTicker(req: GetTickerReq): Promise; + getServerTime(): Promise; /** - * getServerTime Get Server Time - * Description: Get the API server time. This is the Unix timestamp. - * Documentation: https://www.kucoin.com/docs-new/api-3470229 + * getServiceStatus Get Service Status + * Description: Get the service status. + * Documentation: https://www.kucoin.com/docs-new/api-3470230 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -265,15 +265,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 4 | * +---------------------+---------+ */ - getServerTime(): Promise; + getServiceStatus(): Promise; /** - * getTradeHistory Get Trade History - * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. - * Documentation: https://www.kucoin.com/docs-new/api-3470232 + * getPublicToken Get Public Token - Futures + * Description: This interface can obtain the token required for websocket to establish a Futures connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token + * Documentation: https://www.kucoin.com/docs-new/api-3470297 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -281,111 +281,111 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getTradeHistory(req: GetTradeHistoryReq): Promise; + getPublicToken(): Promise; /** - * get24hrStats Get 24hr Stats - * Description: Get the statistics of the platform futures trading volume in the last 24 hours. - * Documentation: https://www.kucoin.com/docs-new/api-3470228 + * getPrivateToken Get Private Token - Futures + * Description: This interface can obtain the token required for websocket to establish a Futures private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token + * Documentation: https://www.kucoin.com/docs-new/api-3470296 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | - * | API-CHANNEL | PUBLIC | - * | API-PERMISSION | NULL | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - get24hrStats(): Promise; + getPrivateToken(): Promise; } export class MarketAPIImpl implements MarketAPI { constructor(private transport: Transport) {} - getAllTickers(): Promise { + getSymbol(req: GetSymbolReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/allTickers', - null, - new GetAllTickersResp(), + '/api/v1/contracts/{symbol}', + req, + new GetSymbolResp(), false, ); } - getPrivateToken(): Promise { + getAllSymbols(): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/bullet-private', + 'GET', + '/api/v1/contracts/active', null, - new GetPrivateTokenResp(), + new GetAllSymbolsResp(), false, ); } - getPublicToken(): Promise { + getTicker(req: GetTickerReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/bullet-public', - null, - new GetPublicTokenResp(), + 'GET', + '/api/v1/ticker', + req, + new GetTickerResp(), false, ); } - getAllSymbols(): Promise { + getAllTickers(): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/contracts/active', + '/api/v1/allTickers', null, - new GetAllSymbolsResp(), + new GetAllTickersResp(), false, ); } - getSymbol(req: GetSymbolReq): Promise { + getFullOrderBook(req: GetFullOrderBookReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/contracts/{symbol}', + '/api/v1/level2/snapshot', req, - new GetSymbolResp(), + new GetFullOrderBookResp(), false, ); } - getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise { + getPartOrderBook(req: GetPartOrderBookReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/index/query', + '/api/v1/level2/depth{size}', req, - new GetSpotIndexPriceResp(), + new GetPartOrderBookResp(), false, ); } - getInterestRateIndex(req: GetInterestRateIndexReq): Promise { + getTradeHistory(req: GetTradeHistoryReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/interest/query', + '/api/v1/trade/history', req, - new GetInterestRateIndexResp(), + new GetTradeHistoryResp(), false, ); } @@ -402,38 +402,38 @@ export class MarketAPIImpl implements MarketAPI { ); } - getPartOrderBook(req: GetPartOrderBookReq): Promise { + getMarkPrice(req: GetMarkPriceReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/level2/depth{size}', + '/api/v1/mark-price/{symbol}/current', req, - new GetPartOrderBookResp(), + new GetMarkPriceResp(), false, ); } - getFullOrderBook(req: GetFullOrderBookReq): Promise { + getSpotIndexPrice(req: GetSpotIndexPriceReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/level2/snapshot', + '/api/v1/index/query', req, - new GetFullOrderBookResp(), + new GetSpotIndexPriceResp(), false, ); } - getMarkPrice(req: GetMarkPriceReq): Promise { + getInterestRateIndex(req: GetInterestRateIndexReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/mark-price/{symbol}/current', + '/api/v1/interest/query', req, - new GetMarkPriceResp(), + new GetInterestRateIndexResp(), false, ); } @@ -450,62 +450,62 @@ export class MarketAPIImpl implements MarketAPI { ); } - getServiceStatus(): Promise { + get24hrStats(): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/status', + '/api/v1/trade-statistics', null, - new GetServiceStatusResp(), + new Get24hrStatsResp(), false, ); } - getTicker(req: GetTickerReq): Promise { + getServerTime(): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/ticker', - req, - new GetTickerResp(), + '/api/v1/timestamp', + null, + new GetServerTimeResp(), false, ); } - getServerTime(): Promise { + getServiceStatus(): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/timestamp', + '/api/v1/status', null, - new GetServerTimeResp(), + new GetServiceStatusResp(), false, ); } - getTradeHistory(req: GetTradeHistoryReq): Promise { + getPublicToken(): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/trade/history', - req, - new GetTradeHistoryResp(), + 'POST', + '/api/v1/bullet-public', + null, + new GetPublicTokenResp(), false, ); } - get24hrStats(): Promise { + getPrivateToken(): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/trade-statistics', + 'POST', + '/api/v1/bullet-private', null, - new Get24hrStatsResp(), + new GetPrivateTokenResp(), false, ); } diff --git a/sdk/node/src/generate/futures/order/api_order.template b/sdk/node/src/generate/futures/order/api_order.template index addd4311..853703e1 100644 --- a/sdk/node/src/generate/futures/order/api_order.template +++ b/sdk/node/src/generate/futures/order/api_order.template @@ -5,142 +5,102 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getTradeHistory request test', ()=> { + test('addOrder request test', ()=> { /** - * getTradeHistory - * Get Trade History - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/orders */ - let builder = GetTradeHistoryReq.builder(); - builder.setOrderId(?).setSymbol(?).setSide(?).setType(?).setTradeTypes(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); let req = builder.build(); - let resp = api.getTradeHistory(req); + let resp = api.addOrder(req); return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOpenOrderValue request test', ()=> { + test('addOrderTest request test', ()=> { /** - * getOpenOrderValue - * Get Open Order Value - * /api/v1/openOrderStatistics + * addOrderTest + * Add Order Test + * /api/v1/orders/test */ - let builder = GetOpenOrderValueReq.builder(); - builder.setSymbol(?); + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); let req = builder.build(); - let resp = api.getOpenOrderValue(req); + let resp = api.addOrderTest(req); return resp.then(result => { - expect(result.openOrderBuySize).toEqual(expect.anything()); - expect(result.openOrderSellSize).toEqual(expect.anything()); - expect(result.openOrderBuyCost).toEqual(expect.anything()); - expect(result.openOrderSellCost).toEqual(expect.anything()); - expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOrderByClientOid request test', ()=> { + test('batchAddOrders request test', ()=> { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v1/orders/byClientOid + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi */ - let builder = GetOrderByClientOidReq.builder(); - builder.setClientOid(?); + let builder = BatchAddOrdersReq.builder(); + builder.setItems(?); let req = builder.build(); - let resp = api.getOrderByClientOid(req); + let resp = api.batchAddOrders(req); return resp.then(result => { - expect(result.id).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.type).toEqual(expect.anything()); - expect(result.side).toEqual(expect.anything()); - expect(result.price).toEqual(expect.anything()); - expect(result.size).toEqual(expect.anything()); - expect(result.value).toEqual(expect.anything()); - expect(result.dealValue).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.stp).toEqual(expect.anything()); - expect(result.stop).toEqual(expect.anything()); - expect(result.stopPriceType).toEqual(expect.anything()); - expect(result.stopTriggered).toEqual(expect.anything()); - expect(result.stopPrice).toEqual(expect.anything()); - expect(result.timeInForce).toEqual(expect.anything()); - expect(result.postOnly).toEqual(expect.anything()); - expect(result.hidden).toEqual(expect.anything()); - expect(result.iceberg).toEqual(expect.anything()); - expect(result.leverage).toEqual(expect.anything()); - expect(result.forceHold).toEqual(expect.anything()); - expect(result.closeOrder).toEqual(expect.anything()); - expect(result.visibleSize).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); - expect(result.remark).toEqual(expect.anything()); - expect(result.tags).toEqual(expect.anything()); - expect(result.isActive).toEqual(expect.anything()); - expect(result.cancelExist).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); - expect(result.updatedAt).toEqual(expect.anything()); - expect(result.endAt).toEqual(expect.anything()); - expect(result.orderTime).toEqual(expect.anything()); - expect(result.settleCurrency).toEqual(expect.anything()); - expect(result.marginMode).toEqual(expect.anything()); - expect(result.avgDealPrice).toEqual(expect.anything()); - expect(result.filledSize).toEqual(expect.anything()); - expect(result.filledValue).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - expect(result.reduceOnly).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByClientOid request test', ()=> { + test('addTPSLOrder request test', ()=> { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v1/orders/client-order/{clientOid} + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders */ - let builder = CancelOrderByClientOidReq.builder(); - builder.setSymbol(?).setClientOid(?); + let builder = AddTPSLOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStopPriceType(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTriggerStopUpPrice(?).setTriggerStopDownPrice(?).setQty(?).setValueQty(?); let req = builder.build(); - let resp = api.cancelOrderByClientOid(req); + let resp = api.addTPSLOrder(req); return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllOrdersV1 request test', ()=> { + test('cancelOrderById request test', ()=> { /** - * cancelAllOrdersV1 - * Cancel All Orders - V1 - * /api/v1/orders + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} */ - let builder = CancelAllOrdersV1Req.builder(); - builder.setSymbol(?); + let builder = CancelOrderByIdReq.builder(); + builder.setOrderId(?); let req = builder.build(); - let resp = api.cancelAllOrdersV1(req); + let resp = api.cancelOrderById(req); return resp.then(result => { expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOrderList request test', ()=> { + test('cancelOrderByClientOid request test', ()=> { /** - * getOrderList - * Get Order List - * /api/v1/orders + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} */ - let builder = GetOrderListReq.builder(); - builder.setStatus(?).setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let builder = CancelOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); let req = builder.build(); - let resp = api.getOrderList(req); + let resp = api.cancelOrderByClientOid(req); return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) @@ -156,36 +116,39 @@ describe('Auto Test', ()=> { let resp = api.batchCancelOrders(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('batchAddOrders request test', ()=> { + test('cancelAllOrdersV3 request test', ()=> { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/orders/multi + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders */ - let builder = BatchAddOrdersReq.builder(); - builder.setItems(?); + let builder = CancelAllOrdersV3Req.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.batchAddOrders(req); + let resp = api.cancelAllOrdersV3(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderById request test', ()=> { + test('cancelAllStopOrders request test', ()=> { /** - * cancelOrderById - * Cancel Order By OrderId - * /api/v1/orders/{orderId} + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders */ - let builder = CancelOrderByIdReq.builder(); - builder.setOrderId(?); + let builder = CancelAllStopOrdersReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.cancelOrderById(req); + let resp = api.cancelAllStopOrders(req); return resp.then(result => { expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) @@ -238,38 +201,80 @@ describe('Auto Test', ()=> { expect(result.filledValue).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.reduceOnly).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrder request test', ()=> { + test('getOrderByClientOid request test', ()=> { /** - * addOrder - * Add Order - * /api/v1/orders + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid */ - let builder = AddOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); + let builder = GetOrderByClientOidReq.builder(); + builder.setClientOid(?); let req = builder.build(); - let resp = api.addOrder(req); + let resp = api.getOrderByClientOid(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.dealValue).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPriceType).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.forceHold).toEqual(expect.anything()); + expect(result.closeOrder).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.endAt).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.avgDealPrice).toEqual(expect.anything()); + expect(result.filledSize).toEqual(expect.anything()); + expect(result.filledValue).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reduceOnly).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderTest request test', ()=> { + test('getOrderList request test', ()=> { /** - * addOrderTest - * Add Order Test - * /api/v1/orders/test + * getOrderList + * Get Order List + * /api/v1/orders */ - let builder = AddOrderTestReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStop(?).setStopPriceType(?).setStopPrice(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setQty(?).setValueQty(?); + let builder = GetOrderListReq.builder(); + builder.setStatus(?).setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.addOrderTest(req); + let resp = api.getOrderList(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -285,86 +290,99 @@ describe('Auto Test', ()=> { let resp = api.getRecentClosedOrders(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getRecentTradeHistory request test', ()=> { + test('getStopOrderList request test', ()=> { /** - * getRecentTradeHistory - * Get Recent Trade History - * /api/v1/recentFills + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders */ - let builder = GetRecentTradeHistoryReq.builder(); - builder.setSymbol(?); + let builder = GetStopOrderListReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getRecentTradeHistory(req); + let resp = api.getStopOrderList(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('addTPSLOrder request test', ()=> { + test('getOpenOrderValue request test', ()=> { /** - * addTPSLOrder - * Add Take Profit And Stop Loss Order - * /api/v1/st-orders + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics */ - let builder = AddTPSLOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setLeverage(?).setType(?).setRemark(?).setStopPriceType(?).setReduceOnly(?).setCloseOrder(?).setForceHold(?).setStp(?).setMarginMode(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTriggerStopUpPrice(?).setTriggerStopDownPrice(?).setQty(?).setValueQty(?); + let builder = GetOpenOrderValueReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.addTPSLOrder(req); + let resp = api.getOpenOrderValue(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.openOrderBuySize).toEqual(expect.anything()); + expect(result.openOrderSellSize).toEqual(expect.anything()); + expect(result.openOrderBuyCost).toEqual(expect.anything()); + expect(result.openOrderSellCost).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllStopOrders request test', ()=> { + test('getRecentTradeHistory request test', ()=> { /** - * cancelAllStopOrders - * Cancel All Stop orders - * /api/v1/stopOrders + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills */ - let builder = CancelAllStopOrdersReq.builder(); + let builder = GetRecentTradeHistoryReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.cancelAllStopOrders(req); + let resp = api.getRecentTradeHistory(req); return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getStopOrderList request test', ()=> { + test('getTradeHistory request test', ()=> { /** - * getStopOrderList - * Get Stop Order List - * /api/v1/stopOrders + * getTradeHistory + * Get Trade History + * /api/v1/fills */ - let builder = GetStopOrderListReq.builder(); - builder.setSymbol(?).setSide(?).setType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let builder = GetTradeHistoryReq.builder(); + builder.setOrderId(?).setSymbol(?).setSide(?).setType(?).setTradeTypes(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getStopOrderList(req); + let resp = api.getTradeHistory(req); return resp.then(result => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllOrdersV3 request test', ()=> { + test('cancelAllOrdersV1 request test', ()=> { /** - * cancelAllOrdersV3 - * Cancel All Orders - * /api/v3/orders + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders */ - let builder = CancelAllOrdersV3Req.builder(); + let builder = CancelAllOrdersV1Req.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.cancelAllOrdersV3(req); + let resp = api.cancelAllOrdersV1(req); return resp.then(result => { expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts index 9199119a..2f973227 100644 --- a/sdk/node/src/generate/futures/order/api_order.test.ts +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -1,34 +1,34 @@ -import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; -import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; -import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; -import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetRecentClosedOrdersReq } from './model_get_recent_closed_orders_req'; import { GetStopOrderListResp } from './model_get_stop_order_list_resp'; -import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; import { AddOrderReq } from './model_add_order_req'; import { CancelAllStopOrdersResp } from './model_cancel_all_stop_orders_resp'; import { CancelAllOrdersV1Req } from './model_cancel_all_orders_v1_req'; import { GetStopOrderListReq } from './model_get_stop_order_list_req'; import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; import { CancelAllOrdersV3Resp } from './model_cancel_all_orders_v3_resp'; import { AddOrderTestReq } from './model_add_order_test_req'; -import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; -import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; import { GetOrderListResp } from './model_get_order_list_resp'; import { GetOrderListReq } from './model_get_order_list_req'; +import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; import { CancelAllOrdersV3Req } from './model_cancel_all_orders_v3_req'; import { BatchCancelOrdersResp } from './model_batch_cancel_orders_resp'; -import { AddOrderTestResp } from './model_add_order_test_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; import { CancelAllOrdersV1Resp } from './model_cancel_all_orders_v1_resp'; -import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; import { BatchAddOrdersReq } from './model_batch_add_orders_req'; -import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; import { GetRecentTradeHistoryReq } from './model_get_recent_trade_history_req'; import { GetRecentTradeHistoryResp } from './model_get_recent_trade_history_resp'; import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; @@ -37,15 +37,15 @@ import { GetRecentClosedOrdersResp } from './model_get_recent_closed_orders_resp import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getTradeHistory request test', () => { + test('addOrder request test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/orders */ let data = - '{"orderId": "236655147005071361", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "tradeTypes": "trade", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetTradeHistoryReq(); + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -53,16 +53,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getTradeHistory response test', () => { + test('addOrder response test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/orders */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.04045854",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.040467",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); + let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -71,14 +71,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOpenOrderValue request test', () => { + test('addOrderTest request test', () => { /** - * getOpenOrderValue - * Get Open Order Value - * /api/v1/openOrderStatistics + * addOrderTest + * Add Order Test + * /api/v1/orders/test */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetOpenOrderValueReq(); + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; + let req = new AddOrderTestReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -86,16 +87,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOpenOrderValue response test', () => { + test('addOrderTest response test', () => { /** - * getOpenOrderValue - * Get Open Order Value - * /api/v1/openOrderStatistics + * addOrderTest + * Add Order Test + * /api/v1/orders/test */ let data = - '{\n "code": "200000",\n "data": {\n "openOrderBuySize": 1,\n "openOrderSellSize": 0,\n "openOrderBuyCost": "0.0001",\n "openOrderSellCost": "0",\n "settleCurrency": "USDT"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOpenOrderValueResp(); + let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -104,14 +105,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByClientOid request test', () => { + test('batchAddOrders request test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v1/orders/byClientOid + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi */ - let data = '{"clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); + let data = + '[{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}, {"clientOid": "5c52e11203aa677f33e493fc", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}]'; + let req = new BatchAddOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -119,16 +121,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByClientOid response test', () => { + test('batchAddOrders response test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v1/orders/byClientOid + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi */ let data = - '{\n "code": "200000",\n "data": {\n "id": "250444645610336256",\n "symbol": "XRPUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "1",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1732523858568,\n "updatedAt": 1732523858568,\n "endAt": null,\n "orderTime": 1732523858550892322,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "orderId": "235919387779985408",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n },\n {\n "orderId": "235919387855482880",\n "clientOid": "5c52e11203aa677f33e493fc",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); + let resp = new BatchAddOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -137,14 +139,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByClientOid request test', () => { + test('addTPSLOrder request test', () => { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v1/orders/client-order/{clientOid} + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders */ - let data = '{"symbol": "XBTUSDTM", "clientOid": "example_string_default_value"}'; - let req = new CancelOrderByClientOidReq(); + let data = + '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; + let req = new AddTPSLOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -152,16 +155,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByClientOid response test', () => { + test('addTPSLOrder response test', () => { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v1/orders/client-order/{clientOid} + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders */ let data = - '{\n "code": "200000",\n "data": {\n "clientOid": "017485b0-2957-4681-8a14-5d46b35aee0d"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); + let resp = new AddTPSLOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -170,14 +173,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelAllOrdersV1 request test', () => { + test('cancelOrderById request test', () => { /** - * cancelAllOrdersV1 - * Cancel All Orders - V1 - * /api/v1/orders + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllOrdersV1Req(); + let data = '{"orderId": "example_string_default_value"}'; + let req = new CancelOrderByIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -185,16 +188,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelAllOrdersV1 response test', () => { + test('cancelOrderById response test', () => { /** - * cancelAllOrdersV1 - * Cancel All Orders - V1 - * /api/v1/orders + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235303670076489728"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersV1Resp(); + let resp = new CancelOrderByIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -203,15 +206,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderList request test', () => { + test('cancelOrderByClientOid request test', () => { /** - * getOrderList - * Get Order List - * /api/v1/orders + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} */ - let data = - '{"status": "done", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 123456}'; - let req = new GetOrderListReq(); + let data = '{"symbol": "XBTUSDTM", "clientOid": "example_string_default_value"}'; + let req = new CancelOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -219,16 +221,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderList response test', () => { + test('cancelOrderByClientOid response test', () => { /** - * getOrderList - * Get Order List - * /api/v1/orders + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "clientOid": "017485b0-2957-4681-8a14-5d46b35aee0d"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderListResp(); + let resp = new CancelOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -270,15 +272,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchAddOrders request test', () => { + test('cancelAllOrdersV3 request test', () => { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/orders/multi + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders */ - let data = - '[{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}, {"clientOid": "5c52e11203aa677f33e493fc", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}]'; - let req = new BatchAddOrdersReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new CancelAllOrdersV3Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -286,16 +287,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchAddOrders response test', () => { + test('cancelAllOrdersV3 response test', () => { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/orders/multi + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders */ let data = - '{\n "code": "200000",\n "data": [\n {\n "orderId": "235919387779985408",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n },\n {\n "orderId": "235919387855482880",\n "clientOid": "5c52e11203aa677f33e493fc",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersResp(); + let resp = new CancelAllOrdersV3Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -304,14 +305,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderById request test', () => { + test('cancelAllStopOrders request test', () => { /** - * cancelOrderById - * Cancel Order By OrderId - * /api/v1/orders/{orderId} + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders */ - let data = '{"orderId": "example_string_default_value"}'; - let req = new CancelOrderByIdReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new CancelAllStopOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -319,16 +320,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderById response test', () => { + test('cancelAllStopOrders response test', () => { /** - * cancelOrderById - * Cancel Order By OrderId - * /api/v1/orders/{orderId} + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235303670076489728"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByIdResp(); + let resp = new CancelAllStopOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -370,15 +371,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrder request test', () => { + test('getOrderByClientOid request test', () => { /** - * addOrder - * Add Order - * /api/v1/orders + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid */ - let data = - '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderReq(); + let data = '{"clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -386,16 +386,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrder response test', () => { + test('getOrderByClientOid response test', () => { /** - * addOrder - * Add Order - * /api/v1/orders + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "250444645610336256",\n "symbol": "XRPUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "1",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1732523858568,\n "updatedAt": 1732523858568,\n "endAt": null,\n "orderTime": 1732523858550892322,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); + let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -404,15 +404,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderTest request test', () => { + test('getOrderList request test', () => { /** - * addOrderTest - * Add Order Test - * /api/v1/orders/test + * getOrderList + * Get Order List + * /api/v1/orders */ let data = - '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderTestReq(); + '{"status": "done", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 123456}'; + let req = new GetOrderListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -420,16 +420,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderTest response test', () => { + test('getOrderList response test', () => { /** - * addOrderTest - * Add Order Test - * /api/v1/orders/test + * getOrderList + * Get Order List + * /api/v1/orders */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); + let resp = new GetOrderListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -471,14 +471,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRecentTradeHistory request test', () => { + test('getStopOrderList request test', () => { /** - * getRecentTradeHistory - * Get Recent Trade History - * /api/v1/recentFills + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetRecentTradeHistoryReq(); + let data = + '{"symbol": "XBTUSDTM", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 50}'; + let req = new GetStopOrderListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -486,16 +487,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRecentTradeHistory response test', () => { + test('getStopOrderList response test', () => { /** - * getRecentTradeHistory - * Get Recent Trade History - * /api/v1/recentFills + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders */ let data = - '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.04045854",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.040467",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentTradeHistoryResp(); + let resp = new GetStopOrderListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -504,15 +505,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addTPSLOrder request test', () => { + test('getOpenOrderValue request test', () => { /** - * addTPSLOrder - * Add Take Profit And Stop Loss Order - * /api/v1/st-orders + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics */ - let data = - '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; - let req = new AddTPSLOrderReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetOpenOrderValueReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -520,16 +520,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addTPSLOrder response test', () => { + test('getOpenOrderValue response test', () => { /** - * addTPSLOrder - * Add Take Profit And Stop Loss Order - * /api/v1/st-orders + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "openOrderBuySize": 1,\n "openOrderSellSize": 0,\n "openOrderBuyCost": "0.0001",\n "openOrderSellCost": "0",\n "settleCurrency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddTPSLOrderResp(); + let resp = new GetOpenOrderValueResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -538,14 +538,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelAllStopOrders request test', () => { + test('getRecentTradeHistory request test', () => { /** - * cancelAllStopOrders - * Cancel All Stop orders - * /api/v1/stopOrders + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllStopOrdersReq(); + let req = new GetRecentTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -553,16 +553,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelAllStopOrders response test', () => { + test('getRecentTradeHistory response test', () => { /** - * cancelAllStopOrders - * Cancel All Stop orders - * /api/v1/stopOrders + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.04045854",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.040467",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllStopOrdersResp(); + let resp = new GetRecentTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -571,15 +571,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getStopOrderList request test', () => { + test('getTradeHistory request test', () => { /** - * getStopOrderList - * Get Stop Order List - * /api/v1/stopOrders + * getTradeHistory + * Get Trade History + * /api/v1/fills */ let data = - '{"symbol": "XBTUSDTM", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 50}'; - let req = new GetStopOrderListReq(); + '{"orderId": "236655147005071361", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "tradeTypes": "trade", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -587,16 +587,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getStopOrderList response test', () => { + test('getTradeHistory response test', () => { /** - * getStopOrderList - * Get Stop Order List - * /api/v1/stopOrders + * getTradeHistory + * Get Trade History + * /api/v1/fills */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.04045854",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.040467",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderListResp(); + let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -605,14 +605,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelAllOrdersV3 request test', () => { + test('cancelAllOrdersV1 request test', () => { /** - * cancelAllOrdersV3 - * Cancel All Orders - * /api/v3/orders + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllOrdersV3Req(); + let req = new CancelAllOrdersV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -620,16 +620,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelAllOrdersV3 response test', () => { + test('cancelAllOrdersV1 response test', () => { /** - * cancelAllOrdersV3 - * Cancel All Orders - * /api/v3/orders + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders */ let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersV3Resp(); + let resp = new CancelAllOrdersV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/futures/order/api_order.ts b/sdk/node/src/generate/futures/order/api_order.ts index 8f5dd44b..cbdbbd4d 100644 --- a/sdk/node/src/generate/futures/order/api_order.ts +++ b/sdk/node/src/generate/futures/order/api_order.ts @@ -1,37 +1,37 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { Transport } from '@internal/interfaces/transport'; -import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; -import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; -import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; -import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; +import { GetOpenOrderValueResp } from './model_get_open_order_value_resp'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; +import { CancelAllStopOrdersReq } from './model_cancel_all_stop_orders_req'; import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetRecentClosedOrdersReq } from './model_get_recent_closed_orders_req'; import { GetStopOrderListResp } from './model_get_stop_order_list_resp'; -import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; import { CancelOrderByIdResp } from './model_cancel_order_by_id_resp'; +import { AddTPSLOrderReq } from './model_add_tpsl_order_req'; import { AddOrderReq } from './model_add_order_req'; import { CancelAllStopOrdersResp } from './model_cancel_all_stop_orders_resp'; import { CancelAllOrdersV1Req } from './model_cancel_all_orders_v1_req'; import { GetStopOrderListReq } from './model_get_stop_order_list_req'; import { AddTPSLOrderResp } from './model_add_tpsl_order_resp'; import { GetTradeHistoryReq } from './model_get_trade_history_req'; +import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; import { CancelAllOrdersV3Resp } from './model_cancel_all_orders_v3_resp'; import { AddOrderTestReq } from './model_add_order_test_req'; -import { GetOpenOrderValueReq } from './model_get_open_order_value_req'; -import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; import { GetOrderListResp } from './model_get_order_list_resp'; import { GetOrderListReq } from './model_get_order_list_req'; +import { BatchCancelOrdersReq } from './model_batch_cancel_orders_req'; import { CancelAllOrdersV3Req } from './model_cancel_all_orders_v3_req'; import { BatchCancelOrdersResp } from './model_batch_cancel_orders_resp'; -import { AddOrderTestResp } from './model_add_order_test_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { AddOrderTestResp } from './model_add_order_test_resp'; import { CancelAllOrdersV1Resp } from './model_cancel_all_orders_v1_resp'; -import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; import { BatchAddOrdersReq } from './model_batch_add_orders_req'; -import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; import { GetRecentTradeHistoryReq } from './model_get_recent_trade_history_req'; import { GetRecentTradeHistoryResp } from './model_get_recent_trade_history_resp'; import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; @@ -40,9 +40,9 @@ import { GetRecentClosedOrdersResp } from './model_get_recent_closed_orders_resp export interface OrderAPI { /** - * getTradeHistory Get Trade History - * Description: Get a list of recent fills. If you need to get your recent trade history with low latency, please query endpoint Get List of Orders Completed in 24h. The requested data is not real-time. - * Documentation: https://www.kucoin.com/docs-new/api-3470248 + * addOrder Add Order + * Description: Place order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470235 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -50,15 +50,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getTradeHistory(req: GetTradeHistoryReq): Promise; + addOrder(req: AddOrderReq): Promise; /** - * getOpenOrderValue Get Open Order Value - * Description: You can query this endpoint to get the the total number and value of the all your active orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470250 + * addOrderTest Add Order Test + * Description: Place order to the futures trading system just for validation + * Documentation: https://www.kucoin.com/docs-new/api-3470238 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -66,31 +66,31 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getOpenOrderValue(req: GetOpenOrderValueReq): Promise; + addOrderTest(req: AddOrderTestReq): Promise; /** - * getOrderByClientOid Get Order By ClientOid - * Description: Get a single order by client order id (including a stop order). - * Documentation: https://www.kucoin.com/docs-new/api-3470352 + * batchAddOrders Batch Add Orders + * Description: Place multiple order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. You can place up to 20 orders at one time, including limit orders, market orders, and stop orders Please be noted that the system would hold the fees from the orders entered the orderbook in advance. + * Documentation: https://www.kucoin.com/docs-new/api-3470236 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 20 | * +---------------------+---------+ */ - getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + batchAddOrders(req: BatchAddOrdersReq): Promise; /** - * cancelOrderByClientOid Cancel Order By ClientOid - * Description: Cancel order by client defined orderId. - * Documentation: https://www.kucoin.com/docs-new/api-3470240 + * addTPSLOrder Add Take Profit And Stop Loss Order + * Description: Place take profit and stop loss order supports both take-profit and stop-loss functions, and other functions are exactly the same as the place order interface. + * Documentation: https://www.kucoin.com/docs-new/api-3470237 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -98,16 +98,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + addTPSLOrder(req: AddTPSLOrderReq): Promise; /** - * @deprecated - * cancelAllOrdersV1 Cancel All Orders - V1 - * Description: Cancel all open orders (excluding stop orders). The response is a list of orderIDs of the canceled orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470362 + * cancelOrderById Cancel Order By OrderId + * Description: Cancel order by system generated orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470239 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -115,15 +114,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 200 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise; + cancelOrderById(req: CancelOrderByIdReq): Promise; /** - * getOrderList Get Order List - * Description: List your current orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470244 + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: Cancel order by client defined orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470240 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -131,10 +130,10 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getOrderList(req: GetOrderListReq): Promise; + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; /** * batchCancelOrders Batch Cancel Orders @@ -153,9 +152,9 @@ export interface OrderAPI { batchCancelOrders(req: BatchCancelOrdersReq): Promise; /** - * batchAddOrders Batch Add Orders - * Description: Place multiple order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. You can place up to 20 orders at one time, including limit orders, market orders, and stop orders Please be noted that the system would hold the fees from the orders entered the orderbook in advance. - * Documentation: https://www.kucoin.com/docs-new/api-3470236 + * cancelAllOrdersV3 Cancel All Orders + * Description: Cancel all open orders (excluding stop orders). The response is a list of orderIDs of the canceled orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470242 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -163,15 +162,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - batchAddOrders(req: BatchAddOrdersReq): Promise; + cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise; /** - * cancelOrderById Cancel Order By OrderId - * Description: Cancel order by system generated orderId. - * Documentation: https://www.kucoin.com/docs-new/api-3470239 + * cancelAllStopOrders Cancel All Stop orders + * Description: Cancel all untriggered stop orders. The response is a list of orderIDs of the canceled stop orders. To cancel triggered stop orders, please use \'Cancel Multiple Futures Limit orders\'. + * Documentation: https://www.kucoin.com/docs-new/api-3470243 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -179,10 +178,10 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - cancelOrderById(req: CancelOrderByIdReq): Promise; + cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise; /** * getOrderByOrderId Get Order By OrderId @@ -201,25 +200,25 @@ export interface OrderAPI { getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; /** - * addOrder Add Order - * Description: Place order to the futures trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470235 + * getOrderByClientOid Get Order By ClientOid + * Description: Get a single order by client order id (including a stop order). + * Documentation: https://www.kucoin.com/docs-new/api-3470352 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | FUTURES | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - addOrder(req: AddOrderReq): Promise; + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; /** - * addOrderTest Add Order Test - * Description: Place order to the futures trading system just for validation - * Documentation: https://www.kucoin.com/docs-new/api-3470238 + * getOrderList Get Order List + * Description: List your current orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470244 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -230,7 +229,7 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - addOrderTest(req: AddOrderTestReq): Promise; + getOrderList(req: GetOrderListReq): Promise; /** * getRecentClosedOrders Get Recent Closed Orders @@ -249,9 +248,9 @@ export interface OrderAPI { getRecentClosedOrders(req: GetRecentClosedOrdersReq): Promise; /** - * getRecentTradeHistory Get Recent Trade History - * Description: Get a list of recent 1000 fills in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. - * Documentation: https://www.kucoin.com/docs-new/api-3470249 + * getStopOrderList Get Stop Order List + * Description: Get the un-triggered stop orders list. Stop orders that have been triggered can be queried through the general order interface + * Documentation: https://www.kucoin.com/docs-new/api-3470247 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -259,15 +258,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 6 | * +---------------------+---------+ */ - getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise; + getStopOrderList(req: GetStopOrderListReq): Promise; /** - * addTPSLOrder Add Take Profit And Stop Loss Order - * Description: Place take profit and stop loss order supports both take-profit and stop-loss functions, and other functions are exactly the same as the place order interface. - * Documentation: https://www.kucoin.com/docs-new/api-3470237 + * getOpenOrderValue Get Open Order Value + * Description: You can query this endpoint to get the the total number and value of the all your active orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470250 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -275,15 +274,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - addTPSLOrder(req: AddTPSLOrderReq): Promise; + getOpenOrderValue(req: GetOpenOrderValueReq): Promise; /** - * cancelAllStopOrders Cancel All Stop orders - * Description: Cancel all untriggered stop orders. The response is a list of orderIDs of the canceled stop orders. To cancel triggered stop orders, please use \'Cancel Multiple Futures Limit orders\'. - * Documentation: https://www.kucoin.com/docs-new/api-3470243 + * getRecentTradeHistory Get Recent Trade History + * Description: Get a list of recent 1000 fills in the last 24 hours. If you need to get your recent traded order history with low latency, you may query this endpoint. + * Documentation: https://www.kucoin.com/docs-new/api-3470249 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -291,15 +290,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise; + getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise; /** - * getStopOrderList Get Stop Order List - * Description: Get the un-triggered stop orders list. Stop orders that have been triggered can be queried through the general order interface - * Documentation: https://www.kucoin.com/docs-new/api-3470247 + * getTradeHistory Get Trade History + * Description: Get a list of recent fills. If you need to get your recent trade history with low latency, please query endpoint Get List of Orders Completed in 24h. The requested data is not real-time. + * Documentation: https://www.kucoin.com/docs-new/api-3470248 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -307,15 +306,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 6 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getStopOrderList(req: GetStopOrderListReq): Promise; + getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * cancelAllOrdersV3 Cancel All Orders + * @deprecated + * cancelAllOrdersV1 Cancel All Orders - V1 * Description: Cancel all open orders (excluding stop orders). The response is a list of orderIDs of the canceled orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470242 + * Documentation: https://www.kucoin.com/docs-new/api-3470362 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -323,83 +323,83 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 200 | * +---------------------+---------+ */ - cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise; + cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise; } export class OrderAPIImpl implements OrderAPI { constructor(private transport: Transport) {} - getTradeHistory(req: GetTradeHistoryReq): Promise { + addOrder(req: AddOrderReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/fills', + 'POST', + '/api/v1/orders', req, - new GetTradeHistoryResp(), + new AddOrderResp(), false, ); } - getOpenOrderValue(req: GetOpenOrderValueReq): Promise { + addOrderTest(req: AddOrderTestReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/openOrderStatistics', + 'POST', + '/api/v1/orders/test', req, - new GetOpenOrderValueResp(), + new AddOrderTestResp(), false, ); } - getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + batchAddOrders(req: BatchAddOrdersReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/orders/byClientOid', + 'POST', + '/api/v1/orders/multi', req, - new GetOrderByClientOidResp(), + new BatchAddOrdersResp(), false, ); } - cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + addTPSLOrder(req: AddTPSLOrderReq): Promise { return this.transport.call( 'futures', false, - 'DELETE', - '/api/v1/orders/client-order/{clientOid}', + 'POST', + '/api/v1/st-orders', req, - new CancelOrderByClientOidResp(), + new AddTPSLOrderResp(), false, ); } - cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise { + cancelOrderById(req: CancelOrderByIdReq): Promise { return this.transport.call( 'futures', false, 'DELETE', - '/api/v1/orders', + '/api/v1/orders/{orderId}', req, - new CancelAllOrdersV1Resp(), + new CancelOrderByIdResp(), false, ); } - getOrderList(req: GetOrderListReq): Promise { + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/orders', + 'DELETE', + '/api/v1/orders/client-order/{clientOid}', req, - new GetOrderListResp(), + new CancelOrderByClientOidResp(), false, ); } @@ -416,26 +416,26 @@ export class OrderAPIImpl implements OrderAPI { ); } - batchAddOrders(req: BatchAddOrdersReq): Promise { + cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/orders/multi', + 'DELETE', + '/api/v3/orders', req, - new BatchAddOrdersResp(), + new CancelAllOrdersV3Resp(), false, ); } - cancelOrderById(req: CancelOrderByIdReq): Promise { + cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise { return this.transport.call( 'futures', false, 'DELETE', - '/api/v1/orders/{orderId}', + '/api/v1/stopOrders', req, - new CancelOrderByIdResp(), + new CancelAllStopOrdersResp(), false, ); } @@ -452,26 +452,26 @@ export class OrderAPIImpl implements OrderAPI { ); } - addOrder(req: AddOrderReq): Promise { + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/orders', + 'GET', + '/api/v1/orders/byClientOid', req, - new AddOrderResp(), + new GetOrderByClientOidResp(), false, ); } - addOrderTest(req: AddOrderTestReq): Promise { + getOrderList(req: GetOrderListReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/orders/test', + 'GET', + '/api/v1/orders', req, - new AddOrderTestResp(), + new GetOrderListResp(), false, ); } @@ -488,62 +488,62 @@ export class OrderAPIImpl implements OrderAPI { ); } - getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise { + getStopOrderList(req: GetStopOrderListReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/recentFills', + '/api/v1/stopOrders', req, - new GetRecentTradeHistoryResp(), + new GetStopOrderListResp(), false, ); } - addTPSLOrder(req: AddTPSLOrderReq): Promise { + getOpenOrderValue(req: GetOpenOrderValueReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/st-orders', + 'GET', + '/api/v1/openOrderStatistics', req, - new AddTPSLOrderResp(), + new GetOpenOrderValueResp(), false, ); } - cancelAllStopOrders(req: CancelAllStopOrdersReq): Promise { + getRecentTradeHistory(req: GetRecentTradeHistoryReq): Promise { return this.transport.call( 'futures', false, - 'DELETE', - '/api/v1/stopOrders', + 'GET', + '/api/v1/recentFills', req, - new CancelAllStopOrdersResp(), + new GetRecentTradeHistoryResp(), false, ); } - getStopOrderList(req: GetStopOrderListReq): Promise { + getTradeHistory(req: GetTradeHistoryReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/stopOrders', + '/api/v1/fills', req, - new GetStopOrderListResp(), + new GetTradeHistoryResp(), false, ); } - cancelAllOrdersV3(req: CancelAllOrdersV3Req): Promise { + cancelAllOrdersV1(req: CancelAllOrdersV1Req): Promise { return this.transport.call( 'futures', false, 'DELETE', - '/api/v3/orders', + '/api/v1/orders', req, - new CancelAllOrdersV3Resp(), + new CancelAllOrdersV1Resp(), false, ); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts index 8c94c221..045682e1 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts @@ -5,7 +5,7 @@ import { Serializable } from '@internal/interfaces/serializable'; export class CancelAllOrdersV3Req implements Serializable { /** - * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + * Cancel all limit orders for a specific symbol only, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; @@ -22,7 +22,7 @@ export class CancelAllOrdersV3Req implements Serializable */ static create(data: { /** - * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + * Cancel all limit orders for a specific symbol only, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; }): CancelAllOrdersV3Req { @@ -48,7 +48,7 @@ export class CancelAllOrdersV3Req implements Serializable export class CancelAllOrdersV3ReqBuilder { obj: CancelAllOrdersV3Req = new CancelAllOrdersV3Req(); /** - * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) + * Cancel all limit orders for a specific symbol only, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ setSymbol(value: string): CancelAllOrdersV3ReqBuilder { this.obj.symbol = value; diff --git a/sdk/node/src/generate/futures/positions/api_positions.template b/sdk/node/src/generate/futures/positions/api_positions.template index b61c44ee..238c1a21 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.template +++ b/sdk/node/src/generate/futures/positions/api_positions.template @@ -5,67 +5,55 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getIsolatedMarginRiskLimit request test', ()=> { + test('getMarginMode request test', ()=> { /** - * getIsolatedMarginRiskLimit - * Get Isolated Margin Risk Limit - * /api/v1/contracts/risk-limit/{symbol} + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode */ - let builder = GetIsolatedMarginRiskLimitReq.builder(); + let builder = GetMarginModeReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.getIsolatedMarginRiskLimit(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getPositionsHistory request test', ()=> { - /** - * getPositionsHistory - * Get Positions History - * /api/v1/history-positions - */ - let builder = GetPositionsHistoryReq.builder(); - builder.setSymbol(?).setFrom(?).setTo(?).setLimit(?).setPageId(?); - let req = builder.build(); - let resp = api.getPositionsHistory(req); + let resp = api.getMarginMode(req); return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + console.log(resp); }); }) - test('getMaxWithdrawMargin request test', ()=> { + test('switchMarginMode request test', ()=> { /** - * getMaxWithdrawMargin - * Get Max Withdraw Margin - * /api/v1/margin/maxWithdrawMargin + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode */ - let builder = GetMaxWithdrawMarginReq.builder(); - builder.setSymbol(?); + let builder = SwitchMarginModeReq.builder(); + builder.setSymbol(?).setMarginMode(?); let req = builder.build(); - let resp = api.getMaxWithdrawMargin(req); + let resp = api.switchMarginMode(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + console.log(resp); }); }) - test('removeIsolatedMargin request test', ()=> { + test('getMaxOpenSize request test', ()=> { /** - * removeIsolatedMargin - * Remove Isolated Margin - * /api/v1/margin/withdrawMargin + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize */ - let builder = RemoveIsolatedMarginReq.builder(); - builder.setSymbol(?).setWithdrawAmount(?); + let builder = GetMaxOpenSizeReq.builder(); + builder.setSymbol(?).setPrice(?).setLeverage(?); let req = builder.build(); - let resp = api.removeIsolatedMargin(req); + let resp = api.getMaxOpenSize(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.maxBuyOpenSize).toEqual(expect.anything()); + expect(result.maxSellOpenSize).toEqual(expect.anything()); + console.log(resp); }); }) @@ -124,21 +112,93 @@ describe('Auto Test', ()=> { expect(result.posMaint).toEqual(expect.anything()); expect(result.maintMargin).toEqual(expect.anything()); expect(result.maintainMargin).toEqual(expect.anything()); + console.log(resp); }); }) - test('modifyAutoDepositStatus request test', ()=> { + test('getPositionList request test', ()=> { /** - * modifyAutoDepositStatus - * Modify Isolated Margin Auto-Deposit Status - * /api/v1/position/margin/auto-deposit-status + * getPositionList + * Get Position List + * /api/v1/positions */ - let builder = ModifyAutoDepositStatusReq.builder(); - builder.setSymbol(?).setStatus(?); + let builder = GetPositionListReq.builder(); + builder.setCurrency(?); let req = builder.build(); - let resp = api.modifyAutoDepositStatus(req); + let resp = api.getPositionList(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getPositionsHistory request test', ()=> { + /** + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions + */ + let builder = GetPositionsHistoryReq.builder(); + builder.setSymbol(?).setFrom(?).setTo(?).setLimit(?).setPageId(?); + let req = builder.build(); + let resp = api.getPositionsHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMaxWithdrawMargin request test', ()=> { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin + */ + let builder = GetMaxWithdrawMarginReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMaxWithdrawMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getCrossMarginLeverage request test', ()=> { + /** + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage + */ + let builder = GetCrossMarginLeverageReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCrossMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyMarginLeverage request test', ()=> { + /** + * modifyMarginLeverage + * Modify Cross Margin Leverage + * /api/v2/changeCrossUserLeverage + */ + let builder = ModifyMarginLeverageReq.builder(); + builder.setSymbol(?).setLeverage(?); + let req = builder.build(); + let resp = api.modifyMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + console.log(resp); }); }) @@ -190,117 +250,71 @@ describe('Auto Test', ()=> { expect(result.bankruptPrice).toEqual(expect.anything()); expect(result.userId).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); }); }) - test('modifyIsolatedMarginRiskLimt request test', ()=> { - /** - * modifyIsolatedMarginRiskLimt - * Modify Isolated Margin Risk Limit - * /api/v1/position/risk-limit-level/change - */ - let builder = ModifyIsolatedMarginRiskLimtReq.builder(); - builder.setSymbol(?).setLevel(?); - let req = builder.build(); - let resp = api.modifyIsolatedMarginRiskLimt(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getPositionList request test', ()=> { + test('removeIsolatedMargin request test', ()=> { /** - * getPositionList - * Get Position List - * /api/v1/positions + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin */ - let builder = GetPositionListReq.builder(); - builder.setCurrency(?); + let builder = RemoveIsolatedMarginReq.builder(); + builder.setSymbol(?).setWithdrawAmount(?); let req = builder.build(); - let resp = api.getPositionList(req); + let resp = api.removeIsolatedMargin(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('modifyMarginLeverage request test', ()=> { - /** - * modifyMarginLeverage - * Modify Cross Margin Leverage - * /api/v2/changeCrossUserLeverage - */ - let builder = ModifyMarginLeverageReq.builder(); - builder.setSymbol(?).setLeverage(?); - let req = builder.build(); - let resp = api.modifyMarginLeverage(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.leverage).toEqual(expect.anything()); - }); - }) - - test('getCrossMarginLeverage request test', ()=> { + test('getIsolatedMarginRiskLimit request test', ()=> { /** - * getCrossMarginLeverage - * Get Cross Margin Leverage - * /api/v2/getCrossUserLeverage + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} */ - let builder = GetCrossMarginLeverageReq.builder(); + let builder = GetIsolatedMarginRiskLimitReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.getCrossMarginLeverage(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.leverage).toEqual(expect.anything()); - }); - }) - - test('getMaxOpenSize request test', ()=> { - /** - * getMaxOpenSize - * Get Max Open Size - * /api/v2/getMaxOpenSize - */ - let builder = GetMaxOpenSizeReq.builder(); - builder.setSymbol(?).setPrice(?).setLeverage(?); - let req = builder.build(); - let resp = api.getMaxOpenSize(req); + let resp = api.getIsolatedMarginRiskLimit(req); return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.maxBuyOpenSize).toEqual(expect.anything()); - expect(result.maxSellOpenSize).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('switchMarginMode request test', ()=> { + test('modifyIsolatedMarginRiskLimt request test', ()=> { /** - * switchMarginMode - * Switch Margin Mode - * /api/v2/position/changeMarginMode + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change */ - let builder = SwitchMarginModeReq.builder(); - builder.setSymbol(?).setMarginMode(?); + let builder = ModifyIsolatedMarginRiskLimtReq.builder(); + builder.setSymbol(?).setLevel(?); let req = builder.build(); - let resp = api.switchMarginMode(req); + let resp = api.modifyIsolatedMarginRiskLimt(req); return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.marginMode).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getMarginMode request test', ()=> { + test('modifyAutoDepositStatus request test', ()=> { /** - * getMarginMode - * Get Margin Mode - * /api/v2/position/getMarginMode + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status */ - let builder = GetMarginModeReq.builder(); - builder.setSymbol(?); + let builder = ModifyAutoDepositStatusReq.builder(); + builder.setSymbol(?).setStatus(?); let req = builder.build(); - let resp = api.getMarginMode(req); + let resp = api.modifyAutoDepositStatus(req); return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.marginMode).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts index b2e0e517..68af1d76 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.test.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -4,14 +4,14 @@ import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_r import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; -import { GetMarginModeReq } from './model_get_margin_mode_req'; import { GetCrossMarginLeverageResp } from './model_get_cross_margin_leverage_resp'; +import { GetMarginModeReq } from './model_get_margin_mode_req'; import { SwitchMarginModeResp } from './model_switch_margin_mode_resp'; import { GetPositionsHistoryResp } from './model_get_positions_history_resp'; import { GetPositionListReq } from './model_get_position_list_req'; import { GetIsolatedMarginRiskLimitReq } from './model_get_isolated_margin_risk_limit_req'; -import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; import { GetIsolatedMarginRiskLimitResp } from './model_get_isolated_margin_risk_limit_resp'; +import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; import { GetMarginModeResp } from './model_get_margin_mode_resp'; import { ModifyMarginLeverageReq } from './model_modify_margin_leverage_req'; import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; @@ -19,8 +19,8 @@ import { ModifyMarginLeverageResp } from './model_modify_margin_leverage_resp'; import { GetPositionDetailsReq } from './model_get_position_details_req'; import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; import { SwitchMarginModeReq } from './model_switch_margin_mode_req'; -import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; import { GetPositionListResp } from './model_get_position_list_resp'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; import { GetPositionDetailsResp } from './model_get_position_details_resp'; import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; @@ -29,14 +29,14 @@ import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getIsolatedMarginRiskLimit request test', () => { + test('getMarginMode request test', () => { /** - * getIsolatedMarginRiskLimit - * Get Isolated Margin Risk Limit - * /api/v1/contracts/risk-limit/{symbol} + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetIsolatedMarginRiskLimitReq(); + let req = new GetMarginModeReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -44,16 +44,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getIsolatedMarginRiskLimit response test', () => { + test('getMarginMode response test', () => { /** - * getIsolatedMarginRiskLimit - * Get Isolated Margin Risk Limit - * /api/v1/contracts/risk-limit/{symbol} + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode */ let data = - '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "level": 1,\n "maxRiskLimit": 100000,\n "minRiskLimit": 0,\n "maxLeverage": 125,\n "initialMargin": 0.008,\n "maintainMargin": 0.004\n },\n {\n "symbol": "XBTUSDTM",\n "level": 2,\n "maxRiskLimit": 500000,\n "minRiskLimit": 100000,\n "maxLeverage": 100,\n "initialMargin": 0.01,\n "maintainMargin": 0.005\n },\n {\n "symbol": "XBTUSDTM",\n "level": 3,\n "maxRiskLimit": 1000000,\n "minRiskLimit": 500000,\n "maxLeverage": 75,\n "initialMargin": 0.014,\n "maintainMargin": 0.007\n },\n {\n "symbol": "XBTUSDTM",\n "level": 4,\n "maxRiskLimit": 2000000,\n "minRiskLimit": 1000000,\n "maxLeverage": 50,\n "initialMargin": 0.02,\n "maintainMargin": 0.01\n },\n {\n "symbol": "XBTUSDTM",\n "level": 5,\n "maxRiskLimit": 3000000,\n "minRiskLimit": 2000000,\n "maxLeverage": 30,\n "initialMargin": 0.034,\n "maintainMargin": 0.017\n },\n {\n "symbol": "XBTUSDTM",\n "level": 6,\n "maxRiskLimit": 5000000,\n "minRiskLimit": 3000000,\n "maxLeverage": 20,\n "initialMargin": 0.05,\n "maintainMargin": 0.025\n },\n {\n "symbol": "XBTUSDTM",\n "level": 7,\n "maxRiskLimit": 8000000,\n "minRiskLimit": 5000000,\n "maxLeverage": 10,\n "initialMargin": 0.1,\n "maintainMargin": 0.05\n },\n {\n "symbol": "XBTUSDTM",\n "level": 8,\n "maxRiskLimit": 12000000,\n "minRiskLimit": 8000000,\n "maxLeverage": 5,\n "initialMargin": 0.2,\n "maintainMargin": 0.1\n },\n {\n "symbol": "XBTUSDTM",\n "level": 9,\n "maxRiskLimit": 20000000,\n "minRiskLimit": 12000000,\n "maxLeverage": 4,\n "initialMargin": 0.25,\n "maintainMargin": 0.125\n },\n {\n "symbol": "XBTUSDTM",\n "level": 10,\n "maxRiskLimit": 30000000,\n "minRiskLimit": 20000000,\n "maxLeverage": 3,\n "initialMargin": 0.334,\n "maintainMargin": 0.167\n },\n {\n "symbol": "XBTUSDTM",\n "level": 11,\n "maxRiskLimit": 40000000,\n "minRiskLimit": 30000000,\n "maxLeverage": 2,\n "initialMargin": 0.5,\n "maintainMargin": 0.25\n },\n {\n "symbol": "XBTUSDTM",\n "level": 12,\n "maxRiskLimit": 50000000,\n "minRiskLimit": 40000000,\n "maxLeverage": 1,\n "initialMargin": 1.0,\n "maintainMargin": 0.5\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginRiskLimitResp(); + let resp = new GetMarginModeResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -62,15 +62,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getPositionsHistory request test', () => { + test('switchMarginMode request test', () => { /** - * getPositionsHistory - * Get Positions History - * /api/v1/history-positions + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode */ - let data = - '{"symbol": "example_string_default_value", "from": 123456, "to": 123456, "limit": 10, "pageId": 1}'; - let req = new GetPositionsHistoryReq(); + let data = '{"symbol": "XBTUSDTM", "marginMode": "ISOLATED"}'; + let req = new SwitchMarginModeReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -78,48 +77,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getPositionsHistory response test', () => { + test('switchMarginMode response test', () => { /** - * getPositionsHistory - * Get Positions History - * /api/v1/history-positions + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "closeId": "500000000027312193",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "CLOSE_SHORT",\n "pnl": "-3.79237944",\n "realisedGrossCost": "3.795",\n "withdrawPnl": "0.0",\n "tradeFee": "0.078657",\n "fundingFee": "0.08127756",\n "openTime": 1727073653603,\n "closeTime": 1729155587945,\n "openPrice": "63650.0",\n "closePrice": "67445.0",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026809668",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "SUIUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-1.10919296",\n "realisedGrossCost": "1.11297635",\n "withdrawPnl": "0.0",\n "tradeFee": "0.00200295",\n "fundingFee": "0.00578634",\n "openTime": 1726473389296,\n "closeTime": 1728738683541,\n "openPrice": "1.1072",\n "closePrice": "2.22017635",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026819355",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-5.941896296",\n "realisedGrossCost": "5.86937042",\n "withdrawPnl": "0.0",\n "tradeFee": "0.074020096",\n "fundingFee": "0.00149422",\n "openTime": 1726490775358,\n "closeTime": 1727061049859,\n "openPrice": "58679.6",\n "closePrice": "64548.97042",\n "marginMode": "ISOLATED"\n }\n ]\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetPositionsHistoryResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } - }); - test('getMaxWithdrawMargin request test', () => { - /** - * getMaxWithdrawMargin - * Get Max Withdraw Margin - * /api/v1/margin/maxWithdrawMargin - */ - let data = '{"symbol": "example_string_default_value"}'; - let req = new GetMaxWithdrawMarginReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('getMaxWithdrawMargin response test', () => { - /** - * getMaxWithdrawMargin - * Get Max Withdraw Margin - * /api/v1/margin/maxWithdrawMargin - */ - let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxWithdrawMarginResp(); + let resp = new SwitchMarginModeResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -128,14 +95,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('removeIsolatedMargin request test', () => { + test('getMaxOpenSize request test', () => { /** - * removeIsolatedMargin - * Remove Isolated Margin - * /api/v1/margin/withdrawMargin + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize */ - let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; - let req = new RemoveIsolatedMarginReq(); + let data = + '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; + let req = new GetMaxOpenSizeReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -143,15 +111,16 @@ describe('Auto Test', () => { console.log(req); }); - test('removeIsolatedMargin response test', () => { + test('getMaxOpenSize response test', () => { /** - * removeIsolatedMargin - * Remove Isolated Margin - * /api/v1/margin/withdrawMargin + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize */ - let data = '{\n "code": "200000",\n "data": "0.1"\n}'; + let data = + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": 0,\n "maxSellOpenSize": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new RemoveIsolatedMarginResp(); + let resp = new GetMaxOpenSizeResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -193,14 +162,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('modifyAutoDepositStatus request test', () => { + test('getPositionList request test', () => { /** - * modifyAutoDepositStatus - * Modify Isolated Margin Auto-Deposit Status - * /api/v1/position/margin/auto-deposit-status + * getPositionList + * Get Position List + * /api/v1/positions */ - let data = '{"symbol": "XBTUSDTM", "status": true}'; - let req = new ModifyAutoDepositStatusReq(); + let data = '{"currency": "USDT"}'; + let req = new GetPositionListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -208,15 +177,16 @@ describe('Auto Test', () => { console.log(req); }); - test('modifyAutoDepositStatus response test', () => { + test('getPositionList response test', () => { /** - * modifyAutoDepositStatus - * Modify Isolated Margin Auto-Deposit Status - * /api/v1/position/margin/auto-deposit-status + * getPositionList + * Get Position List + * /api/v1/positions */ - let data = '{\n "code": "200000",\n "data": true\n}'; + let data = + '{\n "code": "200000",\n "data": [\n {\n "id": "500000000001046430",\n "symbol": "ETHUSDM",\n "crossMode": true,\n "delevPercentage": 0.71,\n "openingTimestamp": 1730635780702,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": -4.069805E-4,\n "currentComm": 2.441E-7,\n "unrealisedCost": -4.069805E-4,\n "realisedGrossCost": 0.0,\n "realisedCost": 2.441E-7,\n "isOpen": true,\n "markPrice": 2454.12,\n "markValue": -4.07478E-4,\n "posCost": -4.069805E-4,\n "posInit": 4.06981E-5,\n "posMargin": 4.07478E-5,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -2.441E-7,\n "unrealisedPnl": -4.975E-7,\n "unrealisedPnlPcnt": -0.0012,\n "unrealisedRoePcnt": -0.0122,\n "avgEntryPrice": 2457.12,\n "liquidationPrice": 1429.96,\n "bankruptPrice": 1414.96,\n "settleCurrency": "ETH",\n "isInverse": true,\n "marginMode": "CROSS",\n "positionSide": "BOTH",\n "leverage": 10\n },\n {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.97,\n "delevPercentage": 0.5,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": -0.15936162,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": -0.15936162,\n "isOpen": true,\n "markPrice": 68323.06,\n "markValue": 68.32306,\n "posCost": 67.4309,\n "posCross": 0.06225152,\n "posCrossMargin": 0,\n "posInit": 22.2769666644,\n "posComm": 0.0539821899,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.26210915,\n "posMargin": 22.1310912243,\n "posFunding": -0.19982016,\n "posMaint": 0.4046228699,\n "maintMargin": 23.0232512243,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.2402787,\n "unrealisedPnl": 0.89216,\n "unrealisedPnlPcnt": 0.0132,\n "unrealisedRoePcnt": 0.04,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45704.44,\n "bankruptPrice": 45353.8,\n "settleCurrency": "USDT",\n "isInverse": false,\n "maintainMargin": 0.005,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.97\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyAutoDepositStatusResp(); + let resp = new GetPositionListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -225,14 +195,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addIsolatedMargin request test', () => { + test('getPositionsHistory request test', () => { /** - * addIsolatedMargin - * Add Isolated Margin - * /api/v1/position/margin/deposit-margin + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions */ - let data = '{"symbol": "string", "margin": 0, "bizNo": "string"}'; - let req = new AddIsolatedMarginReq(); + let data = + '{"symbol": "example_string_default_value", "from": 123456, "to": 123456, "limit": 10, "pageId": 1}'; + let req = new GetPositionsHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -240,16 +211,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addIsolatedMargin response test', () => { + test('getPositionsHistory response test', () => { /** - * addIsolatedMargin - * Add Isolated Margin - * /api/v1/position/margin/deposit-margin + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions */ let data = - '{\n "code": "200000",\n "data": {\n "id": "6200c9b83aecfb000152ddcd",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 18.72,\n "crossMode": false,\n "delevPercentage": 0.66,\n "openingTimestamp": 1646287090131,\n "currentTimestamp": 1646295055021,\n "currentQty": 1,\n "currentCost": 43.388,\n "currentComm": 0.0260328,\n "unrealisedCost": 43.388,\n "realisedGrossCost": 0,\n "realisedCost": 0.0260328,\n "isOpen": true,\n "markPrice": 43536.65,\n "markValue": 43.53665,\n "posCost": 43.388,\n "posCross": 0.000024985,\n "posInit": 2.1694,\n "posComm": 0.02733446,\n "posLoss": 0,\n "posMargin": 2.19675944,\n "posMaint": 0.24861326,\n "maintMargin": 2.34540944,\n "realisedGrossPnl": 0,\n "realisedPnl": -0.0260328,\n "unrealisedPnl": 0.14865,\n "unrealisedPnlPcnt": 0.0034,\n "unrealisedRoePcnt": 0.0685,\n "avgEntryPrice": 43388,\n "liquidationPrice": 41440,\n "bankruptPrice": 41218,\n "userId": 1234321123,\n "settleCurrency": "USDT"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "closeId": "500000000027312193",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "CLOSE_SHORT",\n "pnl": "-3.79237944",\n "realisedGrossCost": "3.795",\n "withdrawPnl": "0.0",\n "tradeFee": "0.078657",\n "fundingFee": "0.08127756",\n "openTime": 1727073653603,\n "closeTime": 1729155587945,\n "openPrice": "63650.0",\n "closePrice": "67445.0",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026809668",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "SUIUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-1.10919296",\n "realisedGrossCost": "1.11297635",\n "withdrawPnl": "0.0",\n "tradeFee": "0.00200295",\n "fundingFee": "0.00578634",\n "openTime": 1726473389296,\n "closeTime": 1728738683541,\n "openPrice": "1.1072",\n "closePrice": "2.22017635",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026819355",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-5.941896296",\n "realisedGrossCost": "5.86937042",\n "withdrawPnl": "0.0",\n "tradeFee": "0.074020096",\n "fundingFee": "0.00149422",\n "openTime": 1726490775358,\n "closeTime": 1727061049859,\n "openPrice": "58679.6",\n "closePrice": "64548.97042",\n "marginMode": "ISOLATED"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddIsolatedMarginResp(); + let resp = new GetPositionsHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -258,14 +229,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('modifyIsolatedMarginRiskLimt request test', () => { + test('getMaxWithdrawMargin request test', () => { /** - * modifyIsolatedMarginRiskLimt - * Modify Isolated Margin Risk Limit - * /api/v1/position/risk-limit-level/change + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin */ - let data = '{"symbol": "XBTUSDTM", "level": 2}'; - let req = new ModifyIsolatedMarginRiskLimtReq(); + let data = '{"symbol": "example_string_default_value"}'; + let req = new GetMaxWithdrawMarginReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -273,15 +244,15 @@ describe('Auto Test', () => { console.log(req); }); - test('modifyIsolatedMarginRiskLimt response test', () => { + test('getMaxWithdrawMargin response test', () => { /** - * modifyIsolatedMarginRiskLimt - * Modify Isolated Margin Risk Limit - * /api/v1/position/risk-limit-level/change + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin */ - let data = '{\n "code": "200000",\n "data": true\n}'; + let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyIsolatedMarginRiskLimtResp(); + let resp = new GetMaxWithdrawMarginResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -290,14 +261,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getPositionList request test', () => { + test('getCrossMarginLeverage request test', () => { /** - * getPositionList - * Get Position List - * /api/v1/positions + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage */ - let data = '{"currency": "USDT"}'; - let req = new GetPositionListReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetCrossMarginLeverageReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -305,16 +276,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getPositionList response test', () => { + test('getCrossMarginLeverage response test', () => { /** - * getPositionList - * Get Position List - * /api/v1/positions + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "500000000001046430",\n "symbol": "ETHUSDM",\n "crossMode": true,\n "delevPercentage": 0.71,\n "openingTimestamp": 1730635780702,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": -4.069805E-4,\n "currentComm": 2.441E-7,\n "unrealisedCost": -4.069805E-4,\n "realisedGrossCost": 0.0,\n "realisedCost": 2.441E-7,\n "isOpen": true,\n "markPrice": 2454.12,\n "markValue": -4.07478E-4,\n "posCost": -4.069805E-4,\n "posInit": 4.06981E-5,\n "posMargin": 4.07478E-5,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -2.441E-7,\n "unrealisedPnl": -4.975E-7,\n "unrealisedPnlPcnt": -0.0012,\n "unrealisedRoePcnt": -0.0122,\n "avgEntryPrice": 2457.12,\n "liquidationPrice": 1429.96,\n "bankruptPrice": 1414.96,\n "settleCurrency": "ETH",\n "isInverse": true,\n "marginMode": "CROSS",\n "positionSide": "BOTH",\n "leverage": 10\n },\n {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.97,\n "delevPercentage": 0.5,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": -0.15936162,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": -0.15936162,\n "isOpen": true,\n "markPrice": 68323.06,\n "markValue": 68.32306,\n "posCost": 67.4309,\n "posCross": 0.06225152,\n "posCrossMargin": 0,\n "posInit": 22.2769666644,\n "posComm": 0.0539821899,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.26210915,\n "posMargin": 22.1310912243,\n "posFunding": -0.19982016,\n "posMaint": 0.4046228699,\n "maintMargin": 23.0232512243,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.2402787,\n "unrealisedPnl": 0.89216,\n "unrealisedPnlPcnt": 0.0132,\n "unrealisedRoePcnt": 0.04,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45704.44,\n "bankruptPrice": 45353.8,\n "settleCurrency": "USDT",\n "isInverse": false,\n "maintainMargin": 0.005,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.97\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPositionListResp(); + let resp = new GetCrossMarginLeverageResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -356,14 +327,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getCrossMarginLeverage request test', () => { + test('addIsolatedMargin request test', () => { /** - * getCrossMarginLeverage - * Get Cross Margin Leverage - * /api/v2/getCrossUserLeverage + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetCrossMarginLeverageReq(); + let data = '{"symbol": "string", "margin": 0, "bizNo": "string"}'; + let req = new AddIsolatedMarginReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -371,16 +342,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getCrossMarginLeverage response test', () => { + test('addIsolatedMargin response test', () => { /** - * getCrossMarginLeverage - * Get Cross Margin Leverage - * /api/v2/getCrossUserLeverage + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin */ let data = - '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "6200c9b83aecfb000152ddcd",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 18.72,\n "crossMode": false,\n "delevPercentage": 0.66,\n "openingTimestamp": 1646287090131,\n "currentTimestamp": 1646295055021,\n "currentQty": 1,\n "currentCost": 43.388,\n "currentComm": 0.0260328,\n "unrealisedCost": 43.388,\n "realisedGrossCost": 0,\n "realisedCost": 0.0260328,\n "isOpen": true,\n "markPrice": 43536.65,\n "markValue": 43.53665,\n "posCost": 43.388,\n "posCross": 0.000024985,\n "posInit": 2.1694,\n "posComm": 0.02733446,\n "posLoss": 0,\n "posMargin": 2.19675944,\n "posMaint": 0.24861326,\n "maintMargin": 2.34540944,\n "realisedGrossPnl": 0,\n "realisedPnl": -0.0260328,\n "unrealisedPnl": 0.14865,\n "unrealisedPnlPcnt": 0.0034,\n "unrealisedRoePcnt": 0.0685,\n "avgEntryPrice": 43388,\n "liquidationPrice": 41440,\n "bankruptPrice": 41218,\n "userId": 1234321123,\n "settleCurrency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginLeverageResp(); + let resp = new AddIsolatedMarginResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -389,15 +360,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMaxOpenSize request test', () => { + test('removeIsolatedMargin request test', () => { /** - * getMaxOpenSize - * Get Max Open Size - * /api/v2/getMaxOpenSize + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin */ - let data = - '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; - let req = new GetMaxOpenSizeReq(); + let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; + let req = new RemoveIsolatedMarginReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -405,16 +375,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getMaxOpenSize response test', () => { + test('removeIsolatedMargin response test', () => { /** - * getMaxOpenSize - * Get Max Open Size - * /api/v2/getMaxOpenSize + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin */ - let data = - '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": 0,\n "maxSellOpenSize": 0\n }\n}'; + let data = '{\n "code": "200000",\n "data": "0.1"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxOpenSizeResp(); + let resp = new RemoveIsolatedMarginResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -423,14 +392,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('switchMarginMode request test', () => { + test('getIsolatedMarginRiskLimit request test', () => { /** - * switchMarginMode - * Switch Margin Mode - * /api/v2/position/changeMarginMode + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} */ - let data = '{"symbol": "XBTUSDTM", "marginMode": "ISOLATED"}'; - let req = new SwitchMarginModeReq(); + let data = '{"symbol": "XBTUSDTM"}'; + let req = new GetIsolatedMarginRiskLimitReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -438,16 +407,16 @@ describe('Auto Test', () => { console.log(req); }); - test('switchMarginMode response test', () => { + test('getIsolatedMarginRiskLimit response test', () => { /** - * switchMarginMode - * Switch Margin Mode - * /api/v2/position/changeMarginMode + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} */ let data = - '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "level": 1,\n "maxRiskLimit": 100000,\n "minRiskLimit": 0,\n "maxLeverage": 125,\n "initialMargin": 0.008,\n "maintainMargin": 0.004\n },\n {\n "symbol": "XBTUSDTM",\n "level": 2,\n "maxRiskLimit": 500000,\n "minRiskLimit": 100000,\n "maxLeverage": 100,\n "initialMargin": 0.01,\n "maintainMargin": 0.005\n },\n {\n "symbol": "XBTUSDTM",\n "level": 3,\n "maxRiskLimit": 1000000,\n "minRiskLimit": 500000,\n "maxLeverage": 75,\n "initialMargin": 0.014,\n "maintainMargin": 0.007\n },\n {\n "symbol": "XBTUSDTM",\n "level": 4,\n "maxRiskLimit": 2000000,\n "minRiskLimit": 1000000,\n "maxLeverage": 50,\n "initialMargin": 0.02,\n "maintainMargin": 0.01\n },\n {\n "symbol": "XBTUSDTM",\n "level": 5,\n "maxRiskLimit": 3000000,\n "minRiskLimit": 2000000,\n "maxLeverage": 30,\n "initialMargin": 0.034,\n "maintainMargin": 0.017\n },\n {\n "symbol": "XBTUSDTM",\n "level": 6,\n "maxRiskLimit": 5000000,\n "minRiskLimit": 3000000,\n "maxLeverage": 20,\n "initialMargin": 0.05,\n "maintainMargin": 0.025\n },\n {\n "symbol": "XBTUSDTM",\n "level": 7,\n "maxRiskLimit": 8000000,\n "minRiskLimit": 5000000,\n "maxLeverage": 10,\n "initialMargin": 0.1,\n "maintainMargin": 0.05\n },\n {\n "symbol": "XBTUSDTM",\n "level": 8,\n "maxRiskLimit": 12000000,\n "minRiskLimit": 8000000,\n "maxLeverage": 5,\n "initialMargin": 0.2,\n "maintainMargin": 0.1\n },\n {\n "symbol": "XBTUSDTM",\n "level": 9,\n "maxRiskLimit": 20000000,\n "minRiskLimit": 12000000,\n "maxLeverage": 4,\n "initialMargin": 0.25,\n "maintainMargin": 0.125\n },\n {\n "symbol": "XBTUSDTM",\n "level": 10,\n "maxRiskLimit": 30000000,\n "minRiskLimit": 20000000,\n "maxLeverage": 3,\n "initialMargin": 0.334,\n "maintainMargin": 0.167\n },\n {\n "symbol": "XBTUSDTM",\n "level": 11,\n "maxRiskLimit": 40000000,\n "minRiskLimit": 30000000,\n "maxLeverage": 2,\n "initialMargin": 0.5,\n "maintainMargin": 0.25\n },\n {\n "symbol": "XBTUSDTM",\n "level": 12,\n "maxRiskLimit": 50000000,\n "minRiskLimit": 40000000,\n "maxLeverage": 1,\n "initialMargin": 1.0,\n "maintainMargin": 0.5\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new SwitchMarginModeResp(); + let resp = new GetIsolatedMarginRiskLimitResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -456,14 +425,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMarginMode request test', () => { + test('modifyIsolatedMarginRiskLimt request test', () => { /** - * getMarginMode - * Get Margin Mode - * /api/v2/position/getMarginMode + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change */ - let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetMarginModeReq(); + let data = '{"symbol": "XBTUSDTM", "level": 2}'; + let req = new ModifyIsolatedMarginRiskLimtReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -471,16 +440,47 @@ describe('Auto Test', () => { console.log(req); }); - test('getMarginMode response test', () => { + test('modifyIsolatedMarginRiskLimt response test', () => { /** - * getMarginMode - * Get Margin Mode - * /api/v2/position/getMarginMode + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change */ - let data = - '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; + let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarginModeResp(); + let resp = new ModifyIsolatedMarginRiskLimtResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); + test('modifyAutoDepositStatus request test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let data = '{"symbol": "XBTUSDTM", "status": true}'; + let req = new ModifyAutoDepositStatusReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('modifyAutoDepositStatus response test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let data = '{\n "code": "200000",\n "data": true\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new ModifyAutoDepositStatusResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/futures/positions/api_positions.ts b/sdk/node/src/generate/futures/positions/api_positions.ts index d9c4a311..b02eb80d 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.ts @@ -7,14 +7,14 @@ import { ModifyAutoDepositStatusReq } from './model_modify_auto_deposit_status_r import { GetMaxOpenSizeReq } from './model_get_max_open_size_req'; import { GetMaxWithdrawMarginResp } from './model_get_max_withdraw_margin_resp'; import { AddIsolatedMarginResp } from './model_add_isolated_margin_resp'; -import { GetMarginModeReq } from './model_get_margin_mode_req'; import { GetCrossMarginLeverageResp } from './model_get_cross_margin_leverage_resp'; +import { GetMarginModeReq } from './model_get_margin_mode_req'; import { SwitchMarginModeResp } from './model_switch_margin_mode_resp'; import { GetPositionsHistoryResp } from './model_get_positions_history_resp'; import { GetPositionListReq } from './model_get_position_list_req'; import { GetIsolatedMarginRiskLimitReq } from './model_get_isolated_margin_risk_limit_req'; -import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; import { GetIsolatedMarginRiskLimitResp } from './model_get_isolated_margin_risk_limit_resp'; +import { GetCrossMarginLeverageReq } from './model_get_cross_margin_leverage_req'; import { GetMarginModeResp } from './model_get_margin_mode_resp'; import { ModifyMarginLeverageReq } from './model_modify_margin_leverage_req'; import { RemoveIsolatedMarginResp } from './model_remove_isolated_margin_resp'; @@ -22,8 +22,8 @@ import { ModifyMarginLeverageResp } from './model_modify_margin_leverage_resp'; import { GetPositionDetailsReq } from './model_get_position_details_req'; import { ModifyAutoDepositStatusResp } from './model_modify_auto_deposit_status_resp'; import { SwitchMarginModeReq } from './model_switch_margin_mode_req'; -import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; import { GetPositionListResp } from './model_get_position_list_resp'; +import { GetMaxOpenSizeResp } from './model_get_max_open_size_resp'; import { GetPositionDetailsResp } from './model_get_position_details_resp'; import { ModifyIsolatedMarginRiskLimtResp } from './model_modify_isolated_margin_risk_limt_resp'; import { ModifyIsolatedMarginRiskLimtReq } from './model_modify_isolated_margin_risk_limt_req'; @@ -32,27 +32,25 @@ import { GetMaxWithdrawMarginReq } from './model_get_max_withdraw_margin_req'; export interface PositionsAPI { /** - * getIsolatedMarginRiskLimit Get Isolated Margin Risk Limit - * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). - * Documentation: https://www.kucoin.com/docs-new/api-3470263 + * getMarginMode Get Margin Mode + * Description: This interface can query the margin mode of the current symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470259 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | - * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT-POOL | FUTURES | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getIsolatedMarginRiskLimit( - req: GetIsolatedMarginRiskLimitReq, - ): Promise; + getMarginMode(req: GetMarginModeReq): Promise; /** - * getPositionsHistory Get Positions History - * Description: This interface can query position history information records. - * Documentation: https://www.kucoin.com/docs-new/api-3470254 + * switchMarginMode Switch Margin Mode + * Description: This interface can modify the margin mode of the current symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470262 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -63,12 +61,12 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionsHistory(req: GetPositionsHistoryReq): Promise; + switchMarginMode(req: SwitchMarginModeReq): Promise; /** - * getMaxWithdrawMargin Get Max Withdraw Margin - * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. - * Documentation: https://www.kucoin.com/docs-new/api-3470258 + * getMaxOpenSize Get Max Open Size + * Description: Get Maximum Open Position Size. + * Documentation: https://www.kucoin.com/docs-new/api-3470251 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -76,15 +74,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; /** - * removeIsolatedMargin Remove Isolated Margin - * Description: Remove Isolated Margin Manually. - * Documentation: https://www.kucoin.com/docs-new/api-3470256 + * getPositionDetails Get Position Details + * Description: Get the position details of a specified position. + * Documentation: https://www.kucoin.com/docs-new/api-3470252 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -92,15 +90,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; + getPositionDetails(req: GetPositionDetailsReq): Promise; /** - * getPositionDetails Get Position Details + * getPositionList Get Position List * Description: Get the position details of a specified position. - * Documentation: https://www.kucoin.com/docs-new/api-3470252 + * Documentation: https://www.kucoin.com/docs-new/api-3470253 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -111,13 +109,12 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionDetails(req: GetPositionDetailsReq): Promise; + getPositionList(req: GetPositionListReq): Promise; /** - * @deprecated - * modifyAutoDepositStatus Modify Isolated Margin Auto-Deposit Status - * Description: This endpoint is only applicable to isolated margin and is no longer recommended. It is recommended to use cross margin instead. - * Documentation: https://www.kucoin.com/docs-new/api-3470255 + * getPositionsHistory Get Positions History + * Description: This interface can query position history information records. + * Documentation: https://www.kucoin.com/docs-new/api-3470254 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -125,15 +122,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 4 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; + getPositionsHistory(req: GetPositionsHistoryReq): Promise; /** - * addIsolatedMargin Add Isolated Margin - * Description: Add Isolated Margin Manually. - * Documentation: https://www.kucoin.com/docs-new/api-3470257 + * getMaxWithdrawMargin Get Max Withdraw Margin + * Description: This interface can query the maximum amount of margin that the current position supports withdrawal. + * Documentation: https://www.kucoin.com/docs-new/api-3470258 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -141,15 +138,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 4 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - addIsolatedMargin(req: AddIsolatedMarginReq): Promise; + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise; /** - * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit - * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). - * Documentation: https://www.kucoin.com/docs-new/api-3470264 + * getCrossMarginLeverage Get Cross Margin Leverage + * Description: This interface can query the current symbol’s cross-margin leverage multiple. + * Documentation: https://www.kucoin.com/docs-new/api-3470260 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -157,17 +154,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - modifyIsolatedMarginRiskLimt( - req: ModifyIsolatedMarginRiskLimtReq, - ): Promise; + getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise; /** - * getPositionList Get Position List - * Description: Get the position details of a specified position. - * Documentation: https://www.kucoin.com/docs-new/api-3470253 + * modifyMarginLeverage Modify Cross Margin Leverage + * Description: This interface can modify the current symbol’s cross-margin leverage multiple. + * Documentation: https://www.kucoin.com/docs-new/api-3470261 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -178,12 +173,12 @@ export interface PositionsAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getPositionList(req: GetPositionListReq): Promise; + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; /** - * modifyMarginLeverage Modify Cross Margin Leverage - * Description: This interface can modify the current symbol’s cross-margin leverage multiple. - * Documentation: https://www.kucoin.com/docs-new/api-3470261 + * addIsolatedMargin Add Isolated Margin + * Description: Add Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470257 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -191,15 +186,15 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 4 | * +---------------------+---------+ */ - modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise; + addIsolatedMargin(req: AddIsolatedMarginReq): Promise; /** - * getCrossMarginLeverage Get Cross Margin Leverage - * Description: This interface can query the current symbol’s cross-margin leverage multiple. - * Documentation: https://www.kucoin.com/docs-new/api-3470260 + * removeIsolatedMargin Remove Isolated Margin + * Description: Remove Isolated Margin Manually. + * Documentation: https://www.kucoin.com/docs-new/api-3470256 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -207,31 +202,33 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise; + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise; /** - * getMaxOpenSize Get Max Open Size - * Description: Get Maximum Open Position Size. - * Documentation: https://www.kucoin.com/docs-new/api-3470251 + * getIsolatedMarginRiskLimit Get Isolated Margin Risk Limit + * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). + * Documentation: https://www.kucoin.com/docs-new/api-3470263 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | FUTURES | * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | - * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT-POOL | PUBLIC | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getMaxOpenSize(req: GetMaxOpenSizeReq): Promise; + getIsolatedMarginRiskLimit( + req: GetIsolatedMarginRiskLimitReq, + ): Promise; /** - * switchMarginMode Switch Margin Mode - * Description: This interface can modify the margin mode of the current symbol. - * Documentation: https://www.kucoin.com/docs-new/api-3470262 + * modifyIsolatedMarginRiskLimt Modify Isolated Margin Risk Limit + * Description: This interface can be used to obtain information about risk limit level of a specific contract(Only valid for isolated Margin). + * Documentation: https://www.kucoin.com/docs-new/api-3470264 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -239,15 +236,18 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - switchMarginMode(req: SwitchMarginModeReq): Promise; + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise; /** - * getMarginMode Get Margin Mode - * Description: This interface can query the margin mode of the current symbol. - * Documentation: https://www.kucoin.com/docs-new/api-3470259 + * @deprecated + * modifyAutoDepositStatus Modify Isolated Margin Auto-Deposit Status + * Description: This endpoint is only applicable to isolated margin and is no longer recommended. It is recommended to use cross margin instead. + * Documentation: https://www.kucoin.com/docs-new/api-3470255 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -255,183 +255,183 @@ export interface PositionsAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | FUTURES | * | API-RATE-LIMIT-POOL | FUTURES | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 4 | * +---------------------+---------+ */ - getMarginMode(req: GetMarginModeReq): Promise; + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise; } export class PositionsAPIImpl implements PositionsAPI { constructor(private transport: Transport) {} - getIsolatedMarginRiskLimit( - req: GetIsolatedMarginRiskLimitReq, - ): Promise { + getMarginMode(req: GetMarginModeReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/contracts/risk-limit/{symbol}', + '/api/v2/position/getMarginMode', req, - new GetIsolatedMarginRiskLimitResp(), + new GetMarginModeResp(), false, ); } - getPositionsHistory(req: GetPositionsHistoryReq): Promise { + switchMarginMode(req: SwitchMarginModeReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/history-positions', + 'POST', + '/api/v2/position/changeMarginMode', req, - new GetPositionsHistoryResp(), + new SwitchMarginModeResp(), false, ); } - getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { + getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/margin/maxWithdrawMargin', + '/api/v2/getMaxOpenSize', req, - new GetMaxWithdrawMarginResp(), + new GetMaxOpenSizeResp(), false, ); } - removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { + getPositionDetails(req: GetPositionDetailsReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/margin/withdrawMargin', + 'GET', + '/api/v1/position', req, - new RemoveIsolatedMarginResp(), + new GetPositionDetailsResp(), false, ); } - getPositionDetails(req: GetPositionDetailsReq): Promise { + getPositionList(req: GetPositionListReq): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v1/position', + '/api/v1/positions', req, - new GetPositionDetailsResp(), + new GetPositionListResp(), false, ); } - modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise { + getPositionsHistory(req: GetPositionsHistoryReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/position/margin/auto-deposit-status', + 'GET', + '/api/v1/history-positions', req, - new ModifyAutoDepositStatusResp(), + new GetPositionsHistoryResp(), false, ); } - addIsolatedMargin(req: AddIsolatedMarginReq): Promise { + getMaxWithdrawMargin(req: GetMaxWithdrawMarginReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/position/margin/deposit-margin', + 'GET', + '/api/v1/margin/maxWithdrawMargin', req, - new AddIsolatedMarginResp(), + new GetMaxWithdrawMarginResp(), false, ); } - modifyIsolatedMarginRiskLimt( - req: ModifyIsolatedMarginRiskLimtReq, - ): Promise { + getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise { return this.transport.call( 'futures', false, - 'POST', - '/api/v1/position/risk-limit-level/change', + 'GET', + '/api/v2/getCrossUserLeverage', req, - new ModifyIsolatedMarginRiskLimtResp(), + new GetCrossMarginLeverageResp(), false, ); } - getPositionList(req: GetPositionListReq): Promise { + modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v1/positions', + 'POST', + '/api/v2/changeCrossUserLeverage', req, - new GetPositionListResp(), + new ModifyMarginLeverageResp(), false, ); } - modifyMarginLeverage(req: ModifyMarginLeverageReq): Promise { + addIsolatedMargin(req: AddIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, 'POST', - '/api/v2/changeCrossUserLeverage', + '/api/v1/position/margin/deposit-margin', req, - new ModifyMarginLeverageResp(), + new AddIsolatedMarginResp(), false, ); } - getCrossMarginLeverage(req: GetCrossMarginLeverageReq): Promise { + removeIsolatedMargin(req: RemoveIsolatedMarginReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v2/getCrossUserLeverage', + 'POST', + '/api/v1/margin/withdrawMargin', req, - new GetCrossMarginLeverageResp(), + new RemoveIsolatedMarginResp(), false, ); } - getMaxOpenSize(req: GetMaxOpenSizeReq): Promise { + getIsolatedMarginRiskLimit( + req: GetIsolatedMarginRiskLimitReq, + ): Promise { return this.transport.call( 'futures', false, 'GET', - '/api/v2/getMaxOpenSize', + '/api/v1/contracts/risk-limit/{symbol}', req, - new GetMaxOpenSizeResp(), + new GetIsolatedMarginRiskLimitResp(), false, ); } - switchMarginMode(req: SwitchMarginModeReq): Promise { + modifyIsolatedMarginRiskLimt( + req: ModifyIsolatedMarginRiskLimtReq, + ): Promise { return this.transport.call( 'futures', false, 'POST', - '/api/v2/position/changeMarginMode', + '/api/v1/position/risk-limit-level/change', req, - new SwitchMarginModeResp(), + new ModifyIsolatedMarginRiskLimtResp(), false, ); } - getMarginMode(req: GetMarginModeReq): Promise { + modifyAutoDepositStatus(req: ModifyAutoDepositStatusReq): Promise { return this.transport.call( 'futures', false, - 'GET', - '/api/v2/position/getMarginMode', + 'POST', + '/api/v1/position/margin/auto-deposit-status', req, - new GetMarginModeResp(), + new ModifyAutoDepositStatusResp(), false, ); } diff --git a/sdk/node/src/generate/index.ts b/sdk/node/src/generate/index.ts index fdeadcdf..7d2f4098 100644 --- a/sdk/node/src/generate/index.ts +++ b/sdk/node/src/generate/index.ts @@ -1,6 +1,7 @@ export * from './account'; export * from './affiliate'; export * from './broker'; +export * from './copytrading'; export * from './earn'; export * from './futures'; export * from './margin'; diff --git a/sdk/node/src/generate/margin/credit/api_credit.template b/sdk/node/src/generate/margin/credit/api_credit.template index eaec3996..f01de6a8 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.template +++ b/sdk/node/src/generate/margin/credit/api_credit.template @@ -5,21 +5,6 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('modifyPurchase request test', ()=> { - /** - * modifyPurchase - * Modify Purchase - * /api/v3/lend/purchase/update - */ - let builder = ModifyPurchaseReq.builder(); - builder.setCurrency(?).setInterestRate(?).setPurchaseOrderNo(?); - let req = builder.build(); - let resp = api.modifyPurchase(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - test('getLoanMarket request test', ()=> { /** * getLoanMarket @@ -32,6 +17,7 @@ describe('Auto Test', ()=> { let resp = api.getLoanMarket(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -47,6 +33,39 @@ describe('Auto Test', ()=> { let resp = api.getLoanMarketInterestRate(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('purchase request test', ()=> { + /** + * purchase + * Purchase + * /api/v3/purchase + */ + let builder = PurchaseReq.builder(); + builder.setCurrency(?).setSize(?).setInterestRate(?); + let req = builder.build(); + let resp = api.purchase(req); + return resp.then(result => { + expect(result.orderNo).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyPurchase request test', ()=> { + /** + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update + */ + let builder = ModifyPurchaseReq.builder(); + builder.setCurrency(?).setInterestRate(?).setPurchaseOrderNo(?); + let req = builder.build(); + let resp = api.modifyPurchase(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -66,21 +85,23 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('purchase request test', ()=> { + test('redeem request test', ()=> { /** - * purchase - * Purchase - * /api/v3/purchase + * redeem + * Redeem + * /api/v3/redeem */ - let builder = PurchaseReq.builder(); - builder.setCurrency(?).setSize(?).setInterestRate(?); + let builder = RedeemReq.builder(); + builder.setCurrency(?).setSize(?).setPurchaseOrderNo(?); let req = builder.build(); - let resp = api.purchase(req); + let resp = api.redeem(req); return resp.then(result => { expect(result.orderNo).toEqual(expect.anything()); + console.log(resp); }); }) @@ -100,21 +121,7 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - }); - }) - - test('redeem request test', ()=> { - /** - * redeem - * Redeem - * /api/v3/redeem - */ - let builder = RedeemReq.builder(); - builder.setCurrency(?).setSize(?).setPurchaseOrderNo(?); - let req = builder.build(); - let resp = api.redeem(req); - return resp.then(result => { - expect(result.orderNo).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/margin/credit/api_credit.test.ts b/sdk/node/src/generate/margin/credit/api_credit.test.ts index ef5842e0..91213f4f 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.test.ts +++ b/sdk/node/src/generate/margin/credit/api_credit.test.ts @@ -15,39 +15,6 @@ import { GetLoanMarketReq } from './model_get_loan_market_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('modifyPurchase request test', () => { - /** - * modifyPurchase - * Modify Purchase - * /api/v3/lend/purchase/update - */ - let data = - '{"currency": "BTC", "purchaseOrderNo": "671bafa804c26d000773c533", "interestRate": "0.09"}'; - let req = new ModifyPurchaseReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('modifyPurchase response test', () => { - /** - * modifyPurchase - * Modify Purchase - * /api/v3/lend/purchase/update - */ - let data = '{\n "code": "200000",\n "data": null\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new ModifyPurchaseResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } - }); test('getLoanMarket request test', () => { /** * getLoanMarket @@ -114,15 +81,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getPurchaseOrders request test', () => { + test('purchase request test', () => { /** - * getPurchaseOrders - * Get Purchase Orders - * /api/v3/purchase/orders + * purchase + * Purchase + * /api/v3/purchase */ - let data = - '{"currency": "BTC", "status": "DONE", "purchaseOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; - let req = new GetPurchaseOrdersReq(); + let data = '{"currency": "BTC", "size": "0.001", "interestRate": "0.1"}'; + let req = new PurchaseReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -130,16 +96,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getPurchaseOrders response test', () => { + test('purchase response test', () => { /** - * getPurchaseOrders - * Get Purchase Orders - * /api/v3/purchase/orders + * purchase + * Purchase + * /api/v3/purchase */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bb15a3b3f930007880bae",\n "purchaseSize": "0.001",\n "matchSize": "0",\n "interestRate": "0.1",\n "incomeSize": "0",\n "applyTime": 1729868122172,\n "status": "PENDING"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPurchaseOrdersResp(); + let resp = new PurchaseResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -148,14 +114,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('purchase request test', () => { + test('modifyPurchase request test', () => { /** - * purchase - * Purchase - * /api/v3/purchase + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update */ - let data = '{"currency": "BTC", "size": "0.001", "interestRate": "0.1"}'; - let req = new PurchaseReq(); + let data = + '{"currency": "BTC", "purchaseOrderNo": "671bafa804c26d000773c533", "interestRate": "0.09"}'; + let req = new ModifyPurchaseReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -163,16 +130,15 @@ describe('Auto Test', () => { console.log(req); }); - test('purchase response test', () => { + test('modifyPurchase response test', () => { /** - * purchase - * Purchase - * /api/v3/purchase + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update */ - let data = - '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; + let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new PurchaseResp(); + let resp = new ModifyPurchaseResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -181,15 +147,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRedeemOrders request test', () => { + test('getPurchaseOrders request test', () => { /** - * getRedeemOrders - * Get Redeem Orders - * /api/v3/redeem/orders + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders */ let data = - '{"currency": "BTC", "status": "DONE", "redeemOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; - let req = new GetRedeemOrdersReq(); + '{"currency": "BTC", "status": "DONE", "purchaseOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; + let req = new GetPurchaseOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -197,16 +163,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRedeemOrders response test', () => { + test('getPurchaseOrders response test', () => { /** - * getRedeemOrders - * Get Redeem Orders - * /api/v3/redeem/orders + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bafa804c26d000773c533",\n "redeemOrderNo": "671bb01004c26d000773c55c",\n "redeemSize": "0.001",\n "receiptSize": "0.001",\n "applyTime": null,\n "status": "DONE"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bb15a3b3f930007880bae",\n "purchaseSize": "0.001",\n "matchSize": "0",\n "interestRate": "0.1",\n "incomeSize": "0",\n "applyTime": 1729868122172,\n "status": "PENDING"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRedeemOrdersResp(); + let resp = new GetPurchaseOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -249,4 +215,38 @@ describe('Auto Test', () => { console.log(resp); } }); + test('getRedeemOrders request test', () => { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let data = + '{"currency": "BTC", "status": "DONE", "redeemOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; + let req = new GetRedeemOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); + }); + + test('getRedeemOrders response test', () => { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let data = + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bafa804c26d000773c533",\n "redeemOrderNo": "671bb01004c26d000773c55c",\n "redeemSize": "0.001",\n "receiptSize": "0.001",\n "applyTime": null,\n "status": "DONE"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetRedeemOrdersResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } + }); }); diff --git a/sdk/node/src/generate/margin/credit/api_credit.ts b/sdk/node/src/generate/margin/credit/api_credit.ts index eb3efa19..e49500b4 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.ts +++ b/sdk/node/src/generate/margin/credit/api_credit.ts @@ -17,22 +17,6 @@ import { RedeemReq } from './model_redeem_req'; import { GetLoanMarketReq } from './model_get_loan_market_req'; export interface CreditAPI { - /** - * modifyPurchase Modify Purchase - * Description: This API endpoint is used to update the interest rates of subscription orders, which will take effect at the beginning of the next hour.,Please ensure that the funds are in the main(funding) account - * Documentation: https://www.kucoin.com/docs-new/api-3470217 - * +---------------------+---------+ - * | Extra API Info | Value | - * +---------------------+---------+ - * | API-DOMAIN | SPOT | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | MARGIN | - * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | - * +---------------------+---------+ - */ - modifyPurchase(req: ModifyPurchaseReq): Promise; - /** * getLoanMarket Get Loan Market * Description: This API endpoint is used to get the information about the currencies available for lending. @@ -68,25 +52,25 @@ export interface CreditAPI { ): Promise; /** - * getPurchaseOrders Get Purchase Orders - * Description: This API endpoint provides pagination query for the purchase orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470213 + * purchase Purchase + * Description: Invest credit in the market and earn interest + * Documentation: https://www.kucoin.com/docs-new/api-3470216 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - getPurchaseOrders(req: GetPurchaseOrdersReq): Promise; + purchase(req: PurchaseReq): Promise; /** - * purchase Purchase - * Description: Invest credit in the market and earn interest - * Documentation: https://www.kucoin.com/docs-new/api-3470216 + * modifyPurchase Modify Purchase + * Description: This API endpoint is used to update the interest rates of subscription orders, which will take effect at the beginning of the next hour.,Please ensure that the funds are in the main(funding) account + * Documentation: https://www.kucoin.com/docs-new/api-3470217 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -94,15 +78,15 @@ export interface CreditAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - purchase(req: PurchaseReq): Promise; + modifyPurchase(req: ModifyPurchaseReq): Promise; /** - * getRedeemOrders Get Redeem Orders - * Description: This API endpoint provides pagination query for the redeem orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470214 + * getPurchaseOrders Get Purchase Orders + * Description: This API endpoint provides pagination query for the purchase orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470213 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -113,7 +97,7 @@ export interface CreditAPI { * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getRedeemOrders(req: GetRedeemOrdersReq): Promise; + getPurchaseOrders(req: GetPurchaseOrdersReq): Promise; /** * redeem Redeem @@ -130,23 +114,27 @@ export interface CreditAPI { * +---------------------+---------+ */ redeem(req: RedeemReq): Promise; + + /** + * getRedeemOrders Get Redeem Orders + * Description: This API endpoint provides pagination query for the redeem orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470214 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 10 | + * +---------------------+---------+ + */ + getRedeemOrders(req: GetRedeemOrdersReq): Promise; } export class CreditAPIImpl implements CreditAPI { constructor(private transport: Transport) {} - modifyPurchase(req: ModifyPurchaseReq): Promise { - return this.transport.call( - 'spot', - false, - 'POST', - '/api/v3/lend/purchase/update', - req, - new ModifyPurchaseResp(), - false, - ); - } - getLoanMarket(req: GetLoanMarketReq): Promise { return this.transport.call( 'spot', @@ -173,38 +161,38 @@ export class CreditAPIImpl implements CreditAPI { ); } - getPurchaseOrders(req: GetPurchaseOrdersReq): Promise { + purchase(req: PurchaseReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/purchase/orders', + 'POST', + '/api/v3/purchase', req, - new GetPurchaseOrdersResp(), + new PurchaseResp(), false, ); } - purchase(req: PurchaseReq): Promise { + modifyPurchase(req: ModifyPurchaseReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v3/purchase', + '/api/v3/lend/purchase/update', req, - new PurchaseResp(), + new ModifyPurchaseResp(), false, ); } - getRedeemOrders(req: GetRedeemOrdersReq): Promise { + getPurchaseOrders(req: GetPurchaseOrdersReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/redeem/orders', + '/api/v3/purchase/orders', req, - new GetRedeemOrdersResp(), + new GetPurchaseOrdersResp(), false, ); } @@ -220,4 +208,16 @@ export class CreditAPIImpl implements CreditAPI { false, ); } + + getRedeemOrders(req: GetRedeemOrdersReq): Promise { + return this.transport.call( + 'spot', + false, + 'GET', + '/api/v3/redeem/orders', + req, + new GetRedeemOrdersResp(), + false, + ); + } } diff --git a/sdk/node/src/generate/margin/debit/api_debit.template b/sdk/node/src/generate/margin/debit/api_debit.template index 93dc2ebc..e19c667b 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.template +++ b/sdk/node/src/generate/margin/debit/api_debit.template @@ -5,26 +5,6 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getBorrowHistory request test', ()=> { - /** - * getBorrowHistory - * Get Borrow History - * /api/v3/margin/borrow - */ - let builder = GetBorrowHistoryReq.builder(); - builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setOrderNo(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); - let req = builder.build(); - let resp = api.getBorrowHistory(req); - return resp.then(result => { - expect(result.timestamp).toEqual(expect.anything()); - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - test('borrow request test', ()=> { /** * borrow @@ -38,19 +18,20 @@ describe('Auto Test', ()=> { return resp.then(result => { expect(result.orderNo).toEqual(expect.anything()); expect(result.actualSize).toEqual(expect.anything()); + console.log(resp); }); }) - test('getInterestHistory request test', ()=> { + test('getBorrowHistory request test', ()=> { /** - * getInterestHistory - * Get Interest History - * /api/v3/margin/interest + * getBorrowHistory + * Get Borrow History + * /api/v3/margin/borrow */ - let builder = GetInterestHistoryReq.builder(); - builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); + let builder = GetBorrowHistoryReq.builder(); + builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setOrderNo(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getInterestHistory(req); + let resp = api.getBorrowHistory(req); return resp.then(result => { expect(result.timestamp).toEqual(expect.anything()); expect(result.currentPage).toEqual(expect.anything()); @@ -58,6 +39,25 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('repay request test', ()=> { + /** + * repay + * Repay + * /api/v3/margin/repay + */ + let builder = RepayReq.builder(); + builder.setCurrency(?).setSize(?).setSymbol(?).setIsIsolated(?).setIsHf(?); + let req = builder.build(); + let resp = api.repay(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.orderNo).toEqual(expect.anything()); + expect(result.actualSize).toEqual(expect.anything()); + console.log(resp); }); }) @@ -78,23 +78,28 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('repay request test', ()=> { + test('getInterestHistory request test', ()=> { /** - * repay - * Repay - * /api/v3/margin/repay + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest */ - let builder = RepayReq.builder(); - builder.setCurrency(?).setSize(?).setSymbol(?).setIsIsolated(?).setIsHf(?); + let builder = GetInterestHistoryReq.builder(); + builder.setCurrency(?).setIsIsolated(?).setSymbol(?).setStartTime(?).setEndTime(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.repay(req); + let resp = api.getInterestHistory(req); return resp.then(result => { expect(result.timestamp).toEqual(expect.anything()); - expect(result.orderNo).toEqual(expect.anything()); - expect(result.actualSize).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -110,6 +115,7 @@ describe('Auto Test', ()=> { let resp = api.modifyLeverage(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/margin/debit/api_debit.test.ts b/sdk/node/src/generate/margin/debit/api_debit.test.ts index d997074a..d4e8f753 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.test.ts +++ b/sdk/node/src/generate/margin/debit/api_debit.test.ts @@ -13,15 +13,15 @@ import { GetBorrowHistoryResp } from './model_get_borrow_history_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getBorrowHistory request test', () => { + test('borrow request test', () => { /** - * getBorrowHistory - * Get Borrow History + * borrow + * Borrow * /api/v3/margin/borrow */ let data = - '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetBorrowHistoryReq(); + '{"currency": "USDT", "size": 10, "timeInForce": "FOK", "isIsolated": false, "isHf": false}'; + let req = new BorrowReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -29,16 +29,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getBorrowHistory response test', () => { + test('borrow response test', () => { /** - * getBorrowHistory - * Get Borrow History + * borrow + * Borrow * /api/v3/margin/borrow */ let data = - '{\n "code": "200000",\n "data": {\n "timestamp": 1729657580449,\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "orderNo": "67187162c0d6990007717b15",\n "symbol": null,\n "currency": "USDT",\n "size": "10",\n "actualSize": "10",\n "status": "SUCCESS",\n "createdTime": 1729655138000\n },\n {\n "orderNo": "67187155b088e70007149585",\n "symbol": null,\n "currency": "USDT",\n "size": "0.1",\n "actualSize": "0",\n "status": "FAILED",\n "createdTime": 1729655125000\n }\n ]\n }\n}'; + '{"code":"200000","data":{"orderNo":"67187162c0d6990007717b15","actualSize":"10"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetBorrowHistoryResp(); + let resp = new BorrowResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -47,15 +47,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('borrow request test', () => { + test('getBorrowHistory request test', () => { /** - * borrow - * Borrow + * getBorrowHistory + * Get Borrow History * /api/v3/margin/borrow */ let data = - '{"currency": "USDT", "size": 10, "timeInForce": "FOK", "isIsolated": false, "isHf": false}'; - let req = new BorrowReq(); + '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetBorrowHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -63,16 +63,16 @@ describe('Auto Test', () => { console.log(req); }); - test('borrow response test', () => { + test('getBorrowHistory response test', () => { /** - * borrow - * Borrow + * getBorrowHistory + * Get Borrow History * /api/v3/margin/borrow */ let data = - '{"code":"200000","data":{"orderNo":"67187162c0d6990007717b15","actualSize":"10"}}'; + '{\n "code": "200000",\n "data": {\n "timestamp": 1729657580449,\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "orderNo": "67187162c0d6990007717b15",\n "symbol": null,\n "currency": "USDT",\n "size": "10",\n "actualSize": "10",\n "status": "SUCCESS",\n "createdTime": 1729655138000\n },\n {\n "orderNo": "67187155b088e70007149585",\n "symbol": null,\n "currency": "USDT",\n "size": "0.1",\n "actualSize": "0",\n "status": "FAILED",\n "createdTime": 1729655125000\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BorrowResp(); + let resp = new GetBorrowHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -81,15 +81,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getInterestHistory request test', () => { + test('repay request test', () => { /** - * getInterestHistory - * Get Interest History - * /api/v3/margin/interest + * repay + * Repay + * /api/v3/margin/repay */ - let data = - '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetInterestHistoryReq(); + let data = '{"currency": "USDT", "size": 10}'; + let req = new RepayReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -97,16 +96,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getInterestHistory response test', () => { + test('repay response test', () => { /** - * getInterestHistory - * Get Interest History - * /api/v3/margin/interest + * repay + * Repay + * /api/v3/margin/repay */ let data = - '{"code":"200000","data":{"timestamp":1729665170701,"currentPage":1,"pageSize":50,"totalNum":3,"totalPage":1,"items":[{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729663213375},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729659618802},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729656028077}]}}'; + '{"code":"200000","data":{"timestamp":1729655606816,"orderNo":"671873361d5bd400075096ad","actualSize":"10"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetInterestHistoryResp(); + let resp = new RepayResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -149,14 +148,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('repay request test', () => { + test('getInterestHistory request test', () => { /** - * repay - * Repay - * /api/v3/margin/repay + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest */ - let data = '{"currency": "USDT", "size": 10}'; - let req = new RepayReq(); + let data = + '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetInterestHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -164,16 +164,16 @@ describe('Auto Test', () => { console.log(req); }); - test('repay response test', () => { + test('getInterestHistory response test', () => { /** - * repay - * Repay - * /api/v3/margin/repay + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest */ let data = - '{"code":"200000","data":{"timestamp":1729655606816,"orderNo":"671873361d5bd400075096ad","actualSize":"10"}}'; + '{"code":"200000","data":{"timestamp":1729665170701,"currentPage":1,"pageSize":50,"totalNum":3,"totalPage":1,"items":[{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729663213375},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729659618802},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729656028077}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new RepayResp(); + let resp = new GetInterestHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/margin/debit/api_debit.ts b/sdk/node/src/generate/margin/debit/api_debit.ts index d2fe9937..29a09834 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.ts +++ b/sdk/node/src/generate/margin/debit/api_debit.ts @@ -16,9 +16,9 @@ import { GetBorrowHistoryResp } from './model_get_borrow_history_resp'; export interface DebitAPI { /** - * getBorrowHistory Get Borrow History - * Description: This API endpoint is used to get the borrowing orders for cross and isolated margin accounts - * Documentation: https://www.kucoin.com/docs-new/api-3470207 + * borrow Borrow + * Description: This API endpoint is used to initiate an application for cross or isolated margin borrowing. + * Documentation: https://www.kucoin.com/docs-new/api-3470206 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -29,12 +29,12 @@ export interface DebitAPI { * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - getBorrowHistory(req: GetBorrowHistoryReq): Promise; + borrow(req: BorrowReq): Promise; /** - * borrow Borrow - * Description: This API endpoint is used to initiate an application for cross or isolated margin borrowing. - * Documentation: https://www.kucoin.com/docs-new/api-3470206 + * getBorrowHistory Get Borrow History + * Description: This API endpoint is used to get the borrowing orders for cross and isolated margin accounts + * Documentation: https://www.kucoin.com/docs-new/api-3470207 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -45,12 +45,12 @@ export interface DebitAPI { * | API-RATE-LIMIT | 15 | * +---------------------+---------+ */ - borrow(req: BorrowReq): Promise; + getBorrowHistory(req: GetBorrowHistoryReq): Promise; /** - * getInterestHistory Get Interest History - * Description: Request via this endpoint to get the interest records of the cross/isolated margin lending. - * Documentation: https://www.kucoin.com/docs-new/api-3470209 + * repay Repay + * Description: This API endpoint is used to initiate an application for cross or isolated margin repayment. + * Documentation: https://www.kucoin.com/docs-new/api-3470210 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -58,10 +58,10 @@ export interface DebitAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getInterestHistory(req: GetInterestHistoryReq): Promise; + repay(req: RepayReq): Promise; /** * getRepayHistory Get Repay History @@ -80,9 +80,9 @@ export interface DebitAPI { getRepayHistory(req: GetRepayHistoryReq): Promise; /** - * repay Repay - * Description: This API endpoint is used to initiate an application for cross or isolated margin repayment. - * Documentation: https://www.kucoin.com/docs-new/api-3470210 + * getInterestHistory Get Interest History + * Description: Request via this endpoint to get the interest records of the cross/isolated margin lending. + * Documentation: https://www.kucoin.com/docs-new/api-3470209 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -90,10 +90,10 @@ export interface DebitAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 20 | * +---------------------+---------+ */ - repay(req: RepayReq): Promise; + getInterestHistory(req: GetInterestHistoryReq): Promise; /** * modifyLeverage Modify Leverage @@ -115,38 +115,38 @@ export interface DebitAPI { export class DebitAPIImpl implements DebitAPI { constructor(private transport: Transport) {} - getBorrowHistory(req: GetBorrowHistoryReq): Promise { + borrow(req: BorrowReq): Promise { return this.transport.call( 'spot', false, - 'GET', + 'POST', '/api/v3/margin/borrow', req, - new GetBorrowHistoryResp(), + new BorrowResp(), false, ); } - borrow(req: BorrowReq): Promise { + getBorrowHistory(req: GetBorrowHistoryReq): Promise { return this.transport.call( 'spot', false, - 'POST', + 'GET', '/api/v3/margin/borrow', req, - new BorrowResp(), + new GetBorrowHistoryResp(), false, ); } - getInterestHistory(req: GetInterestHistoryReq): Promise { + repay(req: RepayReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/margin/interest', + 'POST', + '/api/v3/margin/repay', req, - new GetInterestHistoryResp(), + new RepayResp(), false, ); } @@ -163,14 +163,14 @@ export class DebitAPIImpl implements DebitAPI { ); } - repay(req: RepayReq): Promise { + getInterestHistory(req: GetInterestHistoryReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/margin/repay', + 'GET', + '/api/v3/margin/interest', req, - new RepayResp(), + new GetInterestHistoryResp(), false, ); } diff --git a/sdk/node/src/generate/margin/market/api_market.template b/sdk/node/src/generate/margin/market/api_market.template index 6d9e4fd2..31c47a74 100644 --- a/sdk/node/src/generate/margin/market/api_market.template +++ b/sdk/node/src/generate/margin/market/api_market.template @@ -5,15 +5,20 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getIsolatedMarginSymbols request test', ()=> { + test('getCrossMarginSymbols request test', ()=> { /** - * getIsolatedMarginSymbols - * Get Symbols - Isolated Margin - * /api/v1/isolated/symbols + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols */ - let resp = api.getIsolatedMarginSymbols(); + let builder = GetCrossMarginSymbolsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCrossMarginSymbols(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.timestamp).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) @@ -29,23 +34,7 @@ describe('Auto Test', ()=> { expect(result.maxLeverage).toEqual(expect.anything()); expect(result.warningDebtRatio).toEqual(expect.anything()); expect(result.liqDebtRatio).toEqual(expect.anything()); - }); - }) - - test('getMarkPriceDetail request test', ()=> { - /** - * getMarkPriceDetail - * Get Mark Price Detail - * /api/v1/mark-price/{symbol}/current - */ - let builder = GetMarkPriceDetailReq.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getMarkPriceDetail(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.timePoint).toEqual(expect.anything()); - expect(result.value).toEqual(expect.anything()); + console.log(resp); }); }) @@ -61,34 +50,51 @@ describe('Auto Test', ()=> { let resp = api.getETFInfo(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getCrossMarginSymbols request test', ()=> { + test('getMarkPriceList request test', ()=> { /** - * getCrossMarginSymbols - * Get Symbols - Cross Margin - * /api/v3/margin/symbols + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols */ - let builder = GetCrossMarginSymbolsReq.builder(); + let resp = api.getMarkPriceList(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMarkPriceDetail request test', ()=> { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let builder = GetMarkPriceDetailReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.getCrossMarginSymbols(req); + let resp = api.getMarkPriceDetail(req); return resp.then(result => { - expect(result.timestamp).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + console.log(resp); }); }) - test('getMarkPriceList request test', ()=> { + test('getIsolatedMarginSymbols request test', ()=> { /** - * getMarkPriceList - * Get Mark Price List - * /api/v3/mark-price/all-symbols + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols */ - let resp = api.getMarkPriceList(); + let resp = api.getIsolatedMarginSymbols(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/margin/market/api_market.test.ts b/sdk/node/src/generate/margin/market/api_market.test.ts index 1a9b9843..c8afa1a3 100644 --- a/sdk/node/src/generate/margin/market/api_market.test.ts +++ b/sdk/node/src/generate/margin/market/api_market.test.ts @@ -1,8 +1,8 @@ import { GetMarkPriceDetailReq } from './model_get_mark_price_detail_req'; import { GetCrossMarginSymbolsResp } from './model_get_cross_margin_symbols_resp'; import { GetMarkPriceListResp } from './model_get_mark_price_list_resp'; -import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; import { GetIsolatedMarginSymbolsResp } from './model_get_isolated_margin_symbols_resp'; +import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; import { GetMarkPriceDetailResp } from './model_get_mark_price_detail_resp'; import { GetETFInfoResp } from './model_get_etf_info_resp'; import { GetETFInfoReq } from './model_get_etf_info_req'; @@ -10,20 +10,38 @@ import { GetMarginConfigResp } from './model_get_margin_config_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getIsolatedMarginSymbols request test', () => { + test('getCrossMarginSymbols request test', () => { /** - * getIsolatedMarginSymbols - * Get Symbols - Isolated Margin - * /api/v1/isolated/symbols + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetCrossMarginSymbolsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getIsolatedMarginSymbols response test', () => { + test('getCrossMarginSymbols response test', () => { /** - * getIsolatedMarginSymbols - * Get Symbols - Isolated Margin - * /api/v1/isolated/symbols + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols */ + let data = + '{\n "code": "200000",\n "data": {\n "timestamp": 1729665839353,\n "items": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "enableTrading": true,\n "market": "USDS",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "baseIncrement": "0.00000001",\n "baseMinSize": "0.00001",\n "baseMaxSize": "10000000000",\n "quoteIncrement": "0.000001",\n "quoteMinSize": "0.1",\n "quoteMaxSize": "99999999",\n "priceIncrement": "0.1",\n "feeCurrency": "USDT",\n "priceLimitRate": "0.1",\n "minFunds": "0.1"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCrossMarginSymbolsResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); test('getMarginConfig request test', () => { /** @@ -40,39 +58,6 @@ describe('Auto Test', () => { * /api/v1/margin/config */ }); - test('getMarkPriceDetail request test', () => { - /** - * getMarkPriceDetail - * Get Mark Price Detail - * /api/v1/mark-price/{symbol}/current - */ - let data = '{"symbol": "USDT-BTC"}'; - let req = new GetMarkPriceDetailReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); - }); - - test('getMarkPriceDetail response test', () => { - /** - * getMarkPriceDetail - * Get Mark Price Detail - * /api/v1/mark-price/{symbol}/current - */ - let data = - '{\n "code": "200000",\n "data": {\n "symbol": "USDT-BTC",\n "timePoint": 1729676888000,\n "value": 1.5045E-5\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetMarkPriceDetailResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } - }); test('getETFInfo request test', () => { /** * getETFInfo @@ -106,14 +91,29 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getCrossMarginSymbols request test', () => { + test('getMarkPriceList request test', () => { /** - * getCrossMarginSymbols - * Get Symbols - Cross Margin - * /api/v3/margin/symbols + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols */ - let data = '{"symbol": "BTC-USDT"}'; - let req = new GetCrossMarginSymbolsReq(); + }); + + test('getMarkPriceList response test', () => { + /** + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols + */ + }); + test('getMarkPriceDetail request test', () => { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let data = '{"symbol": "USDT-BTC"}'; + let req = new GetMarkPriceDetailReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -121,16 +121,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getCrossMarginSymbols response test', () => { + test('getMarkPriceDetail response test', () => { /** - * getCrossMarginSymbols - * Get Symbols - Cross Margin - * /api/v3/margin/symbols + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current */ let data = - '{\n "code": "200000",\n "data": {\n "timestamp": 1729665839353,\n "items": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "enableTrading": true,\n "market": "USDS",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "baseIncrement": "0.00000001",\n "baseMinSize": "0.00001",\n "baseMaxSize": "10000000000",\n "quoteIncrement": "0.000001",\n "quoteMinSize": "0.1",\n "quoteMaxSize": "99999999",\n "priceIncrement": "0.1",\n "feeCurrency": "USDT",\n "priceLimitRate": "0.1",\n "minFunds": "0.1"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "symbol": "USDT-BTC",\n "timePoint": 1729676888000,\n "value": 1.5045E-5\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginSymbolsResp(); + let resp = new GetMarkPriceDetailResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -139,19 +139,19 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMarkPriceList request test', () => { + test('getIsolatedMarginSymbols request test', () => { /** - * getMarkPriceList - * Get Mark Price List - * /api/v3/mark-price/all-symbols + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols */ }); - test('getMarkPriceList response test', () => { + test('getIsolatedMarginSymbols response test', () => { /** - * getMarkPriceList - * Get Mark Price List - * /api/v3/mark-price/all-symbols + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols */ }); }); diff --git a/sdk/node/src/generate/margin/market/api_market.ts b/sdk/node/src/generate/margin/market/api_market.ts index 61b9438b..0351edd3 100644 --- a/sdk/node/src/generate/margin/market/api_market.ts +++ b/sdk/node/src/generate/margin/market/api_market.ts @@ -4,8 +4,8 @@ import { Transport } from '@internal/interfaces/transport'; import { GetMarkPriceDetailReq } from './model_get_mark_price_detail_req'; import { GetCrossMarginSymbolsResp } from './model_get_cross_margin_symbols_resp'; import { GetMarkPriceListResp } from './model_get_mark_price_list_resp'; -import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; import { GetIsolatedMarginSymbolsResp } from './model_get_isolated_margin_symbols_resp'; +import { GetCrossMarginSymbolsReq } from './model_get_cross_margin_symbols_req'; import { GetMarkPriceDetailResp } from './model_get_mark_price_detail_resp'; import { GetETFInfoResp } from './model_get_etf_info_resp'; import { GetETFInfoReq } from './model_get_etf_info_req'; @@ -13,9 +13,9 @@ import { GetMarginConfigResp } from './model_get_margin_config_resp'; export interface MarketAPI { /** - * getIsolatedMarginSymbols Get Symbols - Isolated Margin - * Description: This endpoint allows querying the configuration of isolated margin symbol. - * Documentation: https://www.kucoin.com/docs-new/api-3470194 + * getCrossMarginSymbols Get Symbols - Cross Margin + * Description: This endpoint allows querying the configuration of cross margin symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470189 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -26,7 +26,7 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getIsolatedMarginSymbols(): Promise; + getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise; /** * getMarginConfig Get Margin Config @@ -45,9 +45,9 @@ export interface MarketAPI { getMarginConfig(): Promise; /** - * getMarkPriceDetail Get Mark Price Detail - * Description: This endpoint returns the current Mark price for specified margin trading pairs. - * Documentation: https://www.kucoin.com/docs-new/api-3470193 + * getETFInfo Get ETF Info + * Description: This interface returns leveraged token information + * Documentation: https://www.kucoin.com/docs-new/api-3470191 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -55,15 +55,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise; + getETFInfo(req: GetETFInfoReq): Promise; /** - * getETFInfo Get ETF Info - * Description: This interface returns leveraged token information - * Documentation: https://www.kucoin.com/docs-new/api-3470191 + * getMarkPriceList Get Mark Price List + * Description: This endpoint returns the current Mark price for all margin trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470192 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -71,15 +71,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 10 | * +---------------------+--------+ */ - getETFInfo(req: GetETFInfoReq): Promise; + getMarkPriceList(): Promise; /** - * getCrossMarginSymbols Get Symbols - Cross Margin - * Description: This endpoint allows querying the configuration of cross margin symbol. - * Documentation: https://www.kucoin.com/docs-new/api-3470189 + * getMarkPriceDetail Get Mark Price Detail + * Description: This endpoint returns the current Mark price for specified margin trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470193 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -87,15 +87,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+--------+ */ - getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise; + getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise; /** - * getMarkPriceList Get Mark Price List - * Description: This endpoint returns the current Mark price for all margin trading pairs. - * Documentation: https://www.kucoin.com/docs-new/api-3470192 + * getIsolatedMarginSymbols Get Symbols - Isolated Margin + * Description: This endpoint allows querying the configuration of isolated margin symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470194 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -103,23 +103,23 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getMarkPriceList(): Promise; + getIsolatedMarginSymbols(): Promise; } export class MarketAPIImpl implements MarketAPI { constructor(private transport: Transport) {} - getIsolatedMarginSymbols(): Promise { + getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/isolated/symbols', - null, - new GetIsolatedMarginSymbolsResp(), + '/api/v3/margin/symbols', + req, + new GetCrossMarginSymbolsResp(), false, ); } @@ -136,50 +136,50 @@ export class MarketAPIImpl implements MarketAPI { ); } - getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise { + getETFInfo(req: GetETFInfoReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/mark-price/{symbol}/current', + '/api/v3/etf/info', req, - new GetMarkPriceDetailResp(), + new GetETFInfoResp(), false, ); } - getETFInfo(req: GetETFInfoReq): Promise { + getMarkPriceList(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/etf/info', - req, - new GetETFInfoResp(), + '/api/v3/mark-price/all-symbols', + null, + new GetMarkPriceListResp(), false, ); } - getCrossMarginSymbols(req: GetCrossMarginSymbolsReq): Promise { + getMarkPriceDetail(req: GetMarkPriceDetailReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/margin/symbols', + '/api/v1/mark-price/{symbol}/current', req, - new GetCrossMarginSymbolsResp(), + new GetMarkPriceDetailResp(), false, ); } - getMarkPriceList(): Promise { + getIsolatedMarginSymbols(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/mark-price/all-symbols', + '/api/v1/isolated/symbols', null, - new GetMarkPriceListResp(), + new GetIsolatedMarginSymbolsResp(), false, ); } diff --git a/sdk/node/src/generate/margin/order/api_order.template b/sdk/node/src/generate/margin/order/api_order.template index daaa7e5d..b0525988 100644 --- a/sdk/node/src/generate/margin/order/api_order.template +++ b/sdk/node/src/generate/margin/order/api_order.template @@ -5,107 +5,106 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('addOrderV1 request test', ()=> { + test('addOrder request test', ()=> { /** - * addOrderV1 - * Add Order - V1 - * /api/v1/margin/order + * addOrder + * Add Order + * /api/v3/hf/margin/order */ - let builder = AddOrderV1Req.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); let req = builder.build(); - let resp = api.addOrderV1(req); + let resp = api.addOrder(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); expect(result.loanApplyId).toEqual(expect.anything()); expect(result.borrowSize).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderTestV1 request test', ()=> { + test('addOrderTest request test', ()=> { /** - * addOrderTestV1 - * Add Order Test - V1 - * /api/v1/margin/order/test + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test */ - let builder = AddOrderTestV1Req.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); let req = builder.build(); - let resp = api.addOrderTestV1(req); + let resp = api.addOrderTest(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); expect(result.loanApplyId).toEqual(expect.anything()); expect(result.borrowSize).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('getTradeHistory request test', ()=> { + test('cancelOrderByOrderId request test', ()=> { /** - * getTradeHistory - * Get Trade History - * /api/v3/hf/margin/fills + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} */ - let builder = GetTradeHistoryReq.builder(); - builder.setSymbol(?).setTradeType(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId(?).setSymbol(?); let req = builder.build(); - let resp = api.getTradeHistory(req); + let resp = api.cancelOrderByOrderId(req); return resp.then(result => { - expect(result.items).toEqual(expect.anything()); - expect(result.lastId).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSymbolsWithOpenOrder request test', ()=> { + test('cancelOrderByClientOid request test', ()=> { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v3/hf/margin/order/active/symbols + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ - let builder = GetSymbolsWithOpenOrderReq.builder(); - builder.setTradeType(?); + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); let req = builder.build(); - let resp = api.getSymbolsWithOpenOrder(req); + let resp = api.cancelOrderByClientOid(req); return resp.then(result => { - expect(result.symbolSize).toEqual(expect.anything()); - expect(result.symbols).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrder request test', ()=> { + test('cancelAllOrdersBySymbol request test', ()=> { /** - * addOrder - * Add Order - * /api/v3/hf/margin/order + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders */ - let builder = AddOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); + let builder = CancelAllOrdersBySymbolReq.builder(); + builder.setSymbol(?).setTradeType(?); let req = builder.build(); - let resp = api.addOrder(req); + let resp = api.cancelAllOrdersBySymbol(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.loanApplyId).toEqual(expect.anything()); - expect(result.borrowSize).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderTest request test', ()=> { + test('getSymbolsWithOpenOrder request test', ()=> { /** - * addOrderTest - * Add Order Test - * /api/v3/hf/margin/order/test + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols */ - let builder = AddOrderTestReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setIsIsolated(?).setAutoBorrow(?).setAutoRepay(?); + let builder = GetSymbolsWithOpenOrderReq.builder(); + builder.setTradeType(?); let req = builder.build(); - let resp = api.addOrderTest(req); + let resp = api.getSymbolsWithOpenOrder(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.loanApplyId).toEqual(expect.anything()); - expect(result.borrowSize).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.symbolSize).toEqual(expect.anything()); + expect(result.symbols).toEqual(expect.anything()); + console.log(resp); }); }) @@ -121,34 +120,54 @@ describe('Auto Test', ()=> { let resp = api.getOpenOrders(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByClientOid request test', ()=> { + test('getClosedOrders request test', ()=> { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done */ - let builder = CancelOrderByClientOidReq.builder(); - builder.setClientOid(?).setSymbol(?); + let builder = GetClosedOrdersReq.builder(); + builder.setSymbol(?).setTradeType(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); let req = builder.build(); - let resp = api.cancelOrderByClientOid(req); + let resp = api.getClosedOrders(req); return resp.then(result => { - expect(result.clientOid).toEqual(expect.anything()); + expect(result.lastId).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOrderByClientOid request test', ()=> { + test('getTradeHistory request test', ()=> { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills */ - let builder = GetOrderByClientOidReq.builder(); - builder.setSymbol(?).setClientOid(?); + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?).setTradeType(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); let req = builder.build(); - let resp = api.getOrderByClientOid(req); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.items).toEqual(expect.anything()); + expect(result.lastId).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getOrderByOrderId request test', ()=> { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); @@ -187,65 +206,20 @@ describe('Auto Test', ()=> { expect(result.remainFunds).toEqual(expect.anything()); expect(result.tax).toEqual(expect.anything()); expect(result.active).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllOrdersBySymbol request test', ()=> { - /** - * cancelAllOrdersBySymbol - * Cancel All Orders By Symbol - * /api/v3/hf/margin/orders - */ - let builder = CancelAllOrdersBySymbolReq.builder(); - builder.setSymbol(?).setTradeType(?); - let req = builder.build(); - let resp = api.cancelAllOrdersBySymbol(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - - test('getClosedOrders request test', ()=> { - /** - * getClosedOrders - * Get Closed Orders - * /api/v3/hf/margin/orders/done - */ - let builder = GetClosedOrdersReq.builder(); - builder.setSymbol(?).setTradeType(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); - let req = builder.build(); - let resp = api.getClosedOrders(req); - return resp.then(result => { - expect(result.lastId).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('cancelOrderByOrderId request test', ()=> { - /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v3/hf/margin/orders/{orderId} - */ - let builder = CancelOrderByOrderIdReq.builder(); - builder.setOrderId(?).setSymbol(?); - let req = builder.build(); - let resp = api.cancelOrderByOrderId(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - }); - }) - - test('getOrderByOrderId request test', ()=> { + test('getOrderByClientOid request test', ()=> { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v3/hf/margin/orders/{orderId} + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ - let builder = GetOrderByOrderIdReq.builder(); - builder.setSymbol(?).setOrderId(?); + let builder = GetOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); let req = builder.build(); - let resp = api.getOrderByOrderId(req); + let resp = api.getOrderByClientOid(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); @@ -284,6 +258,45 @@ describe('Auto Test', ()=> { expect(result.remainFunds).toEqual(expect.anything()); expect(result.tax).toEqual(expect.anything()); expect(result.active).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addOrderV1 request test', ()=> { + /** + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order + */ + let builder = AddOrderV1Req.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let req = builder.build(); + let resp = api.addOrderV1(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addOrderTestV1 request test', ()=> { + /** + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test + */ + let builder = AddOrderTestV1Req.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setAutoBorrow(?).setAutoRepay(?).setMarginModel(?); + let req = builder.build(); + let resp = api.addOrderTestV1(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/margin/order/api_order.test.ts b/sdk/node/src/generate/margin/order/api_order.test.ts index 2a355ace..bc33a96f 100644 --- a/sdk/node/src/generate/margin/order/api_order.test.ts +++ b/sdk/node/src/generate/margin/order/api_order.test.ts @@ -17,8 +17,8 @@ import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_ import { AddOrderTestReq } from './model_add_order_test_req'; import { AddOrderTestV1Resp } from './model_add_order_test_v1_resp'; import { AddOrderV1Resp } from './model_add_order_v1_resp'; -import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { AddOrderTestResp } from './model_add_order_test_resp'; import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { AddOrderResp } from './model_add_order_resp'; @@ -27,15 +27,15 @@ import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('addOrderV1 request test', () => { + test('addOrder request test', () => { /** - * addOrderV1 - * Add Order - V1 - * /api/v1/margin/order + * addOrder + * Add Order + * /api/v3/hf/margin/order */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; - let req = new AddOrderV1Req(); + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -43,16 +43,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderV1 response test', () => { + test('addOrder response test', () => { /** - * addOrderV1 - * Add Order - V1 - * /api/v1/margin/order + * addOrder + * Add Order + * /api/v3/hf/margin/order */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; + '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "671663e02188630007e21c9c",\n "clientOid": "5c52e11203aa677f33e1493fb",\n "borrowSize": "10.2",\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderV1Resp(); + let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -61,15 +61,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderTestV1 request test', () => { + test('addOrderTest request test', () => { /** - * addOrderTestV1 - * Add Order Test - V1 - * /api/v1/margin/order/test + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; - let req = new AddOrderTestV1Req(); + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderTestReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -77,16 +77,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderTestV1 response test', () => { + test('addOrderTest response test', () => { /** - * addOrderTestV1 - * Add Order Test - V1 - * /api/v1/margin/order/test + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; + '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "5bd6e9286d99522a52e458de",\n "clientOid": "5c52e11203aa677f33e493fb",\n "borrowSize": 10.2,\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestV1Resp(); + let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -95,15 +95,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getTradeHistory request test', () => { + test('cancelOrderByOrderId request test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v3/hf/margin/fills + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} */ - let data = - '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetTradeHistoryReq(); + let data = '{"orderId": "671663e02188630007e21c9c", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -111,16 +110,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getTradeHistory response test', () => { + test('cancelOrderByOrderId response test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v3/hf/margin/fills + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} */ - let data = - '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 137891621991,\n "symbol": "BTC-USDT",\n "tradeId": 11040911994273793,\n "orderId": "671868085584bc0007d85f46",\n "counterOrderId": "67186805b7cbdf00071621f9",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67141.6",\n "size": "0.00001",\n "funds": "0.671416",\n "fee": "0.000671416",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "MARGIN_TRADE",\n "tax": "0",\n "taxRate": "0",\n "type": "limit",\n "createdAt": 1729652744998\n }\n ],\n "lastId": 137891621991\n }\n}'; + let data = '{"code":"200000","data":{"orderId":"671663e02188630007e21c9c"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); + let resp = new CancelOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -129,14 +127,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSymbolsWithOpenOrder request test', () => { + test('cancelOrderByClientOid request test', () => { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v3/hf/margin/order/active/symbols + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ - let data = '{"tradeType": "MARGIN_TRADE"}'; - let req = new GetSymbolsWithOpenOrderReq(); + let data = '{"clientOid": "5c52e11203aa677f33e1493fb", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -144,16 +142,15 @@ describe('Auto Test', () => { console.log(req); }); - test('getSymbolsWithOpenOrder response test', () => { + test('cancelOrderByClientOid response test', () => { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v3/hf/margin/order/active/symbols + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ - let data = - '{\n "code": "200000",\n "data": {\n "symbolSize": 1,\n "symbols": [\n "BTC-USDT"\n ]\n }\n}'; + let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e1493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolsWithOpenOrderResp(); + let resp = new CancelOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -162,15 +159,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrder request test', () => { + test('cancelAllOrdersBySymbol request test', () => { /** - * addOrder - * Add Order - * /api/v3/hf/margin/order + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders */ - let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderReq(); + let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; + let req = new CancelAllOrdersBySymbolReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -178,16 +174,15 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrder response test', () => { + test('cancelAllOrdersBySymbol response test', () => { /** - * addOrder - * Add Order - * /api/v3/hf/margin/order + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders */ - let data = - '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "671663e02188630007e21c9c",\n "clientOid": "5c52e11203aa677f33e1493fb",\n "borrowSize": "10.2",\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; + let data = '{"code":"200000","data":"success"}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); + let resp = new CancelAllOrdersBySymbolResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -196,15 +191,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderTest request test', () => { + test('getSymbolsWithOpenOrder request test', () => { /** - * addOrderTest - * Add Order Test - * /api/v3/hf/margin/order/test + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols */ - let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderTestReq(); + let data = '{"tradeType": "MARGIN_TRADE"}'; + let req = new GetSymbolsWithOpenOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -212,16 +206,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderTest response test', () => { + test('getSymbolsWithOpenOrder response test', () => { /** - * addOrderTest - * Add Order Test - * /api/v3/hf/margin/order/test + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols */ let data = - '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "5bd6e9286d99522a52e458de",\n "clientOid": "5c52e11203aa677f33e493fb",\n "borrowSize": 10.2,\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "symbolSize": 1,\n "symbols": [\n "BTC-USDT"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); + let resp = new GetSymbolsWithOpenOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -263,14 +257,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByClientOid request test', () => { + test('getClosedOrders request test', () => { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done */ - let data = '{"clientOid": "5c52e11203aa677f33e1493fb", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByClientOidReq(); + let data = + '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetClosedOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -278,15 +273,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByClientOid response test', () => { + test('getClosedOrders response test', () => { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done */ - let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e1493fb"}}'; + let data = + '{\n "code": "200000",\n "data": {\n "lastId": 136112949351,\n "items": [\n {\n "id": "6716491f6afcdb00078365c8",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0",\n "remainFunds": "0",\n "cancelledSize": "0.00001",\n "cancelledFunds": "0.5",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": true,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729513759162,\n "lastUpdatedAt": 1729521126597\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); + let resp = new GetClosedOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -295,14 +291,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByClientOid request test', () => { + test('getTradeHistory request test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills */ - let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); + let data = + '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -310,16 +307,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByClientOid response test', () => { + test('getTradeHistory response test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v3/hf/margin/orders/client-order/{clientOid} + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills */ let data = - '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; + '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 137891621991,\n "symbol": "BTC-USDT",\n "tradeId": 11040911994273793,\n "orderId": "671868085584bc0007d85f46",\n "counterOrderId": "67186805b7cbdf00071621f9",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67141.6",\n "size": "0.00001",\n "funds": "0.671416",\n "fee": "0.000671416",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "MARGIN_TRADE",\n "tax": "0",\n "taxRate": "0",\n "type": "limit",\n "createdAt": 1729652744998\n }\n ],\n "lastId": 137891621991\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); + let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -328,14 +325,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelAllOrdersBySymbol request test', () => { + test('getOrderByOrderId request test', () => { /** - * cancelAllOrdersBySymbol - * Cancel All Orders By Symbol - * /api/v3/hf/margin/orders + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} */ - let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; - let req = new CancelAllOrdersBySymbolReq(); + let data = '{"symbol": "BTC-USDT", "orderId": "671667306afcdb000723107f"}'; + let req = new GetOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -343,15 +340,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelAllOrdersBySymbol response test', () => { + test('getOrderByOrderId response test', () => { /** - * cancelAllOrdersBySymbol - * Cancel All Orders By Symbol - * /api/v3/hf/margin/orders + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} */ - let data = '{"code":"200000","data":"success"}'; + let data = + '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersBySymbolResp(); + let resp = new GetOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -360,15 +358,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getClosedOrders request test', () => { + test('getOrderByClientOid request test', () => { /** - * getClosedOrders - * Get Closed Orders - * /api/v3/hf/margin/orders/done + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ - let data = - '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetClosedOrdersReq(); + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -376,16 +373,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getClosedOrders response test', () => { + test('getOrderByClientOid response test', () => { /** - * getClosedOrders - * Get Closed Orders - * /api/v3/hf/margin/orders/done + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "lastId": 136112949351,\n "items": [\n {\n "id": "6716491f6afcdb00078365c8",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0",\n "remainFunds": "0",\n "cancelledSize": "0.00001",\n "cancelledFunds": "0.5",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": true,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729513759162,\n "lastUpdatedAt": 1729521126597\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetClosedOrdersResp(); + let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -394,14 +391,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByOrderId request test', () => { + test('addOrderV1 request test', () => { /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v3/hf/margin/orders/{orderId} + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order */ - let data = '{"orderId": "671663e02188630007e21c9c", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdReq(); + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; + let req = new AddOrderV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -409,15 +407,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByOrderId response test', () => { + test('addOrderV1 response test', () => { /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v3/hf/margin/orders/{orderId} + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order */ - let data = '{"code":"200000","data":{"orderId":"671663e02188630007e21c9c"}}'; + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdResp(); + let resp = new AddOrderV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -426,14 +425,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByOrderId request test', () => { + test('addOrderTestV1 request test', () => { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v3/hf/margin/orders/{orderId} + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test */ - let data = '{"symbol": "BTC-USDT", "orderId": "671667306afcdb000723107f"}'; - let req = new GetOrderByOrderIdReq(); + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; + let req = new AddOrderTestV1Req(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -441,16 +441,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByOrderId response test', () => { + test('addOrderTestV1 response test', () => { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v3/hf/margin/orders/{orderId} + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test */ let data = - '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdResp(); + let resp = new AddOrderTestV1Resp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/margin/order/api_order.ts b/sdk/node/src/generate/margin/order/api_order.ts index bc876092..df743d59 100644 --- a/sdk/node/src/generate/margin/order/api_order.ts +++ b/sdk/node/src/generate/margin/order/api_order.ts @@ -20,8 +20,8 @@ import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_ import { AddOrderTestReq } from './model_add_order_test_req'; import { AddOrderTestV1Resp } from './model_add_order_test_v1_resp'; import { AddOrderV1Resp } from './model_add_order_v1_resp'; -import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { AddOrderTestResp } from './model_add_order_test_resp'; import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { AddOrderResp } from './model_add_order_resp'; @@ -30,10 +30,9 @@ import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order export interface OrderAPI { /** - * @deprecated - * addOrderV1 Add Order - V1 + * addOrder Add Order * Description: Place order to the Cross-margin or Isolated-margin trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470312 + * Documentation: https://www.kucoin.com/docs-new/api-3470204 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -44,13 +43,12 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - addOrderV1(req: AddOrderV1Req): Promise; + addOrder(req: AddOrderReq): Promise; /** - * @deprecated - * addOrderTestV1 Add Order Test - V1 - * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. - * Documentation: https://www.kucoin.com/docs-new/api-3470313 + * addOrderTest Add Order Test + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470205 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -61,28 +59,28 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - addOrderTestV1(req: AddOrderTestV1Req): Promise; + addOrderTest(req: AddOrderTestReq): Promise; /** - * getTradeHistory Get Trade History - * Description: This endpoint can be used to obtain a list of the latest Margin transaction details. The returned data is sorted in descending order according to the latest update time of the order. - * Documentation: https://www.kucoin.com/docs-new/api-3470200 + * cancelOrderByOrderId Cancel Order By OrderId + * Description: This endpoint can be used to cancel a margin order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470195 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getTradeHistory(req: GetTradeHistoryReq): Promise; + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; /** - * getSymbolsWithOpenOrder Get Symbols With Open Order - * Description: This interface can query all Margin symbol that has active orders - * Documentation: https://www.kucoin.com/docs-new/api-3470196 + * cancelOrderByClientOid Cancel Order By ClientOid + * Description: This endpoint can be used to cancel a margin order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470201 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -90,15 +88,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise; + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; /** - * addOrder Add Order - * Description: Place order to the Cross-margin or Isolated-margin trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470204 + * cancelAllOrdersBySymbol Cancel All Orders By Symbol + * Description: This interface can cancel all open Margin orders by symbol This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470197 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -106,15 +104,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - addOrder(req: AddOrderReq): Promise; + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; /** - * addOrderTest Add Order Test - * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. - * Documentation: https://www.kucoin.com/docs-new/api-3470205 + * getSymbolsWithOpenOrder Get Symbols With Open Order + * Description: This interface can query all Margin symbol that has active orders + * Documentation: https://www.kucoin.com/docs-new/api-3470196 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -122,10 +120,10 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - addOrderTest(req: AddOrderTestReq): Promise; + getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise; /** * getOpenOrders Get Open Orders @@ -144,25 +142,25 @@ export interface OrderAPI { getOpenOrders(req: GetOpenOrdersReq): Promise; /** - * cancelOrderByClientOid Cancel Order By ClientOid - * Description: This endpoint can be used to cancel a margin order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470201 + * getClosedOrders Get Closed Orders + * Description: This interface is to obtain all Margin closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470199 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | MARGIN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; + getClosedOrders(req: GetClosedOrdersReq): Promise; /** - * getOrderByClientOid Get Order By ClientOid - * Description: This endpoint can be used to obtain information for a single Margin order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470203 + * getTradeHistory Get Trade History + * Description: This endpoint can be used to obtain a list of the latest Margin transaction details. The returned data is sorted in descending order according to the latest update time of the order. + * Documentation: https://www.kucoin.com/docs-new/api-3470200 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -173,28 +171,28 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * cancelAllOrdersBySymbol Cancel All Orders By Symbol - * Description: This interface can cancel all open Margin orders by symbol This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470197 + * getOrderByOrderId Get Order By OrderId + * Description: This endpoint can be used to obtain information for a single Margin order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470202 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | MARGIN | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; /** - * getClosedOrders Get Closed Orders - * Description: This interface is to obtain all Margin closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470199 + * getOrderByClientOid Get Order By ClientOid + * Description: This endpoint can be used to obtain information for a single Margin order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470203 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -202,15 +200,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getClosedOrders(req: GetClosedOrdersReq): Promise; + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; /** - * cancelOrderByOrderId Cancel Order By OrderId - * Description: This endpoint can be used to cancel a margin order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470195 + * @deprecated + * addOrderV1 Add Order - V1 + * Description: Place order to the Cross-margin or Isolated-margin trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470312 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -221,96 +220,97 @@ export interface OrderAPI { * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; + addOrderV1(req: AddOrderV1Req): Promise; /** - * getOrderByOrderId Get Order By OrderId - * Description: This endpoint can be used to obtain information for a single Margin order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470202 + * @deprecated + * addOrderTestV1 Add Order Test - V1 + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470313 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | MARGIN | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; + addOrderTestV1(req: AddOrderTestV1Req): Promise; } export class OrderAPIImpl implements OrderAPI { constructor(private transport: Transport) {} - addOrderV1(req: AddOrderV1Req): Promise { + addOrder(req: AddOrderReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/margin/order', + '/api/v3/hf/margin/order', req, - new AddOrderV1Resp(), + new AddOrderResp(), false, ); } - addOrderTestV1(req: AddOrderTestV1Req): Promise { + addOrderTest(req: AddOrderTestReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/margin/order/test', + '/api/v3/hf/margin/order/test', req, - new AddOrderTestV1Resp(), + new AddOrderTestResp(), false, ); } - getTradeHistory(req: GetTradeHistoryReq): Promise { + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/hf/margin/fills', + 'DELETE', + '/api/v3/hf/margin/orders/{orderId}', req, - new GetTradeHistoryResp(), + new CancelOrderByOrderIdResp(), false, ); } - getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise { + cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/hf/margin/order/active/symbols', + 'DELETE', + '/api/v3/hf/margin/orders/client-order/{clientOid}', req, - new GetSymbolsWithOpenOrderResp(), + new CancelOrderByClientOidResp(), false, ); } - addOrder(req: AddOrderReq): Promise { + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/hf/margin/order', + 'DELETE', + '/api/v3/hf/margin/orders', req, - new AddOrderResp(), + new CancelAllOrdersBySymbolResp(), false, ); } - addOrderTest(req: AddOrderTestReq): Promise { + getSymbolsWithOpenOrder(req: GetSymbolsWithOpenOrderReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/hf/margin/order/test', + 'GET', + '/api/v3/hf/margin/order/active/symbols', req, - new AddOrderTestResp(), + new GetSymbolsWithOpenOrderResp(), false, ); } @@ -327,74 +327,74 @@ export class OrderAPIImpl implements OrderAPI { ); } - cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise { + getClosedOrders(req: GetClosedOrdersReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v3/hf/margin/orders/client-order/{clientOid}', + 'GET', + '/api/v3/hf/margin/orders/done', req, - new CancelOrderByClientOidResp(), + new GetClosedOrdersResp(), false, ); } - getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + getTradeHistory(req: GetTradeHistoryReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/hf/margin/orders/client-order/{clientOid}', + '/api/v3/hf/margin/fills', req, - new GetOrderByClientOidResp(), + new GetTradeHistoryResp(), false, ); } - cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v3/hf/margin/orders', + 'GET', + '/api/v3/hf/margin/orders/{orderId}', req, - new CancelAllOrdersBySymbolResp(), + new GetOrderByOrderIdResp(), false, ); } - getClosedOrders(req: GetClosedOrdersReq): Promise { + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/hf/margin/orders/done', + '/api/v3/hf/margin/orders/client-order/{clientOid}', req, - new GetClosedOrdersResp(), + new GetOrderByClientOidResp(), false, ); } - cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { + addOrderV1(req: AddOrderV1Req): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v3/hf/margin/orders/{orderId}', + 'POST', + '/api/v1/margin/order', req, - new CancelOrderByOrderIdResp(), + new AddOrderV1Resp(), false, ); } - getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { + addOrderTestV1(req: AddOrderTestV1Req): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/hf/margin/orders/{orderId}', + 'POST', + '/api/v1/margin/order/test', req, - new GetOrderByOrderIdResp(), + new AddOrderTestV1Resp(), false, ); } diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.template b/sdk/node/src/generate/margin/risklimit/api_risk_limit.template index 33c611e9..5181a77c 100644 --- a/sdk/node/src/generate/margin/risklimit/api_risk_limit.template +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.template @@ -17,6 +17,7 @@ describe('Auto Test', ()=> { let resp = api.getMarginRiskLimit(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/service/copytrading_api.ts b/sdk/node/src/generate/service/copytrading_api.ts new file mode 100644 index 00000000..1c848841 --- /dev/null +++ b/sdk/node/src/generate/service/copytrading_api.ts @@ -0,0 +1,23 @@ +// Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. + +import { Transport } from '@internal/interfaces/transport'; + +import { FuturesAPI, FuturesAPIImpl } from '@generate/copytrading/futures/api_futures'; + +export interface CopyTradingService { + getFuturesApi(): FuturesAPI; +} + +export class CopyTradingServiceImpl implements CopyTradingService { + private readonly transport: Transport; + private readonly futures: FuturesAPI; + + constructor(transport: Transport) { + this.transport = transport; + this.futures = new FuturesAPIImpl(transport); + } + + getFuturesApi(): FuturesAPI { + return this.futures; + } +} diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts index 7cd8cf53..753e6c6b 100644 --- a/sdk/node/src/generate/service/index.ts +++ b/sdk/node/src/generate/service/index.ts @@ -1,6 +1,7 @@ export * from './account_api'; export * from './affiliate_api'; export * from './broker_api'; +export * from './copytrading_api'; export * from './earn_api'; export * from './futures_api'; export * from './margin_api'; diff --git a/sdk/node/src/generate/spot/market/api_market.template b/sdk/node/src/generate/spot/market/api_market.template index 1e4cd548..ad48166a 100644 --- a/sdk/node/src/generate/spot/market/api_market.template +++ b/sdk/node/src/generate/spot/market/api_market.template @@ -5,72 +5,112 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getPrivateToken request test', ()=> { + test('getAnnouncements request test', ()=> { /** - * getPrivateToken - * Get Private Token - Spot/Margin - * /api/v1/bullet-private + * getAnnouncements + * Get Announcements + * /api/v3/announcements */ - let resp = api.getPrivateToken(); + let builder = GetAnnouncementsReq.builder(); + builder.setCurrentPage(?).setPageSize(?).setAnnType(?).setLang(?).setStartTime(?).setEndTime(?); + let req = builder.build(); + let resp = api.getAnnouncements(req); return resp.then(result => { - expect(result.token).toEqual(expect.anything()); - expect(result.instanceServers).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + console.log(resp); }); }) - test('getPublicToken request test', ()=> { + test('getCurrency request test', ()=> { /** - * getPublicToken - * Get Public Token - Spot/Margin - * /api/v1/bullet-public + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} */ - let resp = api.getPublicToken(); + let builder = GetCurrencyReq.builder(); + builder.setCurrency(?).setChain(?); + let req = builder.build(); + let resp = api.getCurrency(req); return resp.then(result => { - expect(result.token).toEqual(expect.anything()); - expect(result.instanceServers).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.fullName).toEqual(expect.anything()); + expect(result.precision).toEqual(expect.anything()); + expect(result.confirms).toEqual(expect.anything()); + expect(result.contractAddress).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.isDebitEnabled).toEqual(expect.anything()); + expect(result.chains).toEqual(expect.anything()); + console.log(resp); }); }) - test('getAllTickers request test', ()=> { + test('getAllCurrencies request test', ()=> { /** - * getAllTickers - * Get All Tickers - * /api/v1/market/allTickers + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies */ - let resp = api.getAllTickers(); + let resp = api.getAllCurrencies(); return resp.then(result => { - expect(result.time).toEqual(expect.anything()); - expect(result.ticker).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getKlines request test', ()=> { + test('getSymbol request test', ()=> { /** - * getKlines - * Get Klines - * /api/v1/market/candles + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} */ - let builder = GetKlinesReq.builder(); - builder.setSymbol(?).setType(?).setStartAt(?).setEndAt(?); + let builder = GetSymbolReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.getKlines(req); + let resp = api.getSymbol(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.baseCurrency).toEqual(expect.anything()); + expect(result.quoteCurrency).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.market).toEqual(expect.anything()); + expect(result.baseMinSize).toEqual(expect.anything()); + expect(result.quoteMinSize).toEqual(expect.anything()); + expect(result.baseMaxSize).toEqual(expect.anything()); + expect(result.quoteMaxSize).toEqual(expect.anything()); + expect(result.baseIncrement).toEqual(expect.anything()); + expect(result.quoteIncrement).toEqual(expect.anything()); + expect(result.priceIncrement).toEqual(expect.anything()); + expect(result.priceLimitRate).toEqual(expect.anything()); + expect(result.minFunds).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.enableTrading).toEqual(expect.anything()); + expect(result.feeCategory).toEqual(expect.anything()); + expect(result.makerFeeCoefficient).toEqual(expect.anything()); + expect(result.takerFeeCoefficient).toEqual(expect.anything()); + expect(result.st).toEqual(expect.anything()); + console.log(resp); }); }) - test('getTradeHistory request test', ()=> { + test('getAllSymbols request test', ()=> { /** - * getTradeHistory - * Get Trade History - * /api/v1/market/histories + * getAllSymbols + * Get All Symbols + * /api/v2/symbols */ - let builder = GetTradeHistoryReq.builder(); - builder.setSymbol(?); + let builder = GetAllSymbolsReq.builder(); + builder.setMarket(?); let req = builder.build(); - let resp = api.getTradeHistory(req); + let resp = api.getAllSymbols(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -93,6 +133,53 @@ describe('Auto Test', ()=> { expect(result.bestBidSize).toEqual(expect.anything()); expect(result.bestAsk).toEqual(expect.anything()); expect(result.bestAskSize).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getAllTickers request test', ()=> { + /** + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers + */ + let resp = api.getAllTickers(); + return resp.then(result => { + expect(result.time).toEqual(expect.anything()); + expect(result.ticker).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/market/histories + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getKlines request test', ()=> { + /** + * getKlines + * Get Klines + * /api/v1/market/candles + */ + let builder = GetKlinesReq.builder(); + builder.setSymbol(?).setType(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) @@ -111,48 +198,26 @@ describe('Auto Test', ()=> { expect(result.sequence).toEqual(expect.anything()); expect(result.bids).toEqual(expect.anything()); expect(result.asks).toEqual(expect.anything()); + console.log(resp); }); }) - test('get24hrStats request test', ()=> { + test('getFullOrderBook request test', ()=> { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/market/stats + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 */ - let builder = Get24hrStatsReq.builder(); + let builder = GetFullOrderBookReq.builder(); builder.setSymbol(?); let req = builder.build(); - let resp = api.get24hrStats(req); + let resp = api.getFullOrderBook(req); return resp.then(result => { expect(result.time).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.buy).toEqual(expect.anything()); - expect(result.sell).toEqual(expect.anything()); - expect(result.changeRate).toEqual(expect.anything()); - expect(result.changePrice).toEqual(expect.anything()); - expect(result.high).toEqual(expect.anything()); - expect(result.low).toEqual(expect.anything()); - expect(result.vol).toEqual(expect.anything()); - expect(result.volValue).toEqual(expect.anything()); - expect(result.last).toEqual(expect.anything()); - expect(result.averagePrice).toEqual(expect.anything()); - expect(result.takerFeeRate).toEqual(expect.anything()); - expect(result.makerFeeRate).toEqual(expect.anything()); - expect(result.takerCoefficient).toEqual(expect.anything()); - expect(result.makerCoefficient).toEqual(expect.anything()); - }); - }) - - test('getMarketList request test', ()=> { - /** - * getMarketList - * Get Market List - * /api/v1/markets - */ - let resp = api.getMarketList(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + console.log(resp); }); }) @@ -1063,153 +1128,106 @@ describe('Auto Test', ()=> { expect(result.BAX).toEqual(expect.anything()); expect(result.FTM3S).toEqual(expect.anything()); expect(result.COTI).toEqual(expect.anything()); + console.log(resp); }); }) - test('getServiceStatus request test', ()=> { + test('get24hrStats request test', ()=> { /** - * getServiceStatus - * Get Service Status - * /api/v1/status + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats */ - let resp = api.getServiceStatus(); + let builder = Get24hrStatsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.get24hrStats(req); return resp.then(result => { - expect(result.status).toEqual(expect.anything()); - expect(result.msg).toEqual(expect.anything()); + expect(result.time).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.buy).toEqual(expect.anything()); + expect(result.sell).toEqual(expect.anything()); + expect(result.changeRate).toEqual(expect.anything()); + expect(result.changePrice).toEqual(expect.anything()); + expect(result.high).toEqual(expect.anything()); + expect(result.low).toEqual(expect.anything()); + expect(result.vol).toEqual(expect.anything()); + expect(result.volValue).toEqual(expect.anything()); + expect(result.last).toEqual(expect.anything()); + expect(result.averagePrice).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.takerCoefficient).toEqual(expect.anything()); + expect(result.makerCoefficient).toEqual(expect.anything()); + console.log(resp); }); }) - test('getServerTime request test', ()=> { + test('getMarketList request test', ()=> { /** - * getServerTime - * Get Server Time - * /api/v1/timestamp + * getMarketList + * Get Market List + * /api/v1/markets */ - let resp = api.getServerTime(); + let resp = api.getMarketList(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getAllSymbols request test', ()=> { + test('getServerTime request test', ()=> { /** - * getAllSymbols - * Get All Symbols - * /api/v2/symbols + * getServerTime + * Get Server Time + * /api/v1/timestamp */ - let builder = GetAllSymbolsReq.builder(); - builder.setMarket(?); - let req = builder.build(); - let resp = api.getAllSymbols(req); + let resp = api.getServerTime(); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSymbol request test', ()=> { - /** - * getSymbol - * Get Symbol - * /api/v2/symbols/{symbol} - */ - let builder = GetSymbolReq.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getSymbol(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.name).toEqual(expect.anything()); - expect(result.baseCurrency).toEqual(expect.anything()); - expect(result.quoteCurrency).toEqual(expect.anything()); - expect(result.feeCurrency).toEqual(expect.anything()); - expect(result.market).toEqual(expect.anything()); - expect(result.baseMinSize).toEqual(expect.anything()); - expect(result.quoteMinSize).toEqual(expect.anything()); - expect(result.baseMaxSize).toEqual(expect.anything()); - expect(result.quoteMaxSize).toEqual(expect.anything()); - expect(result.baseIncrement).toEqual(expect.anything()); - expect(result.quoteIncrement).toEqual(expect.anything()); - expect(result.priceIncrement).toEqual(expect.anything()); - expect(result.priceLimitRate).toEqual(expect.anything()); - expect(result.minFunds).toEqual(expect.anything()); - expect(result.isMarginEnabled).toEqual(expect.anything()); - expect(result.enableTrading).toEqual(expect.anything()); - expect(result.feeCategory).toEqual(expect.anything()); - expect(result.makerFeeCoefficient).toEqual(expect.anything()); - expect(result.takerFeeCoefficient).toEqual(expect.anything()); - expect(result.st).toEqual(expect.anything()); - }); - }) - - test('getAnnouncements request test', ()=> { - /** - * getAnnouncements - * Get Announcements - * /api/v3/announcements - */ - let builder = GetAnnouncementsReq.builder(); - builder.setCurrentPage(?).setPageSize(?).setAnnType(?).setLang(?).setStartTime(?).setEndTime(?); - let req = builder.build(); - let resp = api.getAnnouncements(req); - return resp.then(result => { - expect(result.totalNum).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - }); - }) - - test('getCurrency request test', ()=> { + test('getServiceStatus request test', ()=> { /** - * getCurrency - * Get Currency - * /api/v3/currencies/{currency} + * getServiceStatus + * Get Service Status + * /api/v1/status */ - let builder = GetCurrencyReq.builder(); - builder.setCurrency(?).setChain(?); - let req = builder.build(); - let resp = api.getCurrency(req); + let resp = api.getServiceStatus(); return resp.then(result => { - expect(result.currency).toEqual(expect.anything()); - expect(result.name).toEqual(expect.anything()); - expect(result.fullName).toEqual(expect.anything()); - expect(result.precision).toEqual(expect.anything()); - expect(result.confirms).toEqual(expect.anything()); - expect(result.contractAddress).toEqual(expect.anything()); - expect(result.isMarginEnabled).toEqual(expect.anything()); - expect(result.isDebitEnabled).toEqual(expect.anything()); - expect(result.chains).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.msg).toEqual(expect.anything()); + console.log(resp); }); }) - test('getAllCurrencies request test', ()=> { + test('getPublicToken request test', ()=> { /** - * getAllCurrencies - * Get All Currencies - * /api/v3/currencies + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public */ - let resp = api.getAllCurrencies(); + let resp = api.getPublicToken(); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); }); }) - test('getFullOrderBook request test', ()=> { + test('getPrivateToken request test', ()=> { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v3/market/orderbook/level2 + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private */ - let builder = GetFullOrderBookReq.builder(); - builder.setSymbol(?); - let req = builder.build(); - let resp = api.getFullOrderBook(req); + let resp = api.getPrivateToken(); return resp.then(result => { - expect(result.time).toEqual(expect.anything()); - expect(result.sequence).toEqual(expect.anything()); - expect(result.bids).toEqual(expect.anything()); - expect(result.asks).toEqual(expect.anything()); + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/spot/market/api_market.test.ts b/sdk/node/src/generate/spot/market/api_market.test.ts index ec24fe4c..5d8e1081 100644 --- a/sdk/node/src/generate/spot/market/api_market.test.ts +++ b/sdk/node/src/generate/spot/market/api_market.test.ts @@ -1,8 +1,8 @@ import { GetAnnouncementsResp } from './model_get_announcements_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; import { Get24hrStatsReq } from './model_get24hr_stats_req'; -import { GetAllSymbolsReq } from './model_get_all_symbols_req'; import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetAllSymbolsReq } from './model_get_all_symbols_req'; import { GetTickerReq } from './model_get_ticker_req'; import { GetPrivateTokenResp } from './model_get_private_token_resp'; import { GetFiatPriceResp } from './model_get_fiat_price_resp'; @@ -13,8 +13,8 @@ import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookReq } from './model_get_full_order_book_req'; import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; -import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetMarketListResp } from './model_get_market_list_resp'; import { GetCurrencyReq } from './model_get_currency_req'; import { GetAllCurrenciesResp } from './model_get_all_currencies_resp'; @@ -30,60 +30,96 @@ import { GetKlinesResp } from './model_get_klines_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getPrivateToken request test', () => { + test('getAnnouncements request test', () => { /** - * getPrivateToken - * Get Private Token - Spot/Margin - * /api/v1/bullet-private + * getAnnouncements + * Get Announcements + * /api/v3/announcements */ + let data = + '{"currentPage": 1, "pageSize": 50, "annType": "latest-announcements", "lang": "en_US", "startTime": 1729594043000, "endTime": 1729697729000}'; + let req = new GetAnnouncementsReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getPrivateToken response test', () => { + test('getAnnouncements response test', () => { /** - * getPrivateToken - * Get Private Token - Spot/Margin - * /api/v1/bullet-private + * getAnnouncements + * Get Announcements + * /api/v3/announcements */ + let data = + '{\n "code": "200000",\n "data": {\n "totalNum": 195,\n "totalPage": 13,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "annId": 129045,\n "annTitle": "KuCoin Isolated Margin Adds the Scroll (SCR) Trading Pair",\n "annType": [\n "latest-announcements"\n ],\n "annDesc": "To enrich the variety of assets available,\xa0KuCoin\u2019s Isolated Margin Trading platform has added the Scroll (SCR)\xa0asset and trading pair.",\n "cTime": 1729594043000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/kucoin-isolated-margin-adds-scr?lang=en_US"\n },\n {\n "annId": 129001,\n "annTitle": "DAPP-30D Fixed Promotion, Enjoy an APR of 200%!\u200b",\n "annType": [\n "latest-announcements",\n "activities"\n ],\n "annDesc": "KuCoin Earn will be launching the DAPP Fixed Promotion at 10:00:00 on October 22, 2024 (UTC). The available product is \u201cDAPP-30D\'\' with an APR of 200%.",\n "cTime": 1729588460000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/dapp-30d-fixed-promotion-enjoy?lang=en_US"\n },\n {\n "annId": 128581,\n "annTitle": "NAYM (NAYM) Gets Listed on KuCoin! World Premiere!",\n "annType": [\n "latest-announcements",\n "new-listings"\n ],\n "annDesc": "Trading:\xa011:00 on October 22, 2024 (UTC)",\n "cTime": 1729497729000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/en-naym-naym-gets-listed-on-kucoin-world-premiere?lang=en_US"\n }\n ]\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetAnnouncementsResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('getPublicToken request test', () => { + test('getCurrency request test', () => { /** - * getPublicToken - * Get Public Token - Spot/Margin - * /api/v1/bullet-public + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} */ + let data = '{"currency": "BTC", "chain": "eth"}'; + let req = new GetCurrencyReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getPublicToken response test', () => { + test('getCurrency response test', () => { /** - * getPublicToken - * Get Public Token - Spot/Margin - * /api/v1/bullet-public + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} */ + let data = + '{"code":"200000","data":{"currency":"BTC","name":"BTC","fullName":"Bitcoin","precision":8,"confirms":null,"contractAddress":null,"isMarginEnabled":true,"isDebitEnabled":true,"chains":[{"chainName":"BTC","withdrawalMinSize":"0.001","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":3,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"btc"},{"chainName":"Lightning Network","withdrawalMinSize":"0.00001","depositMinSize":"0.00001","withdrawFeeRate":"0","withdrawalMinFee":"0.000015","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":1,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":"0.03","needTag":false,"chainId":"btcln"},{"chainName":"KCC","withdrawalMinSize":"0.0008","depositMinSize":null,"withdrawFeeRate":"0","withdrawalMinFee":"0.00002","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":20,"preConfirms":20,"contractAddress":"0xfa93c12cd345c658bc4644d1d4e1b9615952258c","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"kcc"},{"chainName":"BTC-Segwit","withdrawalMinSize":"0.0008","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":false,"isDepositEnabled":true,"confirms":2,"preConfirms":2,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"bech32"}]}}'; + let commonResp = RestResponse.fromJson(data); + let resp = new GetCurrencyResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('getAllTickers request test', () => { + test('getAllCurrencies request test', () => { /** - * getAllTickers - * Get All Tickers - * /api/v1/market/allTickers + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies */ }); - test('getAllTickers response test', () => { + test('getAllCurrencies response test', () => { /** - * getAllTickers - * Get All Tickers - * /api/v1/market/allTickers + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies */ }); - test('getKlines request test', () => { + test('getSymbol request test', () => { /** - * getKlines - * Get Klines - * /api/v1/market/candles + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} */ - let data = - '{"symbol": "BTC-USDT", "type": "1min", "startAt": 1566703297, "endAt": 1566789757}'; - let req = new GetKlinesReq(); + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetSymbolReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -91,16 +127,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getKlines response test', () => { + test('getSymbol response test', () => { /** - * getKlines - * Get Klines - * /api/v1/market/candles + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} */ let data = - '{\n "code": "200000",\n "data": [\n [\n "1566789720",\n "10411.5",\n "10401.9",\n "10411.5",\n "10396.3",\n "29.11357276",\n "302889.301529914"\n ],\n [\n "1566789660",\n "10416",\n "10411.5",\n "10422.3",\n "10411.5",\n "15.61781842",\n "162703.708997029"\n ],\n [\n "1566789600",\n "10408.6",\n "10416",\n "10416",\n "10405.4",\n "12.45584973",\n "129666.51508559"\n ]\n ]\n}'; + '{"code":"200000","data":{"symbol":"BTC-USDT","name":"BTC-USDT","baseCurrency":"BTC","quoteCurrency":"USDT","feeCurrency":"USDT","market":"USDS","baseMinSize":"0.00001","quoteMinSize":"0.1","baseMaxSize":"10000000000","quoteMaxSize":"99999999","baseIncrement":"0.00000001","quoteIncrement":"0.000001","priceIncrement":"0.1","priceLimitRate":"0.1","minFunds":"0.1","isMarginEnabled":true,"enableTrading":true,"feeCategory":1,"makerFeeCoefficient":"1.00","takerFeeCoefficient":"1.00","st":false}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetKlinesResp(); + let resp = new GetSymbolResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -109,14 +145,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getTradeHistory request test', () => { + test('getAllSymbols request test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/market/histories + * getAllSymbols + * Get All Symbols + * /api/v2/symbols */ - let data = '{"symbol": "BTC-USDT"}'; - let req = new GetTradeHistoryReq(); + let data = '{"market": "ALTS"}'; + let req = new GetAllSymbolsReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -124,16 +160,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getTradeHistory response test', () => { + test('getAllSymbols response test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/market/histories + * getAllSymbols + * Get All Symbols + * /api/v2/symbols */ let data = - '{\n "code": "200000",\n "data": [\n {\n "sequence": "10976028003549185",\n "price": "67122",\n "size": "0.000025",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549188",\n "price": "67122",\n "size": "0.01792257",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549191",\n "price": "67122.9",\n "size": "0.05654289",\n "side": "buy",\n "time": 1729177117877000000\n }\n ]\n}'; + '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "feeCurrency": "USDT",\n "market": "USDS",\n "baseMinSize": "0.00001",\n "quoteMinSize": "0.1",\n "baseMaxSize": "10000000000",\n "quoteMaxSize": "99999999",\n "baseIncrement": "0.00000001",\n "quoteIncrement": "0.000001",\n "priceIncrement": "0.1",\n "priceLimitRate": "0.1",\n "minFunds": "0.1",\n "isMarginEnabled": true,\n "enableTrading": true,\n "feeCategory": 1,\n "makerFeeCoefficient": "1.00",\n "takerFeeCoefficient": "1.00",\n "st": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); + let resp = new GetAllSymbolsResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -175,47 +211,29 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getPartOrderBook request test', () => { + test('getAllTickers request test', () => { /** - * getPartOrderBook - * Get Part OrderBook - * /api/v1/market/orderbook/level2_{size} + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers */ - let data = '{"symbol": "BTC-USDT", "size": "20"}'; - let req = new GetPartOrderBookReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('getPartOrderBook response test', () => { + test('getAllTickers response test', () => { /** - * getPartOrderBook - * Get Part OrderBook - * /api/v1/market/orderbook/level2_{size} + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers */ - let data = - '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetPartOrderBookResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); - test('get24hrStats request test', () => { + test('getTradeHistory request test', () => { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/market/stats + * getTradeHistory + * Get Trade History + * /api/v1/market/histories */ let data = '{"symbol": "BTC-USDT"}'; - let req = new Get24hrStatsReq(); + let req = new GetTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -223,16 +241,16 @@ describe('Auto Test', () => { console.log(req); }); - test('get24hrStats response test', () => { + test('getTradeHistory response test', () => { /** - * get24hrStats - * Get 24hr Stats - * /api/v1/market/stats + * getTradeHistory + * Get Trade History + * /api/v1/market/histories */ let data = - '{"code":"200000","data":{"time":1729175612158,"symbol":"BTC-USDT","buy":"66982.4","sell":"66982.5","changeRate":"-0.0114","changePrice":"-778.1","high":"68107.7","low":"66683.3","vol":"1738.02898182","volValue":"117321982.415978333","last":"66981.5","averagePrice":"67281.21437289","takerFeeRate":"0.001","makerFeeRate":"0.001","takerCoefficient":"1","makerCoefficient":"1"}}'; + '{\n "code": "200000",\n "data": [\n {\n "sequence": "10976028003549185",\n "price": "67122",\n "size": "0.000025",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549188",\n "price": "67122",\n "size": "0.01792257",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549191",\n "price": "67122.9",\n "size": "0.05654289",\n "side": "buy",\n "time": 1729177117877000000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new Get24hrStatsResp(); + let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -241,29 +259,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getMarketList request test', () => { - /** - * getMarketList - * Get Market List - * /api/v1/markets - */ - }); - - test('getMarketList response test', () => { - /** - * getMarketList - * Get Market List - * /api/v1/markets - */ - }); - test('getFiatPrice request test', () => { + test('getKlines request test', () => { /** - * getFiatPrice - * Get Fiat Price - * /api/v1/prices + * getKlines + * Get Klines + * /api/v1/market/candles */ - let data = '{"base": "USD", "currencies": "example_string_default_value"}'; - let req = new GetFiatPriceReq(); + let data = + '{"symbol": "BTC-USDT", "type": "1min", "startAt": 1566703297, "endAt": 1566789757}'; + let req = new GetKlinesReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -271,16 +275,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getFiatPrice response test', () => { + test('getKlines response test', () => { /** - * getFiatPrice - * Get Fiat Price - * /api/v1/prices + * getKlines + * Get Klines + * /api/v1/market/candles */ let data = - '{"code":"200000","data":{"AGLD":"1.1174410000000001","DFI":"0.0168915500000000","PYTHUP":"0.0397880960000000","ISLM":"0.0606196750000000","NEAR":"4.7185395500000000","AIOZ":"0.4862867350000000","AUDIO":"0.1219390000000000","BBL":"0.0067766100000000","WLD":"2.2893547500000000","HNT":"5.8990489999999984","ETHFI":"1.5892050000000000","DMAIL":"0.2726636000000000","OPUP":"0.0986506500000000","VET3S":"0.0003700448850000","MANA3S":"0.0006056970000000","TIDAL":"0.0001154422500000","HALO":"0.0058270850000000","OPUL":"0.0839480050000000","MANA3L":"0.0029569407900000","DGB":"0.0066556705000000","AA":"0.2406796000000000","BCH":"366.2167999999996484","GMEE":"0.0113333305000000","JST":"0.0302348750000000","PBUX":"0.0208795550000000","AR":"18.5457224999999909","SEI":"0.4332832500000000","PSTAKE":"0.0493153300000000","LMWR":"0.1618190500000000","UNFIDOWN":"0.0062058955000000","BB":"0.3245376500000000","JTO":"2.1239375000000002","WEMIX":"0.7916040000000000","G":"0.0324037900000000","MARSH":"0.0617591050000000","BN":"0.0036961510000000","FLIP":"1.0976509000000000","FLR":"0.0144827550000000","BIGTIME":"0.1238780300000000","FLY":"0.0005157420000000","T":"0.0233483200000000","W":"0.2865566500000000","BDX":"0.0774012800000000","BABYDOGE":"0.0000000029375305","SFP":"0.7256370000000000","DIA":"0.9179408000000000","ISME":"0.0022388800000000","LYM":"0.0010155919500000","VET3L":"0.0000289755050000","JUP":"0.8230882500000000","LYX":"1.4501745500000001","AIEPK":"0.0050094940000000","SILLY":"0.0159420250000000","SCPT":"0.0122038950000000","WOO":"0.1796601250000000","BLUR":"0.2462768000000000","STRK":"0.3963117450000000","BFC":"0.0383608100000000","DC":"0.0003097450500000","KARATE":"0.0007296350000000","SUSHI3L":"0.5115441000000000","NETVR":"0.0976111700000000","WAVES":"1.0806594000000000","LITH":"0.0001520239500000","HAPI":"8.6533711499999987","SUSHI3S":"1.2752620500000000","CEEK":"0.0294852500000000","FLOKI":"0.0001414292500000","SHR":"0.0012463765000000","SAND":"0.2566616050000000","TURT":"0.0020889550000000","UMA":"2.5207390000000000","BEPRO":"0.0003955021500000","SCRT":"0.1995002000000000","TUSD":"0.9945025000000000","COOKIE":"0.0220089900000000","LRDS":"0.6218889000000000","SIN":"0.0033633175000000","OAS":"0.0331933950000000","ROOT":"0.0183108400000000","ADA3L":"0.0046396790000000","TIAUP":"0.1228385500000000","HTR":"0.0353023400000000","UNB":"0.0003837080500000","UNA":"0.0164917500000000","HARD":"0.1087056200000000","G3":"0.0502648550000000","ADA3S":"0.0006191202850000","MYRO":"0.1071863800000000","HTX":"0.0000013693150000","FT":"0.3585206500000000","BTCDOWN":"0.1065467000000000","UNI":"7.3571195999999993","FX":"0.1379310000000000","OBI":"0.0079030465000000","UNO":"0.0137131400000000","WRX":"0.1221389000000000","TIADOWN":"0.0000914642450000","ETHDOWN":"0.1306346500000000","WELL":"0.0471244260000000","SWFTC":"0.0028966509500000","SKL":"0.0362418700000000","UOS":"0.0867765900000000","AIPAD":"0.0478660550000000","BRETT":"0.1037481000000000","SKY":"0.0520139800000000","FRM":"0.0153123400000000","VISION":"0.0014451770500000","LENDS":"0.0047276350000000","SLF":"0.3318340000000000","BULL":"0.0023988000000000","FLOW":"0.5372312500000000","ODDZ":"0.0063368300000000","SLN":"0.2804597000000000","UPO":"0.0440779500000000","SLP":"0.0023997995000000","ID":"0.3718140000000000","SLIM":"0.0906446550000000","SPOT":"0.0021289350000000","DOP":"0.0023028480000000","ISSP":"0.0000874562500000","UQC":"3.2339822000000003","IO":"1.8185902499999999","DOT":"4.2022978000000005","1INCH":"0.2645676500000000","SMH":"0.3448275000000000","MAK":"0.0396701550000000","TOKO":"0.0005923037000000","TURBO":"0.0108085930000000","UNFI":"2.8555714999999996","MAN":"0.0210764565000000","EVER":"0.0332733550000000","FTM":"0.7259068650000000","SHRAP":"0.0476361700000000","MAV":"0.1738130500000000","MAX":"0.2864966800000000","DPR":"0.0018240875000000","FTT":"2.0559715000000002","ARKM":"1.7444273499999999","ATOM":"4.2954512000000002","PENDLE":"4.1554212500000007","QUICK":"0.0365317250000000","BLZ":"0.1217191100000000","BOBA":"0.2014092450000000","MBL":"0.0027856065000000","OFN":"0.1252373500000000","UNIO":"0.0025487250000000","SNS":"0.0200899500000000","SNX":"1.4282854999999999","NXRA":"0.0272763550000000","TAIKO":"1.4392800000000001","AVAX3L":"0.1410875109550000","L3":"0.0608395650000000","API3":"1.3728132500000001","XRP3S":"0.0028095945000000","QKC":"0.0085157400000000","AVAX3S":"0.5148424500000000","ROSE":"0.0693453100000000","SATS":"0.0000002701648500","BMX":"0.3100449000000000","PORTAL":"0.2811593500000000","TOMI":"0.0309045400000000","XRP3L":"2.1586201500000002","SOL":"151.7250995000003583","SON":"0.0002421788500000","BNC":"0.1882058500000000","SOCIAL":"0.0026486750000000","CGPT":"0.1305147100000000","CELR":"0.0127736100000000","BNB":"591.0973035000118935","OGN":"0.0852573500000000","CELO":"0.7711142500000000","AUCTION":"13.1634150000000014","MANTA":"0.7564216000000000","LAYER":"0.0372713550000000","AERO":"1.3783104999999999","CETUS":"0.1808295400000000","LL":"0.0201199350000000","SPA":"0.0067426270000000","PYTHDOWN":"0.0011834080000000","NEIROCTO":"0.0019964013000000","UTK":"0.0365217300000000","GMRX":"0.0007386305000000","BOB":"0.0000380619595000","HOTCROSS":"0.0056491740000000","AERGO":"0.1007595950000000","MOCA":"0.0783608000000000","SQD":"0.0380809500000000","MV":"0.0081359300000000","BNB3L":"0.2761618500000000","BNB3S":"0.0008545725000000","GALAX3L":"0.0057571999600000","KAI":"0.0020080954500000","SQR":"0.0470764500000000","GALAX3S":"0.1933033000000000","EGLD":"25.5272299999999713","ZBCN":"0.0010404795000000","KAS":"0.1216691350000000","MEW":"0.0086176890000000","PUNDIX":"0.4130933500000000","LOOKS":"0.0392803500000000","FXS":"1.9060465000000000","BOSON":"0.2732633000000000","BRISE":"0.0000000860569500","AEVO":"0.3388305000000000","FLUX":"0.5276360500000000","PRCL":"0.1969015000000000","UNFIUP":"0.0011654170000000","SEIDOWN":"0.0442778500000000","DOAI":"0.0052363805000000","QNT":"65.4312679999998206","REDO":"0.2837580500000000","STRIKE":"6.8225869999999997","ETHW":"3.2418782499999998","OM":"1.5396797750000000","OP":"1.6911539999999999","WHALE":"0.8134930500000000","1CAT":"0.0018460765000000","NEON":"0.4446775500000000","GTAI":"0.7786105000000000","SSV":"21.2393749999999841","ETH2":"2601.6678843156403923","KCS":"8.7646155000000020","ARPA":"0.0393882960000000","ARTFI":"0.0141029450000000","BRL":"0.1742807323452485","ALEX":"0.0924537500000000","STG":"0.2943527500000000","SHIB":"0.0000178060925000","IOTX":"0.0394202800000000","OLE":"0.0171414250000000","KDA":"0.5653172000000000","CERE":"0.0022548720000000","DOCK":"0.0018990500000000","STX":"1.8157916500000000","OLT":"0.0007596200000000","QI":"0.0131754090000000","SDAO":"0.2748625000000000","BLAST":"0.0087636160000000","LINK3S":"0.0000702948350000","IOST":"0.0049745115000000","SUI":"2.0589700000000000","CAKE":"1.7941024999999999","BSW":"0.0586706500000000","OMG":"0.2597700500000000","VOLT":"0.0000002716641000","LINK3L":"1.3408292499999999","GEEQ":"0.0385607100000000","PYUSD":"0.9988003500000000","SUN":"0.0186106900000000","TOWER":"0.0014812590000000","BTC":"67133.4165000832051564","IOTA":"0.1189405000000000","REEF":"0.0019960015000000","TRIAS":"3.3683149999999998","KEY":"0.0037594713240047","ETH3L":"0.0003305946200000","BTT":"0.0000009117439000","ONE":"0.0132003965000000","RENDER":"5.2263854999999995","ETH3S":"0.5517240000000000","ANKR":"0.0264867500000000","ALGO":"0.1188405500000000","SYLO":"0.0007600198000000","ZCX":"0.0784707450000000","SD":"0.3851073500000000","ONT":"0.1877960550000000","MJT":"0.0132433750000000","DYM":"1.6659666000000001","DYP":"0.0205397250000000","BAKEUP":"0.0389894955000000","OOE":"0.0079360300000000","ZELIX":"0.0000649675000000","DOGE3L":"0.3837080500000000","ARTY":"0.3980009000000000","QORPO":"0.1204297550000000","ICE":"0.0051504235000000","NOTAI":"0.0000892753400000","DOGE3S":"0.2291853500000000","NAKA":"1.0695649500000000","GALAX":"0.0212893500000000","MKR":"1245.8767500000163833","DODO":"0.1152423500000000","ICP":"7.6731615000000027","ZEC":"35.9400209999999543","ZEE":"0.0065767100000000","ICX":"0.1383308000000000","KMNO":"0.0921499020000000","TT":"0.0033883050000000","DOT3L":"0.1454272500000000","XAI":"0.2038980000000000","ZEN":"8.0149905000000007","DOGE":"0.1213093150000000","ALPHA":"0.0567416150000000","DUSK":"0.1964517250000000","DOT3S":"0.0053613180000000","SXP":"0.2538730000000000","HBAR":"0.0510044850000000","SYNT":"0.0467166300000000","ZEX":"0.0571714000000000","BONDLY":"0.0022208890000000","MLK":"0.2080859050000000","KICKS":"0.0001301249050000","PEPE":"0.0000100249850000","OUSD":"0.9982006500000000","LUNCDOWN":"0.0000733333150000","DOGS":"0.0007086455000000","REV3L":"0.0094672640000000","CTSI":"0.1257371000000000","C98":"0.1219390000000000","OSMO":"0.5370313500000000","NTRN":"0.3869064500000000","CFX2S":"0.0084757600000000","SYN":"0.5636180500000000","VIDT":"0.0308745550000000","SYS":"0.0997501000000000","GAS":"4.3029474500000008","BOME":"0.0087336310000000","COMBO":"0.4068964500000000","XCH":"14.9825050000000010","VR":"0.0063538215000000","CFX2L":"0.0499660045000000","VSYS":"0.0005201398000000","PANDORA":"1629.2949450001102772","THETA":"1.2461766000000000","XCN":"0.0012699647000000","NEXG":"0.0039180400000000","MELOS":"0.0021244372500000","XCV":"0.0013253370000000","ORN":"0.8797599000000000","WLKN":"0.0010624685000000","AAVE":"154.2708259999996162","MNT":"0.6168914000000000","BONK":"0.0000227296295000","PERP":"0.6037979500000000","XDC":"0.0276361750000000","MNW":"0.3681158500000000","XDB":"0.0002578710000000","BOND":"1.5662165000000000","SUIA":"0.0809595000000000","MOG":"0.0000019330330000","SUTER":"0.0001840079500000","TIME":"16.2648634999999969","RACA":"0.0001949025000000","BICO":"0.2021988500000000","MON":"0.1066466500000000","SWEAT":"0.0063718125000000","MOXIE":"0.0022088950000000","BABYBNB":"0.0289755050000000","IGU":"0.0050674650000000","HMSTR":"0.0037990995000000","XEC":"0.0000354722550000","MONI":"0.0058470750000000","XR":"0.2374812000000000","PEOPLE":"0.0796601500000000","PUMLX":"0.0054572700000000","ZIL":"0.0145927000000000","WLDDOWN":"0.2089954500000000","VAI":"0.0799999800000000","XEN":"0.0000000839580000","MPC":"0.1001499000000000","XEM":"0.0176951480000000","JASMY3S":"0.0019670160000000","OTK":"0.0290464695000000","TRAC":"0.4521738000000000","DFYN":"0.0070664650000000","BIDP":"0.0001939030000000","JASMY3L":"0.0001653772700000","INJDOWN":"0.0000194902500000","KLV":"0.0019310340000000","WAXL":"0.7858069000000000","TRBDOWN":"0.0023138425000000","BCH3L":"4.6390663064999996","GMT3S":"0.0000457771000000","KMD":"0.2493752500000000","BCH3S":"0.9634180500000000","ECOX":"0.0987506000000000","AAVE3S":"0.0560719500000000","GMT3L":"0.0053983694650000","EPIK":"0.0045857060000000","SUIP":"0.1067565950000000","AAVE3L":"0.3638687346200000","ZK":"0.1262368500000000","ZKF":"0.0008595700000000","OMNIA":"0.7624186000000000","ZKJ":"1.1124435000000000","ZKL":"0.1255372000000000","GAFI":"3.0634675000000001","CARV":"0.8703646000000000","KNC":"0.4433782000000000","CATS":"0.0000599700000000","PROM":"5.2833570000000006","ALEPH":"0.1756121500000000","PONKE":"0.3958020000000000","OVR":"0.1553223000000000","CATI":"0.4105146400000000","ORDER":"0.1183008200000000","GFT":"0.0166616650000000","BIFI":"0.0020489750000000","GGC":"6.9965029985000000","GGG":"0.0403798000000000","DAPPX":"0.0043788095000000","SUKU":"0.0618790450000000","ULTI":"0.0168015950000000","CREDI":"0.0192903500000000","ERTHA":"0.0010014990000000","FURY":"0.1405297000000000","KARRAT":"0.5577210000000000","MOBILE":"0.0009005495000000","SIDUS":"0.0037671155000000","NAVI":"0.1254672350000000","TAO":"583.4081500000051807","USDJ":"1.1386304000000001","MTL":"0.9563216000000000","VET":"0.0225387250000000","FITFI":"0.0036421780000000","USDT":"0.9995000000000000","OXT":"0.0695652000000000","CANDY":"0.0005597200000000","USDP":"0.9932031500000000","MTS":"0.0027516235000000","TADA":"0.0283858000000000","MTV":"0.0006559718500000","NAVX":"0.1342228550000000","ILV":"35.6771524999999671","VINU":"0.0000000109045450","GHX":"0.0903548000000000","EDU":"0.5167415000000000","HYVE":"0.0137331300000000","BTC3L":"0.0058620675000000","ANYONE":"0.9015490000000000","BEAT":"0.0012593700000000","KING":"0.0004821588000000","CREAM":"15.6541689999999973","CAS":"0.0038590695000000","IMX":"1.4944524000000000","CAT":"0.0000256981445000","BTC3S":"0.0014142925000000","USDE":"0.9985005000000000","USDD":"1.0000997000000000","CWAR":"0.0037981000000000","USDC":"0.9997998500000000","KRL":"0.3543127550000000","INJ":"21.7691100000000194","GAME":"0.0139630150000000","TRIBL":"1.0994500000000000","XLM":"0.0948525500000000","TRBUP":"0.0012293850000000","VRADOWN":"0.0013433280000000","SUPER":"1.2853570000000000","EIGEN":"3.1536223999999999","IOI":"0.0146926500000000","KSM":"17.5212350000000129","CCD":"0.0034832575000000","EGO":"0.0093553200000000","EGP":"2.7946019999999998","MXC":"0.0066866550000000","TEL":"0.0014432780000000","MOVR":"9.1340307000000027","XMR":"155.5421899999990755","MXM":"0.0092853550000000","OORT":"0.1099949750000000","GLM":"0.3231383500000000","RAY":"2.0228880499999998","XTAG":"0.0218190850000000","GLQ":"0.0854572500000000","CWEB":"0.0038480750000000","REVU":"0.0105047450000000","REVV":"0.0039760110000000","ZRO":"3.7952014499999994","XNL":"0.0093853050000000","XNO":"0.8496749500000000","SAROS":"0.0019290350000000","KACE":"2.1165411999999998","ZRX":"0.3186406000000000","WLTH":"0.0374312750000000","ATOM3L":"0.0321719060000000","GMM":"0.0001497251000000","BEER":"0.0000138670630000","GMT":"0.1275362000000000","HEART":"0.0159920000000000","GMX":"22.7186349999999882","ABBC":"0.0061769100000000","OMNI":"8.9235359999999970","ATOM3S":"0.0007945225400000","IRL":"0.0099650150000000","CFG":"0.3248375000000000","WSDM":"0.0139830050000000","GNS":"1.8390800000000001","VANRY":"0.0809295150000000","CFX":"0.1595202000000000","GRAIL":"817.1212349999937891","BEFI":"0.0175712100000000","VELO":"0.0132043945000000","XPR":"0.0008077959000000","DOVI":"0.0584707500000000","ACE":"0.0021349320000000","ACH":"0.0190534685000000","ISP":"0.0012161916000000","XCAD":"0.2834582000000000","MINA":"0.5630183500000000","TIA":"5.9318325999999999","DRIFT":"0.4350823500000000","ACQ":"0.0056981495000000","ACS":"0.0014917537500000","MIND":"0.0018920535000000","STORE":"0.0062358805000000","REN":"0.0351224300000000","ELA":"1.7282354500000000","DREAMS":"0.0002498750000000","ADA":"0.3463267500000000","ELF":"0.3777110500000000","REQ":"0.0959919800000000","STORJ":"0.5662167500000000","LADYS":"0.0000000837581000","PAXG":"2697.9303600003123340","REZ":"0.0409795000000000","XRD":"0.0157821050000000","CHO":"0.0205097400000000","CHR":"0.1769115000000000","ADS":"0.1889055000000000","CHZ":"0.0738030800000000","ADX":"0.1575212000000000","XRP":"0.5525036100000000","JASMY":"0.0188615645000000","KAGI":"0.1834582250000000","FIDA":"0.2282858000000000","PBR":"0.0291953950000000","AEG":"0.0093453250000000","H2O":"0.1610194500000000","CHMB":"0.0001715641750000","SAND3L":"0.0015447972150000","PBX":"0.0006879558500000","SOLVE":"0.0084557700000000","DECHAT":"0.1512243500000000","GARI":"0.0076861550000000","SHIB2L":"1.1996998499999999","SHIB2S":"0.0240879500000000","ENA":"0.3942028000000000","VEMP":"0.0029335325000000","ENJ":"0.1467266000000000","AFG":"0.0072163900000000","RATS":"0.0001211593900000","GRT":"0.1646076550000000","FORWARD":"0.0012873560000000","TFUEL":"0.0598800450000000","ENS":"17.0634640000000052","KASDOWN":"0.0258770550000000","XTM":"0.0251074400000000","DEGEN":"0.0084857550000000","TLM":"0.0100449750000000","DYDXDOWN":"0.1042598440000000","CKB":"0.0146026950000000","LUNC":"0.0000889255150000","AURORA":"0.1204397500000000","LUNA":"0.3624187000000000","XTZ":"0.6776610000000000","ELON":"0.0000001410294500","DMTR":"0.0891554000000000","EOS":"0.4759619000000000","GST":"0.0118940500000000","FORT":"0.1155422000000000","FLAME":"0.0247076400000000","PATEX":"0.9605195000000000","DEEP":"0.0328885475000000","ID3L":"0.0016201895000000","GTC":"0.6625685500000000","ID3S":"0.0071674145000000","RIO":"0.7616190000000000","CLH":"0.0008555720000000","BURGER":"0.4016990500000000","VRA":"0.0029765110000000","SUNDOG":"0.2173912500000000","GTT":"0.0002038980000000","INJUP":"0.2327835500000000","CPOOL":"0.1557720750000000","EPX":"0.0000740629500000","CLV":"0.0329835000000000","FEAR":"0.0560519600000000","MEME":"0.0124847545000000","ROOBEE":"0.0004520738500000","DEFI":"0.0192903500000000","TOKEN":"0.0477361200000000","GRAPE":"0.0020599695000000","KASUP":"0.3996001000000000","XWG":"0.0003843077500000","SKEY":"0.0621289200000000","SFUND":"1.3243375000000000","EQX":"0.0032823580000000","ORDIUP":"0.0548315705000000","TON":"5.1857058499999995","DEGO":"2.2667660500000001","IZI":"0.0088455750000000","ERG":"0.6605695500000000","ERN":"1.9255367500000001","VENOM":"0.0817591000000000","VOXEL":"0.1497251000000000","RLC":"1.4649671500000000","PHA":"0.1093453000000000","DYDXUP":"0.0112573685000000","APE3S":"0.0008475760000000","ORBS":"0.0288955450000000","OPDOWN":"0.6758619000000000","ESE":"0.0139130400000000","APE3L":"0.1339330000000000","HMND":"0.0982208650000000","COQ":"0.0000014432780000","AURY":"0.3340329000000000","CULT":"0.0000028025980000","AKT":"2.4642672500000001","GLMR":"0.1606196500000000","XYM":"0.0142528700000000","ORAI":"6.1769100000000012","XYO":"0.0058680645000000","ETC":"18.8458723500000169","LAI":"0.0142828550000000","PIP":"0.0178310800000000","ETH":"2607.6655149998362673","NEO":"10.3575186499999991","RMV":"0.0081659150000000","KLAY":"0.1251374000000000","PIT":"0.0000000003268365","TARA":"0.0043978000000000","KALT":"0.1128735350000000","PIX":"0.0001023687900000","ETN":"0.0021579205000000","CSIX":"0.0141729100000000","TRADE":"0.4708644500000000","MAVIA":"1.3592200500000001","HIGH":"1.3043474999999999","TRB":"62.5387150000000006","ORDI":"35.7421200000000126","TRVL":"0.0373643085000000","AMB":"0.0059670150000000","TRU":"0.0762018800000000","LOGX":"0.0271963950000000","FINC":"0.0362018900000000","INFRA":"0.1978010500000000","NATIX":"0.0008729633000000","NFP":"0.2152923000000000","TRY":"0.0292166033323590","TRX":"0.1597201000000000","LBP":"0.0001243378000000","LBR":"0.0595702000000000","EUL":"2.9735125000000000","NFT":"0.0000004077960000","SEIUP":"0.0478110825000000","PUFFER":"0.3676161000000000","EUR":"1.0811249323958897","ORCA":"2.0664662499999999","NEAR3L":"0.0117010765350000","AMP":"0.0038330825000000","XDEFI":"0.0472563600000000","HIFI":"0.4947525000000000","TRUF":"0.0459570100000000","AITECH":"0.1045477000000000","AMU":"0.0043978000000000","USTC":"0.0214692600000000","KNGL":"0.0499750000000000","FOXY":"0.0102686631000000","NGC":"0.0147935995000000","TENET":"0.0043278350000000","NEAR3S":"0.0072553705000000","MAHA":"1.1904045000000000","NGL":"0.0701748950000000","TST":"0.0080359800000000","HIPPO":"0.0104447750000000","AXS3S":"0.0308705570000000","CRO":"0.0781409100000000","ZPAY":"0.0050574700000000","MNDE":"0.1026786350000000","CRV":"0.2534732000000000","SWASH":"0.0056271850000000","AXS3L":"0.0106388779000000","VERSE":"0.0001803098000000","RPK":"0.0049975000000000","RPL":"10.9745099999999958","AZERO":"0.3789104500000000","SOUL":"0.0534332700000000","VXV":"0.2619689500000000","LDO":"1.0885554500000000","MAGIC":"0.3390304000000000","ALICE":"1.0324835000000000","SEAM":"1.1933030499999999","PLU":"1.9300345000000001","AOG":"0.0031224380000000","SMOLE":"0.0000387806000000","EWT":"1.1094450000000000","TSUGT":"0.0029185400000000","PMG":"0.0800599500000000","OPAI":"0.0006826585000000","LOCUS":"0.0216591650000000","CTA":"0.0825087250000000","NIM":"0.0013673160000000","CTC":"0.4033982000000000","APE":"0.7035480500000000","MERL":"0.2720639000000000","JAM":"0.0004770613500000","CTI":"0.0130314810000000","APP":"0.0021989000000000","APT":"9.9947001500000000","WLDUP":"0.0093043455000000","ZEND":"0.1280759300000000","FIRE":"0.9113441000000000","DENT":"0.0008630682500000","PYTH":"0.3390603850000000","LFT":"0.0155322300000000","DPET":"0.0319040400000000","ORDIDOWN":"0.3788105000000000","KPOL":"0.0029175405000000","ETHUP":"8.4971493000000032","BAND":"1.0939527500000001","POL":"0.3656171000000000","ASTR":"0.0582608550000000","NKN":"0.0691654000000000","RSR":"0.0068055955000000","DVPN":"0.0005979009000000","TWT":"1.1119437500000000","ARB":"0.5510243500000000","CVC":"0.1409801746501747","ARC":"0.0300849500000000","XETA":"0.0022888550000000","MTRG":"0.4007995000000000","LOKA":"0.1867066000000000","LPOOL":"0.0660069800000000","TURBOS":"0.0034812585000000","CVX":"1.7816087499999999","ARX":"0.0007556220000000","MPLX":"0.4355221300000000","SUSHI":"0.7011492500000000","NLK":"0.0114442750000000","PEPE2":"0.0000000313843000","WBTC":"66881.4425499645548419","SUI3L":"0.0211204345000000","CWS":"0.1927036000000000","SUI3S":"0.0000579110300000","INSP":"0.0264167850000000","MANA":"0.2945026750000000","VRTX":"0.0641679000000000","CSPR":"0.0116441750000000","ATA":"0.0785007300000000","OPEN":"0.0080049955000000","HAI":"0.0448275750000000","NMR":"14.7436245000000072","ATH":"0.0540929400000000","LIT":"0.6282857000000000","TLOS":"0.3263467450000000","TNSR":"0.3662168000000000","CXT":"0.0871364100000000","POLYX":"0.2346826000000000","ZERO":"0.0002507745500000","ROUTE":"0.0610694500000000","LOOM":"0.0580009850000000","PRE":"0.0078680640000000","VRAUP":"0.0134652640000000","HBB":"0.0714742450000000","RVN":"0.0165017450000000","PRQ":"0.0715741950000000","ONDO":"0.7134930750000000","PEPEDOWN":"0.0000155022450000","WOOP":"0.0020179905000000","LUNCUP":"0.0168355780000000","KAVA":"0.3522238000000000","LKI":"0.0104187880000000","AVA":"0.4857570000000000","NOM":"0.0233883000000000","MAPO":"0.0089015470000000","PEPEUP":"0.0114252845000000","STRAX":"0.0487156300000000","NOT":"0.0078670645000000","ZERC":"0.1108245600000000","BCUT":"0.0255672100000000","MASA":"0.0691354150000000","WAN":"0.1785077544737212","WAT":"0.0003273762300000","WAX":"0.0327636100000000","MASK":"2.2259864500000002","EOS3L":"0.0002122138400000","IDEA":"0.0005887055000000","EOS3S":"0.0034472755000000","YFI":"4919.4290549999908843","MOODENG":"0.0774612500000000","XCUR":"0.0048845565000000","HYDRA":"0.2225886500000000","POPCAT":"1.3382305500000000","LQTY":"0.7848074000000000","PIXEL":"0.1406596350000000","LMR":"0.0145437245000000","ZETA":"0.5997999500000000","YGG":"0.4717640000000000","AXS":"4.6006985000000006","BCHSV":"49.8250749999999370","NRN":"0.0395802000000000","FTON":"0.0091954000000000","COMP":"43.6581599999999881","XPRT":"0.1819090000000000","HFT":"0.1443278000000000","UXLINK":"0.5085456000000000","STAMP":"0.0335032400000000","RUNE":"4.9233370999999996","ZEUS":"0.2587705500000000","LTC3L":"1.8294848000000001","DAPP":"0.1763118000000000","FORTH":"2.9508238500000004","ALPINE":"1.5322335000000000","SENSO":"0.0328835500000000","LTC3S":"0.0006986505000000","DEXE":"8.3795081500000028","GOAL":"0.0175912000000000","AVAX":"27.5602130000000058","LISTA":"0.3782108000000000","AMPL":"1.3743124999999999","WORK":"0.1384307500000000","BRWL":"0.0017391300000000","BANANA":"57.1314200000001362","PUSH":"0.0750624500000000","WEN":"0.0001015492000000","NEIRO":"0.0879560000000000","BTCUP":"34.7711057499999789","SOL3S":"0.0007816090000000","BRAWL":"0.0004776610500000","LAY3R":"0.2161918500000000","LPT":"11.9304317999999945","GODS":"0.1807096000000000","SAND3S":"4.6152911999999992","RDNT":"0.0640679500000000","SOL3L":"1.8351913752850000","NIBI":"0.0653772950000000","NUM":"0.0436181800000000","PYR":"2.5590198499999997","DAG":"0.0226176855000000","DAI":"0.9989006596042375","HIP":"0.0034982500000000","DAO":"0.2848575000000000","AVAIL":"0.1300929210000000","DAR":"0.1512243500000000","FET":"1.3760116500000000","FCON":"0.0001197600900000","XAVA":"0.3789104500000000","LRC":"0.1208395500000000","UNI3S":"0.0000653573050000","PZP":"0.0599600050000000","POKT":"0.0424787500000000","DASH":"23.6881500000000109","BAKEDOWN":"0.0003324636850000","POLC":"0.0061389290000000","DBR":"0.0377671070000000","CIRUS":"0.0055772100000000","UNI3L":"0.0993921490650000","NWC":"0.0681659000000000","POLK":"0.0142628650000000","LSD":"0.9420287500000000","MARS4":"0.0005878059500000","LSK":"0.8080957500000000","BLOCK":"0.0261869000000000","ANALOS":"0.0000446776500000","SAFE":"0.8779608000000000","DCK":"0.0234082900000000","LSS":"0.0562718500000000","DCR":"12.4337799999999929","LIKE":"0.0559720000000000","DATA":"0.0361819000000000","WIF":"2.5696145499999999","BLOK":"0.0006546725000000","LTC":"71.6261690000000611","METIS":"42.0289750000000612","WIN":"0.0000868365600000","HLG":"0.0018790600000000","LTO":"0.1166116650000000","DYDX":"0.9341327000000000","ARB3S":"0.0509025360000000","MUBI":"0.0303848000000000","ARB3L":"0.0025917035000000","RBTC1":"0.0000039480250000","POND":"0.0118640650000000","LINA":"0.0037771105000000","MYRIA":"0.0025337325000000","LINK":"11.0244849999999944","QTUM":"2.4262016723130069","TUNE":"0.0148025950000000","UFO":"0.0000006479758500","CYBER":"2.8755615000000001","WILD":"0.2433782500000000","POLS":"0.2809594500000000","NYM":"0.0719640000000000","FIL":"3.6786597500000005","BAL":"2.0099945000000000","SCA":"0.3999999000000000","STND":"0.0133123405000000","WMTX":"0.2138930000000000","SCLP":"0.1545227000000000","MANEKI":"0.0073963000000000","BAT":"0.1721139000000000","AKRO":"0.0042302838000000","FTM3L":"8.2574692000000024","BAX":"0.0000709645000000","FTM3S":"0.0000255072400000","COTI":"0.0951524000000000"}}'; + '{\n "code": "200000",\n "data": [\n [\n "1566789720",\n "10411.5",\n "10401.9",\n "10411.5",\n "10396.3",\n "29.11357276",\n "302889.301529914"\n ],\n [\n "1566789660",\n "10416",\n "10411.5",\n "10422.3",\n "10411.5",\n "15.61781842",\n "162703.708997029"\n ],\n [\n "1566789600",\n "10408.6",\n "10416",\n "10416",\n "10405.4",\n "12.45584973",\n "129666.51508559"\n ]\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFiatPriceResp(); + let resp = new GetKlinesResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -289,44 +293,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getServiceStatus request test', () => { - /** - * getServiceStatus - * Get Service Status - * /api/v1/status - */ - }); - - test('getServiceStatus response test', () => { - /** - * getServiceStatus - * Get Service Status - * /api/v1/status - */ - }); - test('getServerTime request test', () => { - /** - * getServerTime - * Get Server Time - * /api/v1/timestamp - */ - }); - - test('getServerTime response test', () => { - /** - * getServerTime - * Get Server Time - * /api/v1/timestamp - */ - }); - test('getAllSymbols request test', () => { + test('getPartOrderBook request test', () => { /** - * getAllSymbols - * Get All Symbols - * /api/v2/symbols + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} */ - let data = '{"market": "ALTS"}'; - let req = new GetAllSymbolsReq(); + let data = '{"symbol": "BTC-USDT", "size": "20"}'; + let req = new GetPartOrderBookReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -334,16 +308,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getAllSymbols response test', () => { + test('getPartOrderBook response test', () => { /** - * getAllSymbols - * Get All Symbols - * /api/v2/symbols + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} */ let data = - '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "feeCurrency": "USDT",\n "market": "USDS",\n "baseMinSize": "0.00001",\n "quoteMinSize": "0.1",\n "baseMaxSize": "10000000000",\n "quoteMaxSize": "99999999",\n "baseIncrement": "0.00000001",\n "quoteIncrement": "0.000001",\n "priceIncrement": "0.1",\n "priceLimitRate": "0.1",\n "minFunds": "0.1",\n "isMarginEnabled": true,\n "enableTrading": true,\n "feeCategory": 1,\n "makerFeeCoefficient": "1.00",\n "takerFeeCoefficient": "1.00",\n "st": false\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAllSymbolsResp(); + let resp = new GetPartOrderBookResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -352,14 +326,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSymbol request test', () => { + test('getFullOrderBook request test', () => { /** - * getSymbol - * Get Symbol - * /api/v2/symbols/{symbol} + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetSymbolReq(); + let req = new GetFullOrderBookReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -367,16 +341,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getSymbol response test', () => { + test('getFullOrderBook response test', () => { /** - * getSymbol - * Get Symbol - * /api/v2/symbols/{symbol} + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 */ let data = - '{"code":"200000","data":{"symbol":"BTC-USDT","name":"BTC-USDT","baseCurrency":"BTC","quoteCurrency":"USDT","feeCurrency":"USDT","market":"USDS","baseMinSize":"0.00001","quoteMinSize":"0.1","baseMaxSize":"10000000000","quoteMaxSize":"99999999","baseIncrement":"0.00000001","quoteIncrement":"0.000001","priceIncrement":"0.1","priceLimitRate":"0.1","minFunds":"0.1","isMarginEnabled":true,"enableTrading":true,"feeCategory":1,"makerFeeCoefficient":"1.00","takerFeeCoefficient":"1.00","st":false}}'; + '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolResp(); + let resp = new GetFullOrderBookResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -385,15 +359,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getAnnouncements request test', () => { + test('getFiatPrice request test', () => { /** - * getAnnouncements - * Get Announcements - * /api/v3/announcements + * getFiatPrice + * Get Fiat Price + * /api/v1/prices */ - let data = - '{"currentPage": 1, "pageSize": 50, "annType": "latest-announcements", "lang": "en_US", "startTime": 1729594043000, "endTime": 1729697729000}'; - let req = new GetAnnouncementsReq(); + let data = '{"base": "USD", "currencies": "example_string_default_value"}'; + let req = new GetFiatPriceReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -401,16 +374,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getAnnouncements response test', () => { + test('getFiatPrice response test', () => { /** - * getAnnouncements - * Get Announcements - * /api/v3/announcements + * getFiatPrice + * Get Fiat Price + * /api/v1/prices */ let data = - '{\n "code": "200000",\n "data": {\n "totalNum": 195,\n "totalPage": 13,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "annId": 129045,\n "annTitle": "KuCoin Isolated Margin Adds the Scroll (SCR) Trading Pair",\n "annType": [\n "latest-announcements"\n ],\n "annDesc": "To enrich the variety of assets available,\xa0KuCoin\u2019s Isolated Margin Trading platform has added the Scroll (SCR)\xa0asset and trading pair.",\n "cTime": 1729594043000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/kucoin-isolated-margin-adds-scr?lang=en_US"\n },\n {\n "annId": 129001,\n "annTitle": "DAPP-30D Fixed Promotion, Enjoy an APR of 200%!\u200b",\n "annType": [\n "latest-announcements",\n "activities"\n ],\n "annDesc": "KuCoin Earn will be launching the DAPP Fixed Promotion at 10:00:00 on October 22, 2024 (UTC). The available product is \u201cDAPP-30D\'\' with an APR of 200%.",\n "cTime": 1729588460000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/dapp-30d-fixed-promotion-enjoy?lang=en_US"\n },\n {\n "annId": 128581,\n "annTitle": "NAYM (NAYM) Gets Listed on KuCoin! World Premiere!",\n "annType": [\n "latest-announcements",\n "new-listings"\n ],\n "annDesc": "Trading:\xa011:00 on October 22, 2024 (UTC)",\n "cTime": 1729497729000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/en-naym-naym-gets-listed-on-kucoin-world-premiere?lang=en_US"\n }\n ]\n }\n}'; + '{"code":"200000","data":{"AGLD":"1.1174410000000001","DFI":"0.0168915500000000","PYTHUP":"0.0397880960000000","ISLM":"0.0606196750000000","NEAR":"4.7185395500000000","AIOZ":"0.4862867350000000","AUDIO":"0.1219390000000000","BBL":"0.0067766100000000","WLD":"2.2893547500000000","HNT":"5.8990489999999984","ETHFI":"1.5892050000000000","DMAIL":"0.2726636000000000","OPUP":"0.0986506500000000","VET3S":"0.0003700448850000","MANA3S":"0.0006056970000000","TIDAL":"0.0001154422500000","HALO":"0.0058270850000000","OPUL":"0.0839480050000000","MANA3L":"0.0029569407900000","DGB":"0.0066556705000000","AA":"0.2406796000000000","BCH":"366.2167999999996484","GMEE":"0.0113333305000000","JST":"0.0302348750000000","PBUX":"0.0208795550000000","AR":"18.5457224999999909","SEI":"0.4332832500000000","PSTAKE":"0.0493153300000000","LMWR":"0.1618190500000000","UNFIDOWN":"0.0062058955000000","BB":"0.3245376500000000","JTO":"2.1239375000000002","WEMIX":"0.7916040000000000","G":"0.0324037900000000","MARSH":"0.0617591050000000","BN":"0.0036961510000000","FLIP":"1.0976509000000000","FLR":"0.0144827550000000","BIGTIME":"0.1238780300000000","FLY":"0.0005157420000000","T":"0.0233483200000000","W":"0.2865566500000000","BDX":"0.0774012800000000","BABYDOGE":"0.0000000029375305","SFP":"0.7256370000000000","DIA":"0.9179408000000000","ISME":"0.0022388800000000","LYM":"0.0010155919500000","VET3L":"0.0000289755050000","JUP":"0.8230882500000000","LYX":"1.4501745500000001","AIEPK":"0.0050094940000000","SILLY":"0.0159420250000000","SCPT":"0.0122038950000000","WOO":"0.1796601250000000","BLUR":"0.2462768000000000","STRK":"0.3963117450000000","BFC":"0.0383608100000000","DC":"0.0003097450500000","KARATE":"0.0007296350000000","SUSHI3L":"0.5115441000000000","NETVR":"0.0976111700000000","WAVES":"1.0806594000000000","LITH":"0.0001520239500000","HAPI":"8.6533711499999987","SUSHI3S":"1.2752620500000000","CEEK":"0.0294852500000000","FLOKI":"0.0001414292500000","SHR":"0.0012463765000000","SAND":"0.2566616050000000","TURT":"0.0020889550000000","UMA":"2.5207390000000000","BEPRO":"0.0003955021500000","SCRT":"0.1995002000000000","TUSD":"0.9945025000000000","COOKIE":"0.0220089900000000","LRDS":"0.6218889000000000","SIN":"0.0033633175000000","OAS":"0.0331933950000000","ROOT":"0.0183108400000000","ADA3L":"0.0046396790000000","TIAUP":"0.1228385500000000","HTR":"0.0353023400000000","UNB":"0.0003837080500000","UNA":"0.0164917500000000","HARD":"0.1087056200000000","G3":"0.0502648550000000","ADA3S":"0.0006191202850000","MYRO":"0.1071863800000000","HTX":"0.0000013693150000","FT":"0.3585206500000000","BTCDOWN":"0.1065467000000000","UNI":"7.3571195999999993","FX":"0.1379310000000000","OBI":"0.0079030465000000","UNO":"0.0137131400000000","WRX":"0.1221389000000000","TIADOWN":"0.0000914642450000","ETHDOWN":"0.1306346500000000","WELL":"0.0471244260000000","SWFTC":"0.0028966509500000","SKL":"0.0362418700000000","UOS":"0.0867765900000000","AIPAD":"0.0478660550000000","BRETT":"0.1037481000000000","SKY":"0.0520139800000000","FRM":"0.0153123400000000","VISION":"0.0014451770500000","LENDS":"0.0047276350000000","SLF":"0.3318340000000000","BULL":"0.0023988000000000","FLOW":"0.5372312500000000","ODDZ":"0.0063368300000000","SLN":"0.2804597000000000","UPO":"0.0440779500000000","SLP":"0.0023997995000000","ID":"0.3718140000000000","SLIM":"0.0906446550000000","SPOT":"0.0021289350000000","DOP":"0.0023028480000000","ISSP":"0.0000874562500000","UQC":"3.2339822000000003","IO":"1.8185902499999999","DOT":"4.2022978000000005","1INCH":"0.2645676500000000","SMH":"0.3448275000000000","MAK":"0.0396701550000000","TOKO":"0.0005923037000000","TURBO":"0.0108085930000000","UNFI":"2.8555714999999996","MAN":"0.0210764565000000","EVER":"0.0332733550000000","FTM":"0.7259068650000000","SHRAP":"0.0476361700000000","MAV":"0.1738130500000000","MAX":"0.2864966800000000","DPR":"0.0018240875000000","FTT":"2.0559715000000002","ARKM":"1.7444273499999999","ATOM":"4.2954512000000002","PENDLE":"4.1554212500000007","QUICK":"0.0365317250000000","BLZ":"0.1217191100000000","BOBA":"0.2014092450000000","MBL":"0.0027856065000000","OFN":"0.1252373500000000","UNIO":"0.0025487250000000","SNS":"0.0200899500000000","SNX":"1.4282854999999999","NXRA":"0.0272763550000000","TAIKO":"1.4392800000000001","AVAX3L":"0.1410875109550000","L3":"0.0608395650000000","API3":"1.3728132500000001","XRP3S":"0.0028095945000000","QKC":"0.0085157400000000","AVAX3S":"0.5148424500000000","ROSE":"0.0693453100000000","SATS":"0.0000002701648500","BMX":"0.3100449000000000","PORTAL":"0.2811593500000000","TOMI":"0.0309045400000000","XRP3L":"2.1586201500000002","SOL":"151.7250995000003583","SON":"0.0002421788500000","BNC":"0.1882058500000000","SOCIAL":"0.0026486750000000","CGPT":"0.1305147100000000","CELR":"0.0127736100000000","BNB":"591.0973035000118935","OGN":"0.0852573500000000","CELO":"0.7711142500000000","AUCTION":"13.1634150000000014","MANTA":"0.7564216000000000","LAYER":"0.0372713550000000","AERO":"1.3783104999999999","CETUS":"0.1808295400000000","LL":"0.0201199350000000","SPA":"0.0067426270000000","PYTHDOWN":"0.0011834080000000","NEIROCTO":"0.0019964013000000","UTK":"0.0365217300000000","GMRX":"0.0007386305000000","BOB":"0.0000380619595000","HOTCROSS":"0.0056491740000000","AERGO":"0.1007595950000000","MOCA":"0.0783608000000000","SQD":"0.0380809500000000","MV":"0.0081359300000000","BNB3L":"0.2761618500000000","BNB3S":"0.0008545725000000","GALAX3L":"0.0057571999600000","KAI":"0.0020080954500000","SQR":"0.0470764500000000","GALAX3S":"0.1933033000000000","EGLD":"25.5272299999999713","ZBCN":"0.0010404795000000","KAS":"0.1216691350000000","MEW":"0.0086176890000000","PUNDIX":"0.4130933500000000","LOOKS":"0.0392803500000000","FXS":"1.9060465000000000","BOSON":"0.2732633000000000","BRISE":"0.0000000860569500","AEVO":"0.3388305000000000","FLUX":"0.5276360500000000","PRCL":"0.1969015000000000","UNFIUP":"0.0011654170000000","SEIDOWN":"0.0442778500000000","DOAI":"0.0052363805000000","QNT":"65.4312679999998206","REDO":"0.2837580500000000","STRIKE":"6.8225869999999997","ETHW":"3.2418782499999998","OM":"1.5396797750000000","OP":"1.6911539999999999","WHALE":"0.8134930500000000","1CAT":"0.0018460765000000","NEON":"0.4446775500000000","GTAI":"0.7786105000000000","SSV":"21.2393749999999841","ETH2":"2601.6678843156403923","KCS":"8.7646155000000020","ARPA":"0.0393882960000000","ARTFI":"0.0141029450000000","BRL":"0.1742807323452485","ALEX":"0.0924537500000000","STG":"0.2943527500000000","SHIB":"0.0000178060925000","IOTX":"0.0394202800000000","OLE":"0.0171414250000000","KDA":"0.5653172000000000","CERE":"0.0022548720000000","DOCK":"0.0018990500000000","STX":"1.8157916500000000","OLT":"0.0007596200000000","QI":"0.0131754090000000","SDAO":"0.2748625000000000","BLAST":"0.0087636160000000","LINK3S":"0.0000702948350000","IOST":"0.0049745115000000","SUI":"2.0589700000000000","CAKE":"1.7941024999999999","BSW":"0.0586706500000000","OMG":"0.2597700500000000","VOLT":"0.0000002716641000","LINK3L":"1.3408292499999999","GEEQ":"0.0385607100000000","PYUSD":"0.9988003500000000","SUN":"0.0186106900000000","TOWER":"0.0014812590000000","BTC":"67133.4165000832051564","IOTA":"0.1189405000000000","REEF":"0.0019960015000000","TRIAS":"3.3683149999999998","KEY":"0.0037594713240047","ETH3L":"0.0003305946200000","BTT":"0.0000009117439000","ONE":"0.0132003965000000","RENDER":"5.2263854999999995","ETH3S":"0.5517240000000000","ANKR":"0.0264867500000000","ALGO":"0.1188405500000000","SYLO":"0.0007600198000000","ZCX":"0.0784707450000000","SD":"0.3851073500000000","ONT":"0.1877960550000000","MJT":"0.0132433750000000","DYM":"1.6659666000000001","DYP":"0.0205397250000000","BAKEUP":"0.0389894955000000","OOE":"0.0079360300000000","ZELIX":"0.0000649675000000","DOGE3L":"0.3837080500000000","ARTY":"0.3980009000000000","QORPO":"0.1204297550000000","ICE":"0.0051504235000000","NOTAI":"0.0000892753400000","DOGE3S":"0.2291853500000000","NAKA":"1.0695649500000000","GALAX":"0.0212893500000000","MKR":"1245.8767500000163833","DODO":"0.1152423500000000","ICP":"7.6731615000000027","ZEC":"35.9400209999999543","ZEE":"0.0065767100000000","ICX":"0.1383308000000000","KMNO":"0.0921499020000000","TT":"0.0033883050000000","DOT3L":"0.1454272500000000","XAI":"0.2038980000000000","ZEN":"8.0149905000000007","DOGE":"0.1213093150000000","ALPHA":"0.0567416150000000","DUSK":"0.1964517250000000","DOT3S":"0.0053613180000000","SXP":"0.2538730000000000","HBAR":"0.0510044850000000","SYNT":"0.0467166300000000","ZEX":"0.0571714000000000","BONDLY":"0.0022208890000000","MLK":"0.2080859050000000","KICKS":"0.0001301249050000","PEPE":"0.0000100249850000","OUSD":"0.9982006500000000","LUNCDOWN":"0.0000733333150000","DOGS":"0.0007086455000000","REV3L":"0.0094672640000000","CTSI":"0.1257371000000000","C98":"0.1219390000000000","OSMO":"0.5370313500000000","NTRN":"0.3869064500000000","CFX2S":"0.0084757600000000","SYN":"0.5636180500000000","VIDT":"0.0308745550000000","SYS":"0.0997501000000000","GAS":"4.3029474500000008","BOME":"0.0087336310000000","COMBO":"0.4068964500000000","XCH":"14.9825050000000010","VR":"0.0063538215000000","CFX2L":"0.0499660045000000","VSYS":"0.0005201398000000","PANDORA":"1629.2949450001102772","THETA":"1.2461766000000000","XCN":"0.0012699647000000","NEXG":"0.0039180400000000","MELOS":"0.0021244372500000","XCV":"0.0013253370000000","ORN":"0.8797599000000000","WLKN":"0.0010624685000000","AAVE":"154.2708259999996162","MNT":"0.6168914000000000","BONK":"0.0000227296295000","PERP":"0.6037979500000000","XDC":"0.0276361750000000","MNW":"0.3681158500000000","XDB":"0.0002578710000000","BOND":"1.5662165000000000","SUIA":"0.0809595000000000","MOG":"0.0000019330330000","SUTER":"0.0001840079500000","TIME":"16.2648634999999969","RACA":"0.0001949025000000","BICO":"0.2021988500000000","MON":"0.1066466500000000","SWEAT":"0.0063718125000000","MOXIE":"0.0022088950000000","BABYBNB":"0.0289755050000000","IGU":"0.0050674650000000","HMSTR":"0.0037990995000000","XEC":"0.0000354722550000","MONI":"0.0058470750000000","XR":"0.2374812000000000","PEOPLE":"0.0796601500000000","PUMLX":"0.0054572700000000","ZIL":"0.0145927000000000","WLDDOWN":"0.2089954500000000","VAI":"0.0799999800000000","XEN":"0.0000000839580000","MPC":"0.1001499000000000","XEM":"0.0176951480000000","JASMY3S":"0.0019670160000000","OTK":"0.0290464695000000","TRAC":"0.4521738000000000","DFYN":"0.0070664650000000","BIDP":"0.0001939030000000","JASMY3L":"0.0001653772700000","INJDOWN":"0.0000194902500000","KLV":"0.0019310340000000","WAXL":"0.7858069000000000","TRBDOWN":"0.0023138425000000","BCH3L":"4.6390663064999996","GMT3S":"0.0000457771000000","KMD":"0.2493752500000000","BCH3S":"0.9634180500000000","ECOX":"0.0987506000000000","AAVE3S":"0.0560719500000000","GMT3L":"0.0053983694650000","EPIK":"0.0045857060000000","SUIP":"0.1067565950000000","AAVE3L":"0.3638687346200000","ZK":"0.1262368500000000","ZKF":"0.0008595700000000","OMNIA":"0.7624186000000000","ZKJ":"1.1124435000000000","ZKL":"0.1255372000000000","GAFI":"3.0634675000000001","CARV":"0.8703646000000000","KNC":"0.4433782000000000","CATS":"0.0000599700000000","PROM":"5.2833570000000006","ALEPH":"0.1756121500000000","PONKE":"0.3958020000000000","OVR":"0.1553223000000000","CATI":"0.4105146400000000","ORDER":"0.1183008200000000","GFT":"0.0166616650000000","BIFI":"0.0020489750000000","GGC":"6.9965029985000000","GGG":"0.0403798000000000","DAPPX":"0.0043788095000000","SUKU":"0.0618790450000000","ULTI":"0.0168015950000000","CREDI":"0.0192903500000000","ERTHA":"0.0010014990000000","FURY":"0.1405297000000000","KARRAT":"0.5577210000000000","MOBILE":"0.0009005495000000","SIDUS":"0.0037671155000000","NAVI":"0.1254672350000000","TAO":"583.4081500000051807","USDJ":"1.1386304000000001","MTL":"0.9563216000000000","VET":"0.0225387250000000","FITFI":"0.0036421780000000","USDT":"0.9995000000000000","OXT":"0.0695652000000000","CANDY":"0.0005597200000000","USDP":"0.9932031500000000","MTS":"0.0027516235000000","TADA":"0.0283858000000000","MTV":"0.0006559718500000","NAVX":"0.1342228550000000","ILV":"35.6771524999999671","VINU":"0.0000000109045450","GHX":"0.0903548000000000","EDU":"0.5167415000000000","HYVE":"0.0137331300000000","BTC3L":"0.0058620675000000","ANYONE":"0.9015490000000000","BEAT":"0.0012593700000000","KING":"0.0004821588000000","CREAM":"15.6541689999999973","CAS":"0.0038590695000000","IMX":"1.4944524000000000","CAT":"0.0000256981445000","BTC3S":"0.0014142925000000","USDE":"0.9985005000000000","USDD":"1.0000997000000000","CWAR":"0.0037981000000000","USDC":"0.9997998500000000","KRL":"0.3543127550000000","INJ":"21.7691100000000194","GAME":"0.0139630150000000","TRIBL":"1.0994500000000000","XLM":"0.0948525500000000","TRBUP":"0.0012293850000000","VRADOWN":"0.0013433280000000","SUPER":"1.2853570000000000","EIGEN":"3.1536223999999999","IOI":"0.0146926500000000","KSM":"17.5212350000000129","CCD":"0.0034832575000000","EGO":"0.0093553200000000","EGP":"2.7946019999999998","MXC":"0.0066866550000000","TEL":"0.0014432780000000","MOVR":"9.1340307000000027","XMR":"155.5421899999990755","MXM":"0.0092853550000000","OORT":"0.1099949750000000","GLM":"0.3231383500000000","RAY":"2.0228880499999998","XTAG":"0.0218190850000000","GLQ":"0.0854572500000000","CWEB":"0.0038480750000000","REVU":"0.0105047450000000","REVV":"0.0039760110000000","ZRO":"3.7952014499999994","XNL":"0.0093853050000000","XNO":"0.8496749500000000","SAROS":"0.0019290350000000","KACE":"2.1165411999999998","ZRX":"0.3186406000000000","WLTH":"0.0374312750000000","ATOM3L":"0.0321719060000000","GMM":"0.0001497251000000","BEER":"0.0000138670630000","GMT":"0.1275362000000000","HEART":"0.0159920000000000","GMX":"22.7186349999999882","ABBC":"0.0061769100000000","OMNI":"8.9235359999999970","ATOM3S":"0.0007945225400000","IRL":"0.0099650150000000","CFG":"0.3248375000000000","WSDM":"0.0139830050000000","GNS":"1.8390800000000001","VANRY":"0.0809295150000000","CFX":"0.1595202000000000","GRAIL":"817.1212349999937891","BEFI":"0.0175712100000000","VELO":"0.0132043945000000","XPR":"0.0008077959000000","DOVI":"0.0584707500000000","ACE":"0.0021349320000000","ACH":"0.0190534685000000","ISP":"0.0012161916000000","XCAD":"0.2834582000000000","MINA":"0.5630183500000000","TIA":"5.9318325999999999","DRIFT":"0.4350823500000000","ACQ":"0.0056981495000000","ACS":"0.0014917537500000","MIND":"0.0018920535000000","STORE":"0.0062358805000000","REN":"0.0351224300000000","ELA":"1.7282354500000000","DREAMS":"0.0002498750000000","ADA":"0.3463267500000000","ELF":"0.3777110500000000","REQ":"0.0959919800000000","STORJ":"0.5662167500000000","LADYS":"0.0000000837581000","PAXG":"2697.9303600003123340","REZ":"0.0409795000000000","XRD":"0.0157821050000000","CHO":"0.0205097400000000","CHR":"0.1769115000000000","ADS":"0.1889055000000000","CHZ":"0.0738030800000000","ADX":"0.1575212000000000","XRP":"0.5525036100000000","JASMY":"0.0188615645000000","KAGI":"0.1834582250000000","FIDA":"0.2282858000000000","PBR":"0.0291953950000000","AEG":"0.0093453250000000","H2O":"0.1610194500000000","CHMB":"0.0001715641750000","SAND3L":"0.0015447972150000","PBX":"0.0006879558500000","SOLVE":"0.0084557700000000","DECHAT":"0.1512243500000000","GARI":"0.0076861550000000","SHIB2L":"1.1996998499999999","SHIB2S":"0.0240879500000000","ENA":"0.3942028000000000","VEMP":"0.0029335325000000","ENJ":"0.1467266000000000","AFG":"0.0072163900000000","RATS":"0.0001211593900000","GRT":"0.1646076550000000","FORWARD":"0.0012873560000000","TFUEL":"0.0598800450000000","ENS":"17.0634640000000052","KASDOWN":"0.0258770550000000","XTM":"0.0251074400000000","DEGEN":"0.0084857550000000","TLM":"0.0100449750000000","DYDXDOWN":"0.1042598440000000","CKB":"0.0146026950000000","LUNC":"0.0000889255150000","AURORA":"0.1204397500000000","LUNA":"0.3624187000000000","XTZ":"0.6776610000000000","ELON":"0.0000001410294500","DMTR":"0.0891554000000000","EOS":"0.4759619000000000","GST":"0.0118940500000000","FORT":"0.1155422000000000","FLAME":"0.0247076400000000","PATEX":"0.9605195000000000","DEEP":"0.0328885475000000","ID3L":"0.0016201895000000","GTC":"0.6625685500000000","ID3S":"0.0071674145000000","RIO":"0.7616190000000000","CLH":"0.0008555720000000","BURGER":"0.4016990500000000","VRA":"0.0029765110000000","SUNDOG":"0.2173912500000000","GTT":"0.0002038980000000","INJUP":"0.2327835500000000","CPOOL":"0.1557720750000000","EPX":"0.0000740629500000","CLV":"0.0329835000000000","FEAR":"0.0560519600000000","MEME":"0.0124847545000000","ROOBEE":"0.0004520738500000","DEFI":"0.0192903500000000","TOKEN":"0.0477361200000000","GRAPE":"0.0020599695000000","KASUP":"0.3996001000000000","XWG":"0.0003843077500000","SKEY":"0.0621289200000000","SFUND":"1.3243375000000000","EQX":"0.0032823580000000","ORDIUP":"0.0548315705000000","TON":"5.1857058499999995","DEGO":"2.2667660500000001","IZI":"0.0088455750000000","ERG":"0.6605695500000000","ERN":"1.9255367500000001","VENOM":"0.0817591000000000","VOXEL":"0.1497251000000000","RLC":"1.4649671500000000","PHA":"0.1093453000000000","DYDXUP":"0.0112573685000000","APE3S":"0.0008475760000000","ORBS":"0.0288955450000000","OPDOWN":"0.6758619000000000","ESE":"0.0139130400000000","APE3L":"0.1339330000000000","HMND":"0.0982208650000000","COQ":"0.0000014432780000","AURY":"0.3340329000000000","CULT":"0.0000028025980000","AKT":"2.4642672500000001","GLMR":"0.1606196500000000","XYM":"0.0142528700000000","ORAI":"6.1769100000000012","XYO":"0.0058680645000000","ETC":"18.8458723500000169","LAI":"0.0142828550000000","PIP":"0.0178310800000000","ETH":"2607.6655149998362673","NEO":"10.3575186499999991","RMV":"0.0081659150000000","KLAY":"0.1251374000000000","PIT":"0.0000000003268365","TARA":"0.0043978000000000","KALT":"0.1128735350000000","PIX":"0.0001023687900000","ETN":"0.0021579205000000","CSIX":"0.0141729100000000","TRADE":"0.4708644500000000","MAVIA":"1.3592200500000001","HIGH":"1.3043474999999999","TRB":"62.5387150000000006","ORDI":"35.7421200000000126","TRVL":"0.0373643085000000","AMB":"0.0059670150000000","TRU":"0.0762018800000000","LOGX":"0.0271963950000000","FINC":"0.0362018900000000","INFRA":"0.1978010500000000","NATIX":"0.0008729633000000","NFP":"0.2152923000000000","TRY":"0.0292166033323590","TRX":"0.1597201000000000","LBP":"0.0001243378000000","LBR":"0.0595702000000000","EUL":"2.9735125000000000","NFT":"0.0000004077960000","SEIUP":"0.0478110825000000","PUFFER":"0.3676161000000000","EUR":"1.0811249323958897","ORCA":"2.0664662499999999","NEAR3L":"0.0117010765350000","AMP":"0.0038330825000000","XDEFI":"0.0472563600000000","HIFI":"0.4947525000000000","TRUF":"0.0459570100000000","AITECH":"0.1045477000000000","AMU":"0.0043978000000000","USTC":"0.0214692600000000","KNGL":"0.0499750000000000","FOXY":"0.0102686631000000","NGC":"0.0147935995000000","TENET":"0.0043278350000000","NEAR3S":"0.0072553705000000","MAHA":"1.1904045000000000","NGL":"0.0701748950000000","TST":"0.0080359800000000","HIPPO":"0.0104447750000000","AXS3S":"0.0308705570000000","CRO":"0.0781409100000000","ZPAY":"0.0050574700000000","MNDE":"0.1026786350000000","CRV":"0.2534732000000000","SWASH":"0.0056271850000000","AXS3L":"0.0106388779000000","VERSE":"0.0001803098000000","RPK":"0.0049975000000000","RPL":"10.9745099999999958","AZERO":"0.3789104500000000","SOUL":"0.0534332700000000","VXV":"0.2619689500000000","LDO":"1.0885554500000000","MAGIC":"0.3390304000000000","ALICE":"1.0324835000000000","SEAM":"1.1933030499999999","PLU":"1.9300345000000001","AOG":"0.0031224380000000","SMOLE":"0.0000387806000000","EWT":"1.1094450000000000","TSUGT":"0.0029185400000000","PMG":"0.0800599500000000","OPAI":"0.0006826585000000","LOCUS":"0.0216591650000000","CTA":"0.0825087250000000","NIM":"0.0013673160000000","CTC":"0.4033982000000000","APE":"0.7035480500000000","MERL":"0.2720639000000000","JAM":"0.0004770613500000","CTI":"0.0130314810000000","APP":"0.0021989000000000","APT":"9.9947001500000000","WLDUP":"0.0093043455000000","ZEND":"0.1280759300000000","FIRE":"0.9113441000000000","DENT":"0.0008630682500000","PYTH":"0.3390603850000000","LFT":"0.0155322300000000","DPET":"0.0319040400000000","ORDIDOWN":"0.3788105000000000","KPOL":"0.0029175405000000","ETHUP":"8.4971493000000032","BAND":"1.0939527500000001","POL":"0.3656171000000000","ASTR":"0.0582608550000000","NKN":"0.0691654000000000","RSR":"0.0068055955000000","DVPN":"0.0005979009000000","TWT":"1.1119437500000000","ARB":"0.5510243500000000","CVC":"0.1409801746501747","ARC":"0.0300849500000000","XETA":"0.0022888550000000","MTRG":"0.4007995000000000","LOKA":"0.1867066000000000","LPOOL":"0.0660069800000000","TURBOS":"0.0034812585000000","CVX":"1.7816087499999999","ARX":"0.0007556220000000","MPLX":"0.4355221300000000","SUSHI":"0.7011492500000000","NLK":"0.0114442750000000","PEPE2":"0.0000000313843000","WBTC":"66881.4425499645548419","SUI3L":"0.0211204345000000","CWS":"0.1927036000000000","SUI3S":"0.0000579110300000","INSP":"0.0264167850000000","MANA":"0.2945026750000000","VRTX":"0.0641679000000000","CSPR":"0.0116441750000000","ATA":"0.0785007300000000","OPEN":"0.0080049955000000","HAI":"0.0448275750000000","NMR":"14.7436245000000072","ATH":"0.0540929400000000","LIT":"0.6282857000000000","TLOS":"0.3263467450000000","TNSR":"0.3662168000000000","CXT":"0.0871364100000000","POLYX":"0.2346826000000000","ZERO":"0.0002507745500000","ROUTE":"0.0610694500000000","LOOM":"0.0580009850000000","PRE":"0.0078680640000000","VRAUP":"0.0134652640000000","HBB":"0.0714742450000000","RVN":"0.0165017450000000","PRQ":"0.0715741950000000","ONDO":"0.7134930750000000","PEPEDOWN":"0.0000155022450000","WOOP":"0.0020179905000000","LUNCUP":"0.0168355780000000","KAVA":"0.3522238000000000","LKI":"0.0104187880000000","AVA":"0.4857570000000000","NOM":"0.0233883000000000","MAPO":"0.0089015470000000","PEPEUP":"0.0114252845000000","STRAX":"0.0487156300000000","NOT":"0.0078670645000000","ZERC":"0.1108245600000000","BCUT":"0.0255672100000000","MASA":"0.0691354150000000","WAN":"0.1785077544737212","WAT":"0.0003273762300000","WAX":"0.0327636100000000","MASK":"2.2259864500000002","EOS3L":"0.0002122138400000","IDEA":"0.0005887055000000","EOS3S":"0.0034472755000000","YFI":"4919.4290549999908843","MOODENG":"0.0774612500000000","XCUR":"0.0048845565000000","HYDRA":"0.2225886500000000","POPCAT":"1.3382305500000000","LQTY":"0.7848074000000000","PIXEL":"0.1406596350000000","LMR":"0.0145437245000000","ZETA":"0.5997999500000000","YGG":"0.4717640000000000","AXS":"4.6006985000000006","BCHSV":"49.8250749999999370","NRN":"0.0395802000000000","FTON":"0.0091954000000000","COMP":"43.6581599999999881","XPRT":"0.1819090000000000","HFT":"0.1443278000000000","UXLINK":"0.5085456000000000","STAMP":"0.0335032400000000","RUNE":"4.9233370999999996","ZEUS":"0.2587705500000000","LTC3L":"1.8294848000000001","DAPP":"0.1763118000000000","FORTH":"2.9508238500000004","ALPINE":"1.5322335000000000","SENSO":"0.0328835500000000","LTC3S":"0.0006986505000000","DEXE":"8.3795081500000028","GOAL":"0.0175912000000000","AVAX":"27.5602130000000058","LISTA":"0.3782108000000000","AMPL":"1.3743124999999999","WORK":"0.1384307500000000","BRWL":"0.0017391300000000","BANANA":"57.1314200000001362","PUSH":"0.0750624500000000","WEN":"0.0001015492000000","NEIRO":"0.0879560000000000","BTCUP":"34.7711057499999789","SOL3S":"0.0007816090000000","BRAWL":"0.0004776610500000","LAY3R":"0.2161918500000000","LPT":"11.9304317999999945","GODS":"0.1807096000000000","SAND3S":"4.6152911999999992","RDNT":"0.0640679500000000","SOL3L":"1.8351913752850000","NIBI":"0.0653772950000000","NUM":"0.0436181800000000","PYR":"2.5590198499999997","DAG":"0.0226176855000000","DAI":"0.9989006596042375","HIP":"0.0034982500000000","DAO":"0.2848575000000000","AVAIL":"0.1300929210000000","DAR":"0.1512243500000000","FET":"1.3760116500000000","FCON":"0.0001197600900000","XAVA":"0.3789104500000000","LRC":"0.1208395500000000","UNI3S":"0.0000653573050000","PZP":"0.0599600050000000","POKT":"0.0424787500000000","DASH":"23.6881500000000109","BAKEDOWN":"0.0003324636850000","POLC":"0.0061389290000000","DBR":"0.0377671070000000","CIRUS":"0.0055772100000000","UNI3L":"0.0993921490650000","NWC":"0.0681659000000000","POLK":"0.0142628650000000","LSD":"0.9420287500000000","MARS4":"0.0005878059500000","LSK":"0.8080957500000000","BLOCK":"0.0261869000000000","ANALOS":"0.0000446776500000","SAFE":"0.8779608000000000","DCK":"0.0234082900000000","LSS":"0.0562718500000000","DCR":"12.4337799999999929","LIKE":"0.0559720000000000","DATA":"0.0361819000000000","WIF":"2.5696145499999999","BLOK":"0.0006546725000000","LTC":"71.6261690000000611","METIS":"42.0289750000000612","WIN":"0.0000868365600000","HLG":"0.0018790600000000","LTO":"0.1166116650000000","DYDX":"0.9341327000000000","ARB3S":"0.0509025360000000","MUBI":"0.0303848000000000","ARB3L":"0.0025917035000000","RBTC1":"0.0000039480250000","POND":"0.0118640650000000","LINA":"0.0037771105000000","MYRIA":"0.0025337325000000","LINK":"11.0244849999999944","QTUM":"2.4262016723130069","TUNE":"0.0148025950000000","UFO":"0.0000006479758500","CYBER":"2.8755615000000001","WILD":"0.2433782500000000","POLS":"0.2809594500000000","NYM":"0.0719640000000000","FIL":"3.6786597500000005","BAL":"2.0099945000000000","SCA":"0.3999999000000000","STND":"0.0133123405000000","WMTX":"0.2138930000000000","SCLP":"0.1545227000000000","MANEKI":"0.0073963000000000","BAT":"0.1721139000000000","AKRO":"0.0042302838000000","FTM3L":"8.2574692000000024","BAX":"0.0000709645000000","FTM3S":"0.0000255072400000","COTI":"0.0951524000000000"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAnnouncementsResp(); + let resp = new GetFiatPriceResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -419,14 +392,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getCurrency request test', () => { + test('get24hrStats request test', () => { /** - * getCurrency - * Get Currency - * /api/v3/currencies/{currency} + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats */ - let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetCurrencyReq(); + let data = '{"symbol": "BTC-USDT"}'; + let req = new Get24hrStatsReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -434,16 +407,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getCurrency response test', () => { + test('get24hrStats response test', () => { /** - * getCurrency - * Get Currency - * /api/v3/currencies/{currency} + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats */ let data = - '{"code":"200000","data":{"currency":"BTC","name":"BTC","fullName":"Bitcoin","precision":8,"confirms":null,"contractAddress":null,"isMarginEnabled":true,"isDebitEnabled":true,"chains":[{"chainName":"BTC","withdrawalMinSize":"0.001","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":3,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"btc"},{"chainName":"Lightning Network","withdrawalMinSize":"0.00001","depositMinSize":"0.00001","withdrawFeeRate":"0","withdrawalMinFee":"0.000015","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":1,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":"0.03","needTag":false,"chainId":"btcln"},{"chainName":"KCC","withdrawalMinSize":"0.0008","depositMinSize":null,"withdrawFeeRate":"0","withdrawalMinFee":"0.00002","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":20,"preConfirms":20,"contractAddress":"0xfa93c12cd345c658bc4644d1d4e1b9615952258c","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"kcc"},{"chainName":"BTC-Segwit","withdrawalMinSize":"0.0008","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":false,"isDepositEnabled":true,"confirms":2,"preConfirms":2,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"bech32"}]}}'; + '{"code":"200000","data":{"time":1729175612158,"symbol":"BTC-USDT","buy":"66982.4","sell":"66982.5","changeRate":"-0.0114","changePrice":"-778.1","high":"68107.7","low":"66683.3","vol":"1738.02898182","volValue":"117321982.415978333","last":"66981.5","averagePrice":"67281.21437289","takerFeeRate":"0.001","makerFeeRate":"0.001","takerCoefficient":"1","makerCoefficient":"1"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCurrencyResp(); + let resp = new Get24hrStatsResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -452,52 +425,79 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getAllCurrencies request test', () => { + test('getMarketList request test', () => { /** - * getAllCurrencies - * Get All Currencies - * /api/v3/currencies + * getMarketList + * Get Market List + * /api/v1/markets */ }); - test('getAllCurrencies response test', () => { + test('getMarketList response test', () => { /** - * getAllCurrencies - * Get All Currencies - * /api/v3/currencies + * getMarketList + * Get Market List + * /api/v1/markets */ }); - test('getFullOrderBook request test', () => { + test('getServerTime request test', () => { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v3/market/orderbook/level2 + * getServerTime + * Get Server Time + * /api/v1/timestamp */ - let data = '{"symbol": "BTC-USDT"}'; - let req = new GetFullOrderBookReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('getFullOrderBook response test', () => { + test('getServerTime response test', () => { /** - * getFullOrderBook - * Get Full OrderBook - * /api/v3/market/orderbook/level2 + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + }); + test('getServiceStatus request test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + + test('getServiceStatus response test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + }); + test('getPublicToken request test', () => { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + }); + + test('getPublicToken response test', () => { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + }); + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private + */ + }); + + test('getPrivateToken response test', () => { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private */ - let data = - '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetFullOrderBookResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); }); diff --git a/sdk/node/src/generate/spot/market/api_market.ts b/sdk/node/src/generate/spot/market/api_market.ts index b23f270f..1fd2e792 100644 --- a/sdk/node/src/generate/spot/market/api_market.ts +++ b/sdk/node/src/generate/spot/market/api_market.ts @@ -4,8 +4,8 @@ import { Transport } from '@internal/interfaces/transport'; import { GetAnnouncementsResp } from './model_get_announcements_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; import { Get24hrStatsReq } from './model_get24hr_stats_req'; -import { GetAllSymbolsReq } from './model_get_all_symbols_req'; import { GetServiceStatusResp } from './model_get_service_status_resp'; +import { GetAllSymbolsReq } from './model_get_all_symbols_req'; import { GetTickerReq } from './model_get_ticker_req'; import { GetPrivateTokenResp } from './model_get_private_token_resp'; import { GetFiatPriceResp } from './model_get_fiat_price_resp'; @@ -16,8 +16,8 @@ import { GetFullOrderBookResp } from './model_get_full_order_book_resp'; import { GetTickerResp } from './model_get_ticker_resp'; import { GetFullOrderBookReq } from './model_get_full_order_book_req'; import { GetAllSymbolsResp } from './model_get_all_symbols_resp'; -import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetPublicTokenResp } from './model_get_public_token_resp'; +import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetMarketListResp } from './model_get_market_list_resp'; import { GetCurrencyReq } from './model_get_currency_req'; import { GetAllCurrenciesResp } from './model_get_all_currencies_resp'; @@ -33,25 +33,9 @@ import { GetKlinesResp } from './model_get_klines_resp'; export interface MarketAPI { /** - * getPrivateToken Get Private Token - Spot/Margin - * Description: This interface can obtain the token required for websocket to establish a Spot/Margin private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token - * Documentation: https://www.kucoin.com/docs-new/api-3470295 - * +---------------------+---------+ - * | Extra API Info | Value | - * +---------------------+---------+ - * | API-DOMAIN | SPOT | - * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | - * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | - * +---------------------+---------+ - */ - getPrivateToken(): Promise; - - /** - * getPublicToken Get Public Token - Spot/Margin - * Description: This interface can obtain the token required for websocket to establish a Spot/Margin connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token - * Documentation: https://www.kucoin.com/docs-new/api-3470294 + * getAnnouncements Get Announcements + * Description: This interface can obtain the latest news announcements, and the default page search is for announcements within a month. + * Documentation: https://www.kucoin.com/docs-new/api-3470157 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -59,15 +43,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 20 | * +---------------------+--------+ */ - getPublicToken(): Promise; + getAnnouncements(req: GetAnnouncementsReq): Promise; /** - * getAllTickers Get All Tickers - * Description: Request market tickers for all the trading pairs in the market (including 24h volume), takes a snapshot every 2 seconds. On the rare occasion that we will change the currency name, if you still want the changed symbol name, you can use the symbolName field instead of the symbol field via “Get all tickers” endpoint. - * Documentation: https://www.kucoin.com/docs-new/api-3470167 + * getCurrency Get Currency + * Description: Request via this endpoint to get the currency details of a specified currency + * Documentation: https://www.kucoin.com/docs-new/api-3470155 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -75,15 +59,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 15 | + * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getAllTickers(): Promise; + getCurrency(req: GetCurrencyReq): Promise; /** - * getKlines Get Klines - * Description: Get the Kline of the symbol. Data are returned in grouped buckets based on requested type. For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time. - * Documentation: https://www.kucoin.com/docs-new/api-3470163 + * getAllCurrencies Get All Currencies + * Description: Request via this endpoint to get the currency list.Not all currencies currently can be used for trading. + * Documentation: https://www.kucoin.com/docs-new/api-3470152 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -94,12 +78,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getKlines(req: GetKlinesReq): Promise; + getAllCurrencies(): Promise; /** - * getTradeHistory Get Trade History - * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. - * Documentation: https://www.kucoin.com/docs-new/api-3470162 + * getSymbol Get Symbol + * Description: Request via this endpoint to get detail currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. + * Documentation: https://www.kucoin.com/docs-new/api-3470159 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -107,15 +91,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 4 | * +---------------------+--------+ */ - getTradeHistory(req: GetTradeHistoryReq): Promise; + getSymbol(req: GetSymbolReq): Promise; /** - * getTicker Get Ticker - * Description: Request via this endpoint to get Level 1 Market Data. The returned value includes the best bid price and size, the best ask price and size as well as the last traded price and the last traded size. - * Documentation: https://www.kucoin.com/docs-new/api-3470160 + * getAllSymbols Get All Symbols + * Description: Request via this endpoint to get a list of available currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. + * Documentation: https://www.kucoin.com/docs-new/api-3470154 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -123,15 +107,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 4 | * +---------------------+--------+ */ - getTicker(req: GetTickerReq): Promise; + getAllSymbols(req: GetAllSymbolsReq): Promise; /** - * getPartOrderBook Get Part OrderBook - * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. - * Documentation: https://www.kucoin.com/docs-new/api-3470165 + * getTicker Get Ticker + * Description: Request via this endpoint to get Level 1 Market Data. The returned value includes the best bid price and size, the best ask price and size as well as the last traded price and the last traded size. + * Documentation: https://www.kucoin.com/docs-new/api-3470160 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -142,12 +126,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 2 | * +---------------------+--------+ */ - getPartOrderBook(req: GetPartOrderBookReq): Promise; + getTicker(req: GetTickerReq): Promise; /** - * get24hrStats Get 24hr Stats - * Description: Request via this endpoint to get the statistics of the specified ticker in the last 24 hours. - * Documentation: https://www.kucoin.com/docs-new/api-3470161 + * getAllTickers Get All Tickers + * Description: Request market tickers for all the trading pairs in the market (including 24h volume), takes a snapshot every 2 seconds. On the rare occasion that we will change the currency name, if you still want the changed symbol name, you can use the symbolName field instead of the symbol field via “Get all tickers” endpoint. + * Documentation: https://www.kucoin.com/docs-new/api-3470167 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -158,12 +142,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 15 | * +---------------------+--------+ */ - get24hrStats(req: Get24hrStatsReq): Promise; + getAllTickers(): Promise; /** - * getMarketList Get Market List - * Description: Request via this endpoint to get the transaction currency for the entire trading market. - * Documentation: https://www.kucoin.com/docs-new/api-3470166 + * getTradeHistory Get Trade History + * Description: Request via this endpoint to get the trade history of the specified symbol, the returned quantity is the last 100 transaction records. + * Documentation: https://www.kucoin.com/docs-new/api-3470162 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -174,12 +158,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getMarketList(): Promise; + getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * getFiatPrice Get Fiat Price - * Description: Request via this endpoint to get the fiat price of the currencies for the available trading pairs. - * Documentation: https://www.kucoin.com/docs-new/api-3470153 + * getKlines Get Klines + * Description: Get the Kline of the symbol. Data are returned in grouped buckets based on requested type. For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time. + * Documentation: https://www.kucoin.com/docs-new/api-3470163 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -190,12 +174,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getFiatPrice(req: GetFiatPriceReq): Promise; + getKlines(req: GetKlinesReq): Promise; /** - * getServiceStatus Get Service Status - * Description: Get the service status - * Documentation: https://www.kucoin.com/docs-new/api-3470158 + * getPartOrderBook Get Part OrderBook + * Description: Query for part orderbook depth data. (aggregated by price) You are recommended to request via this endpoint as the system reponse would be faster and cosume less traffic. + * Documentation: https://www.kucoin.com/docs-new/api-3470165 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -203,15 +187,31 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+--------+ */ - getServiceStatus(): Promise; + getPartOrderBook(req: GetPartOrderBookReq): Promise; /** - * getServerTime Get Server Time - * Description: Get the server time. - * Documentation: https://www.kucoin.com/docs-new/api-3470156 + * getFullOrderBook Get Full OrderBook + * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. + * Documentation: https://www.kucoin.com/docs-new/api-3470164 + * +---------------------+---------+ + * | Extra API Info | Value | + * +---------------------+---------+ + * | API-DOMAIN | SPOT | + * | API-CHANNEL | PRIVATE | + * | API-PERMISSION | GENERAL | + * | API-RATE-LIMIT-POOL | SPOT | + * | API-RATE-LIMIT | 3 | + * +---------------------+---------+ + */ + getFullOrderBook(req: GetFullOrderBookReq): Promise; + + /** + * getFiatPrice Get Fiat Price + * Description: Request via this endpoint to get the fiat price of the currencies for the available trading pairs. + * Documentation: https://www.kucoin.com/docs-new/api-3470153 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -222,12 +222,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getServerTime(): Promise; + getFiatPrice(req: GetFiatPriceReq): Promise; /** - * getAllSymbols Get All Symbols - * Description: Request via this endpoint to get a list of available currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. - * Documentation: https://www.kucoin.com/docs-new/api-3470154 + * get24hrStats Get 24hr Stats + * Description: Request via this endpoint to get the statistics of the specified ticker in the last 24 hours. + * Documentation: https://www.kucoin.com/docs-new/api-3470161 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -235,15 +235,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 4 | + * | API-RATE-LIMIT | 15 | * +---------------------+--------+ */ - getAllSymbols(req: GetAllSymbolsReq): Promise; + get24hrStats(req: Get24hrStatsReq): Promise; /** - * getSymbol Get Symbol - * Description: Request via this endpoint to get detail currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. - * Documentation: https://www.kucoin.com/docs-new/api-3470159 + * getMarketList Get Market List + * Description: Request via this endpoint to get the transaction currency for the entire trading market. + * Documentation: https://www.kucoin.com/docs-new/api-3470166 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -251,15 +251,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 4 | + * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getSymbol(req: GetSymbolReq): Promise; + getMarketList(): Promise; /** - * getAnnouncements Get Announcements - * Description: This interface can obtain the latest news announcements, and the default page search is for announcements within a month. - * Documentation: https://www.kucoin.com/docs-new/api-3470157 + * getServerTime Get Server Time + * Description: Get the server time. + * Documentation: https://www.kucoin.com/docs-new/api-3470156 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -267,15 +267,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getAnnouncements(req: GetAnnouncementsReq): Promise; + getServerTime(): Promise; /** - * getCurrency Get Currency - * Description: Request via this endpoint to get the currency details of a specified currency - * Documentation: https://www.kucoin.com/docs-new/api-3470155 + * getServiceStatus Get Service Status + * Description: Get the service status + * Documentation: https://www.kucoin.com/docs-new/api-3470158 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -286,12 +286,12 @@ export interface MarketAPI { * | API-RATE-LIMIT | 3 | * +---------------------+--------+ */ - getCurrency(req: GetCurrencyReq): Promise; + getServiceStatus(): Promise; /** - * getAllCurrencies Get All Currencies - * Description: Request via this endpoint to get the currency list.Not all currencies currently can be used for trading. - * Documentation: https://www.kucoin.com/docs-new/api-3470152 + * getPublicToken Get Public Token - Spot/Margin + * Description: This interface can obtain the token required for websocket to establish a Spot/Margin connection. If you need use public channels (e.g. all public market data), please make request as follows to obtain the server list and public token + * Documentation: https://www.kucoin.com/docs-new/api-3470294 * +---------------------+--------+ * | Extra API Info | Value | * +---------------------+--------+ @@ -299,15 +299,15 @@ export interface MarketAPI { * | API-CHANNEL | PUBLIC | * | API-PERMISSION | NULL | * | API-RATE-LIMIT-POOL | PUBLIC | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 10 | * +---------------------+--------+ */ - getAllCurrencies(): Promise; + getPublicToken(): Promise; /** - * getFullOrderBook Get Full OrderBook - * Description: Query for Full orderbook depth data. (aggregated by price) It is generally used by professional traders because it uses more server resources and traffic, and we have strict access rate limit control. To maintain up-to-date Order Book, please use Websocket incremental feed after retrieving the OrderBook. - * Documentation: https://www.kucoin.com/docs-new/api-3470164 + * getPrivateToken Get Private Token - Spot/Margin + * Description: This interface can obtain the token required for websocket to establish a Spot/Margin private connection. If you need use private channels(e.g. account balance notice), please make request as follows to obtain the server list and private token + * Documentation: https://www.kucoin.com/docs-new/api-3470295 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -315,71 +315,71 @@ export interface MarketAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - getFullOrderBook(req: GetFullOrderBookReq): Promise; + getPrivateToken(): Promise; } export class MarketAPIImpl implements MarketAPI { constructor(private transport: Transport) {} - getPrivateToken(): Promise { + getAnnouncements(req: GetAnnouncementsReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/bullet-private', - null, - new GetPrivateTokenResp(), + 'GET', + '/api/v3/announcements', + req, + new GetAnnouncementsResp(), false, ); } - getPublicToken(): Promise { + getCurrency(req: GetCurrencyReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/bullet-public', - null, - new GetPublicTokenResp(), + 'GET', + '/api/v3/currencies/{currency}', + req, + new GetCurrencyResp(), false, ); } - getAllTickers(): Promise { + getAllCurrencies(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/market/allTickers', + '/api/v3/currencies', null, - new GetAllTickersResp(), + new GetAllCurrenciesResp(), false, ); } - getKlines(req: GetKlinesReq): Promise { + getSymbol(req: GetSymbolReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/market/candles', + '/api/v2/symbols/{symbol}', req, - new GetKlinesResp(), + new GetSymbolResp(), false, ); } - getTradeHistory(req: GetTradeHistoryReq): Promise { + getAllSymbols(req: GetAllSymbolsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/market/histories', + '/api/v2/symbols', req, - new GetTradeHistoryResp(), + new GetAllSymbolsResp(), false, ); } @@ -396,146 +396,146 @@ export class MarketAPIImpl implements MarketAPI { ); } - getPartOrderBook(req: GetPartOrderBookReq): Promise { + getAllTickers(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/market/orderbook/level2_{size}', - req, - new GetPartOrderBookResp(), + '/api/v1/market/allTickers', + null, + new GetAllTickersResp(), false, ); } - get24hrStats(req: Get24hrStatsReq): Promise { + getTradeHistory(req: GetTradeHistoryReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/market/stats', + '/api/v1/market/histories', req, - new Get24hrStatsResp(), + new GetTradeHistoryResp(), false, ); } - getMarketList(): Promise { + getKlines(req: GetKlinesReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/markets', - null, - new GetMarketListResp(), + '/api/v1/market/candles', + req, + new GetKlinesResp(), false, ); } - getFiatPrice(req: GetFiatPriceReq): Promise { + getPartOrderBook(req: GetPartOrderBookReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/prices', + '/api/v1/market/orderbook/level2_{size}', req, - new GetFiatPriceResp(), + new GetPartOrderBookResp(), false, ); } - getServiceStatus(): Promise { + getFullOrderBook(req: GetFullOrderBookReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/status', - null, - new GetServiceStatusResp(), + '/api/v3/market/orderbook/level2', + req, + new GetFullOrderBookResp(), false, ); } - getServerTime(): Promise { + getFiatPrice(req: GetFiatPriceReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/timestamp', - null, - new GetServerTimeResp(), + '/api/v1/prices', + req, + new GetFiatPriceResp(), false, ); } - getAllSymbols(req: GetAllSymbolsReq): Promise { + get24hrStats(req: Get24hrStatsReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v2/symbols', + '/api/v1/market/stats', req, - new GetAllSymbolsResp(), + new Get24hrStatsResp(), false, ); } - getSymbol(req: GetSymbolReq): Promise { + getMarketList(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v2/symbols/{symbol}', - req, - new GetSymbolResp(), + '/api/v1/markets', + null, + new GetMarketListResp(), false, ); } - getAnnouncements(req: GetAnnouncementsReq): Promise { + getServerTime(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/announcements', - req, - new GetAnnouncementsResp(), + '/api/v1/timestamp', + null, + new GetServerTimeResp(), false, ); } - getCurrency(req: GetCurrencyReq): Promise { + getServiceStatus(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/currencies/{currency}', - req, - new GetCurrencyResp(), + '/api/v1/status', + null, + new GetServiceStatusResp(), false, ); } - getAllCurrencies(): Promise { + getPublicToken(): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/currencies', + 'POST', + '/api/v1/bullet-public', null, - new GetAllCurrenciesResp(), + new GetPublicTokenResp(), false, ); } - getFullOrderBook(req: GetFullOrderBookReq): Promise { + getPrivateToken(): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/market/orderbook/level2', - req, - new GetFullOrderBookResp(), + 'POST', + '/api/v1/bullet-private', + null, + new GetPrivateTokenResp(), false, ); } diff --git a/sdk/node/src/generate/spot/order/api_order.template b/sdk/node/src/generate/spot/order/api_order.template index 44599612..a5a66089 100644 --- a/sdk/node/src/generate/spot/order/api_order.template +++ b/sdk/node/src/generate/spot/order/api_order.template @@ -5,94 +5,167 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getTradeHistoryOld request test', ()=> { + test('addOrder request test', ()=> { /** - * getTradeHistoryOld - * Get Trade History - Old - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/hf/orders */ - let builder = GetTradeHistoryOldReq.builder(); - builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let builder = AddOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); let req = builder.build(); - let resp = api.getTradeHistoryOld(req); + let resp = api.addOrder(req); return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('getTradeHistory request test', ()=> { + test('addOrderSync request test', ()=> { /** - * getTradeHistory - * Get Trade History - * /api/v1/hf/fills + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync */ - let builder = GetTradeHistoryReq.builder(); - builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let builder = AddOrderSyncReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); let req = builder.build(); - let resp = api.getTradeHistory(req); + let resp = api.addOrderSync(req); return resp.then(result => { - expect(result.items).toEqual(expect.anything()); - expect(result.lastId).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.matchTime).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOpenOrders request test', ()=> { + test('addOrderTest request test', ()=> { /** - * getOpenOrders - * Get Open Orders - * /api/v1/hf/orders/active + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test */ - let builder = GetOpenOrdersReq.builder(); - builder.setSymbol(?); + let builder = AddOrderTestReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); let req = builder.build(); - let resp = api.getOpenOrders(req); + let resp = api.addOrderTest(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('batchAddOrders request test', ()=> { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi + */ + let builder = BatchAddOrdersReq.builder(); + builder.setOrderList(?); + let req = builder.build(); + let resp = api.batchAddOrders(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('getSymbolsWithOpenOrder request test', ()=> { + test('batchAddOrdersSync request test', ()=> { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v1/hf/orders/active/symbols + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync */ - let resp = api.getSymbolsWithOpenOrder(); + let builder = BatchAddOrdersSyncReq.builder(); + builder.setOrderList(?); + let req = builder.build(); + let resp = api.batchAddOrdersSync(req); return resp.then(result => { - expect(result.symbols).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('modifyOrder request test', ()=> { + test('cancelOrderByOrderId request test', ()=> { /** - * modifyOrder - * Modify Order - * /api/v1/hf/orders/alter + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} */ - let builder = ModifyOrderReq.builder(); - builder.setClientOid(?).setSymbol(?).setOrderId(?).setNewPrice(?).setNewSize(?); + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId(?).setSymbol(?); let req = builder.build(); - let resp = api.modifyOrder(req); + let resp = api.cancelOrderByOrderId(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOrderByOrderIdSync request test', ()=> { + /** + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} + */ + let builder = CancelOrderByOrderIdSyncReq.builder(); + builder.setOrderId(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdSync(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOrderByClientOid request test', ()=> { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); return resp.then(result => { - expect(result.newOrderId).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllOrders request test', ()=> { + test('cancelOrderByClientOidSync request test', ()=> { /** - * cancelAllOrders - * Cancel All Orders - * /api/v1/hf/orders/cancelAll + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} */ - let resp = api.cancelAllOrders(); + let builder = CancelOrderByClientOidSyncReq.builder(); + builder.setClientOid(?).setSymbol(?); + let req = builder.build(); + let resp = api.cancelOrderByClientOidSync(req); return resp.then(result => { - expect(result.succeedSymbols).toEqual(expect.anything()); - expect(result.failedSymbols).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); }); }) @@ -109,21 +182,103 @@ describe('Auto Test', ()=> { return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); expect(result.cancelSize).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByClientOid request test', ()=> { + test('cancelAllOrdersBySymbol request test', ()=> { /** - * cancelOrderByClientOid - * Cancel Order By ClientOid - * /api/v1/hf/orders/client-order/{clientOid} + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v1/hf/orders */ - let builder = CancelOrderByClientOidReq.builder(); - builder.setClientOid(?).setSymbol(?); + let builder = CancelAllOrdersBySymbolReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.cancelOrderByClientOid(req); + let resp = api.cancelAllOrdersBySymbol(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelAllOrders request test', ()=> { + /** + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll + */ + let resp = api.cancelAllOrders(); + return resp.then(result => { + expect(result.succeedSymbols).toEqual(expect.anything()); + expect(result.failedSymbols).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyOrder request test', ()=> { + /** + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter + */ + let builder = ModifyOrderReq.builder(); + builder.setClientOid(?).setSymbol(?).setOrderId(?).setNewPrice(?).setNewSize(?); + let req = builder.build(); + let resp = api.modifyOrder(req); + return resp.then(result => { + expect(result.newOrderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getOrderByOrderId request test', ()=> { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + console.log(resp); }); }) @@ -172,22 +327,70 @@ describe('Auto Test', ()=> { expect(result.remainFunds).toEqual(expect.anything()); expect(result.tax).toEqual(expect.anything()); expect(result.active).toEqual(expect.anything()); + console.log(resp); }); }) - test('setDCP request test', ()=> { + test('getSymbolsWithOpenOrder request test', ()=> { /** - * setDCP - * Set DCP - * /api/v1/hf/orders/dead-cancel-all + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols */ - let builder = SetDCPReq.builder(); - builder.setTimeout(?).setSymbols(?); + let resp = api.getSymbolsWithOpenOrder(); + return resp.then(result => { + expect(result.symbols).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getOpenOrders request test', ()=> { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let builder = GetOpenOrdersReq.builder(); + builder.setSymbol(?); let req = builder.build(); - let resp = api.setDCP(req); + let resp = api.getOpenOrders(req); return resp.then(result => { - expect(result.currentTime).toEqual(expect.anything()); - expect(result.triggerTime).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getClosedOrders request test', ()=> { + /** + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done + */ + let builder = GetClosedOrdersReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getClosedOrders(req); + return resp.then(result => { + expect(result.lastId).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getTradeHistory request test', ()=> { + /** + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then(result => { + expect(result.items).toEqual(expect.anything()); + expect(result.lastId).toEqual(expect.anything()); + console.log(resp); }); }) @@ -203,255 +406,381 @@ describe('Auto Test', ()=> { expect(result.symbols).toEqual(expect.anything()); expect(result.currentTime).toEqual(expect.anything()); expect(result.triggerTime).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelAllOrdersBySymbol request test', ()=> { + test('setDCP request test', ()=> { /** - * cancelAllOrdersBySymbol - * Cancel All Orders By Symbol - * /api/v1/hf/orders + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all */ - let builder = CancelAllOrdersBySymbolReq.builder(); - builder.setSymbol(?); + let builder = SetDCPReq.builder(); + builder.setTimeout(?).setSymbols(?); let req = builder.build(); - let resp = api.cancelAllOrdersBySymbol(req); + let resp = api.setDCP(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currentTime).toEqual(expect.anything()); + expect(result.triggerTime).toEqual(expect.anything()); + console.log(resp); }); }) - test('getClosedOrders request test', ()=> { + test('addStopOrder request test', ()=> { /** - * getClosedOrders - * Get Closed Orders - * /api/v1/hf/orders/done + * addStopOrder + * Add Stop Order + * /api/v1/stop-order */ - let builder = GetClosedOrdersReq.builder(); - builder.setSymbol(?).setSide(?).setType(?).setLastId(?).setLimit(?).setStartAt(?).setEndAt(?); + let builder = AddStopOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setStopPrice(?).setTradeType(?); let req = builder.build(); - let resp = api.getClosedOrders(req); + let resp = api.addStopOrder(req); return resp.then(result => { - expect(result.lastId).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); }); }) - test('batchAddOrders request test', ()=> { + test('cancelStopOrderByClientOid request test', ()=> { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/hf/orders/multi + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid */ - let builder = BatchAddOrdersReq.builder(); - builder.setOrderList(?); + let builder = CancelStopOrderByClientOidReq.builder(); + builder.setSymbol(?).setClientOid(?); let req = builder.build(); - let resp = api.batchAddOrders(req); + let resp = api.cancelStopOrderByClientOid(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelledOrderId).toEqual(expect.anything()); + console.log(resp); }); }) - test('batchAddOrdersSync request test', ()=> { + test('cancelStopOrderByOrderId request test', ()=> { /** - * batchAddOrdersSync - * Batch Add Orders Sync - * /api/v1/hf/orders/multi/sync + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} */ - let builder = BatchAddOrdersSyncReq.builder(); - builder.setOrderList(?); + let builder = CancelStopOrderByOrderIdReq.builder(); + builder.setOrderId(?); let req = builder.build(); - let resp = api.batchAddOrdersSync(req); + let resp = api.cancelStopOrderByOrderId(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByOrderId request test', ()=> { + test('batchCancelStopOrder request test', ()=> { /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v1/hf/orders/{orderId} + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel */ - let builder = CancelOrderByOrderIdReq.builder(); - builder.setOrderId(?).setSymbol(?); + let builder = BatchCancelStopOrderReq.builder(); + builder.setSymbol(?).setTradeType(?).setOrderIds(?); let req = builder.build(); - let resp = api.cancelOrderByOrderId(req); + let resp = api.batchCancelStopOrder(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) - test('getOrderByOrderId request test', ()=> { + test('getStopOrdersList request test', ()=> { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v1/hf/orders/{orderId} + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order */ - let builder = GetOrderByOrderIdReq.builder(); - builder.setSymbol(?).setOrderId(?); + let builder = GetStopOrdersListReq.builder(); + builder.setSymbol(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setOrderIds(?).setPageSize(?).setStop(?); let req = builder.build(); - let resp = api.getOrderByOrderId(req); + let resp = api.getStopOrdersList(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getStopOrderByOrderId request test', ()=> { + /** + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let builder = GetStopOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getStopOrderByOrderId(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); - expect(result.opType).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); expect(result.type).toEqual(expect.anything()); expect(result.side).toEqual(expect.anything()); expect(result.price).toEqual(expect.anything()); expect(result.size).toEqual(expect.anything()); expect(result.funds).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.dealFunds).toEqual(expect.anything()); - expect(result.fee).toEqual(expect.anything()); - expect(result.feeCurrency).toEqual(expect.anything()); expect(result.stp).toEqual(expect.anything()); expect(result.timeInForce).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); expect(result.postOnly).toEqual(expect.anything()); expect(result.hidden).toEqual(expect.anything()); expect(result.iceberg).toEqual(expect.anything()); expect(result.visibleSize).toEqual(expect.anything()); - expect(result.cancelAfter).toEqual(expect.anything()); expect(result.channel).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); expect(result.remark).toEqual(expect.anything()); expect(result.tags).toEqual(expect.anything()); - expect(result.cancelExist).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); - expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.domainId).toEqual(expect.anything()); + expect(result.tradeSource).toEqual(expect.anything()); expect(result.tradeType).toEqual(expect.anything()); - expect(result.inOrderBook).toEqual(expect.anything()); - expect(result.cancelledSize).toEqual(expect.anything()); - expect(result.cancelledFunds).toEqual(expect.anything()); - expect(result.remainSize).toEqual(expect.anything()); - expect(result.remainFunds).toEqual(expect.anything()); - expect(result.tax).toEqual(expect.anything()); - expect(result.active).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggerTime).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrder request test', ()=> { + test('getStopOrderByClientOid request test', ()=> { /** - * addOrder - * Add Order - * /api/v1/hf/orders + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid */ - let builder = AddOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let builder = GetStopOrderByClientOidReq.builder(); + builder.setClientOid(?).setSymbol(?); let req = builder.build(); - let resp = api.addOrder(req); + let resp = api.getStopOrderByClientOid(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByClientOidSync request test', ()=> { + test('addOcoOrder request test', ()=> { /** - * cancelOrderByClientOidSync - * Cancel Order By ClientOid Sync - * /api/v1/hf/orders/sync/client-order/{clientOid} + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order */ - let builder = CancelOrderByClientOidSyncReq.builder(); - builder.setClientOid(?).setSymbol(?); + let builder = AddOcoOrderReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setRemark(?).setPrice(?).setSize(?).setStopPrice(?).setLimitPrice(?).setTradeType(?); let req = builder.build(); - let resp = api.cancelOrderByClientOidSync(req); + let resp = api.addOcoOrder(req); return resp.then(result => { - expect(result.clientOid).toEqual(expect.anything()); - expect(result.originSize).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.remainSize).toEqual(expect.anything()); - expect(result.canceledSize).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); }); }) - test('cancelOrderByOrderIdSync request test', ()=> { + test('cancelOcoOrderByOrderId request test', ()=> { /** - * cancelOrderByOrderIdSync - * Cancel Order By OrderId Sync - * /api/v1/hf/orders/sync/{orderId} + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} */ - let builder = CancelOrderByOrderIdSyncReq.builder(); - builder.setOrderId(?).setSymbol(?); + let builder = CancelOcoOrderByOrderIdReq.builder(); + builder.setOrderId(?); let req = builder.build(); - let resp = api.cancelOrderByOrderIdSync(req); + let resp = api.cancelOcoOrderByOrderId(req); return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOcoOrderByClientOid request test', ()=> { + /** + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let builder = CancelOcoOrderByClientOidReq.builder(); + builder.setClientOid(?); + let req = builder.build(); + let resp = api.cancelOcoOrderByClientOid(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('batchCancelOcoOrders request test', ()=> { + /** + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders + */ + let builder = BatchCancelOcoOrdersReq.builder(); + builder.setOrderIds(?).setSymbol(?); + let req = builder.build(); + let resp = api.batchCancelOcoOrders(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getOcoOrderByOrderId request test', ()=> { + /** + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let builder = GetOcoOrderByOrderIdReq.builder(); + builder.setOrderId(?); + let req = builder.build(); + let resp = api.getOcoOrderByOrderId(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); expect(result.orderId).toEqual(expect.anything()); - expect(result.originSize).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.remainSize).toEqual(expect.anything()); - expect(result.canceledSize).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderSync request test', ()=> { + test('getOcoOrderByClientOid request test', ()=> { /** - * addOrderSync - * Add Order Sync - * /api/v1/hf/orders/sync + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} */ - let builder = AddOrderSyncReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let builder = GetOcoOrderByClientOidReq.builder(); + builder.setClientOid(?); let req = builder.build(); - let resp = api.addOrderSync(req); + let resp = api.getOcoOrderByClientOid(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); expect(result.orderTime).toEqual(expect.anything()); - expect(result.originSize).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.remainSize).toEqual(expect.anything()); - expect(result.canceledSize).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); - expect(result.matchTime).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderTest request test', ()=> { + test('getOcoOrderDetailByOrderId request test', ()=> { /** - * addOrderTest - * Add Order Test - * /api/v1/hf/orders/test + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} */ - let builder = AddOrderTestReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setTags(?).setCancelAfter(?).setFunds(?); + let builder = GetOcoOrderDetailByOrderIdReq.builder(); + builder.setOrderId(?); let req = builder.build(); - let resp = api.addOrderTest(req); + let resp = api.getOcoOrderDetailByOrderId(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + console.log(resp); }); }) - test('getRecentTradeHistoryOld request test', ()=> { + test('getOcoOrderList request test', ()=> { /** - * getRecentTradeHistoryOld - * Get Recent Trade History - Old - * /api/v1/limit/fills + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders */ - let builder = GetRecentTradeHistoryOldReq.builder(); - builder.setCurrentPage(?).setPageSize(?); + let builder = GetOcoOrderListReq.builder(); + builder.setSymbol(?).setStartAt(?).setEndAt(?).setOrderIds(?).setPageSize(?).setCurrentPage(?); let req = builder.build(); - let resp = api.getRecentTradeHistoryOld(req); + let resp = api.getOcoOrderList(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('getRecentOrdersListOld request test', ()=> { + test('addOrderOld request test', ()=> { /** - * getRecentOrdersListOld - * Get Recent Orders List - Old - * /api/v1/limit/orders + * addOrderOld + * Add Order - Old + * /api/v1/orders */ - let builder = GetRecentOrdersListOldReq.builder(); - builder.setCurrentPage(?).setPageSize(?); + let builder = AddOrderOldReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); let req = builder.build(); - let resp = api.getRecentOrdersListOld(req); + let resp = api.addOrderOld(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addOrderTestOld request test', ()=> { + /** + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test + */ + let builder = AddOrderTestOldReq.builder(); + builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); + let req = builder.build(); + let resp = api.addOrderTestOld(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('batchAddOrdersOld request test', ()=> { + /** + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi + */ + let builder = BatchAddOrdersOldReq.builder(); + builder.setOrderList(?).setSymbol(?); + let req = builder.build(); + let resp = api.batchAddOrdersOld(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('cancelOrderByOrderIdOld request test', ()=> { + /** + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let builder = CancelOrderByOrderIdOldReq.builder(); + builder.setSymbol(?).setOrderId(?); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdOld(req); + return resp.then(result => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) @@ -469,50 +798,7 @@ describe('Auto Test', ()=> { expect(result.clientOid).toEqual(expect.anything()); expect(result.cancelledOrderId).toEqual(expect.anything()); expect(result.cancelledOcoOrderIds).toEqual(expect.anything()); - }); - }) - - test('getOrderByClientOidOld request test', ()=> { - /** - * getOrderByClientOidOld - * Get Order By ClientOid - Old - * /api/v1/order/client-order/{clientOid} - */ - let builder = GetOrderByClientOidOldReq.builder(); - builder.setClientOid(?); - let req = builder.build(); - let resp = api.getOrderByClientOidOld(req); - return resp.then(result => { - expect(result.id).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.opType).toEqual(expect.anything()); - expect(result.type).toEqual(expect.anything()); - expect(result.side).toEqual(expect.anything()); - expect(result.price).toEqual(expect.anything()); - expect(result.size).toEqual(expect.anything()); - expect(result.funds).toEqual(expect.anything()); - expect(result.dealFunds).toEqual(expect.anything()); - expect(result.dealSize).toEqual(expect.anything()); - expect(result.fee).toEqual(expect.anything()); - expect(result.feeCurrency).toEqual(expect.anything()); - expect(result.stp).toEqual(expect.anything()); - expect(result.stop).toEqual(expect.anything()); - expect(result.stopTriggered).toEqual(expect.anything()); - expect(result.stopPrice).toEqual(expect.anything()); - expect(result.timeInForce).toEqual(expect.anything()); - expect(result.postOnly).toEqual(expect.anything()); - expect(result.hidden).toEqual(expect.anything()); - expect(result.iceberg).toEqual(expect.anything()); - expect(result.visibleSize).toEqual(expect.anything()); - expect(result.cancelAfter).toEqual(expect.anything()); - expect(result.channel).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); - expect(result.remark).toEqual(expect.anything()); - expect(result.tags).toEqual(expect.anything()); - expect(result.isActive).toEqual(expect.anything()); - expect(result.cancelExist).toEqual(expect.anything()); - expect(result.createdAt).toEqual(expect.anything()); - expect(result.tradeType).toEqual(expect.anything()); + console.log(resp); }); }) @@ -528,6 +814,7 @@ describe('Auto Test', ()=> { let resp = api.batchCancelOrderOld(req); return resp.then(result => { expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) @@ -547,36 +834,23 @@ describe('Auto Test', ()=> { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('batchAddOrdersOld request test', ()=> { + test('getRecentOrdersListOld request test', ()=> { /** - * batchAddOrdersOld - * Batch Add Orders - Old - * /api/v1/orders/multi + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders */ - let builder = BatchAddOrdersOldReq.builder(); - builder.setOrderList(?).setSymbol(?); + let builder = GetRecentOrdersListOldReq.builder(); + builder.setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.batchAddOrdersOld(req); + let resp = api.getRecentOrdersListOld(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - }); - }) - - test('cancelOrderByOrderIdOld request test', ()=> { - /** - * cancelOrderByOrderIdOld - * Cancel Order By OrderId - Old - * /api/v1/orders/{orderId} - */ - let builder = CancelOrderByOrderIdOldReq.builder(); - builder.setSymbol(?).setOrderId(?); - let req = builder.build(); - let resp = api.cancelOrderByOrderIdOld(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); }); }) @@ -621,314 +895,88 @@ describe('Auto Test', ()=> { expect(result.cancelExist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); expect(result.tradeType).toEqual(expect.anything()); + console.log(resp); }); }) - test('addOrderOld request test', ()=> { + test('getOrderByClientOidOld request test', ()=> { /** - * addOrderOld - * Add Order - Old - * /api/v1/orders + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} */ - let builder = AddOrderOldReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); + let builder = GetOrderByClientOidOldReq.builder(); + builder.setClientOid(?); let req = builder.build(); - let resp = api.addOrderOld(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - }); - }) - - test('addOrderTestOld request test', ()=> { - /** - * addOrderTestOld - * Add Order Test - Old - * /api/v1/orders/test - */ - let builder = AddOrderTestOldReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setTradeType(?); - let req = builder.build(); - let resp = api.addOrderTestOld(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - }); - }) - - test('batchCancelStopOrder request test', ()=> { - /** - * batchCancelStopOrder - * Batch Cancel Stop Orders - * /api/v1/stop-order/cancel - */ - let builder = BatchCancelStopOrderReq.builder(); - builder.setSymbol(?).setTradeType(?).setOrderIds(?); - let req = builder.build(); - let resp = api.batchCancelStopOrder(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); - }); - }) - - test('cancelStopOrderByClientOid request test', ()=> { - /** - * cancelStopOrderByClientOid - * Cancel Stop Order By ClientOid - * /api/v1/stop-order/cancelOrderByClientOid - */ - let builder = CancelStopOrderByClientOidReq.builder(); - builder.setSymbol(?).setClientOid(?); - let req = builder.build(); - let resp = api.cancelStopOrderByClientOid(req); - return resp.then(result => { - expect(result.clientOid).toEqual(expect.anything()); - expect(result.cancelledOrderId).toEqual(expect.anything()); - }); - }) - - test('getStopOrdersList request test', ()=> { - /** - * getStopOrdersList - * Get Stop Orders List - * /api/v1/stop-order - */ - let builder = GetStopOrdersListReq.builder(); - builder.setSymbol(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setOrderIds(?).setPageSize(?).setStop(?); - let req = builder.build(); - let resp = api.getStopOrdersList(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); - }); - }) - - test('cancelStopOrderByOrderId request test', ()=> { - /** - * cancelStopOrderByOrderId - * Cancel Stop Order By OrderId - * /api/v1/stop-order/{orderId} - */ - let builder = CancelStopOrderByOrderIdReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.cancelStopOrderByOrderId(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); - }); - }) - - test('getStopOrderByOrderId request test', ()=> { - /** - * getStopOrderByOrderId - * Get Stop Order By OrderId - * /api/v1/stop-order/{orderId} - */ - let builder = GetStopOrderByOrderIdReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.getStopOrderByOrderId(req); + let resp = api.getOrderByClientOidOld(req); return resp.then(result => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); - expect(result.userId).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); expect(result.type).toEqual(expect.anything()); expect(result.side).toEqual(expect.anything()); expect(result.price).toEqual(expect.anything()); expect(result.size).toEqual(expect.anything()); expect(result.funds).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); expect(result.timeInForce).toEqual(expect.anything()); - expect(result.cancelAfter).toEqual(expect.anything()); expect(result.postOnly).toEqual(expect.anything()); expect(result.hidden).toEqual(expect.anything()); expect(result.iceberg).toEqual(expect.anything()); expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); expect(result.channel).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); expect(result.remark).toEqual(expect.anything()); expect(result.tags).toEqual(expect.anything()); - expect(result.domainId).toEqual(expect.anything()); - expect(result.tradeSource).toEqual(expect.anything()); - expect(result.tradeType).toEqual(expect.anything()); - expect(result.feeCurrency).toEqual(expect.anything()); - expect(result.takerFeeRate).toEqual(expect.anything()); - expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); - expect(result.stop).toEqual(expect.anything()); - expect(result.stopTriggerTime).toEqual(expect.anything()); - expect(result.stopPrice).toEqual(expect.anything()); - expect(result.orderTime).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + console.log(resp); }); }) - test('addStopOrder request test', ()=> { + test('getTradeHistoryOld request test', ()=> { /** - * addStopOrder - * Add Stop Order - * /api/v1/stop-order + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills */ - let builder = AddStopOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setType(?).setRemark(?).setStp(?).setPrice(?).setSize(?).setTimeInForce(?).setPostOnly(?).setHidden(?).setIceberg(?).setVisibleSize(?).setCancelAfter(?).setFunds(?).setStopPrice(?).setTradeType(?); + let builder = GetTradeHistoryOldReq.builder(); + builder.setSymbol(?).setOrderId(?).setSide(?).setType(?).setTradeType(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.addStopOrder(req); + let resp = api.getTradeHistoryOld(req); return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) - test('getStopOrderByClientOid request test', ()=> { + test('getRecentTradeHistoryOld request test', ()=> { /** - * getStopOrderByClientOid - * Get Stop Order By ClientOid - * /api/v1/stop-order/queryOrderByClientOid + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills */ - let builder = GetStopOrderByClientOidReq.builder(); - builder.setClientOid(?).setSymbol(?); + let builder = GetRecentTradeHistoryOldReq.builder(); + builder.setCurrentPage(?).setPageSize(?); let req = builder.build(); - let resp = api.getStopOrderByClientOid(req); + let resp = api.getRecentTradeHistoryOld(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - }); - }) - - test('cancelOcoOrderByClientOid request test', ()=> { - /** - * cancelOcoOrderByClientOid - * Cancel OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} - */ - let builder = CancelOcoOrderByClientOidReq.builder(); - builder.setClientOid(?); - let req = builder.build(); - let resp = api.cancelOcoOrderByClientOid(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); - }); - }) - - test('getOcoOrderByClientOid request test', ()=> { - /** - * getOcoOrderByClientOid - * Get OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} - */ - let builder = GetOcoOrderByClientOidReq.builder(); - builder.setClientOid(?); - let req = builder.build(); - let resp = api.getOcoOrderByClientOid(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); - expect(result.orderId).toEqual(expect.anything()); - expect(result.orderTime).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - }); - }) - - test('getOcoOrderDetailByOrderId request test', ()=> { - /** - * getOcoOrderDetailByOrderId - * Get OCO Order Detail By OrderId - * /api/v3/oco/order/details/{orderId} - */ - let builder = GetOcoOrderDetailByOrderIdReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.getOcoOrderDetailByOrderId(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - expect(result.symbol).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); - expect(result.orderTime).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - expect(result.orders).toEqual(expect.anything()); - }); - }) - - test('cancelOcoOrderByOrderId request test', ()=> { - /** - * cancelOcoOrderByOrderId - * Cancel OCO Order By OrderId - * /api/v3/oco/order/{orderId} - */ - let builder = CancelOcoOrderByOrderIdReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.cancelOcoOrderByOrderId(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); - }); - }) - - test('getOcoOrderByOrderId request test', ()=> { - /** - * getOcoOrderByOrderId - * Get OCO Order By OrderId - * /api/v3/oco/order/{orderId} - */ - let builder = GetOcoOrderByOrderIdReq.builder(); - builder.setOrderId(?); - let req = builder.build(); - let resp = api.getOcoOrderByOrderId(req); - return resp.then(result => { - expect(result.symbol).toEqual(expect.anything()); - expect(result.clientOid).toEqual(expect.anything()); - expect(result.orderId).toEqual(expect.anything()); - expect(result.orderTime).toEqual(expect.anything()); - expect(result.status).toEqual(expect.anything()); - }); - }) - - test('addOcoOrder request test', ()=> { - /** - * addOcoOrder - * Add OCO Order - * /api/v3/oco/order - */ - let builder = AddOcoOrderReq.builder(); - builder.setClientOid(?).setSide(?).setSymbol(?).setRemark(?).setPrice(?).setSize(?).setStopPrice(?).setLimitPrice(?).setTradeType(?); - let req = builder.build(); - let resp = api.addOcoOrder(req); - return resp.then(result => { - expect(result.orderId).toEqual(expect.anything()); - }); - }) - - test('batchCancelOcoOrders request test', ()=> { - /** - * batchCancelOcoOrders - * Batch Cancel OCO Order - * /api/v3/oco/orders - */ - let builder = BatchCancelOcoOrdersReq.builder(); - builder.setOrderIds(?).setSymbol(?); - let req = builder.build(); - let resp = api.batchCancelOcoOrders(req); - return resp.then(result => { - expect(result.cancelledOrderIds).toEqual(expect.anything()); - }); - }) - - test('getOcoOrderList request test', ()=> { - /** - * getOcoOrderList - * Get OCO Order List - * /api/v3/oco/orders - */ - let builder = GetOcoOrderListReq.builder(); - builder.setSymbol(?).setStartAt(?).setEndAt(?).setOrderIds(?).setPageSize(?).setCurrentPage(?); - let req = builder.build(); - let resp = api.getOcoOrderList(req); - return resp.then(result => { - expect(result.currentPage).toEqual(expect.anything()); - expect(result.pageSize).toEqual(expect.anything()); - expect(result.totalNum).toEqual(expect.anything()); - expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/spot/order/api_order.test.ts b/sdk/node/src/generate/spot/order/api_order.test.ts index b51d0e56..e6e2c35c 100644 --- a/sdk/node/src/generate/spot/order/api_order.test.ts +++ b/sdk/node/src/generate/spot/order/api_order.test.ts @@ -1,18 +1,18 @@ -import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetTradeHistoryOldReq } from './model_get_trade_history_old_req'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; import { CancelOrderByOrderIdSyncResp } from './model_cancel_order_by_order_id_sync_resp'; +import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; import { CancelStopOrderByOrderIdResp } from './model_cancel_stop_order_by_order_id_resp'; import { CancelStopOrderByClientOidResp } from './model_cancel_stop_order_by_client_oid_resp'; -import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; import { GetOrderByClientOidOldResp } from './model_get_order_by_client_oid_old_resp'; -import { AddOrderReq } from './model_add_order_req'; import { SetDCPResp } from './model_set_dcp_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; import { BatchCancelOrderOldResp } from './model_batch_cancel_order_old_resp'; import { BatchCancelOrderOldReq } from './model_batch_cancel_order_old_req'; -import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; -import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; import { GetOrdersListOldResp } from './model_get_orders_list_old_resp'; +import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; import { GetClosedOrdersReq } from './model_get_closed_orders_req'; import { GetRecentTradeHistoryOldResp } from './model_get_recent_trade_history_old_resp'; import { CancelStopOrderByOrderIdReq } from './model_cancel_stop_order_by_order_id_req'; @@ -27,28 +27,28 @@ import { AddStopOrderResp } from './model_add_stop_order_resp'; import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; import { GetStopOrderByClientOidReq } from './model_get_stop_order_by_client_oid_req'; import { AddOrderTestReq } from './model_add_order_test_req'; -import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; import { GetTradeHistoryOldResp } from './model_get_trade_history_old_resp'; +import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; import { CancelOrderByOrderIdOldReq } from './model_cancel_order_by_order_id_old_req'; import { CancelOrderByOrderIdSyncReq } from './model_cancel_order_by_order_id_sync_req'; import { BatchAddOrdersSyncReq } from './model_batch_add_orders_sync_req'; -import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; import { GetOrdersListOldReq } from './model_get_orders_list_old_req'; +import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; import { GetOcoOrderByClientOidReq } from './model_get_oco_order_by_client_oid_req'; import { CancelPartialOrderReq } from './model_cancel_partial_order_req'; import { BatchAddOrdersSyncResp } from './model_batch_add_orders_sync_resp'; import { BatchAddOrdersOldResp } from './model_batch_add_orders_old_resp'; import { AddOrderTestResp } from './model_add_order_test_resp'; +import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; import { GetOcoOrderListReq } from './model_get_oco_order_list_req'; import { GetOcoOrderByClientOidResp } from './model_get_oco_order_by_client_oid_resp'; -import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; import { AddOrderTestOldReq } from './model_add_order_test_old_req'; import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; import { AddOcoOrderResp } from './model_add_oco_order_resp'; import { CancelOrderByClientOidSyncReq } from './model_cancel_order_by_client_oid_sync_req'; import { GetOrderByOrderIdOldReq } from './model_get_order_by_order_id_old_req'; -import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; import { ModifyOrderResp } from './model_modify_order_resp'; import { SetDCPReq } from './model_set_dcp_req'; @@ -73,36 +73,36 @@ import { BatchAddOrdersOldReq } from './model_batch_add_orders_old_req'; import { GetOpenOrdersReq } from './model_get_open_orders_req'; import { GetStopOrdersListReq } from './model_get_stop_orders_list_req'; import { GetRecentTradeHistoryOldReq } from './model_get_recent_trade_history_old_req'; -import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; import { AddOrderOldResp } from './model_add_order_old_resp'; +import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetOrderByOrderIdOldResp } from './model_get_order_by_order_id_old_resp'; import { BatchCancelOcoOrdersResp } from './model_batch_cancel_oco_orders_resp'; import { GetOcoOrderByOrderIdResp } from './model_get_oco_order_by_order_id_resp'; -import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidOldReq } from './model_cancel_order_by_client_oid_old_req'; import { CancelOcoOrderByClientOidResp } from './model_cancel_oco_order_by_client_oid_resp'; import { GetRecentOrdersListOldReq } from './model_get_recent_orders_list_old_req'; -import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; import { BatchAddOrdersReq } from './model_batch_add_orders_req'; -import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; import { CancelStopOrderByClientOidReq } from './model_cancel_stop_order_by_client_oid_req'; import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; import { AddOrderSyncReq } from './model_add_order_sync_req'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getTradeHistoryOld request test', () => { + test('addOrder request test', () => { /** - * getTradeHistoryOld - * Get Trade History - Old - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/hf/orders */ let data = - '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetTradeHistoryOldReq(); + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -110,16 +110,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getTradeHistoryOld response test', () => { + test('addOrder response test', () => { /** - * getTradeHistoryOld - * Get Trade History - Old - * /api/v1/fills + * addOrder + * Add Order + * /api/v1/hf/orders */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "symbol": "DOGE-USDT",\n "tradeId": "10862827223795713",\n "orderId": "6745698ef4f1200007c561a8",\n "counterOrderId": "6745695ef15b270007ac5076",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "0.40739",\n "size": "10",\n "funds": "4.0739",\n "fee": "0.0040739",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "market",\n "createdAt": 1732602254928\n }\n ]\n }\n}'; + '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryOldResp(); + let resp = new AddOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -128,15 +128,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getTradeHistory request test', () => { + test('addOrderSync request test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/hf/fills + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync */ let data = - '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetTradeHistoryReq(); + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; + let req = new AddOrderSyncReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -144,16 +144,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getTradeHistory response test', () => { + test('addOrderSync response test', () => { /** - * getTradeHistory - * Get Trade History - * /api/v1/hf/fills + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync */ let data = - '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 19814995255305,\n "orderId": "6717422bd51c29000775ea03",\n "counterOrderId": "67174228135f9e000709da8c",\n "tradeId": 11029373945659392,\n "symbol": "BTC-USDT",\n "side": "buy",\n "liquidity": "taker",\n "type": "limit",\n "forceTaker": false,\n "price": "67717.6",\n "size": "0.00001",\n "funds": "0.677176",\n "fee": "0.000677176",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "taxRate": "0",\n "tax": "0",\n "createdAt": 1729577515473\n }\n ],\n "lastId": 19814995255305\n }\n}'; + '{"code":"200000","data":{"orderId":"67111a7cb7cbdf000703e1f6","clientOid":"5c52e11203aa677f33e493f","orderTime":1729174140586,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729174140588}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); + let resp = new AddOrderSyncResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -162,14 +162,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOpenOrders request test', () => { + test('addOrderTest request test', () => { /** - * getOpenOrders - * Get Open Orders - * /api/v1/hf/orders/active + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test */ - let data = '{"symbol": "BTC-USDT"}'; - let req = new GetOpenOrdersReq(); + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; + let req = new AddOrderTestReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -177,16 +178,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOpenOrders response test', () => { + test('addOrderTest response test', () => { /** - * getOpenOrders - * Get Open Orders - * /api/v1/hf/orders/active + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "67120bbef094e200070976f6",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": "order tags",\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true,\n "createdAt": 1729235902748,\n "lastUpdatedAt": 1729235909862\n }\n ]\n}'; + '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOpenOrdersResp(); + let resp = new AddOrderTestResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -195,30 +196,49 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getSymbolsWithOpenOrder request test', () => { + test('batchAddOrders request test', () => { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v1/hf/orders/active/symbols + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi */ + let data = + '{"orderList": [{"clientOid": "client order id 12", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 13", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; + let req = new BatchAddOrdersReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('getSymbolsWithOpenOrder response test', () => { + test('batchAddOrders response test', () => { /** - * getSymbolsWithOpenOrder - * Get Symbols With Open Order - * /api/v1/hf/orders/active/symbols + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi */ + let data = + '{\n "code": "200000",\n "data": [\n {\n "orderId": "6710d8336afcdb0007319c27",\n "clientOid": "client order id 12",\n "success": true\n },\n {\n "success": false,\n "failMsg": "The order funds should more then 0.1 USDT."\n }\n ]\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new BatchAddOrdersResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('modifyOrder request test', () => { + test('batchAddOrdersSync request test', () => { /** - * modifyOrder - * Modify Order - * /api/v1/hf/orders/alter + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync */ let data = - '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; - let req = new ModifyOrderReq(); + '{"orderList": [{"clientOid": "client order id 13", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 14", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; + let req = new BatchAddOrdersSyncReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -226,16 +246,16 @@ describe('Auto Test', () => { console.log(req); }); - test('modifyOrder response test', () => { + test('batchAddOrdersSync response test', () => { /** - * modifyOrder - * Modify Order - * /api/v1/hf/orders/alter + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync */ let data = - '{"code":"200000","data":{"newOrderId":"67112258f9406e0007408827","clientOid":"client order id 12"}}'; + '{"code":"200000","data":[{"orderId":"6711195e5584bc0007bd5aef","clientOid":"client order id 13","orderTime":1729173854299,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729173854326,"success":true},{"success":false,"failMsg":"The order funds should more then 0.1 USDT."}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyOrderResp(); + let resp = new BatchAddOrdersSyncResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -244,30 +264,47 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelAllOrders request test', () => { + test('cancelOrderByOrderId request test', () => { /** - * cancelAllOrders - * Cancel All Orders - * /api/v1/hf/orders/cancelAll + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} */ + let data = '{"orderId": "671124f9365ccb00073debd4", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdReq(); + req = req.fromJson(data); + expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( + false, + ); + console.log(req); }); - test('cancelAllOrders response test', () => { + test('cancelOrderByOrderId response test', () => { /** - * cancelAllOrders - * Cancel All Orders - * /api/v1/hf/orders/cancelAll + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} */ + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "671124f9365ccb00073debd4"\n }\n}'; + let commonResp = RestResponse.fromJson(data); + let resp = new CancelOrderByOrderIdResp(); + resp = resp.fromObject(commonResp.data); + if (commonResp.data !== null) { + expect( + Object.values(resp).every((value) => value === null || value === undefined), + ).toBe(false); + console.log(resp); + } }); - test('cancelPartialOrder request test', () => { + test('cancelOrderByOrderIdSync request test', () => { /** - * cancelPartialOrder - * Cancel Partial Order - * /api/v1/hf/orders/cancel/{orderId} + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} */ - let data = - '{"orderId": "6711f73c1ef16c000717bb31", "symbol": "BTC-USDT", "cancelSize": "0.00001"}'; - let req = new CancelPartialOrderReq(); + let data = '{"orderId": "671128ee365ccb0007534d45", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByOrderIdSyncReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -275,16 +312,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelPartialOrder response test', () => { + test('cancelOrderByOrderIdSync response test', () => { /** - * cancelPartialOrder - * Cancel Partial Order - * /api/v1/hf/orders/cancel/{orderId} + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "6711f73c1ef16c000717bb31",\n "cancelSize": "0.00001"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "671128ee365ccb0007534d45",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelPartialOrderResp(); + let resp = new CancelOrderByOrderIdSyncResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -325,14 +362,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByClientOid request test', () => { + test('cancelOrderByClientOidSync request test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v1/hf/orders/client-order/{clientOid} + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} */ - let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); + let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; + let req = new CancelOrderByClientOidSyncReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -340,16 +377,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByClientOid response test', () => { + test('cancelOrderByClientOidSync response test', () => { /** - * getOrderByClientOid - * Get Order By ClientOid - * /api/v1/hf/orders/client-order/{clientOid} + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; + '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f33e493fb",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); + let resp = new CancelOrderByClientOidSyncResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -358,14 +395,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('setDCP request test', () => { + test('cancelPartialOrder request test', () => { /** - * setDCP - * Set DCP - * /api/v1/hf/orders/dead-cancel-all + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} */ - let data = '{"timeout": 5, "symbols": "BTC-USDT,ETH-USDT"}'; - let req = new SetDCPReq(); + let data = + '{"orderId": "6711f73c1ef16c000717bb31", "symbol": "BTC-USDT", "cancelSize": "0.00001"}'; + let req = new CancelPartialOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -373,15 +411,16 @@ describe('Auto Test', () => { console.log(req); }); - test('setDCP response test', () => { + test('cancelPartialOrder response test', () => { /** - * setDCP - * Set DCP - * /api/v1/hf/orders/dead-cancel-all + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} */ - let data = '{"code":"200000","data":{"currentTime":1729656588,"triggerTime":1729656593}}'; + let data = + '{\n "code": "200000",\n "data": {\n "orderId": "6711f73c1ef16c000717bb31",\n "cancelSize": "0.00001"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new SetDCPResp(); + let resp = new CancelPartialOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -390,21 +429,6 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getDCP request test', () => { - /** - * getDCP - * Get DCP - * /api/v1/hf/orders/dead-cancel-all/query - */ - }); - - test('getDCP response test', () => { - /** - * getDCP - * Get DCP - * /api/v1/hf/orders/dead-cancel-all/query - */ - }); test('cancelAllOrdersBySymbol request test', () => { /** * cancelAllOrdersBySymbol @@ -437,49 +461,30 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getClosedOrders request test', () => { + test('cancelAllOrders request test', () => { /** - * getClosedOrders - * Get Closed Orders - * /api/v1/hf/orders/done + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll */ - let data = - '{"symbol": "BTC-USDT", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetClosedOrdersReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('getClosedOrders response test', () => { + test('cancelAllOrders response test', () => { /** - * getClosedOrders - * Get Closed Orders - * /api/v1/hf/orders/done + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll */ - let data = - '{\n "code": "200000",\n "data": {\n "lastId": 19814995255305,\n "items": [\n {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n ]\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new GetClosedOrdersResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); - test('batchAddOrders request test', () => { + test('modifyOrder request test', () => { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/hf/orders/multi + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter */ let data = - '{"orderList": [{"clientOid": "client order id 12", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 13", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; - let req = new BatchAddOrdersReq(); + '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; + let req = new ModifyOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -487,16 +492,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchAddOrders response test', () => { + test('modifyOrder response test', () => { /** - * batchAddOrders - * Batch Add Orders - * /api/v1/hf/orders/multi + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter */ let data = - '{\n "code": "200000",\n "data": [\n {\n "orderId": "6710d8336afcdb0007319c27",\n "clientOid": "client order id 12",\n "success": true\n },\n {\n "success": false,\n "failMsg": "The order funds should more then 0.1 USDT."\n }\n ]\n}'; + '{"code":"200000","data":{"newOrderId":"67112258f9406e0007408827","clientOid":"client order id 12"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersResp(); + let resp = new ModifyOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -505,15 +510,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchAddOrdersSync request test', () => { + test('getOrderByOrderId request test', () => { /** - * batchAddOrdersSync - * Batch Add Orders Sync - * /api/v1/hf/orders/multi/sync + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} */ - let data = - '{"orderList": [{"clientOid": "client order id 13", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 14", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; - let req = new BatchAddOrdersSyncReq(); + let data = '{"symbol": "BTC-USDT", "orderId": "6717422bd51c29000775ea03"}'; + let req = new GetOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -521,16 +525,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchAddOrdersSync response test', () => { + test('getOrderByOrderId response test', () => { /** - * batchAddOrdersSync - * Batch Add Orders Sync - * /api/v1/hf/orders/multi/sync + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} */ let data = - '{"code":"200000","data":[{"orderId":"6711195e5584bc0007bd5aef","clientOid":"client order id 13","orderTime":1729173854299,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729173854326,"success":true},{"success":false,"failMsg":"The order funds should more then 0.1 USDT."}]}'; + '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersSyncResp(); + let resp = new GetOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -539,14 +543,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByOrderId request test', () => { + test('getOrderByClientOid request test', () => { /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v1/hf/orders/{orderId} + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} */ - let data = '{"orderId": "671124f9365ccb00073debd4", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdReq(); + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; + let req = new GetOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -554,16 +558,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByOrderId response test', () => { + test('getOrderByClientOid response test', () => { /** - * cancelOrderByOrderId - * Cancel Order By OrderId - * /api/v1/hf/orders/{orderId} + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671124f9365ccb00073debd4"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdResp(); + let resp = new GetOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -572,14 +576,29 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByOrderId request test', () => { + test('getSymbolsWithOpenOrder request test', () => { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v1/hf/orders/{orderId} + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols */ - let data = '{"symbol": "BTC-USDT", "orderId": "6717422bd51c29000775ea03"}'; - let req = new GetOrderByOrderIdReq(); + }); + + test('getSymbolsWithOpenOrder response test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols + */ + }); + test('getOpenOrders request test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let data = '{"symbol": "BTC-USDT"}'; + let req = new GetOpenOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -587,16 +606,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByOrderId response test', () => { + test('getOpenOrders response test', () => { /** - * getOrderByOrderId - * Get Order By OrderId - * /api/v1/hf/orders/{orderId} + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active */ let data = - '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "67120bbef094e200070976f6",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": "order tags",\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true,\n "createdAt": 1729235902748,\n "lastUpdatedAt": 1729235909862\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdResp(); + let resp = new GetOpenOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -605,15 +624,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrder request test', () => { + test('getClosedOrders request test', () => { /** - * addOrder - * Add Order - * /api/v1/hf/orders + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderReq(); + '{"symbol": "BTC-USDT", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetClosedOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -621,16 +640,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrder response test', () => { + test('getClosedOrders response test', () => { /** - * addOrder - * Add Order - * /api/v1/hf/orders + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done */ let data = - '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; + '{\n "code": "200000",\n "data": {\n "lastId": 19814995255305,\n "items": [\n {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); + let resp = new GetClosedOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -639,14 +658,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByClientOidSync request test', () => { + test('getTradeHistory request test', () => { /** - * cancelOrderByClientOidSync - * Cancel Order By ClientOid Sync - * /api/v1/hf/orders/sync/client-order/{clientOid} + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills */ - let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByClientOidSyncReq(); + let data = + '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; + let req = new GetTradeHistoryReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -654,16 +674,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByClientOidSync response test', () => { + test('getTradeHistory response test', () => { /** - * cancelOrderByClientOidSync - * Cancel Order By ClientOid Sync - * /api/v1/hf/orders/sync/client-order/{clientOid} + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills */ let data = - '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f33e493fb",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 19814995255305,\n "orderId": "6717422bd51c29000775ea03",\n "counterOrderId": "67174228135f9e000709da8c",\n "tradeId": 11029373945659392,\n "symbol": "BTC-USDT",\n "side": "buy",\n "liquidity": "taker",\n "type": "limit",\n "forceTaker": false,\n "price": "67717.6",\n "size": "0.00001",\n "funds": "0.677176",\n "fee": "0.000677176",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "taxRate": "0",\n "tax": "0",\n "createdAt": 1729577515473\n }\n ],\n "lastId": 19814995255305\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidSyncResp(); + let resp = new GetTradeHistoryResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -672,48 +692,29 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByOrderIdSync request test', () => { + test('getDCP request test', () => { /** - * cancelOrderByOrderIdSync - * Cancel Order By OrderId Sync - * /api/v1/hf/orders/sync/{orderId} + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query */ - let data = '{"orderId": "671128ee365ccb0007534d45", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdSyncReq(); - req = req.fromJson(data); - expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( - false, - ); - console.log(req); }); - test('cancelOrderByOrderIdSync response test', () => { + test('getDCP response test', () => { /** - * cancelOrderByOrderIdSync - * Cancel Order By OrderId Sync - * /api/v1/hf/orders/sync/{orderId} + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query */ - let data = - '{\n "code": "200000",\n "data": {\n "orderId": "671128ee365ccb0007534d45",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; - let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdSyncResp(); - resp = resp.fromObject(commonResp.data); - if (commonResp.data !== null) { - expect( - Object.values(resp).every((value) => value === null || value === undefined), - ).toBe(false); - console.log(resp); - } }); - test('addOrderSync request test', () => { + test('setDCP request test', () => { /** - * addOrderSync - * Add Order Sync - * /api/v1/hf/orders/sync + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all */ - let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; - let req = new AddOrderSyncReq(); + let data = '{"timeout": 5, "symbols": "BTC-USDT,ETH-USDT"}'; + let req = new SetDCPReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -721,16 +722,15 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderSync response test', () => { + test('setDCP response test', () => { /** - * addOrderSync - * Add Order Sync - * /api/v1/hf/orders/sync + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all */ - let data = - '{"code":"200000","data":{"orderId":"67111a7cb7cbdf000703e1f6","clientOid":"5c52e11203aa677f33e493f","orderTime":1729174140586,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729174140588}}'; + let data = '{"code":"200000","data":{"currentTime":1729656588,"triggerTime":1729656593}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderSyncResp(); + let resp = new SetDCPResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -739,15 +739,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderTest request test', () => { + test('addStopOrder request test', () => { /** - * addOrderTest - * Add Order Test - * /api/v1/hf/orders/test + * addStopOrder + * Add Stop Order + * /api/v1/stop-order */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; - let req = new AddOrderTestReq(); + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddStopOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -755,16 +755,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderTest response test', () => { + test('addStopOrder response test', () => { /** - * addOrderTest - * Add Order Test - * /api/v1/hf/orders/test + * addStopOrder + * Add Stop Order + * /api/v1/stop-order */ let data = '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); + let resp = new AddStopOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -773,14 +773,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRecentTradeHistoryOld request test', () => { + test('cancelStopOrderByClientOid request test', () => { /** - * getRecentTradeHistoryOld - * Get Recent Trade History - Old - * /api/v1/limit/fills + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid */ - let data = '{"currentPage": 1, "pageSize": 50}'; - let req = new GetRecentTradeHistoryOldReq(); + let data = '{"symbol": "BTC-USDT", "clientOid": "689ff597f4414061aa819cc414836abd"}'; + let req = new CancelStopOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -788,16 +788,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRecentTradeHistoryOld response test', () => { + test('cancelStopOrderByClientOid response test', () => { /** - * getRecentTradeHistoryOld - * Get Recent Trade History - Old - * /api/v1/limit/fills + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid */ let data = - '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "tradeId": "11732720444522497",\n "orderId": "674aab24754b1e00077dbc69",\n "counterOrderId": "674aab1fb26bfb0007a18b67",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "96999.6",\n "size": "0.00001",\n "funds": "0.969996",\n "fee": "0.000969996",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "limit",\n "createdAt": 1732946724082\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "vs8hoo8ksc8mario0035a74n",\n "clientOid": "689ff597f4414061aa819cc414836abd"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentTradeHistoryOldResp(); + let resp = new CancelStopOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -806,14 +806,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getRecentOrdersListOld request test', () => { + test('cancelStopOrderByOrderId request test', () => { /** - * getRecentOrdersListOld - * Get Recent Orders List - Old - * /api/v1/limit/orders + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} */ - let data = '{"currentPage": 1, "pageSize": 50}'; - let req = new GetRecentOrdersListOldReq(); + let data = '{"orderId": "671124f9365ccb00073debd4"}'; + let req = new CancelStopOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -821,16 +821,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getRecentOrdersListOld response test', () => { + test('cancelStopOrderByOrderId response test', () => { /** - * getRecentOrdersListOld - * Get Recent Orders List - Old - * /api/v1/limit/orders + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentOrdersListOldResp(); + let resp = new CancelStopOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -839,14 +839,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByClientOidOld request test', () => { + test('batchCancelStopOrder request test', () => { /** - * cancelOrderByClientOidOld - * Cancel Order By ClientOid - Old - * /api/v1/order/client-order/{clientOid} + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel */ - let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e4923fb"}'; - let req = new CancelOrderByClientOidOldReq(); + let data = + '{"symbol": "example_string_default_value", "tradeType": "example_string_default_value", "orderIds": "example_string_default_value"}'; + let req = new BatchCancelStopOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -854,16 +855,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByClientOidOld response test', () => { + test('batchCancelStopOrder response test', () => { /** - * cancelOrderByClientOidOld - * Cancel Order By ClientOid - Old - * /api/v1/order/client-order/{clientOid} + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "674a9a872033a50007e2790d",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "cancelledOcoOrderIds": null\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidOldResp(); + let resp = new BatchCancelStopOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -872,14 +873,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByClientOidOld request test', () => { + test('getStopOrdersList request test', () => { /** - * getOrderByClientOidOld - * Get Order By ClientOid - Old - * /api/v1/order/client-order/{clientOid} + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order */ - let data = '{"clientOid": "3d07008668054da6b3cb12e432c2b13a"}'; - let req = new GetOrderByClientOidOldReq(); + let data = + '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; + let req = new GetStopOrdersListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -887,16 +889,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByClientOidOld response test', () => { + test('getStopOrdersList response test', () => { /** - * getOrderByClientOidOld - * Get Order By ClientOid - Old - * /api/v1/order/client-order/{clientOid} + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order */ let data = - '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "vs8hoo8kqjnklv4m0038lrfq",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "404814a0fb4311eb9098acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1628755183702150100,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1628755183704,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidOldResp(); + let resp = new GetStopOrdersListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -905,14 +907,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchCancelOrderOld request test', () => { + test('getStopOrderByOrderId request test', () => { /** - * batchCancelOrderOld - * Batch Cancel Order - Old - * /api/v1/orders + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} */ - let data = '{"symbol": "BTC-USDT", "tradeType": "TRADE"}'; - let req = new BatchCancelOrderOldReq(); + let data = '{"orderId": "example_string_default_value"}'; + let req = new GetStopOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -920,16 +922,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchCancelOrderOld response test', () => { + test('getStopOrderByOrderId response test', () => { /** - * batchCancelOrderOld - * Batch Cancel Order - Old - * /api/v1/orders + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a8635b38d120007709c0f",\n "674a8630439c100007d3bce1"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "vs8hoo8q2ceshiue003b67c0",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "40e0eb9efe6311eb8e58acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1629098781127530200,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629098781128,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelOrderOldResp(); + let resp = new GetStopOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -938,15 +940,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrdersListOld request test', () => { + test('getStopOrderByClientOid request test', () => { /** - * getOrdersListOld - * Get Orders List - Old - * /api/v1/orders + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid */ let data = - '{"symbol": "BTC-USDT", "status": "active", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetOrdersListOldReq(); + '{"clientOid": "example_string_default_value", "symbol": "example_string_default_value"}'; + let req = new GetStopOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -954,16 +956,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrdersListOld response test', () => { + test('getStopOrderByClientOid response test', () => { /** - * getOrdersListOld - * Get Orders List - Old - * /api/v1/orders + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "vs8hoo8os561f5np0032vngj",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "2b700942b5db41cebe578cff48960e09",\n "remark": null,\n "tags": null,\n "orderTime": 1629020492834532600,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629020492837,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "1.00000000000000000000"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrdersListOldResp(); + let resp = new GetStopOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -972,15 +974,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchAddOrdersOld request test', () => { + test('addOcoOrder request test', () => { /** - * batchAddOrdersOld - * Batch Add Orders - Old - * /api/v1/orders/multi + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order */ let data = - '{"symbol": "BTC-USDT", "orderList": [{"clientOid": "3d07008668054da6b3cb12e432c2b13a", "side": "buy", "type": "limit", "price": "50000", "size": "0.0001"}, {"clientOid": "37245dbe6e134b5c97732bfb36cd4a9d", "side": "buy", "type": "limit", "price": "49999", "size": "0.0001"}]}'; - let req = new BatchAddOrdersOldReq(); + '{"symbol": "BTC-USDT", "side": "buy", "price": "94000", "size": "0.1", "clientOid": "5c52e11203aa67f1e493fb", "stopPrice": "98000", "limitPrice": "96000", "remark": "this is remark", "tradeType": "TRADE"}'; + let req = new AddOcoOrderReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -988,16 +990,15 @@ describe('Auto Test', () => { console.log(req); }); - test('batchAddOrdersOld response test', () => { + test('addOcoOrder response test', () => { /** - * batchAddOrdersOld - * Batch Add Orders - Old - * /api/v1/orders/multi + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order */ - let data = - '{\n "code": "200000",\n "data": {\n "data": [\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dfef434f0007efc431",\n "status": "success",\n "failMsg": null,\n "clientOid": "3d07008668054da6b3cb12e432c2b13a"\n },\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "49999",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dffb378b00077b9c20",\n "status": "fail",\n "failMsg": "Balance insufficient!",\n "clientOid": "37245dbe6e134b5c97732bfb36cd4a9d"\n }\n ]\n }\n}'; + let data = '{"code":"200000","data":{"orderId":"674c316e688dea0007c7b986"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersOldResp(); + let resp = new AddOcoOrderResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1006,14 +1007,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOrderByOrderIdOld request test', () => { + test('cancelOcoOrderByOrderId request test', () => { /** - * cancelOrderByOrderIdOld - * Cancel Order By OrderId - Old - * /api/v1/orders/{orderId} + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} */ - let data = '{"symbol": "BTC-USDT", "orderId": "674a97dfef434f0007efc431"}'; - let req = new CancelOrderByOrderIdOldReq(); + let data = '{"orderId": "674c316e688dea0007c7b986"}'; + let req = new CancelOcoOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1021,16 +1022,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOrderByOrderIdOld response test', () => { + test('cancelOcoOrderByOrderId response test', () => { /** - * cancelOrderByOrderIdOld - * Cancel Order By OrderId - Old - * /api/v1/orders/{orderId} + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a97dfef434f0007efc431"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6kkmkk57003gok16",\n "vs93gpqc6kkmkk57003gok17"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdOldResp(); + let resp = new CancelOcoOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1039,14 +1040,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOrderByOrderIdOld request test', () => { + test('cancelOcoOrderByClientOid request test', () => { /** - * getOrderByOrderIdOld - * Get Order By OrderId - Old - * /api/v1/orders/{orderId} + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} */ - let data = '{"orderId": "674a97dfef434f0007efc431"}'; - let req = new GetOrderByOrderIdOldReq(); + let data = '{"clientOid": "5c52e11203aa67f1e493fb"}'; + let req = new CancelOcoOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1054,16 +1055,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOrderByOrderIdOld response test', () => { + test('cancelOcoOrderByClientOid response test', () => { /** - * getOrderByOrderIdOld - * Get Order By OrderId - Old - * /api/v1/orders/{orderId} + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6r0mkk57003gok3h",\n "vs93gpqc6r0mkk57003gok3i"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdOldResp(); + let resp = new CancelOcoOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1072,15 +1073,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderOld request test', () => { + test('batchCancelOcoOrders request test', () => { /** - * addOrderOld - * Add Order - Old - * /api/v1/orders + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderOldReq(); + '{"orderIds": "674c388172cf2800072ee746,674c38bdfd8300000795167e", "symbol": "BTC-USDT"}'; + let req = new BatchCancelOcoOrdersReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1088,16 +1089,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderOld response test', () => { + test('batchCancelOcoOrders response test', () => { /** - * addOrderOld - * Add Order - Old - * /api/v1/orders + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "674a8635b38d120007709c0f"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc750mkk57003gok6i",\n "vs93gpqc750mkk57003gok6j",\n "vs93gpqc75c39p83003tnriu",\n "vs93gpqc75c39p83003tnriv"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderOldResp(); + let resp = new BatchCancelOcoOrdersResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1106,15 +1107,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOrderTestOld request test', () => { + test('getOcoOrderByOrderId request test', () => { /** - * addOrderTestOld - * Add Order Test - Old - * /api/v1/orders/test + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} */ - let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderTestOldReq(); + let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; + let req = new GetOcoOrderByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1122,16 +1122,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOrderTestOld response test', () => { + test('getOcoOrderByOrderId response test', () => { /** - * addOrderTestOld - * Add Order Test - Old - * /api/v1/orders/test + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "674a8776291d9e00074f1edf"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestOldResp(); + let resp = new GetOcoOrderByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1140,15 +1140,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchCancelStopOrder request test', () => { + test('getOcoOrderByClientOid request test', () => { /** - * batchCancelStopOrder - * Batch Cancel Stop Orders - * /api/v1/stop-order/cancel + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} */ - let data = - '{"symbol": "example_string_default_value", "tradeType": "example_string_default_value", "orderIds": "example_string_default_value"}'; - let req = new BatchCancelStopOrderReq(); + let data = '{"clientOid": "5c52e1203aa6f3g7f1e493fb"}'; + let req = new GetOcoOrderByClientOidReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1156,16 +1155,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchCancelStopOrder response test', () => { + test('getOcoOrderByClientOid response test', () => { /** - * batchCancelStopOrder - * Batch Cancel Stop Orders - * /api/v1/stop-order/cancel + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelStopOrderResp(); + let resp = new GetOcoOrderByClientOidResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1174,14 +1173,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelStopOrderByClientOid request test', () => { + test('getOcoOrderDetailByOrderId request test', () => { /** - * cancelStopOrderByClientOid - * Cancel Stop Order By ClientOid - * /api/v1/stop-order/cancelOrderByClientOid + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} */ - let data = '{"symbol": "BTC-USDT", "clientOid": "689ff597f4414061aa819cc414836abd"}'; - let req = new CancelStopOrderByClientOidReq(); + let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; + let req = new GetOcoOrderDetailByOrderIdReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1189,16 +1188,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelStopOrderByClientOid response test', () => { + test('getOcoOrderDetailByOrderId response test', () => { /** - * cancelStopOrderByClientOid - * Cancel Stop Order By ClientOid - * /api/v1/stop-order/cancelOrderByClientOid + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "vs8hoo8ksc8mario0035a74n",\n "clientOid": "689ff597f4414061aa819cc414836abd"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW",\n "orders": [\n {\n "id": "vs93gpqc7dn6h3fa003sfelj",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "94000.00000000000000000000",\n "stopPrice": "94000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n },\n {\n "id": "vs93gpqc7dn6h3fa003sfelk",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "96000.00000000000000000000",\n "stopPrice": "98000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelStopOrderByClientOidResp(); + let resp = new GetOcoOrderDetailByOrderIdResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1207,15 +1206,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getStopOrdersList request test', () => { + test('getOcoOrderList request test', () => { /** - * getStopOrdersList - * Get Stop Orders List - * /api/v1/stop-order + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders */ let data = - '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; - let req = new GetStopOrdersListReq(); + '{"symbol": "BTC-USDT", "startAt": 123456, "endAt": 123456, "orderIds": "example_string_default_value", "pageSize": 50, "currentPage": 1}'; + let req = new GetOcoOrderListReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1223,16 +1222,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getStopOrdersList response test', () => { + test('getOcoOrderList response test', () => { /** - * getStopOrdersList - * Get Stop Orders List - * /api/v1/stop-order + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "vs8hoo8kqjnklv4m0038lrfq",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "404814a0fb4311eb9098acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1628755183702150100,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1628755183704,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrdersListResp(); + let resp = new GetOcoOrderListResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1241,14 +1240,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelStopOrderByOrderId request test', () => { + test('addOrderOld request test', () => { /** - * cancelStopOrderByOrderId - * Cancel Stop Order By OrderId - * /api/v1/stop-order/{orderId} + * addOrderOld + * Add Order - Old + * /api/v1/orders */ - let data = '{"orderId": "671124f9365ccb00073debd4"}'; - let req = new CancelStopOrderByOrderIdReq(); + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1256,16 +1256,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelStopOrderByOrderId response test', () => { + test('addOrderOld response test', () => { /** - * cancelStopOrderByOrderId - * Cancel Stop Order By OrderId - * /api/v1/stop-order/{orderId} + * addOrderOld + * Add Order - Old + * /api/v1/orders */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "674a8635b38d120007709c0f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelStopOrderByOrderIdResp(); + let resp = new AddOrderOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1274,14 +1274,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getStopOrderByOrderId request test', () => { + test('addOrderTestOld request test', () => { /** - * getStopOrderByOrderId - * Get Stop Order By OrderId - * /api/v1/stop-order/{orderId} + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test */ - let data = '{"orderId": "example_string_default_value"}'; - let req = new GetStopOrderByOrderIdReq(); + let data = + '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; + let req = new AddOrderTestOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1289,16 +1290,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getStopOrderByOrderId response test', () => { + test('addOrderTestOld response test', () => { /** - * getStopOrderByOrderId - * Get Stop Order By OrderId - * /api/v1/stop-order/{orderId} + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test */ let data = - '{\n "code": "200000",\n "data": {\n "id": "vs8hoo8q2ceshiue003b67c0",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "40e0eb9efe6311eb8e58acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1629098781127530200,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629098781128,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "orderId": "674a8776291d9e00074f1edf"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderByOrderIdResp(); + let resp = new AddOrderTestOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1307,15 +1308,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addStopOrder request test', () => { + test('batchAddOrdersOld request test', () => { /** - * addStopOrder - * Add Stop Order - * /api/v1/stop-order + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi */ let data = - '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddStopOrderReq(); + '{"symbol": "BTC-USDT", "orderList": [{"clientOid": "3d07008668054da6b3cb12e432c2b13a", "side": "buy", "type": "limit", "price": "50000", "size": "0.0001"}, {"clientOid": "37245dbe6e134b5c97732bfb36cd4a9d", "side": "buy", "type": "limit", "price": "49999", "size": "0.0001"}]}'; + let req = new BatchAddOrdersOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1323,16 +1324,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addStopOrder response test', () => { + test('batchAddOrdersOld response test', () => { /** - * addStopOrder - * Add Stop Order - * /api/v1/stop-order + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi */ let data = - '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; + '{\n "code": "200000",\n "data": {\n "data": [\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dfef434f0007efc431",\n "status": "success",\n "failMsg": null,\n "clientOid": "3d07008668054da6b3cb12e432c2b13a"\n },\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "49999",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dffb378b00077b9c20",\n "status": "fail",\n "failMsg": "Balance insufficient!",\n "clientOid": "37245dbe6e134b5c97732bfb36cd4a9d"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddStopOrderResp(); + let resp = new BatchAddOrdersOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1341,15 +1342,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getStopOrderByClientOid request test', () => { + test('cancelOrderByOrderIdOld request test', () => { /** - * getStopOrderByClientOid - * Get Stop Order By ClientOid - * /api/v1/stop-order/queryOrderByClientOid + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} */ - let data = - '{"clientOid": "example_string_default_value", "symbol": "example_string_default_value"}'; - let req = new GetStopOrderByClientOidReq(); + let data = '{"symbol": "BTC-USDT", "orderId": "674a97dfef434f0007efc431"}'; + let req = new CancelOrderByOrderIdOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1357,16 +1357,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getStopOrderByClientOid response test', () => { + test('cancelOrderByOrderIdOld response test', () => { /** - * getStopOrderByClientOid - * Get Stop Order By ClientOid - * /api/v1/stop-order/queryOrderByClientOid + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} */ let data = - '{\n "code": "200000",\n "data": [\n {\n "id": "vs8hoo8os561f5np0032vngj",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "2b700942b5db41cebe578cff48960e09",\n "remark": null,\n "tags": null,\n "orderTime": 1629020492834532600,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629020492837,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "1.00000000000000000000"\n }\n ]\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a97dfef434f0007efc431"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderByClientOidResp(); + let resp = new CancelOrderByOrderIdOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1375,14 +1375,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOcoOrderByClientOid request test', () => { + test('cancelOrderByClientOidOld request test', () => { /** - * cancelOcoOrderByClientOid - * Cancel OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} */ - let data = '{"clientOid": "5c52e11203aa67f1e493fb"}'; - let req = new CancelOcoOrderByClientOidReq(); + let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e4923fb"}'; + let req = new CancelOrderByClientOidOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1390,16 +1390,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOcoOrderByClientOid response test', () => { + test('cancelOrderByClientOidOld response test', () => { /** - * cancelOcoOrderByClientOid - * Cancel OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6r0mkk57003gok3h",\n "vs93gpqc6r0mkk57003gok3i"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "674a9a872033a50007e2790d",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "cancelledOcoOrderIds": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOcoOrderByClientOidResp(); + let resp = new CancelOrderByClientOidOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1408,14 +1408,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOcoOrderByClientOid request test', () => { + test('batchCancelOrderOld request test', () => { /** - * getOcoOrderByClientOid - * Get OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders */ - let data = '{"clientOid": "5c52e1203aa6f3g7f1e493fb"}'; - let req = new GetOcoOrderByClientOidReq(); + let data = '{"symbol": "BTC-USDT", "tradeType": "TRADE"}'; + let req = new BatchCancelOrderOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1423,16 +1423,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOcoOrderByClientOid response test', () => { + test('batchCancelOrderOld response test', () => { /** - * getOcoOrderByClientOid - * Get OCO Order By ClientOid - * /api/v3/oco/client-order/{clientOid} + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a8635b38d120007709c0f",\n "674a8630439c100007d3bce1"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderByClientOidResp(); + let resp = new BatchCancelOrderOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1441,14 +1441,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOcoOrderDetailByOrderId request test', () => { + test('getOrdersListOld request test', () => { /** - * getOcoOrderDetailByOrderId - * Get OCO Order Detail By OrderId - * /api/v3/oco/order/details/{orderId} + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders */ - let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; - let req = new GetOcoOrderDetailByOrderIdReq(); + let data = + '{"symbol": "BTC-USDT", "status": "active", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; + let req = new GetOrdersListOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1456,16 +1457,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOcoOrderDetailByOrderId response test', () => { + test('getOrdersListOld response test', () => { /** - * getOcoOrderDetailByOrderId - * Get OCO Order Detail By OrderId - * /api/v3/oco/order/details/{orderId} + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW",\n "orders": [\n {\n "id": "vs93gpqc7dn6h3fa003sfelj",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "94000.00000000000000000000",\n "stopPrice": "94000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n },\n {\n "id": "vs93gpqc7dn6h3fa003sfelk",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "96000.00000000000000000000",\n "stopPrice": "98000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderDetailByOrderIdResp(); + let resp = new GetOrdersListOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1474,14 +1475,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('cancelOcoOrderByOrderId request test', () => { + test('getRecentOrdersListOld request test', () => { /** - * cancelOcoOrderByOrderId - * Cancel OCO Order By OrderId - * /api/v3/oco/order/{orderId} + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders */ - let data = '{"orderId": "674c316e688dea0007c7b986"}'; - let req = new CancelOcoOrderByOrderIdReq(); + let data = '{"currentPage": 1, "pageSize": 50}'; + let req = new GetRecentOrdersListOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1489,16 +1490,16 @@ describe('Auto Test', () => { console.log(req); }); - test('cancelOcoOrderByOrderId response test', () => { + test('getRecentOrdersListOld response test', () => { /** - * cancelOcoOrderByOrderId - * Cancel OCO Order By OrderId - * /api/v3/oco/order/{orderId} + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6kkmkk57003gok16",\n "vs93gpqc6kkmkk57003gok17"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOcoOrderByOrderIdResp(); + let resp = new GetRecentOrdersListOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1507,14 +1508,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOcoOrderByOrderId request test', () => { + test('getOrderByOrderIdOld request test', () => { /** - * getOcoOrderByOrderId - * Get OCO Order By OrderId - * /api/v3/oco/order/{orderId} + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} */ - let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; - let req = new GetOcoOrderByOrderIdReq(); + let data = '{"orderId": "674a97dfef434f0007efc431"}'; + let req = new GetOrderByOrderIdOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1522,16 +1523,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOcoOrderByOrderId response test', () => { + test('getOrderByOrderIdOld response test', () => { /** - * getOcoOrderByOrderId - * Get OCO Order By OrderId - * /api/v3/oco/order/{orderId} + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} */ let data = - '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW"\n }\n}'; + '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderByOrderIdResp(); + let resp = new GetOrderByOrderIdOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1540,15 +1541,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('addOcoOrder request test', () => { + test('getOrderByClientOidOld request test', () => { /** - * addOcoOrder - * Add OCO Order - * /api/v3/oco/order + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} */ - let data = - '{"symbol": "BTC-USDT", "side": "buy", "price": "94000", "size": "0.1", "clientOid": "5c52e11203aa67f1e493fb", "stopPrice": "98000", "limitPrice": "96000", "remark": "this is remark", "tradeType": "TRADE"}'; - let req = new AddOcoOrderReq(); + let data = '{"clientOid": "3d07008668054da6b3cb12e432c2b13a"}'; + let req = new GetOrderByClientOidOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1556,15 +1556,16 @@ describe('Auto Test', () => { console.log(req); }); - test('addOcoOrder response test', () => { + test('getOrderByClientOidOld response test', () => { /** - * addOcoOrder - * Add OCO Order - * /api/v3/oco/order + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} */ - let data = '{"code":"200000","data":{"orderId":"674c316e688dea0007c7b986"}}'; + let data = + '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOcoOrderResp(); + let resp = new GetOrderByClientOidOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1573,15 +1574,15 @@ describe('Auto Test', () => { console.log(resp); } }); - test('batchCancelOcoOrders request test', () => { + test('getTradeHistoryOld request test', () => { /** - * batchCancelOcoOrders - * Batch Cancel OCO Order - * /api/v3/oco/orders + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills */ let data = - '{"orderIds": "674c388172cf2800072ee746,674c38bdfd8300000795167e", "symbol": "BTC-USDT"}'; - let req = new BatchCancelOcoOrdersReq(); + '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; + let req = new GetTradeHistoryOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1589,16 +1590,16 @@ describe('Auto Test', () => { console.log(req); }); - test('batchCancelOcoOrders response test', () => { + test('getTradeHistoryOld response test', () => { /** - * batchCancelOcoOrders - * Batch Cancel OCO Order - * /api/v3/oco/orders + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills */ let data = - '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc750mkk57003gok6i",\n "vs93gpqc750mkk57003gok6j",\n "vs93gpqc75c39p83003tnriu",\n "vs93gpqc75c39p83003tnriv"\n ]\n }\n}'; + '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "symbol": "DOGE-USDT",\n "tradeId": "10862827223795713",\n "orderId": "6745698ef4f1200007c561a8",\n "counterOrderId": "6745695ef15b270007ac5076",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "0.40739",\n "size": "10",\n "funds": "4.0739",\n "fee": "0.0040739",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "market",\n "createdAt": 1732602254928\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelOcoOrdersResp(); + let resp = new GetTradeHistoryOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( @@ -1607,15 +1608,14 @@ describe('Auto Test', () => { console.log(resp); } }); - test('getOcoOrderList request test', () => { + test('getRecentTradeHistoryOld request test', () => { /** - * getOcoOrderList - * Get OCO Order List - * /api/v3/oco/orders + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills */ - let data = - '{"symbol": "BTC-USDT", "startAt": 123456, "endAt": 123456, "orderIds": "example_string_default_value", "pageSize": 50, "currentPage": 1}'; - let req = new GetOcoOrderListReq(); + let data = '{"currentPage": 1, "pageSize": 50}'; + let req = new GetRecentTradeHistoryOldReq(); req = req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, @@ -1623,16 +1623,16 @@ describe('Auto Test', () => { console.log(req); }); - test('getOcoOrderList response test', () => { + test('getRecentTradeHistoryOld response test', () => { /** - * getOcoOrderList - * Get OCO Order List - * /api/v3/oco/orders + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills */ let data = - '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n ]\n }\n}'; + '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "tradeId": "11732720444522497",\n "orderId": "674aab24754b1e00077dbc69",\n "counterOrderId": "674aab1fb26bfb0007a18b67",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "96999.6",\n "size": "0.00001",\n "funds": "0.969996",\n "fee": "0.000969996",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "limit",\n "createdAt": 1732946724082\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderListResp(); + let resp = new GetRecentTradeHistoryOldResp(); resp = resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( diff --git a/sdk/node/src/generate/spot/order/api_order.ts b/sdk/node/src/generate/spot/order/api_order.ts index bf21fb63..46a33591 100644 --- a/sdk/node/src/generate/spot/order/api_order.ts +++ b/sdk/node/src/generate/spot/order/api_order.ts @@ -1,21 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { Transport } from '@internal/interfaces/transport'; -import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetTradeHistoryOldReq } from './model_get_trade_history_old_req'; +import { CancelOrderByClientOidReq } from './model_cancel_order_by_client_oid_req'; import { GetClosedOrdersResp } from './model_get_closed_orders_resp'; import { CancelOrderByOrderIdSyncResp } from './model_cancel_order_by_order_id_sync_resp'; +import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; import { CancelStopOrderByOrderIdResp } from './model_cancel_stop_order_by_order_id_resp'; import { CancelStopOrderByClientOidResp } from './model_cancel_stop_order_by_client_oid_resp'; -import { BatchCancelStopOrderReq } from './model_batch_cancel_stop_order_req'; import { GetOrderByClientOidOldResp } from './model_get_order_by_client_oid_old_resp'; -import { AddOrderReq } from './model_add_order_req'; import { SetDCPResp } from './model_set_dcp_resp'; +import { AddOrderReq } from './model_add_order_req'; +import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; import { BatchCancelOrderOldResp } from './model_batch_cancel_order_old_resp'; import { BatchCancelOrderOldReq } from './model_batch_cancel_order_old_req'; -import { GetOrderByClientOidOldReq } from './model_get_order_by_client_oid_old_req'; -import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; import { GetOrdersListOldResp } from './model_get_orders_list_old_resp'; +import { GetStopOrdersListResp } from './model_get_stop_orders_list_resp'; import { GetClosedOrdersReq } from './model_get_closed_orders_req'; import { GetRecentTradeHistoryOldResp } from './model_get_recent_trade_history_old_resp'; import { CancelStopOrderByOrderIdReq } from './model_cancel_stop_order_by_order_id_req'; @@ -30,28 +30,28 @@ import { AddStopOrderResp } from './model_add_stop_order_resp'; import { CancelAllOrdersBySymbolReq } from './model_cancel_all_orders_by_symbol_req'; import { GetStopOrderByClientOidReq } from './model_get_stop_order_by_client_oid_req'; import { AddOrderTestReq } from './model_add_order_test_req'; -import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; import { GetTradeHistoryOldResp } from './model_get_trade_history_old_resp'; +import { BatchCancelOcoOrdersReq } from './model_batch_cancel_oco_orders_req'; import { CancelOrderByOrderIdOldReq } from './model_cancel_order_by_order_id_old_req'; import { CancelOrderByOrderIdSyncReq } from './model_cancel_order_by_order_id_sync_req'; import { BatchAddOrdersSyncReq } from './model_batch_add_orders_sync_req'; -import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; import { GetOrdersListOldReq } from './model_get_orders_list_old_req'; +import { GetOcoOrderDetailByOrderIdResp } from './model_get_oco_order_detail_by_order_id_resp'; import { GetOcoOrderByClientOidReq } from './model_get_oco_order_by_client_oid_req'; import { CancelPartialOrderReq } from './model_cancel_partial_order_req'; import { BatchAddOrdersSyncResp } from './model_batch_add_orders_sync_resp'; import { BatchAddOrdersOldResp } from './model_batch_add_orders_old_resp'; import { AddOrderTestResp } from './model_add_order_test_resp'; +import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; import { GetOcoOrderListReq } from './model_get_oco_order_list_req'; import { GetOcoOrderByClientOidResp } from './model_get_oco_order_by_client_oid_resp'; -import { AddOrderTestOldResp } from './model_add_order_test_old_resp'; import { AddOrderTestOldReq } from './model_add_order_test_old_req'; import { GetSymbolsWithOpenOrderResp } from './model_get_symbols_with_open_order_resp'; import { AddOcoOrderResp } from './model_add_oco_order_resp'; import { CancelOrderByClientOidSyncReq } from './model_cancel_order_by_client_oid_sync_req'; import { GetOrderByOrderIdOldReq } from './model_get_order_by_order_id_old_req'; -import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; import { GetTradeHistoryResp } from './model_get_trade_history_resp'; +import { GetOrderByOrderIdResp } from './model_get_order_by_order_id_resp'; import { GetOrderByClientOidResp } from './model_get_order_by_client_oid_resp'; import { ModifyOrderResp } from './model_modify_order_resp'; import { SetDCPReq } from './model_set_dcp_req'; @@ -76,79 +76,78 @@ import { BatchAddOrdersOldReq } from './model_batch_add_orders_old_req'; import { GetOpenOrdersReq } from './model_get_open_orders_req'; import { GetStopOrdersListReq } from './model_get_stop_orders_list_req'; import { GetRecentTradeHistoryOldReq } from './model_get_recent_trade_history_old_req'; -import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; import { AddOrderOldResp } from './model_add_order_old_resp'; +import { BatchCancelStopOrderResp } from './model_batch_cancel_stop_order_resp'; import { GetTradeHistoryReq } from './model_get_trade_history_req'; import { GetOrderByOrderIdOldResp } from './model_get_order_by_order_id_old_resp'; import { BatchCancelOcoOrdersResp } from './model_batch_cancel_oco_orders_resp'; import { GetOcoOrderByOrderIdResp } from './model_get_oco_order_by_order_id_resp'; -import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidResp } from './model_cancel_order_by_client_oid_resp'; +import { CancelOrderByOrderIdResp } from './model_cancel_order_by_order_id_resp'; import { CancelOrderByClientOidOldReq } from './model_cancel_order_by_client_oid_old_req'; import { CancelOcoOrderByClientOidResp } from './model_cancel_oco_order_by_client_oid_resp'; import { GetRecentOrdersListOldReq } from './model_get_recent_orders_list_old_req'; -import { AddOrderResp } from './model_add_order_resp'; +import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; import { BatchAddOrdersResp } from './model_batch_add_orders_resp'; import { BatchAddOrdersReq } from './model_batch_add_orders_req'; -import { GetOrderByClientOidReq } from './model_get_order_by_client_oid_req'; +import { AddOrderResp } from './model_add_order_resp'; import { CancelStopOrderByClientOidReq } from './model_cancel_stop_order_by_client_oid_req'; import { GetOrderByOrderIdReq } from './model_get_order_by_order_id_req'; import { AddOrderSyncReq } from './model_add_order_sync_req'; export interface OrderAPI { /** - * @deprecated - * getTradeHistoryOld Get Trade History - Old - * Description: Request via this endpoint to get the recent fills. The return value is the data after Pagination, sorted in descending order according to time. - * Documentation: https://www.kucoin.com/docs-new/api-3470350 + * addOrder Add Order + * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470188 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 10 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise; + addOrder(req: AddOrderReq): Promise; /** - * getTradeHistory Get Trade History - * Description: This endpoint can be used to obtain a list of the latest Spot transaction details. The returned data is sorted in descending order according to the latest update time of the order. - * Documentation: https://www.kucoin.com/docs-new/api-3470180 + * addOrderSync Add Order Sync + * Description: Place order to the spot trading system The difference between this interface and \"Add order\" is that this interface will synchronously return the order information after the order matching is completed. For higher latency requirements, please select the \"Add order\" interface. If there is a requirement for returning data integrity, please select this interface + * Documentation: https://www.kucoin.com/docs-new/api-3470170 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getTradeHistory(req: GetTradeHistoryReq): Promise; + addOrderSync(req: AddOrderSyncReq): Promise; /** - * getOpenOrders Get Open Orders - * Description: This interface is to obtain all Spot active order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470178 + * addOrderTest Add Order Test + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470187 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getOpenOrders(req: GetOpenOrdersReq): Promise; + addOrderTest(req: AddOrderTestReq): Promise; /** - * getSymbolsWithOpenOrder Get Symbols With Open Order - * Description: This interface can query all spot symbol that has active orders - * Documentation: https://www.kucoin.com/docs-new/api-3470177 + * batchAddOrders Batch Add Orders + * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair + * Documentation: https://www.kucoin.com/docs-new/api-3470168 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -156,15 +155,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getSymbolsWithOpenOrder(): Promise; + batchAddOrders(req: BatchAddOrdersReq): Promise; /** - * modifyOrder Modify Order - * Description: This interface can modify the price and quantity of the order according to orderId or clientOid. The implementation of this interface is: cancel the order and place a new order on the same trading pair, and return the modification result to the client synchronously When the quantity of the new order updated by the user is less than the filled quantity of this order, the order will be considered as completed, and the order will be cancelled, and no new order will be placed - * Documentation: https://www.kucoin.com/docs-new/api-3470171 + * batchAddOrdersSync Batch Add Orders Sync + * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair + * Documentation: https://www.kucoin.com/docs-new/api-3470169 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -172,15 +171,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - modifyOrder(req: ModifyOrderReq): Promise; + batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise; /** - * cancelAllOrders Cancel All Orders - * Description: This endpoint can cancel all spot orders for all symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470176 + * cancelOrderByOrderId Cancel Order By OrderId + * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470174 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -188,15 +187,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 30 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - cancelAllOrders(): Promise; + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; /** - * cancelPartialOrder Cancel Partial Order - * Description: This interface can cancel the specified quantity of the order according to the orderId. The order execution order is: price first, time first, this interface will not change the queue order - * Documentation: https://www.kucoin.com/docs-new/api-3470183 + * cancelOrderByOrderIdSync Cancel Order By OrderId Sync + * Description: This endpoint can be used to cancel a spot order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470185 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -204,10 +203,12 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - cancelPartialOrder(req: CancelPartialOrderReq): Promise; + cancelOrderByOrderIdSync( + req: CancelOrderByOrderIdSyncReq, + ): Promise; /** * cancelOrderByClientOid Cancel Order By ClientOid @@ -226,25 +227,27 @@ export interface OrderAPI { cancelOrderByClientOid(req: CancelOrderByClientOidReq): Promise; /** - * getOrderByClientOid Get Order By ClientOid - * Description: This endpoint can be used to obtain information for a single Spot order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470182 + * cancelOrderByClientOidSync Cancel Order By ClientOid Sync + * Description: This endpoint can be used to cancel a spot order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470186 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - getOrderByClientOid(req: GetOrderByClientOidReq): Promise; + cancelOrderByClientOidSync( + req: CancelOrderByClientOidSyncReq, + ): Promise; /** - * setDCP Set DCP - * Description: Set Disconnection Protect(Deadman Swich)Through this interface, Call this interface to automatically cancel all orders of the set trading pair after the specified time. If this interface is not called again for renewal or cancellation before the set time, the system will help the user to cancel the order of the corresponding trading pair. Otherwise it will not. - * Documentation: https://www.kucoin.com/docs-new/api-3470173 + * cancelPartialOrder Cancel Partial Order + * Description: This interface can cancel the specified quantity of the order according to the orderId. The order execution order is: price first, time first, this interface will not change the queue order + * Documentation: https://www.kucoin.com/docs-new/api-3470183 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -255,12 +258,12 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - setDCP(req: SetDCPReq): Promise; + cancelPartialOrder(req: CancelPartialOrderReq): Promise; /** - * getDCP Get DCP - * Description: Get Disconnection Protect(Deadman Swich)Through this interface, you can query the settings of automatic order cancellation - * Documentation: https://www.kucoin.com/docs-new/api-3470172 + * cancelAllOrdersBySymbol Cancel All Orders By Symbol + * Description: This endpoint can cancel all spot orders for specific symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470175 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -271,12 +274,12 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getDCP(): Promise; + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; /** - * cancelAllOrdersBySymbol Cancel All Orders By Symbol - * Description: This endpoint can cancel all spot orders for specific symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470175 + * cancelAllOrders Cancel All Orders + * Description: This endpoint can cancel all spot orders for all symbol. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470176 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -284,63 +287,63 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 30 | * +---------------------+---------+ */ - cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise; + cancelAllOrders(): Promise; /** - * getClosedOrders Get Closed Orders - * Description: This interface is to obtain all Spot closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470179 + * modifyOrder Modify Order + * Description: This interface can modify the price and quantity of the order according to orderId or clientOid. The implementation of this interface is: cancel the order and place a new order on the same trading pair, and return the modification result to the client synchronously When the quantity of the new order updated by the user is less than the filled quantity of this order, the order will be considered as completed, and the order will be cancelled, and no new order will be placed + * Documentation: https://www.kucoin.com/docs-new/api-3470171 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getClosedOrders(req: GetClosedOrdersReq): Promise; + modifyOrder(req: ModifyOrderReq): Promise; /** - * batchAddOrders Batch Add Orders - * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair - * Documentation: https://www.kucoin.com/docs-new/api-3470168 + * getOrderByOrderId Get Order By OrderId + * Description: This endpoint can be used to obtain information for a single Spot order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470181 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - batchAddOrders(req: BatchAddOrdersReq): Promise; + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; /** - * batchAddOrdersSync Batch Add Orders Sync - * Description: This endpoint supports sequential batch order placement from a single endpoint. A maximum of 5orders can be placed simultaneously. The order types must be limit orders of the same trading pair - * Documentation: https://www.kucoin.com/docs-new/api-3470169 + * getOrderByClientOid Get Order By ClientOid + * Description: This endpoint can be used to obtain information for a single Spot order using the client order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470182 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise; + getOrderByClientOid(req: GetOrderByClientOidReq): Promise; /** - * cancelOrderByOrderId Cancel Order By OrderId - * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470174 + * getSymbolsWithOpenOrder Get Symbols With Open Order + * Description: This interface can query all spot symbol that has active orders + * Documentation: https://www.kucoin.com/docs-new/api-3470177 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -348,15 +351,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise; + getSymbolsWithOpenOrder(): Promise; /** - * getOrderByOrderId Get Order By OrderId - * Description: This endpoint can be used to obtain information for a single Spot order using the order id. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. - * Documentation: https://www.kucoin.com/docs-new/api-3470181 + * getOpenOrders Get Open Orders + * Description: This interface is to obtain all Spot active order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470178 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -367,46 +370,44 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getOrderByOrderId(req: GetOrderByOrderIdReq): Promise; + getOpenOrders(req: GetOpenOrdersReq): Promise; /** - * addOrder Add Order - * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470188 + * getClosedOrders Get Closed Orders + * Description: This interface is to obtain all Spot closed order lists, and the return value of the active order interface is the paged data of all uncompleted order lists. The returned data is sorted in descending order according to the latest update time of the order. After the user successfully places an order, the order is in Active state, and the user can use inOrderBook to determine whether the order has entered the order. Canceled or fully filled orders are marked as completed Done status. + * Documentation: https://www.kucoin.com/docs-new/api-3470179 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - addOrder(req: AddOrderReq): Promise; + getClosedOrders(req: GetClosedOrdersReq): Promise; /** - * cancelOrderByClientOidSync Cancel Order By ClientOid Sync - * Description: This endpoint can be used to cancel a spot order by orderId. - * Documentation: https://www.kucoin.com/docs-new/api-3470186 + * getTradeHistory Get Trade History + * Description: This endpoint can be used to obtain a list of the latest Spot transaction details. The returned data is sorted in descending order according to the latest update time of the order. + * Documentation: https://www.kucoin.com/docs-new/api-3470180 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelOrderByClientOidSync( - req: CancelOrderByClientOidSyncReq, - ): Promise; + getTradeHistory(req: GetTradeHistoryReq): Promise; /** - * cancelOrderByOrderIdSync Cancel Order By OrderId Sync - * Description: This endpoint can be used to cancel a spot order by orderId. - * Documentation: https://www.kucoin.com/docs-new/api-3470185 + * getDCP Get DCP + * Description: Get Disconnection Protect(Deadman Swich)Through this interface, you can query the settings of automatic order cancellation + * Documentation: https://www.kucoin.com/docs-new/api-3470172 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -414,17 +415,15 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelOrderByOrderIdSync( - req: CancelOrderByOrderIdSyncReq, - ): Promise; + getDCP(): Promise; /** - * addOrderSync Add Order Sync - * Description: Place order to the spot trading system The difference between this interface and \"Add order\" is that this interface will synchronously return the order information after the order matching is completed. For higher latency requirements, please select the \"Add order\" interface. If there is a requirement for returning data integrity, please select this interface - * Documentation: https://www.kucoin.com/docs-new/api-3470170 + * setDCP Set DCP + * Description: Set Disconnection Protect(Deadman Swich)Through this interface, Call this interface to automatically cancel all orders of the set trading pair after the specified time. If this interface is not called again for renewal or cancellation before the set time, the system will help the user to cancel the order of the corresponding trading pair. Otherwise it will not. + * Documentation: https://www.kucoin.com/docs-new/api-3470173 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -432,15 +431,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - addOrderSync(req: AddOrderSyncReq): Promise; + setDCP(req: SetDCPReq): Promise; /** - * addOrderTest Add Order Test - * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. - * Documentation: https://www.kucoin.com/docs-new/api-3470187 + * @deprecated + * addStopOrder Add Stop Order + * Description: Place stop order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470334 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -451,48 +451,50 @@ export interface OrderAPI { * | API-RATE-LIMIT | 1 | * +---------------------+---------+ */ - addOrderTest(req: AddOrderTestReq): Promise; + addStopOrder(req: AddStopOrderReq): Promise; /** * @deprecated - * getRecentTradeHistoryOld Get Recent Trade History - Old - * Description: Request via this endpoint to get a list of 1000 fills in the last 24 hours. The return value is the data after Pagination, sorted in descending order according to time. - * Documentation: https://www.kucoin.com/docs-new/api-3470351 + * cancelStopOrderByClientOid Cancel Stop Order By ClientOid + * Description: This endpoint can be used to cancel a spot stop order by clientOid. + * Documentation: https://www.kucoin.com/docs-new/api-3470336 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 5 | * +---------------------+---------+ */ - getRecentTradeHistoryOld( - req: GetRecentTradeHistoryOldReq, - ): Promise; + cancelStopOrderByClientOid( + req: CancelStopOrderByClientOidReq, + ): Promise; /** * @deprecated - * getRecentOrdersListOld Get Recent Orders List - Old - * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. - * Documentation: https://www.kucoin.com/docs-new/api-3470347 + * cancelStopOrderByOrderId Cancel Stop Order By OrderId + * Description: This endpoint can be used to cancel a spot stop order by orderId. + * Documentation: https://www.kucoin.com/docs-new/api-3470335 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise; + cancelStopOrderByOrderId( + req: CancelStopOrderByOrderIdReq, + ): Promise; /** - * cancelOrderByClientOidOld Cancel Order By ClientOid - Old - * Description: This endpoint can be used to cancel a spot order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470344 + * batchCancelStopOrder Batch Cancel Stop Orders + * Description: This endpoint can be used to cancel a spot stop orders by batch. + * Documentation: https://www.kucoin.com/docs-new/api-3470337 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -503,15 +505,12 @@ export interface OrderAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - cancelOrderByClientOidOld( - req: CancelOrderByClientOidOldReq, - ): Promise; + batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise; /** - * @deprecated - * getOrderByClientOidOld Get Order By ClientOid - Old - * Description: Request via this interface to check the information of a single active order via clientOid. The system will prompt that the order does not exists if the order does not exist or has been settled. - * Documentation: https://www.kucoin.com/docs-new/api-3470349 + * getStopOrdersList Get Stop Orders List + * Description: This interface is to obtain all Spot active stop order lists + * Documentation: https://www.kucoin.com/docs-new/api-3470338 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -519,33 +518,31 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 8 | * +---------------------+---------+ */ - getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise; + getStopOrdersList(req: GetStopOrdersListReq): Promise; /** - * @deprecated - * batchCancelOrderOld Batch Cancel Order - Old - * Description: Request via this endpoint to cancel all open orders. The response is a list of ids of the canceled orders. - * Documentation: https://www.kucoin.com/docs-new/api-3470345 + * getStopOrderByOrderId Get Stop Order By OrderId + * Description: This interface is to obtain Spot stop order details by orderId + * Documentation: https://www.kucoin.com/docs-new/api-3470339 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 20 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise; + getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise; /** - * @deprecated - * getOrdersListOld Get Orders List - Old - * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. - * Documentation: https://www.kucoin.com/docs-new/api-3470346 + * getStopOrderByClientOid Get Stop Order By ClientOid + * Description: This interface is to obtain Spot stop order details by orderId + * Documentation: https://www.kucoin.com/docs-new/api-3470340 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -553,16 +550,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getOrdersListOld(req: GetOrdersListOldReq): Promise; + getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise; /** * @deprecated - * batchAddOrdersOld Batch Add Orders - Old - * Description: Request via this endpoint to place 5 orders at the same time. The order type must be a limit order of the same symbol. - * Documentation: https://www.kucoin.com/docs-new/api-3470342 + * addOcoOrder Add OCO Order + * Description: Place OCO order to the Spot trading system + * Documentation: https://www.kucoin.com/docs-new/api-3470353 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -570,16 +567,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise; + addOcoOrder(req: AddOcoOrderReq): Promise; /** * @deprecated - * cancelOrderByOrderIdOld Cancel Order By OrderId - Old + * cancelOcoOrderByOrderId Cancel OCO Order By OrderId * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470343 + * Documentation: https://www.kucoin.com/docs-new/api-3470354 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -590,30 +587,32 @@ export interface OrderAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise; + cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise; /** * @deprecated - * getOrderByOrderIdOld Get Order By OrderId - Old - * Description: Request via this endpoint to get a single order info by order ID. - * Documentation: https://www.kucoin.com/docs-new/api-3470348 + * cancelOcoOrderByClientOid Cancel OCO Order By ClientOid + * Description: Request via this interface to cancel a stop order via the clientOid. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. + * Documentation: https://www.kucoin.com/docs-new/api-3470355 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise; + cancelOcoOrderByClientOid( + req: CancelOcoOrderByClientOidReq, + ): Promise; /** * @deprecated - * addOrderOld Add Order - Old - * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470333 + * batchCancelOcoOrders Batch Cancel OCO Order + * Description: This interface can batch cancel OCO orders through orderIds. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. + * Documentation: https://www.kucoin.com/docs-new/api-3470356 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -621,67 +620,69 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - addOrderOld(req: AddOrderOldReq): Promise; + batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise; /** * @deprecated - * addOrderTestOld Add Order Test - Old - * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. - * Documentation: https://www.kucoin.com/docs-new/api-3470341 + * getOcoOrderByOrderId Get OCO Order By OrderId + * Description: Request via this interface to get a oco order information via the order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470357 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - addOrderTestOld(req: AddOrderTestOldReq): Promise; + getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise; /** - * batchCancelStopOrder Batch Cancel Stop Orders - * Description: This endpoint can be used to cancel a spot stop orders by batch. - * Documentation: https://www.kucoin.com/docs-new/api-3470337 + * @deprecated + * getOcoOrderByClientOid Get OCO Order By ClientOid + * Description: Request via this interface to get a oco order information via the client order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470358 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise; + getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise; /** * @deprecated - * cancelStopOrderByClientOid Cancel Stop Order By ClientOid - * Description: This endpoint can be used to cancel a spot stop order by clientOid. - * Documentation: https://www.kucoin.com/docs-new/api-3470336 + * getOcoOrderDetailByOrderId Get OCO Order Detail By OrderId + * Description: Request via this interface to get a oco order detail via the order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470359 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 5 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelStopOrderByClientOid( - req: CancelStopOrderByClientOidReq, - ): Promise; + getOcoOrderDetailByOrderId( + req: GetOcoOrderDetailByOrderIdReq, + ): Promise; /** - * getStopOrdersList Get Stop Orders List - * Description: This interface is to obtain all Spot active stop order lists - * Documentation: https://www.kucoin.com/docs-new/api-3470338 + * @deprecated + * getOcoOrderList Get OCO Order List + * Description: Request via this endpoint to get your current OCO order list. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. + * Documentation: https://www.kucoin.com/docs-new/api-3470360 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -689,16 +690,16 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 8 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getStopOrdersList(req: GetStopOrdersListReq): Promise; + getOcoOrderList(req: GetOcoOrderListReq): Promise; /** * @deprecated - * cancelStopOrderByOrderId Cancel Stop Order By OrderId - * Description: This endpoint can be used to cancel a spot stop order by orderId. - * Documentation: https://www.kucoin.com/docs-new/api-3470335 + * addOrderOld Add Order - Old + * Description: Place order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. + * Documentation: https://www.kucoin.com/docs-new/api-3470333 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -706,34 +707,33 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - cancelStopOrderByOrderId( - req: CancelStopOrderByOrderIdReq, - ): Promise; + addOrderOld(req: AddOrderOldReq): Promise; /** - * getStopOrderByOrderId Get Stop Order By OrderId - * Description: This interface is to obtain Spot stop order details by orderId - * Documentation: https://www.kucoin.com/docs-new/api-3470339 + * @deprecated + * addOrderTestOld Add Order Test - Old + * Description: Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * Documentation: https://www.kucoin.com/docs-new/api-3470341 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise; + addOrderTestOld(req: AddOrderTestOldReq): Promise; /** * @deprecated - * addStopOrder Add Stop Order - * Description: Place stop order to the Spot trading system, you can place two major types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your funds will be put on hold for the duration of the order. The amount of funds on hold depends on the order type and parameters specified. - * Documentation: https://www.kucoin.com/docs-new/api-3470334 + * batchAddOrdersOld Batch Add Orders - Old + * Description: Request via this endpoint to place 5 orders at the same time. The order type must be a limit order of the same symbol. + * Documentation: https://www.kucoin.com/docs-new/api-3470342 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -741,32 +741,32 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 1 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - addStopOrder(req: AddStopOrderReq): Promise; + batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise; /** - * getStopOrderByClientOid Get Stop Order By ClientOid - * Description: This interface is to obtain Spot stop order details by orderId - * Documentation: https://www.kucoin.com/docs-new/api-3470340 + * @deprecated + * cancelOrderByOrderIdOld Cancel Order By OrderId - Old + * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470343 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise; + cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise; /** - * @deprecated - * cancelOcoOrderByClientOid Cancel OCO Order By ClientOid - * Description: Request via this interface to cancel a stop order via the clientOid. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. - * Documentation: https://www.kucoin.com/docs-new/api-3470355 + * cancelOrderByClientOidOld Cancel Order By ClientOid - Old + * Description: This endpoint can be used to cancel a spot order by clientOid. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. + * Documentation: https://www.kucoin.com/docs-new/api-3470344 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -777,32 +777,32 @@ export interface OrderAPI { * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - cancelOcoOrderByClientOid( - req: CancelOcoOrderByClientOidReq, - ): Promise; + cancelOrderByClientOidOld( + req: CancelOrderByClientOidOldReq, + ): Promise; /** * @deprecated - * getOcoOrderByClientOid Get OCO Order By ClientOid - * Description: Request via this interface to get a oco order information via the client order ID. - * Documentation: https://www.kucoin.com/docs-new/api-3470358 + * batchCancelOrderOld Batch Cancel Order - Old + * Description: Request via this endpoint to cancel all open orders. The response is a list of ids of the canceled orders. + * Documentation: https://www.kucoin.com/docs-new/api-3470345 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | GENERAL | + * | API-PERMISSION | SPOT | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 20 | * +---------------------+---------+ */ - getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise; + batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise; /** * @deprecated - * getOcoOrderDetailByOrderId Get OCO Order Detail By OrderId - * Description: Request via this interface to get a oco order detail via the order ID. - * Documentation: https://www.kucoin.com/docs-new/api-3470359 + * getOrdersListOld Get Orders List - Old + * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470346 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -813,32 +813,30 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getOcoOrderDetailByOrderId( - req: GetOcoOrderDetailByOrderIdReq, - ): Promise; + getOrdersListOld(req: GetOrdersListOldReq): Promise; /** * @deprecated - * cancelOcoOrderByOrderId Cancel OCO Order By OrderId - * Description: This endpoint can be used to cancel a spot order by orderId. This endpoint only sends cancellation requests. The results of the requests must be obtained by checking the order status or subscribing to websocket. - * Documentation: https://www.kucoin.com/docs-new/api-3470354 + * getRecentOrdersListOld Get Recent Orders List - Old + * Description: Request via this endpoint to get your current order list. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470347 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise; + getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise; /** * @deprecated - * getOcoOrderByOrderId Get OCO Order By OrderId - * Description: Request via this interface to get a oco order information via the order ID. - * Documentation: https://www.kucoin.com/docs-new/api-3470357 + * getOrderByOrderIdOld Get Order By OrderId - Old + * Description: Request via this endpoint to get a single order info by order ID. + * Documentation: https://www.kucoin.com/docs-new/api-3470348 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -849,47 +847,47 @@ export interface OrderAPI { * | API-RATE-LIMIT | 2 | * +---------------------+---------+ */ - getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise; + getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise; /** * @deprecated - * addOcoOrder Add OCO Order - * Description: Place OCO order to the Spot trading system - * Documentation: https://www.kucoin.com/docs-new/api-3470353 + * getOrderByClientOidOld Get Order By ClientOid - Old + * Description: Request via this interface to check the information of a single active order via clientOid. The system will prompt that the order does not exists if the order does not exist or has been settled. + * Documentation: https://www.kucoin.com/docs-new/api-3470349 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 3 | * +---------------------+---------+ */ - addOcoOrder(req: AddOcoOrderReq): Promise; + getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise; /** * @deprecated - * batchCancelOcoOrders Batch Cancel OCO Order - * Description: This interface can batch cancel OCO orders through orderIds. You will receive cancelledOrderIds field once the system has received the cancellation request. The cancellation request will be processed by the matching engine in sequence. To know if the request is processed (successfully or not), you may check the order status or the update message from the pushes. - * Documentation: https://www.kucoin.com/docs-new/api-3470356 + * getTradeHistoryOld Get Trade History - Old + * Description: Request via this endpoint to get the recent fills. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470350 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ * | API-DOMAIN | SPOT | * | API-CHANNEL | PRIVATE | - * | API-PERMISSION | SPOT | + * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 3 | + * | API-RATE-LIMIT | 10 | * +---------------------+---------+ */ - batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise; + getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise; /** * @deprecated - * getOcoOrderList Get OCO Order List - * Description: Request via this endpoint to get your current OCO order list. Items are paginated and sorted to show the latest first. See the Pagination section for retrieving additional entries after the first page. - * Documentation: https://www.kucoin.com/docs-new/api-3470360 + * getRecentTradeHistoryOld Get Recent Trade History - Old + * Description: Request via this endpoint to get a list of 1000 fills in the last 24 hours. The return value is the data after Pagination, sorted in descending order according to time. + * Documentation: https://www.kucoin.com/docs-new/api-3470351 * +---------------------+---------+ * | Extra API Info | Value | * +---------------------+---------+ @@ -897,95 +895,99 @@ export interface OrderAPI { * | API-CHANNEL | PRIVATE | * | API-PERMISSION | GENERAL | * | API-RATE-LIMIT-POOL | SPOT | - * | API-RATE-LIMIT | 2 | + * | API-RATE-LIMIT | 20 | * +---------------------+---------+ */ - getOcoOrderList(req: GetOcoOrderListReq): Promise; + getRecentTradeHistoryOld( + req: GetRecentTradeHistoryOldReq, + ): Promise; } export class OrderAPIImpl implements OrderAPI { constructor(private transport: Transport) {} - getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise { + addOrder(req: AddOrderReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/fills', + 'POST', + '/api/v1/hf/orders', req, - new GetTradeHistoryOldResp(), + new AddOrderResp(), false, ); } - getTradeHistory(req: GetTradeHistoryReq): Promise { + addOrderSync(req: AddOrderSyncReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/fills', + 'POST', + '/api/v1/hf/orders/sync', req, - new GetTradeHistoryResp(), + new AddOrderSyncResp(), false, ); } - getOpenOrders(req: GetOpenOrdersReq): Promise { + addOrderTest(req: AddOrderTestReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/orders/active', + 'POST', + '/api/v1/hf/orders/test', req, - new GetOpenOrdersResp(), + new AddOrderTestResp(), false, ); } - getSymbolsWithOpenOrder(): Promise { + batchAddOrders(req: BatchAddOrdersReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/orders/active/symbols', - null, - new GetSymbolsWithOpenOrderResp(), + 'POST', + '/api/v1/hf/orders/multi', + req, + new BatchAddOrdersResp(), false, ); } - modifyOrder(req: ModifyOrderReq): Promise { + batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/hf/orders/alter', + '/api/v1/hf/orders/multi/sync', req, - new ModifyOrderResp(), + new BatchAddOrdersSyncResp(), false, ); } - cancelAllOrders(): Promise { + cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v1/hf/orders/cancelAll', - null, - new CancelAllOrdersResp(), + '/api/v1/hf/orders/{orderId}', + req, + new CancelOrderByOrderIdResp(), false, ); } - cancelPartialOrder(req: CancelPartialOrderReq): Promise { + cancelOrderByOrderIdSync( + req: CancelOrderByOrderIdSyncReq, + ): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v1/hf/orders/cancel/{orderId}', + '/api/v1/hf/orders/sync/{orderId}', req, - new CancelPartialOrderResp(), + new CancelOrderByOrderIdSyncResp(), false, ); } @@ -1002,498 +1004,496 @@ export class OrderAPIImpl implements OrderAPI { ); } - getOrderByClientOid(req: GetOrderByClientOidReq): Promise { + cancelOrderByClientOidSync( + req: CancelOrderByClientOidSyncReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/orders/client-order/{clientOid}', + 'DELETE', + '/api/v1/hf/orders/sync/client-order/{clientOid}', req, - new GetOrderByClientOidResp(), + new CancelOrderByClientOidSyncResp(), false, ); } - setDCP(req: SetDCPReq): Promise { + cancelPartialOrder(req: CancelPartialOrderReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/hf/orders/dead-cancel-all', + 'DELETE', + '/api/v1/hf/orders/cancel/{orderId}', req, - new SetDCPResp(), + new CancelPartialOrderResp(), false, ); } - getDCP(): Promise { + cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/orders/dead-cancel-all/query', - null, - new GetDCPResp(), + 'DELETE', + '/api/v1/hf/orders', + req, + new CancelAllOrdersBySymbolResp(), false, ); } - cancelAllOrdersBySymbol(req: CancelAllOrdersBySymbolReq): Promise { + cancelAllOrders(): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v1/hf/orders', - req, - new CancelAllOrdersBySymbolResp(), + '/api/v1/hf/orders/cancelAll', + null, + new CancelAllOrdersResp(), false, ); } - getClosedOrders(req: GetClosedOrdersReq): Promise { + modifyOrder(req: ModifyOrderReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/hf/orders/done', + 'POST', + '/api/v1/hf/orders/alter', req, - new GetClosedOrdersResp(), + new ModifyOrderResp(), false, ); } - batchAddOrders(req: BatchAddOrdersReq): Promise { + getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/hf/orders/multi', + 'GET', + '/api/v1/hf/orders/{orderId}', req, - new BatchAddOrdersResp(), + new GetOrderByOrderIdResp(), false, ); } - batchAddOrdersSync(req: BatchAddOrdersSyncReq): Promise { + getOrderByClientOid(req: GetOrderByClientOidReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/hf/orders/multi/sync', + 'GET', + '/api/v1/hf/orders/client-order/{clientOid}', req, - new BatchAddOrdersSyncResp(), + new GetOrderByClientOidResp(), false, ); } - cancelOrderByOrderId(req: CancelOrderByOrderIdReq): Promise { + getSymbolsWithOpenOrder(): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/hf/orders/{orderId}', - req, - new CancelOrderByOrderIdResp(), + 'GET', + '/api/v1/hf/orders/active/symbols', + null, + new GetSymbolsWithOpenOrderResp(), false, ); } - getOrderByOrderId(req: GetOrderByOrderIdReq): Promise { + getOpenOrders(req: GetOpenOrdersReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/hf/orders/{orderId}', + '/api/v1/hf/orders/active', req, - new GetOrderByOrderIdResp(), + new GetOpenOrdersResp(), false, ); } - addOrder(req: AddOrderReq): Promise { + getClosedOrders(req: GetClosedOrdersReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/hf/orders', + 'GET', + '/api/v1/hf/orders/done', req, - new AddOrderResp(), + new GetClosedOrdersResp(), false, ); } - cancelOrderByClientOidSync( - req: CancelOrderByClientOidSyncReq, - ): Promise { + getTradeHistory(req: GetTradeHistoryReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/hf/orders/sync/client-order/{clientOid}', + 'GET', + '/api/v1/hf/fills', req, - new CancelOrderByClientOidSyncResp(), + new GetTradeHistoryResp(), false, ); } - cancelOrderByOrderIdSync( - req: CancelOrderByOrderIdSyncReq, - ): Promise { + getDCP(): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/hf/orders/sync/{orderId}', - req, - new CancelOrderByOrderIdSyncResp(), + 'GET', + '/api/v1/hf/orders/dead-cancel-all/query', + null, + new GetDCPResp(), false, ); } - addOrderSync(req: AddOrderSyncReq): Promise { + setDCP(req: SetDCPReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/hf/orders/sync', + '/api/v1/hf/orders/dead-cancel-all', req, - new AddOrderSyncResp(), + new SetDCPResp(), false, ); } - addOrderTest(req: AddOrderTestReq): Promise { + addStopOrder(req: AddStopOrderReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/hf/orders/test', + '/api/v1/stop-order', req, - new AddOrderTestResp(), + new AddStopOrderResp(), false, ); } - getRecentTradeHistoryOld( - req: GetRecentTradeHistoryOldReq, - ): Promise { + cancelStopOrderByClientOid( + req: CancelStopOrderByClientOidReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/limit/fills', + 'DELETE', + '/api/v1/stop-order/cancelOrderByClientOid', req, - new GetRecentTradeHistoryOldResp(), + new CancelStopOrderByClientOidResp(), false, ); } - getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise { + cancelStopOrderByOrderId( + req: CancelStopOrderByOrderIdReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/limit/orders', + 'DELETE', + '/api/v1/stop-order/{orderId}', req, - new GetRecentOrdersListOldResp(), + new CancelStopOrderByOrderIdResp(), false, ); } - cancelOrderByClientOidOld( - req: CancelOrderByClientOidOldReq, - ): Promise { + batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v1/order/client-order/{clientOid}', + '/api/v1/stop-order/cancel', req, - new CancelOrderByClientOidOldResp(), + new BatchCancelStopOrderResp(), false, ); } - getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise { + getStopOrdersList(req: GetStopOrdersListReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/order/client-order/{clientOid}', + '/api/v1/stop-order', req, - new GetOrderByClientOidOldResp(), - false, + new GetStopOrdersListResp(), + true, ); } - batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise { + getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/orders', + 'GET', + '/api/v1/stop-order/{orderId}', req, - new BatchCancelOrderOldResp(), + new GetStopOrderByOrderIdResp(), false, ); } - getOrdersListOld(req: GetOrdersListOldReq): Promise { + getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/orders', + '/api/v1/stop-order/queryOrderByClientOid', req, - new GetOrdersListOldResp(), + new GetStopOrderByClientOidResp(), false, ); } - batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise { + addOcoOrder(req: AddOcoOrderReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/orders/multi', + '/api/v3/oco/order', req, - new BatchAddOrdersOldResp(), + new AddOcoOrderResp(), false, ); } - cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise { + cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v1/orders/{orderId}', + '/api/v3/oco/order/{orderId}', req, - new CancelOrderByOrderIdOldResp(), + new CancelOcoOrderByOrderIdResp(), false, ); } - getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise { + cancelOcoOrderByClientOid( + req: CancelOcoOrderByClientOidReq, + ): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/orders/{orderId}', + 'DELETE', + '/api/v3/oco/client-order/{clientOid}', req, - new GetOrderByOrderIdOldResp(), + new CancelOcoOrderByClientOidResp(), false, ); } - addOrderOld(req: AddOrderOldReq): Promise { + batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/orders', + 'DELETE', + '/api/v3/oco/orders', req, - new AddOrderOldResp(), + new BatchCancelOcoOrdersResp(), false, ); } - addOrderTestOld(req: AddOrderTestOldReq): Promise { + getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v1/orders/test', + 'GET', + '/api/v3/oco/order/{orderId}', req, - new AddOrderTestOldResp(), + new GetOcoOrderByOrderIdResp(), false, ); } - batchCancelStopOrder(req: BatchCancelStopOrderReq): Promise { + getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/stop-order/cancel', + 'GET', + '/api/v3/oco/client-order/{clientOid}', req, - new BatchCancelStopOrderResp(), + new GetOcoOrderByClientOidResp(), false, ); } - cancelStopOrderByClientOid( - req: CancelStopOrderByClientOidReq, - ): Promise { + getOcoOrderDetailByOrderId( + req: GetOcoOrderDetailByOrderIdReq, + ): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/stop-order/cancelOrderByClientOid', + 'GET', + '/api/v3/oco/order/details/{orderId}', req, - new CancelStopOrderByClientOidResp(), + new GetOcoOrderDetailByOrderIdResp(), false, ); } - getStopOrdersList(req: GetStopOrdersListReq): Promise { + getOcoOrderList(req: GetOcoOrderListReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/stop-order', + '/api/v3/oco/orders', req, - new GetStopOrdersListResp(), - true, + new GetOcoOrderListResp(), + false, ); } - cancelStopOrderByOrderId( - req: CancelStopOrderByOrderIdReq, - ): Promise { + addOrderOld(req: AddOrderOldReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v1/stop-order/{orderId}', + 'POST', + '/api/v1/orders', req, - new CancelStopOrderByOrderIdResp(), + new AddOrderOldResp(), false, ); } - getStopOrderByOrderId(req: GetStopOrderByOrderIdReq): Promise { + addOrderTestOld(req: AddOrderTestOldReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/stop-order/{orderId}', + 'POST', + '/api/v1/orders/test', req, - new GetStopOrderByOrderIdResp(), + new AddOrderTestOldResp(), false, ); } - addStopOrder(req: AddStopOrderReq): Promise { + batchAddOrdersOld(req: BatchAddOrdersOldReq): Promise { return this.transport.call( 'spot', false, 'POST', - '/api/v1/stop-order', + '/api/v1/orders/multi', req, - new AddStopOrderResp(), + new BatchAddOrdersOldResp(), false, ); } - getStopOrderByClientOid(req: GetStopOrderByClientOidReq): Promise { + cancelOrderByOrderIdOld(req: CancelOrderByOrderIdOldReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v1/stop-order/queryOrderByClientOid', + 'DELETE', + '/api/v1/orders/{orderId}', req, - new GetStopOrderByClientOidResp(), + new CancelOrderByOrderIdOldResp(), false, ); } - cancelOcoOrderByClientOid( - req: CancelOcoOrderByClientOidReq, - ): Promise { + cancelOrderByClientOidOld( + req: CancelOrderByClientOidOldReq, + ): Promise { return this.transport.call( 'spot', false, 'DELETE', - '/api/v3/oco/client-order/{clientOid}', + '/api/v1/order/client-order/{clientOid}', req, - new CancelOcoOrderByClientOidResp(), + new CancelOrderByClientOidOldResp(), false, ); } - getOcoOrderByClientOid(req: GetOcoOrderByClientOidReq): Promise { + batchCancelOrderOld(req: BatchCancelOrderOldReq): Promise { return this.transport.call( 'spot', false, - 'GET', - '/api/v3/oco/client-order/{clientOid}', + 'DELETE', + '/api/v1/orders', req, - new GetOcoOrderByClientOidResp(), + new BatchCancelOrderOldResp(), false, ); } - getOcoOrderDetailByOrderId( - req: GetOcoOrderDetailByOrderIdReq, - ): Promise { + getOrdersListOld(req: GetOrdersListOldReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/oco/order/details/{orderId}', + '/api/v1/orders', req, - new GetOcoOrderDetailByOrderIdResp(), + new GetOrdersListOldResp(), false, ); } - cancelOcoOrderByOrderId(req: CancelOcoOrderByOrderIdReq): Promise { + getRecentOrdersListOld(req: GetRecentOrdersListOldReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v3/oco/order/{orderId}', + 'GET', + '/api/v1/limit/orders', req, - new CancelOcoOrderByOrderIdResp(), + new GetRecentOrdersListOldResp(), false, ); } - getOcoOrderByOrderId(req: GetOcoOrderByOrderIdReq): Promise { + getOrderByOrderIdOld(req: GetOrderByOrderIdOldReq): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/oco/order/{orderId}', + '/api/v1/orders/{orderId}', req, - new GetOcoOrderByOrderIdResp(), + new GetOrderByOrderIdOldResp(), false, ); } - addOcoOrder(req: AddOcoOrderReq): Promise { + getOrderByClientOidOld(req: GetOrderByClientOidOldReq): Promise { return this.transport.call( 'spot', false, - 'POST', - '/api/v3/oco/order', + 'GET', + '/api/v1/order/client-order/{clientOid}', req, - new AddOcoOrderResp(), + new GetOrderByClientOidOldResp(), false, ); } - batchCancelOcoOrders(req: BatchCancelOcoOrdersReq): Promise { + getTradeHistoryOld(req: GetTradeHistoryOldReq): Promise { return this.transport.call( 'spot', false, - 'DELETE', - '/api/v3/oco/orders', + 'GET', + '/api/v1/fills', req, - new BatchCancelOcoOrdersResp(), + new GetTradeHistoryOldResp(), false, ); } - getOcoOrderList(req: GetOcoOrderListReq): Promise { + getRecentTradeHistoryOld( + req: GetRecentTradeHistoryOldReq, + ): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v3/oco/orders', + '/api/v1/limit/fills', req, - new GetOcoOrderListResp(), + new GetRecentTradeHistoryOldResp(), false, ); } diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 6c2f4dca..c7749129 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-14'; +export const SdkGenerateDate = '2025-01-17'; diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.template b/sdk/node/src/generate/viplending/viplending/api_vip_lending.template index 7290e228..3bbe7a3c 100644 --- a/sdk/node/src/generate/viplending/viplending/api_vip_lending.template +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.template @@ -5,18 +5,6 @@ describe('Auto Test', ()=> { beforeAll(()=> { api = ?? }); - test('getAccounts request test', ()=> { - /** - * getAccounts - * Get Accounts - * /api/v1/otc-loan/accounts - */ - let resp = api.getAccounts(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); - }); - }) - test('getAccountDetail request test', ()=> { /** * getAccountDetail @@ -31,6 +19,20 @@ describe('Auto Test', ()=> { expect(result.totalMarginAmount).toEqual(expect.anything()); expect(result.transferMarginAmount).toEqual(expect.anything()); expect(result.margins).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getAccounts request test', ()=> { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + let resp = api.getAccounts(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); }); }) diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts b/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts index 91eefe45..a3745681 100644 --- a/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.test.ts @@ -3,21 +3,6 @@ import { GetAccountsResp } from './model_get_accounts_resp'; import { RestResponse } from '@model/common'; describe('Auto Test', () => { - test('getAccounts request test', () => { - /** - * getAccounts - * Get Accounts - * /api/v1/otc-loan/accounts - */ - }); - - test('getAccounts response test', () => { - /** - * getAccounts - * Get Accounts - * /api/v1/otc-loan/accounts - */ - }); test('getAccountDetail request test', () => { /** * getAccountDetail @@ -33,4 +18,19 @@ describe('Auto Test', () => { * /api/v1/otc-loan/loan */ }); + test('getAccounts request test', () => { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + }); + + test('getAccounts response test', () => { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + }); }); diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts index 113ac41c..b2b7cce4 100644 --- a/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts @@ -6,9 +6,9 @@ import { GetAccountsResp } from './model_get_accounts_resp'; export interface VIPLendingAPI { /** - * getAccounts Get Accounts - * Description: Accounts participating in OTC lending, This interface is only for querying accounts currently running OTC lending. - * Documentation: https://www.kucoin.com/docs-new/api-3470278 + * getAccountDetail Get Account Detail + * Description: The following information is only applicable to loans. Get information on off-exchange funding and loans, This endpoint is only for querying accounts that are currently involved in loans. + * Documentation: https://www.kucoin.com/docs-new/api-3470277 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -19,12 +19,12 @@ export interface VIPLendingAPI { * | API-RATE-LIMIT | 1 | * +---------------------+------------+ */ - getAccounts(): Promise; + getAccountDetail(): Promise; /** - * getAccountDetail Get Account Detail - * Description: The following information is only applicable to loans. Get information on off-exchange funding and loans, This endpoint is only for querying accounts that are currently involved in loans. - * Documentation: https://www.kucoin.com/docs-new/api-3470277 + * getAccounts Get Accounts + * Description: Accounts participating in OTC lending, This interface is only for querying accounts currently running OTC lending. + * Documentation: https://www.kucoin.com/docs-new/api-3470278 * +---------------------+------------+ * | Extra API Info | Value | * +---------------------+------------+ @@ -35,32 +35,32 @@ export interface VIPLendingAPI { * | API-RATE-LIMIT | 1 | * +---------------------+------------+ */ - getAccountDetail(): Promise; + getAccounts(): Promise; } export class VIPLendingAPIImpl implements VIPLendingAPI { constructor(private transport: Transport) {} - getAccounts(): Promise { + getAccountDetail(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/otc-loan/accounts', + '/api/v1/otc-loan/loan', null, - new GetAccountsResp(), + new GetAccountDetailResp(), false, ); } - getAccountDetail(): Promise { + getAccounts(): Promise { return this.transport.call( 'spot', false, 'GET', - '/api/v1/otc-loan/loan', + '/api/v1/otc-loan/accounts', null, - new GetAccountDetailResp(), + new GetAccountsResp(), false, ); } diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index 9e549e8e..7d1dd053 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -11,6 +11,7 @@ "outDir": "./dist", "baseUrl": "./", "paths": { + "@src/*": ["src/*"], "@model/*": ["src/model/*"], "@internal/*": ["src/internal/*"], "@generate/*": ["src/generate/*"], From 4d373c883f49035ccf7d280a73a75903fd6e13c9 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 15:57:07 +0800 Subject: [PATCH 037/106] feat(nodejs): add todo list --- sdk/node/package-lock.json | 5 +++ sdk/node/package.json | 3 +- .../src/internal/infra/default_transport.ts | 31 ++++++++++++------- sdk/node/src/model/transport_option.ts | 2 +- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index 69f2bd57..a763a3ee 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -3644,6 +3644,11 @@ "punycode": "^2.1.0" } }, + "uuid": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", + "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==" + }, "v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index be1917c6..232fc23b 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -49,6 +49,7 @@ "axios": "^1.7.9", "axios-retry": "^4.5.0", "class-transformer": "^0.5.1", - "reflect-metadata": "^0.2.2" + "reflect-metadata": "^0.2.2", + "uuid": "^11.0.5" } } diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 47b1ab9c..6072ae49 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -4,7 +4,7 @@ import { Response } from '@internal/interfaces/response'; import { ClientOption } from '@model/client_option'; import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; -import { TransportOption } from '@model/transport_option'; +import { DEFAULT_TRANSPORT_OPTION, TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; import axios, { AxiosInstance, @@ -52,7 +52,7 @@ export class DefaultTransport implements Transport { // Add retry logic axiosRetry(instance, { - retries: trans_option.maxRetries || 3, + retries: trans_option.maxRetries || DEFAULT_TRANSPORT_OPTION.maxRetries, shouldResetTimeout: true, retryDelay: (retryCount, error) => { const delay = trans_option.retryDelay; @@ -61,7 +61,7 @@ export class DefaultTransport implements Transport { retryCondition: (error) => { // acquire request config const currentRetry = (error.config as any)?._retry || 0; - const maxRetries = trans_option.maxRetries || 3; + const maxRetries = trans_option.maxRetries || DEFAULT_TRANSPORT_OPTION.maxRetries; // change retry condition here const shouldRetry = @@ -74,21 +74,26 @@ export class DefaultTransport implements Transport { }); instance.defaults.httpAgent = new HttpAgent({ - maxSockets: trans_option.maxConnsPerHost || 100, - maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, - timeout: trans_option.timeout || 60000, - freeSocketTimeout: trans_option.idleConnTimeout || 30000, + maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: + trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, + freeSocketTimeout: + trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, }); instance.defaults.httpsAgent = new HttpsAgent({ - maxSockets: trans_option.maxConnsPerHost || 100, - maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, - timeout: trans_option.timeout || 60000, - freeSocketTimeout: trans_option.idleConnTimeout || 30000, + maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: + trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, + freeSocketTimeout: + trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, }); + // todo: Use user interceptors, avoid defaults. instance.interceptors.request.use( (config) => { console.log('[REQUEST]', { @@ -199,6 +204,7 @@ export class DefaultTransport implements Transport { let reqBody = ''; let queryPath = path; + // TODO wrong logic if (requestAsJson && requestObj) { reqBody = JSON.stringify(requestObj); } else if (method === 'GET' || method === 'DELETE') { @@ -246,6 +252,7 @@ export class DefaultTransport implements Transport { reset, }; + // todo delete if (remaining <= Math.ceil(limit * 0.1)) { console.warn('[RATE LIMIT WARNING]', rateLimit); } @@ -257,6 +264,7 @@ export class DefaultTransport implements Transport { response: AxiosResponse, responseObj: Response, ): Response { + // todo missing logic if (response.status >= 400) { console.error('[RESPONSE ERROR]', { status: response.status, @@ -334,6 +342,7 @@ export class DefaultTransport implements Transport { } close(): Promise { + // TODO release resource return Promise.resolve(undefined); } } diff --git a/sdk/node/src/model/transport_option.ts b/sdk/node/src/model/transport_option.ts index bee75801..b96fa94e 100644 --- a/sdk/node/src/model/transport_option.ts +++ b/sdk/node/src/model/transport_option.ts @@ -70,7 +70,7 @@ export interface TransportOption { /** * Default values for TransportOption */ -const DEFAULT_TRANSPORT_OPTION: TransportOption = { +export const DEFAULT_TRANSPORT_OPTION: TransportOption = { timeout: 30000, // 30 seconds keepAlive: true, maxIdleConns: 100, From d4f01f33c76ea515774a364af0171e83c71f3738 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 17 Jan 2025 16:54:39 +0800 Subject: [PATCH 038/106] feat(nodejs): fix npm build --- sdk/node/package.json | 7 ++- .../src/internal/infra/default_transport.ts | 54 +++++++++---------- .../src/internal/infra/default_ws_client.ts | 12 +++-- .../src/internal/infra/default_ws_service.ts | 1 + 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/sdk/node/package.json b/sdk/node/package.json index 232fc23b..aeafdfd2 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -29,6 +29,9 @@ "license": "MIT", "devDependencies": { "@types/jest": "^29.5.14", + "@types/node": "^22.10.5", + "@types/uuid": "^9.0.8", + "@types/ws": "^8.5.13", "@typescript-eslint/eslint-plugin": "^8.19.0", "@typescript-eslint/parser": "^8.19.0", "eslint": "^9.17.0", @@ -49,7 +52,9 @@ "axios": "^1.7.9", "axios-retry": "^4.5.0", "class-transformer": "^0.5.1", + "queue-typescript": "^1.0.1", "reflect-metadata": "^0.2.2", - "uuid": "^11.0.5" + "uuid": "^11.0.5", + "ws": "^8.18.0" } } diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 6072ae49..833b0db6 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -6,16 +6,12 @@ import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { DEFAULT_TRANSPORT_OPTION, TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; -import axios, { - AxiosInstance, - AxiosRequestConfig, - AxiosResponse, - AxiosResponseHeaders, - RawAxiosResponseHeaders, -} from 'axios'; +import axios from 'axios'; +import type { CreateAxiosDefaults, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; import 'reflect-metadata'; import axiosRetry from 'axios-retry'; -import { HttpAgent, HttpsAgent } from 'agentkeepalive'; +import { Agent as HttpAgent } from 'http'; +import { Agent as HttpsAgent } from 'https'; export class DefaultTransport implements Transport { private readonly option: ClientOption; @@ -48,7 +44,25 @@ export class DefaultTransport implements Transport { headers: { Connection: trans_option.keepAlive ? 'keep-alive' : 'close', }, - }); + httpAgent: trans_option.keepAlive + ? new HttpAgent({ + maxSockets: trans_option.maxConnsPerHost || 100, + maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, + timeout: trans_option.timeout || 60000, + keepAlive: true, + keepAliveMsecs: trans_option.idleConnTimeout || 30000, + }) + : undefined, + httpsAgent: trans_option.keepAlive + ? new HttpsAgent({ + maxSockets: trans_option.maxConnsPerHost || 100, + maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, + timeout: trans_option.timeout || 60000, + keepAlive: true, + keepAliveMsecs: trans_option.idleConnTimeout || 30000, + }) + : undefined, + } as CreateAxiosDefaults); // Add retry logic axiosRetry(instance, { @@ -73,26 +87,6 @@ export class DefaultTransport implements Transport { }, }); - instance.defaults.httpAgent = new HttpAgent({ - maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, - maxFreeSockets: - trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, - timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, - freeSocketTimeout: - trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, - keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, - }); - - instance.defaults.httpsAgent = new HttpsAgent({ - maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, - maxFreeSockets: - trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, - timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, - freeSocketTimeout: - trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, - keepAlive: trans_option.keepAlive !== undefined ? trans_option.keepAlive : true, - }); - // todo: Use user interceptors, avoid defaults. instance.interceptors.request.use( (config) => { @@ -241,7 +235,7 @@ export class DefaultTransport implements Transport { return config; } - private processLimit(headers: RawAxiosResponseHeaders | AxiosResponseHeaders): RestRateLimit { + private processLimit(headers: any): RestRateLimit { const limit = parseInt(headers['gw-ratelimit-limit'] || '-1', 10); const remaining = parseInt(headers['gw-ratelimit-remaining'] || '-1', 10); const reset = parseInt(headers['gw-ratelimit-reset'] || '-1', 10); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index acf59b1d..8f5d6f6c 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,4 +1,4 @@ -import WebSocket from 'ws'; +import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; import { Queue } from 'queue-typescript'; @@ -175,9 +175,13 @@ export class WebSocketClient { resolve(); }); - this.conn.on('message', (data) => this.onMessage(data.toString())); - this.conn.on('error', (error) => this.onError(error)); - this.conn.on('close', (code, reason) => this.onClose(code, reason.toString())); + this.conn.on('message', (data: WebSocketData) => + this.onMessage(data.toString()), + ); + this.conn.on('error', (error: Error) => this.onError(error)); + this.conn.on('close', (code: number, reason: string) => + this.onClose(code, reason.toString()), + ); setTimeout(() => { if (!this.welcomeReceived) { diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 7ccd4cfe..b8307dee 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -44,6 +44,7 @@ export class DefaultWsService implements WebSocketService { privateChannel: boolean, versionString: string, ) { + this.option = option; if (!option.webSocketClientOption) { throw new Error('WebSocketClientOption is undefined'); } From b6fbd1412eafd148bf104a39efad518b834878fa Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 17:11:09 +0800 Subject: [PATCH 039/106] feat(nodejs): add some tests --- sdk/node/package-lock.json | 32 +- sdk/node/package.json | 2 - .../src/internal/infra/default_ws_service.ts | 4 +- .../e2e/rest/account_test/account_api.test.ts | 332 ++++++++++++++++++ sdk/node/tests/e2e/ws/spot/public.test.ts | 75 ++++ 5 files changed, 436 insertions(+), 9 deletions(-) create mode 100644 sdk/node/tests/e2e/rest/account_test/account_api.test.ts create mode 100644 sdk/node/tests/e2e/ws/spot/public.test.ts diff --git a/sdk/node/package-lock.json b/sdk/node/package-lock.json index a763a3ee..d5cf977c 100644 --- a/sdk/node/package-lock.json +++ b/sdk/node/package-lock.json @@ -1029,6 +1029,15 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "@types/ws": { + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -2861,6 +2870,11 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "linked-list-typescript": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/linked-list-typescript/-/linked-list-typescript-1.0.15.tgz", + "integrity": "sha512-RIyUu9lnJIyIaMe63O7/aFv/T2v3KsMFuXMBbUQCHX+cgtGro86ETDj5ed0a8gQL2+DFjzYYsgVG4I36/cUwgw==" + }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -3270,6 +3284,14 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "queue-typescript": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-typescript/-/queue-typescript-1.0.1.tgz", + "integrity": "sha512-tkK08uPfmpPl0cX1WRSU3EoNb/T5zSoZPGkkpfGX4E8QayWvEmLS2cI3pFngNPkNTCU5pCDQ1IwlzN0L5gdFPg==", + "requires": { + "linked-list-typescript": "^1.0.11" + } + }, "react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", @@ -3644,11 +3666,6 @@ "punycode": "^2.1.0" } }, - "uuid": { - "version": "11.0.5", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", - "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==" - }, "v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -3711,6 +3728,11 @@ "signal-exit": "^3.0.7" } }, + "ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==" + }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/sdk/node/package.json b/sdk/node/package.json index aeafdfd2..efee6a67 100644 --- a/sdk/node/package.json +++ b/sdk/node/package.json @@ -30,7 +30,6 @@ "devDependencies": { "@types/jest": "^29.5.14", "@types/node": "^22.10.5", - "@types/uuid": "^9.0.8", "@types/ws": "^8.5.13", "@typescript-eslint/eslint-plugin": "^8.19.0", "@typescript-eslint/parser": "^8.19.0", @@ -54,7 +53,6 @@ "class-transformer": "^0.5.1", "queue-typescript": "^1.0.1", "reflect-metadata": "^0.2.2", - "uuid": "^11.0.5", "ws": "^8.18.0" } } diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index b8307dee..278d254e 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -11,8 +11,8 @@ import { WebSocketClientOption, WebSocketEvent } from '../../model/websocket_opt import { SubInfo } from '@internal/util/sub'; import { WsMessage } from '@model/common'; import { MessageType } from '@model/constant'; +import { randomUUID } from 'crypto'; -import { v4 as uuidv4 } from 'uuid'; /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. @@ -266,7 +266,7 @@ export class DefaultWsService implements WebSocketService { const subEvent = new WsMessage(); - subEvent.id = uuidv4().toString(); + subEvent.id = randomUUID().toString(); subEvent.type = MessageType.UnsubscribeMessage; subEvent.topic = subInfo.subTopic(); subEvent.privateChannel = this.privateChannel; diff --git a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts new file mode 100644 index 00000000..90c42b85 --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts @@ -0,0 +1,332 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AccountAPI, + GetCrossMarginAccountReq, + GetFuturesAccountReq, + GetFuturesLedgerReq, + GetIsolatedMarginAccountDetailV1Req, + GetIsolatedMarginAccountListV1Req, + GetIsolatedMarginAccountReq, + GetMarginHFLedgerReq, + GetSpotAccountDetailReq, + GetSpotAccountListReq, + GetSpotHFLedgerReq, + GetSpotLedgerReq, +} from '@src/generate/account/account'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: AccountAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getAccountApi(); + }); + test('getAccountInfo request test', () => { + /** + * getAccountInfo + * Get Account Summary Info + * /api/v2/user-info + */ + let resp = api.getAccountInfo(); + return resp.then((result) => { + expect(result.level).toEqual(expect.anything()); + expect(result.subQuantity).toEqual(expect.anything()); + expect(result.spotSubQuantity).toEqual(expect.anything()); + expect(result.marginSubQuantity).toEqual(expect.anything()); + expect(result.futuresSubQuantity).toEqual(expect.anything()); + expect(result.optionSubQuantity).toEqual(expect.anything()); + expect(result.maxSubQuantity).toEqual(expect.anything()); + expect(result.maxDefaultSubQuantity).toEqual(expect.anything()); + expect(result.maxSpotSubQuantity).toEqual(expect.anything()); + expect(result.maxMarginSubQuantity).toEqual(expect.anything()); + expect(result.maxFuturesSubQuantity).toEqual(expect.anything()); + expect(result.maxOptionSubQuantity).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getApikeyInfo request test', () => { + /** + * getApikeyInfo + * Get Apikey Info + * /api/v1/user/api-key + */ + let resp = api.getApikeyInfo(); + return resp.then((result) => { + expect(result.remark).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.isMaster).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotAccountType request test', () => { + /** + * getSpotAccountType + * Get Account Type - Spot + * /api/v1/hf/accounts/opened + */ + let resp = api.getSpotAccountType(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotAccountList request test', () => { + /** + * getSpotAccountList + * Get Account List - Spot + * /api/v1/accounts + */ + let builder = GetSpotAccountListReq.builder(); + builder.setType(GetSpotAccountListReq.TypeEnum.MAIN); + let req = builder.build(); + let resp = api.getSpotAccountList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotAccountDetail request test', () => { + /** + * getSpotAccountDetail + * Get Account Detail - Spot + * /api/v1/accounts/{accountId} + */ + let builder = GetSpotAccountDetailReq.builder(); + builder.setAccountId('671badb050647f0007d94011'); + let req = builder.build(); + let resp = api.getSpotAccountDetail(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.balance).toEqual(expect.anything()); + expect(result.available).toEqual(expect.anything()); + expect(result.holds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getCrossMarginAccount request test', () => { + /** + * getCrossMarginAccount + * Get Account - Cross Margin + * /api/v3/margin/accounts + */ + let builder = GetCrossMarginAccountReq.builder(); + builder.setQuoteCurrency(GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT).setQueryType(GetCrossMarginAccountReq.QueryTypeEnum.MARGIN); + let req = builder.build(); + let resp = api.getCrossMarginAccount(req); + return resp.then(result => { + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getIsolatedMarginAccount request test', () => { + /** + * getIsolatedMarginAccount + * Get Account - Isolated Margin + * /api/v3/isolated/accounts + */ + let builder = GetIsolatedMarginAccountReq.builder(); + builder.setSymbol('BTC-USDT').setQuoteCurrency(GetIsolatedMarginAccountReq.QuoteCurrencyEnum.USDT).setQueryType(GetIsolatedMarginAccountReq.QueryTypeEnum.ISOLATED); + let req = builder.build(); + let resp = api.getIsolatedMarginAccount(req); + return resp.then(result => { + expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); + expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); + expect(result.timestamp).toEqual(expect.anything()); + expect(result.assets).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFuturesAccount request test', () => { + /** + * getFuturesAccount + * Get Account - Futures + * /api/v1/account-overview + */ + let builder = GetFuturesAccountReq.builder(); + builder.setCurrency('XBT'); + let req = builder.build(); + let resp = api.getFuturesAccount(req); + return resp.then(result => { + expect(result.accountEquity).toEqual(expect.anything()); + expect(result.unrealisedPNL).toEqual(expect.anything()); + expect(result.marginBalance).toEqual(expect.anything()); + expect(result.positionMargin).toEqual(expect.anything()); + expect(result.orderMargin).toEqual(expect.anything()); + expect(result.frozenFunds).toEqual(expect.anything()); + expect(result.availableBalance).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.riskRatio).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotLedger request test', () => { + /** + * getSpotLedger + * Get Account Ledgers - Spot/Margin + * /api/v1/accounts/ledgers + */ + let builder = GetSpotLedgerReq.builder(); + builder.setCurrency('USDT').setStartAt(1732032000000).setEndAt(1732118400000).setCurrentPage(1).setPageSize(100); + let req = builder.build(); + let resp = api.getSpotLedger(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotHFLedger request test', () => { + /** + * getSpotHFLedger + * Get Account Ledgers - Trade_hf + * /api/v1/hf/accounts/ledgers + */ + let builder = GetSpotHFLedgerReq.builder(); + builder.setCurrency('USDT').setDirection(GetSpotHFLedgerReq.DirectionEnum.OUT).setBizType(GetSpotHFLedgerReq.BizTypeEnum.TRANSFER) + let req = builder.build(); + let resp = api.getSpotHFLedger(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMarginHFLedger request test', () => { + /** + * getMarginHFLedger + * Get Account Ledgers - Margin_hf + * /api/v3/hf/margin/account/ledgers + */ + let builder = GetMarginHFLedgerReq.builder(); + builder.setCurrency('USDT') + let req = builder.build(); + let resp = api.getMarginHFLedger(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFuturesLedger request test', () => { + /** + * getFuturesLedger + * Get Account Ledgers - Futures + * /api/v1/transaction-history + */ + let builder = GetFuturesLedgerReq.builder(); + builder.setCurrency('DOT').setType('RealisedPNL') + let req = builder.build(); + let resp = api.getFuturesLedger(req); + return resp.then(result => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMarginAccountDetail request test', () => { + /** + * getMarginAccountDetail + * Get Account Detail - Margin + * /api/v1/margin/account + */ + let resp = api.getMarginAccountDetail(); + return resp.then(result => { + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getIsolatedMarginAccountListV1 request test', () => { + /** + * getIsolatedMarginAccountListV1 + * Get Account List - Isolated Margin - V1 + * /api/v1/isolated/accounts + */ + let builder = GetIsolatedMarginAccountListV1Req.builder(); + builder.setBalanceCurrency(GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC); + let req = builder.build(); + let resp = api.getIsolatedMarginAccountListV1(req); + return resp.then(result => { + expect(result.totalConversionBalance).toEqual(expect.anything()); + expect(result.liabilityConversionBalance).toEqual(expect.anything()); + expect(result.assets).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getIsolatedMarginAccountDetailV1 request test', () => { + /** + * getIsolatedMarginAccountDetailV1 + * Get Account Detail - Isolated Margin - V1 + * /api/v1/isolated/account/{symbol} + */ + let builder = GetIsolatedMarginAccountDetailV1Req.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getIsolatedMarginAccountDetailV1(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.debtRatio).toEqual(expect.anything()); + expect(result.baseAsset).toEqual(expect.anything()); + expect(result.quoteAsset).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/ws/spot/public.test.ts b/sdk/node/tests/e2e/ws/spot/public.test.ts new file mode 100644 index 00000000..919aef38 --- /dev/null +++ b/sdk/node/tests/e2e/ws/spot/public.test.ts @@ -0,0 +1,75 @@ +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '../../../../src'; +import { AllTickersEvent, SpotPublicWS } from '@src/generate/spot/spotpublic'; + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +describe('Auto Test', () => { + let api: SpotPublicWS; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const wsService = client.wsService(); + api = wsService.newSpotPublicWS(); + api.start(); + }); + + afterAll(() => { + api.stop(); + }); + + test('getAccountInfo request test', () => { + let subid = api.allTickers((topic: string, subject: string, data: AllTickersEvent) => { + expect(data.bestAsk).toEqual(expect.anything()); + expect(data.bestAskSize).toEqual(expect.anything()); + expect(data.bestBid).toEqual(expect.anything()); + expect(data.bestBidSize).toEqual(expect.anything()); + expect(data.price).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.size).toEqual(expect.anything()); + expect(data.time).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(1000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); +}); From df8ecca3a146bc94929fe402deb19e792e41b85c Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 17 Jan 2025 17:20:18 +0800 Subject: [PATCH 040/106] feat(nodejs): add ws tests --- .../src/internal/rest/default_rest_impl.ts | 9 ++++++-- sdk/node/src/model/websocket_option.ts | 2 +- sdk/node/tests/e2e/ws/spot/public.test.ts | 22 ++++++++----------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sdk/node/src/internal/rest/default_rest_impl.ts b/sdk/node/src/internal/rest/default_rest_impl.ts index 8c8e9489..14a229d5 100644 --- a/sdk/node/src/internal/rest/default_rest_impl.ts +++ b/sdk/node/src/internal/rest/default_rest_impl.ts @@ -10,6 +10,7 @@ import { VIPLendingService, VIPLendingServiceImpl } from '@generate/service/vipl import { ClientOption } from '@model/client_option'; import { SdkVersion } from '@generate/version'; import { DefaultTransport } from '@internal/infra/default_transport'; +import { DEFAULT_TRANSPORT_OPTION } from '@src/model'; export class DefaultKucoinRestAPIImpl implements KucoinRestService { private readonly accountService: AccountService; @@ -22,8 +23,12 @@ export class DefaultKucoinRestAPIImpl implements KucoinRestService { private readonly vipLendingService: VIPLendingService; constructor(options: ClientOption) { - if (!options || !options.transportOption) { - throw new Error('No transport option provided'); + if (!options) { + throw new Error('No option provided'); + } + + if (!options.transportOption) { + options.transportOption = DEFAULT_TRANSPORT_OPTION; } console.info(`SDK version: ${SdkVersion}`); diff --git a/sdk/node/src/model/websocket_option.ts b/sdk/node/src/model/websocket_option.ts index 313d8bca..a6f8973f 100644 --- a/sdk/node/src/model/websocket_option.ts +++ b/sdk/node/src/model/websocket_option.ts @@ -67,7 +67,7 @@ export interface WebSocketClientOption { /** * Default values for WebSocketClientOption */ -const DEFAULT_WEBSOCKET_CLIENT_OPTION: WebSocketClientOption = { +export const DEFAULT_WEBSOCKET_CLIENT_OPTION: WebSocketClientOption = { reconnect: true, reconnectAttempts: -1, reconnectInterval: 5000, // 5 seconds diff --git a/sdk/node/tests/e2e/ws/spot/public.test.ts b/sdk/node/tests/e2e/ws/spot/public.test.ts index 919aef38..0dc1b42f 100644 --- a/sdk/node/tests/e2e/ws/spot/public.test.ts +++ b/sdk/node/tests/e2e/ws/spot/public.test.ts @@ -1,12 +1,12 @@ import { ClientOptionBuilder, - DefaultClient, GlobalApiEndpoint, GlobalBrokerApiEndpoint, GlobalFuturesApiEndpoint, - TransportOptionBuilder, -} from '../../../../src'; + WebSocketClientOptionBuilder, +} from '@model/index'; import { AllTickersEvent, SpotPublicWS } from '@src/generate/spot/spotpublic'; +import { DefaultClient } from '@api/index'; function delay(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); @@ -15,17 +15,13 @@ function delay(ms: number): Promise { describe('Auto Test', () => { let api: SpotPublicWS; - beforeAll(() => { + beforeAll(async () => { const key = process.env.API_KEY || ''; const secret = process.env.API_SECRET || ''; const passphrase = process.env.API_PASSPHRASE || ''; // Set specific options, others will fall back to default values - const httpTransportOption = new TransportOptionBuilder() - .setKeepAlive(true) - .setMaxConnsPerHost(10) - .setMaxIdleConns(10) - .build(); + const websocketClientOption = new WebSocketClientOptionBuilder().build(); // Create a client using the specified options const clientOption = new ClientOptionBuilder() @@ -35,7 +31,7 @@ describe('Auto Test', () => { .setSpotEndpoint(GlobalApiEndpoint) .setFuturesEndpoint(GlobalFuturesApiEndpoint) .setBrokerEndpoint(GlobalBrokerApiEndpoint) - .setTransportOption(httpTransportOption) + .setWebSocketClientOption(websocketClientOption) .build(); const client = new DefaultClient(clientOption); @@ -43,14 +39,14 @@ describe('Auto Test', () => { // Get the Restful Service const wsService = client.wsService(); api = wsService.newSpotPublicWS(); - api.start(); + await api.start(); }); afterAll(() => { api.stop(); }); - test('getAccountInfo request test', () => { + test('allTickers test', () => { let subid = api.allTickers((topic: string, subject: string, data: AllTickersEvent) => { expect(data.bestAsk).toEqual(expect.anything()); expect(data.bestAskSize).toEqual(expect.anything()); @@ -65,7 +61,7 @@ describe('Auto Test', () => { return subid .then(async (id) => { - await delay(1000); + await delay(5000); return id; }) .then((id) => { From 39f2412c9ef1a38859b6f6cffa82434fa9ecf36a Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 17 Jan 2025 19:02:41 +0800 Subject: [PATCH 041/106] fix: modify some todolist --- .../src/internal/infra/default_transport.ts | 48 ++++++++++++------- .../src/internal/infra/default_ws_client.ts | 1 - 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 833b0db6..b1f6f006 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -198,19 +198,23 @@ export class DefaultTransport implements Transport { let reqBody = ''; let queryPath = path; - // TODO wrong logic - if (requestAsJson && requestObj) { - reqBody = JSON.stringify(requestObj); - } else if (method === 'GET' || method === 'DELETE') { - const queryParams = this.rawQuery(requestObj || {}); - if (queryParams) { - queryPath = `${path}?${queryParams}`; + if (requestAsJson) { + if (requestObj){ + reqBody = JSON.stringify(requestObj); + } + }else{ + if (method === 'GET' || method === 'DELETE') { + const queryParams = this.rawQuery(requestObj || {}); + if (queryParams) { + queryPath = `${path}?${queryParams}`; + } + } else if (method == "POST") { + if (requestObj){ + reqBody = JSON.stringify(requestObj); + } + }else{ + throw new Error(`Invalid method: ${method}`); } - } else if (requestObj) { - reqBody = JSON.stringify(requestObj); - } else if (method === 'POST') { - // For POST requests, if no request body is provided, use an empty object - reqBody = '{}'; } const config: AxiosRequestConfig = { @@ -246,11 +250,6 @@ export class DefaultTransport implements Transport { reset, }; - // todo delete - if (remaining <= Math.ceil(limit * 0.1)) { - console.warn('[RATE LIMIT WARNING]', rateLimit); - } - return rateLimit; } @@ -336,7 +335,20 @@ export class DefaultTransport implements Transport { } close(): Promise { - // TODO release resource + // Cancel any pending requests + if (this.httpClient) { + // Clear any persistent connections + if (this.httpClient.defaults.httpAgent) { + this.httpClient.defaults.httpAgent.destroy(); + } + if (this.httpClient.defaults.httpsAgent) { + this.httpClient.defaults.httpsAgent.destroy(); + } + + // Remove reference to the client + (this.httpClient as any) = null; + } + return Promise.resolve(undefined); } } diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 8f5d6f6c..bc66a2b7 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -533,7 +533,6 @@ export class WebSocketClient { }); } - // TODO: private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { try { if (this.options.eventCallback) { From 64d873fe4c048fc7c36a7446e821cd236fda890f Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Sun, 19 Jan 2025 17:33:59 +0800 Subject: [PATCH 042/106] fix(nodejs):fix remove query items --- .../src/internal/infra/default_transport.ts | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index b1f6f006..e7450379 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -188,6 +188,7 @@ export class DefaultTransport implements Transport { requestObj: Serializable | null, broker: boolean, path: string, + rawpath: string, endpoint: string, method: string, requestAsJson: boolean, @@ -204,11 +205,24 @@ export class DefaultTransport implements Transport { } }else{ if (method === 'GET' || method === 'DELETE') { - const queryParams = this.rawQuery(requestObj || {}); - if (queryParams) { - queryPath = `${path}?${queryParams}`; + if (requestObj) { + // create a new object for query parameters + const queryObj = { ...requestObj }; + + // check path variables and remove from query + const pathVarPattern = /{([^}]+)}/g; + let match; + while ((match = pathVarPattern.exec(rawpath)) !== null) { + const pathVarName = match[1]; + delete queryObj[pathVarName]; + } + + const queryParams = this.rawQuery(queryObj); + if (queryParams) { + queryPath = `${path}?${queryParams}`; + } } - } else if (method == "POST") { + } else if (method === "POST") { if (requestObj){ reqBody = JSON.stringify(requestObj); } @@ -295,6 +309,7 @@ export class DefaultTransport implements Transport { requestObj, isBroker, processedPath, + path, endpoint, method, requestJson, From f505c3f687cd2c508e887b01d40eb34af2cf9157 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 20 Jan 2025 10:49:37 +0800 Subject: [PATCH 043/106] feat(nodejs): add test & copy trading --- sdk/node/src/api/api_rest.ts | 6 + .../src/internal/rest/default_rest_impl.ts | 7 + .../rest/account_test/account_deposit.test.ts | 185 +++++++++++ .../e2e/rest/account_test/account_fee.test.ts | 95 ++++++ .../account_test/account_subaccount.test.ts | 302 ++++++++++++++++++ .../account_test/account_transfer.test.ts | 190 +++++++++++ .../account_test/account_withdraw.test.ts | 171 ++++++++++ 7 files changed, 956 insertions(+) create mode 100644 sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts create mode 100644 sdk/node/tests/e2e/rest/account_test/account_fee.test.ts create mode 100644 sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts create mode 100644 sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts create mode 100644 sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts diff --git a/sdk/node/src/api/api_rest.ts b/sdk/node/src/api/api_rest.ts index 995413d9..b8f733ca 100644 --- a/sdk/node/src/api/api_rest.ts +++ b/sdk/node/src/api/api_rest.ts @@ -6,6 +6,7 @@ import { FuturesService } from '@generate/service/futures_api'; import { MarginService } from '@generate/service/margin_api'; import { SpotService } from '@generate/service/spot_api'; import { VIPLendingService } from '@generate/service/viplending_api'; +import { CopyTradingService } from '@src/generate'; export interface KucoinRestService { /** @@ -23,6 +24,11 @@ export interface KucoinRestService { */ getBrokerService(): BrokerService; + /** + * CopyTradingService provides functions to access and manage copy trading-related data + */ + getCopyTradingService(): CopyTradingService; + /** * EarnService provides functions to access and manage earn-related data. */ diff --git a/sdk/node/src/internal/rest/default_rest_impl.ts b/sdk/node/src/internal/rest/default_rest_impl.ts index 14a229d5..e5ad445b 100644 --- a/sdk/node/src/internal/rest/default_rest_impl.ts +++ b/sdk/node/src/internal/rest/default_rest_impl.ts @@ -11,11 +11,13 @@ import { ClientOption } from '@model/client_option'; import { SdkVersion } from '@generate/version'; import { DefaultTransport } from '@internal/infra/default_transport'; import { DEFAULT_TRANSPORT_OPTION } from '@src/model'; +import { CopyTradingService, CopyTradingServiceImpl } from '@src/generate'; export class DefaultKucoinRestAPIImpl implements KucoinRestService { private readonly accountService: AccountService; private readonly affiliateService: AffiliateService; private readonly brokerService: BrokerService; + private readonly copyTradingService: CopyTradingService; private readonly earnService: EarnService; private readonly futuresService: FuturesService; private readonly marginService: MarginService; @@ -38,6 +40,7 @@ export class DefaultKucoinRestAPIImpl implements KucoinRestService { this.accountService = new AccountServiceImpl(transport); this.affiliateService = new AffiliateServiceImpl(transport); this.brokerService = new BrokerServiceImpl(transport); + this.copyTradingService = new CopyTradingServiceImpl(transport); this.earnService = new EarnServiceImpl(transport); this.futuresService = new FuturesServiceImpl(transport); this.marginService = new MarginServiceImpl(transport); @@ -57,6 +60,10 @@ export class DefaultKucoinRestAPIImpl implements KucoinRestService { return this.brokerService; } + getCopyTradingService(): CopyTradingService { + return this.copyTradingService; + } + getEarnService(): EarnService { return this.earnService; } diff --git a/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts new file mode 100644 index 00000000..8afc7cc4 --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts @@ -0,0 +1,185 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddDepositAddressV1Req, + AddDepositAddressV3Req, + DepositAPI, GetDepositAddressV1Req, GetDepositAddressV2Req, + GetDepositAddressV3Req, GetDepositHistoryOldReq, + GetDepositHistoryReq, +} from '@src/generate/account/deposit'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: DepositAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getDepositApi(); + }); + test('addDepositAddressV3 request test', () => { + /** + * addDepositAddressV3 + * Add Deposit Address(V3) + * /api/v3/deposit-address/create + */ + let builder = AddDepositAddressV3Req.builder(); + builder.setCurrency('USDT').setChain('ton').setTo(AddDepositAddressV3Req.ToEnum.MAIN).setAmount('1'); + let req = builder.build(); + let resp = api.addDepositAddressV3(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.expirationDate).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.chainName).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositAddressV3 request test', () => { + /** + * getDepositAddressV3 + * Get Deposit Address(V3) + * /api/v3/deposit-addresses + */ + let builder = GetDepositAddressV3Req.builder(); + builder.setCurrency('ETH').setAmount('10').setChain('eth'); + let req = builder.build(); + let resp = api.getDepositAddressV3(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositHistory request test', () => { + /** + * getDepositHistory + * Get Deposit History + * /api/v1/deposits + */ + let builder = GetDepositHistoryReq.builder(); + builder.setCurrency('USDT').setStartAt(1673496371000).setEndAt(1705032371000) + let req = builder.build(); + let resp = api.getDepositHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositAddressV2 request test', () => { + /** + * getDepositAddressV2 + * Get Deposit Addresses(V2) + * /api/v2/deposit-addresses + */ + let builder = GetDepositAddressV2Req.builder(); + builder.setCurrency('USDT'); + let req = builder.build(); + let resp = api.getDepositAddressV2(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositAddressV1 request test', () => { + /** + * getDepositAddressV1 + * Get Deposit Addresses - V1 + * /api/v1/deposit-addresses + */ + let builder = GetDepositAddressV1Req.builder(); + builder.setCurrency('USDT').setChain('eth'); + let req = builder.build(); + let resp = api.getDepositAddressV1(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.contractAddress).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositHistoryOld request test', () => { + /** + * getDepositHistoryOld + * Get Deposit History - Old + * /api/v1/hist-deposits + */ + let builder = GetDepositHistoryOldReq.builder(); + builder.setStartAt(1714492800000).setEndAt(1732982400000); + let req = builder.build(); + let resp = api.getDepositHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addDepositAddressV1 request test', () => { + /** + * addDepositAddressV1 + * Add Deposit Address - V1 + * /api/v1/deposit-addresses + */ + let builder = AddDepositAddressV1Req.builder(); + builder.setCurrency('ETH').setChain('eth'); + let req = builder.build(); + let resp = api.addDepositAddressV1(req); + return resp.then(result => { + expect(result.address).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.chainId).toEqual(expect.anything()); + expect(result.to).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts new file mode 100644 index 00000000..71c856d0 --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts @@ -0,0 +1,95 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; +import { FeeAPI, GetBasicFeeReq, GetFuturesActualFeeReq, GetSpotActualFeeReq } from '@src/generate/account/fee'; + + +describe('Auto Test', () => { + let api: FeeAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getFeeApi(); + }); + test('getBasicFee request test', () => { + /** + * getBasicFee + * Get Basic Fee - Spot/Margin + * /api/v1/base-fee + */ + let builder = GetBasicFeeReq.builder(); + builder.setCurrencyType(GetBasicFeeReq.CurrencyTypeEnum._0); + let req = builder.build(); + let resp = api.getBasicFee(req); + return resp.then(result => { + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotActualFee request test', () => { + /** + * getSpotActualFee + * Get Actual Fee - Spot/Margin + * /api/v1/trade-fees + */ + let builder = GetSpotActualFeeReq.builder(); + builder.setSymbols('BTC-USDT'); + let req = builder.build(); + let resp = api.getSpotActualFee(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFuturesActualFee request test', () => { + /** + * getFuturesActualFee + * Get Actual Fee - Futures + * /api/v1/trade-fees + */ + let builder = GetFuturesActualFeeReq.builder(); + builder.setSymbol('XBTUSDM'); + let req = builder.build(); + let resp = api.getFuturesActualFee(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + console.log(resp); + }); + }); + +}); \ No newline at end of file diff --git a/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts new file mode 100644 index 00000000..7e0c7a2d --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts @@ -0,0 +1,302 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; +import { + AddSubAccountApiReq, + AddSubAccountFuturesPermissionReq, + AddSubAccountMarginPermissionReq, + AddSubAccountReq, + DeleteSubAccountApiReq, + GetFuturesSubAccountListV2Req, + GetSpotSubAccountDetailReq, + GetSpotSubAccountListV2Req, + GetSpotSubAccountsSummaryV2Req, + GetSubAccountApiListReq, + ModifySubAccountApiReq, + SubAccountAPI, +} from '@src/generate/account/subaccount'; + +describe('Auto Test', () => { + let api: SubAccountAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getSubAccountApi(); + }); + + test('addSubAccount request test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v2/sub/user/created + */ + let builder = AddSubAccountReq.builder(); + builder + .setPassword('**********@123') + .setRemarks('**********@123') + .setSubName('sdkTestIntegration2') + .setAccess(AddSubAccountReq.AccessEnum.SPOT); + let req = builder.build(); + let resp = api.addSubAccount(req); + return resp.then((result) => { + expect(result.uid).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + expect(result.remarks).toEqual(expect.anything()); + expect(result.access).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addSubAccountMarginPermission request test', () => { + /** + * addSubAccountMarginPermission + * Add SubAccount Margin Permission + * /api/v3/sub/user/margin/enable + */ + let builder = AddSubAccountMarginPermissionReq.builder(); + builder.setUid('229290616'); + let req = builder.build(); + let resp = api.addSubAccountMarginPermission(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addSubAccountFuturesPermission request test', () => { + /** + * addSubAccountFuturesPermission + * Add SubAccount Futures Permission + * /api/v3/sub/user/futures/enable + */ + let builder = AddSubAccountFuturesPermissionReq.builder(); + builder.setUid('229290616'); + let req = builder.build(); + let resp = api.addSubAccountFuturesPermission(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotSubAccountsSummaryV2 request test', () => { + /** + * getSpotSubAccountsSummaryV2 + * Get SubAccount List - Summary Info + * /api/v2/sub/user + */ + let builder = GetSpotSubAccountsSummaryV2Req.builder(); + builder.setCurrentPage(1).setPageSize(10); + let req = builder.build(); + let resp = api.getSpotSubAccountsSummaryV2(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotSubAccountDetail request test', () => { + /** + * getSpotSubAccountDetail + * Get SubAccount Detail - Balance + * /api/v1/sub-accounts/{subUserId} + */ + let builder = GetSpotSubAccountDetailReq.builder(); + builder.setSubUserId('6744227ce235b300012232d6').setIncludeBaseAmount(false); + let req = builder.build(); + let resp = api.getSpotSubAccountDetail(req); + return resp.then((result) => { + expect(result.subUserId).toEqual(expect.anything()); + expect(result.subName).toEqual(expect.anything()); + expect(result.mainAccounts).toEqual(expect.anything()); + expect(result.tradeAccounts).toEqual(expect.anything()); + expect(result.marginAccounts).toEqual(expect.anything()); + expect(result.tradeHFAccounts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotSubAccountListV2 request test', () => { + /** + * getSpotSubAccountListV2 + * Get SubAccount List - Spot Balance(V2) + * /api/v2/sub-accounts + */ + let builder = GetSpotSubAccountListV2Req.builder(); + builder.setCurrentPage(1).setPageSize(10); + let req = builder.build(); + let resp = api.getSpotSubAccountListV2(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFuturesSubAccountListV2 request test', () => { + /** + * getFuturesSubAccountListV2 + * Get SubAccount List - Futures Balance(V2) + * /api/v1/account-overview-all + */ + let builder = GetFuturesSubAccountListV2Req.builder(); + builder.setCurrency('XBT'); + let req = builder.build(); + let resp = api.getFuturesSubAccountListV2(req); + return resp.then((result) => { + expect(result.summary).toEqual(expect.anything()); + expect(result.accounts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addSubAccountApi request test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/sub/api-key + */ + let builder = AddSubAccountApiReq.builder(); + builder + .setPassphrase('*****') + .setRemark('**********') + .setPermission('General,Spot') + .setExpire(AddSubAccountApiReq.ExpireEnum._30) + .setSubName('**********'); + let req = builder.build(); + let resp = api.addSubAccountApi(req); + return resp.then((result) => { + expect(result.subName).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiSecret).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.passphrase).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifySubAccountApi request test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/sub/api-key/update + */ + let builder = ModifySubAccountApiReq.builder(); + builder + .setPassphrase('**********') + .setPermission('**********') + .setIpWhitelist('General') + .setExpire(ModifySubAccountApiReq.ExpireEnum._30) + .setSubName('**********') + .setApiKey('6745b6ba87eb0e000107ea6c'); + let req = builder.build(); + let resp = api.modifySubAccountApi(req); + return resp.then((result) => { + expect(result.subName).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.permission).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSubAccountApiList request test', () => { + /** + * getSubAccountApiList + * Get SubAccount API List + * /api/v1/sub/api-key + */ + let builder = GetSubAccountApiListReq.builder(); + builder.setApiKey('6745b6ba87eb0e000107ea6c').setSubName('****'); + let req = builder.build(); + let resp = api.getSubAccountApiList(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('deleteSubAccountApi request test', () => { + /** + * deleteSubAccountApi + * Delete SubAccount API + * /api/v1/sub/api-key + */ + let builder = DeleteSubAccountApiReq.builder(); + builder.setApiKey('').setSubName('').setPassphrase(''); + let req = builder.build(); + let resp = api.deleteSubAccountApi(req); + return resp.then((result) => { + expect(result.subName).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotSubAccountsSummaryV1 request test', () => { + /** + * getSpotSubAccountsSummaryV1 + * Get SubAccount List - Summary Info(V1) + * /api/v1/sub/user + */ + let resp = api.getSpotSubAccountsSummaryV1(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotSubAccountListV1 request test', () => { + /** + * getSpotSubAccountListV1 + * Get SubAccount List - Spot Balance(V1) + * /api/v1/sub-accounts + */ + let resp = api.getSpotSubAccountListV1(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts new file mode 100644 index 00000000..b7f6ca2d --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts @@ -0,0 +1,190 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; +import { + FlexTransferReq, + FuturesAccountTransferInReq, + FuturesAccountTransferOutReq, + GetFuturesAccountTransferOutLedgerReq, + GetTransferQuotasReq, + InnerTransferReq, + SubAccountTransferReq, + TransferAPI, +} from '@src/generate/account/transfer'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: TransferAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getTransferApi(); + }); + + test('getTransferQuotas request test', () => { + /** + * getTransferQuotas + * Get Transfer Quotas + * /api/v1/accounts/transferable + */ + let builder = GetTransferQuotasReq.builder(); + builder.setCurrency('').setType(GetTransferQuotasReq.TypeEnum.MAIN).setTag(''); + let req = builder.build(); + let resp = api.getTransferQuotas(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.balance).toEqual(expect.anything()); + expect(result.available).toEqual(expect.anything()); + expect(result.holds).toEqual(expect.anything()); + expect(result.transferable).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('flexTransfer request test', () => { + /** + * flexTransfer + * Flex Transfer + * /api/v3/accounts/universal-transfer + */ + let builder = FlexTransferReq.builder(); + builder.setClientOid(randomUUID().toString()).setCurrency('USDT').setAmount('1').setFromUserId('6744227ce235b300012232d6').setFromAccountType(FlexTransferReq.FromAccountTypeEnum.MAIN).setType(FlexTransferReq.TypeEnum.INTERNAL).setToUserId('6744227ce235b300012232d6').setToAccountType(FlexTransferReq.ToAccountTypeEnum.TRADE); + let req = builder.build(); + let resp = api.flexTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('subAccountTransfer request test', () => { + /** + * subAccountTransfer + * SubAccount Transfer + * /api/v2/accounts/sub-transfer + */ + let builder = SubAccountTransferReq.builder(); + // builder.setClientOid(?).setCurrency(?).setAmount(?).setDirection(?).setAccountType(?).setSubAccountType(?).setSubUserId(?); + let req = builder.build(); + let resp = api.subAccountTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('innerTransfer request test', () => { + /** + * innerTransfer + * Inner Transfer + * /api/v2/accounts/inner-transfer + */ + let builder = InnerTransferReq.builder(); + // builder.setClientOid(?).setCurrency(?).setAmount(?).setTo(?).setFromTag(?).setToTag(?).setFrom(?); + let req = builder.build(); + let resp = api.innerTransfer(req); + return resp.then(result => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('futuresAccountTransferOut request test', () => { + /** + * futuresAccountTransferOut + * Futures Account Transfer Out + * /api/v3/transfer-out + */ + let builder = FuturesAccountTransferOutReq.builder(); + // builder.setCurrency(?).setAmount(?).setRecAccountType(?); + let req = builder.build(); + let resp = api.futuresAccountTransferOut(req); + return resp.then(result => { + expect(result.applyId).toEqual(expect.anything()); + expect(result.bizNo).toEqual(expect.anything()); + expect(result.payAccountType).toEqual(expect.anything()); + expect(result.payTag).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.recAccountType).toEqual(expect.anything()); + expect(result.recTag).toEqual(expect.anything()); + expect(result.recRemark).toEqual(expect.anything()); + expect(result.recSystem).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.sn).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('futuresAccountTransferIn request test', () => { + /** + * futuresAccountTransferIn + * Futures Account Transfer In + * /api/v1/transfer-in + */ + let builder = FuturesAccountTransferInReq.builder(); + // builder.setCurrency(?).setAmount(?).setPayAccountType(?); + let req = builder.build(); + let resp = api.futuresAccountTransferIn(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFuturesAccountTransferOutLedger request test', () => { + /** + * getFuturesAccountTransferOutLedger + * Get Futures Account Transfer Out Ledger + * /api/v1/transfer-list + */ + let builder = GetFuturesAccountTransferOutLedgerReq.builder(); + // builder.setCurrency(?).setType(?).setTag(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + let req = builder.build(); + let resp = api.getFuturesAccountTransferOutLedger(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + +}); diff --git a/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts new file mode 100644 index 00000000..f65cf97f --- /dev/null +++ b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts @@ -0,0 +1,171 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; +import { + CancelWithdrawalReq, + GetWithdrawalHistoryOldReq, + GetWithdrawalHistoryReq, + GetWithdrawalQuotasReq, + WithdrawalAPI, + WithdrawalV1Req, + WithdrawalV3Req, +} from '@src/generate/account/withdrawal'; + +describe('Auto Test', () => { + let api: WithdrawalAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getAccountService().getWithdrawalApi(); + }); + + test('getWithdrawalQuotas request test', () => { + /** + * getWithdrawalQuotas + * Get Withdrawal Quotas + * /api/v1/withdrawals/quotas + */ + let builder = GetWithdrawalQuotasReq.builder(); + builder.setCurrency('USDT').setChain('bsc'); + let req = builder.build(); + let resp = api.getWithdrawalQuotas(req); + return resp.then(result => { + expect(result.currency).toEqual(expect.anything()); + expect(result.limitBTCAmount).toEqual(expect.anything()); + expect(result.usedBTCAmount).toEqual(expect.anything()); + expect(result.quotaCurrency).toEqual(expect.anything()); + expect(result.limitQuotaCurrencyAmount).toEqual(expect.anything()); + expect(result.usedQuotaCurrencyAmount).toEqual(expect.anything()); + expect(result.remainAmount).toEqual(expect.anything()); + expect(result.availableAmount).toEqual(expect.anything()); + expect(result.withdrawMinFee).toEqual(expect.anything()); + expect(result.innerWithdrawMinFee).toEqual(expect.anything()); + expect(result.withdrawMinSize).toEqual(expect.anything()); + expect(result.isWithdrawEnabled).toEqual(expect.anything()); + expect(result.precision).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.lockedAmount).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('withdrawalV3 request test', () => { + /** + * withdrawalV3 + * Withdraw(V3) + * /api/v3/withdrawals + */ + let builder = WithdrawalV3Req.builder(); + builder.setCurrency('USDT').setChain('bsc').setAmount(20).setIsInner(false).setRemark('******').setWithdrawType(WithdrawalV3Req.WithdrawTypeEnum.ADDRESS); + let req = builder.build(); + let resp = api.withdrawalV3(req); + return resp.then(result => { + expect(result.withdrawalId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelWithdrawal request test', () => { + /** + * cancelWithdrawal + * Cancel Withdrawal + * /api/v1/withdrawals/{withdrawalId} + */ + let builder = CancelWithdrawalReq.builder(); + builder.setWithdrawalId('674fba71b6afc90007e29bd2'); + let req = builder.build(); + let resp = api.cancelWithdrawal(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getWithdrawalHistory request test', () => { + /** + * getWithdrawalHistory + * Get Withdrawal History + * /api/v1/withdrawals + */ + let builder = GetWithdrawalHistoryReq.builder(); + builder.setCurrency('USDT').setStartAt(1703001600000).setEndAt(1703260800000); + let req = builder.build(); + let resp = api.getWithdrawalHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getWithdrawalHistoryOld request test', () => { + /** + * getWithdrawalHistoryOld + * Get Withdrawal History - Old + * /api/v1/hist-withdrawals + */ + let builder = GetWithdrawalHistoryOldReq.builder(); + builder.setCurrency('USDT').setStartAt(1703001600000).setEndAt(1703260800000); + let req = builder.build(); + let resp = api.getWithdrawalHistoryOld(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('withdrawalV1 request test', () => { + /** + * withdrawalV1 + * Withdraw - V1 + * /api/v1/withdrawals + */ + let builder = WithdrawalV1Req.builder(); + builder.setCurrency('USDT').setChain('bsc').setAddress('***********').setAmount(20).setIsInner(false); + let req = builder.build(); + let resp = api.withdrawalV1(req); + return resp.then(result => { + expect(result.withdrawalId).toEqual(expect.anything()); + console.log(resp); + }); + }); + +}); From 368cced6d63abce2f79d0c1e8d7dcc139c7abf05 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 11:23:14 +0800 Subject: [PATCH 044/106] feat(nodejs):modify notifyEvent,using eventEmitter to notify --- sdk/node/src/internal/infra/default_ws_client.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index bc66a2b7..502c8bcb 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -534,13 +534,7 @@ export class WebSocketClient { } private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { - try { - if (this.options.eventCallback) { - this.options.eventCallback(event, msg); - } - } catch (e) { - console.error('Exception in notify_event:', e); - } + this.eventEmitter.emit(event, msg, msg2); } // From 905188fd59704a348b50b0d3dee28f40454d167f Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 13:02:19 +0800 Subject: [PATCH 045/106] feat(nodejs):modify notifyEvent,using eventEmitter to notify --- .../src/internal/infra/default_ws_client.ts | 14 ++++++++--- .../src/internal/infra/default_ws_service.ts | 25 ++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 502c8bcb..ab220e8f 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -61,7 +61,11 @@ export class WebSocketClient { private eventEmitter: EventEmitter; private lastPingTime: number | null; - constructor(tokenProvider: WsTokenProvider, options: WebSocketClientOption) { + constructor( + tokenProvider: WsTokenProvider, + options: WebSocketClientOption, + externalEventEmitter?: EventEmitter + ) { this.options = options; this.conn = null; this.connected = false; @@ -84,7 +88,7 @@ export class WebSocketClient { this.metric = { pingSuccess: 0, pingErr: 0 }; this.keepAliveInterval = null; this.writeInterval = null; - this.eventEmitter = new EventEmitter(); + this.eventEmitter = externalEventEmitter || new EventEmitter(); this.lastPingTime = null; } @@ -534,7 +538,11 @@ export class WebSocketClient { } private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { - this.eventEmitter.emit(event, msg, msg2); + try { + this.eventEmitter.emit('ws_event', event, msg); + } catch (err) { + console.error('Exception in notify_event:', err); + } } // diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 278d254e..211dc0f8 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -12,7 +12,7 @@ import { SubInfo } from '@internal/util/sub'; import { WsMessage } from '@model/common'; import { MessageType } from '@model/constant'; import { randomUUID } from 'crypto'; - +import { EventEmitter } from 'events'; /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. @@ -30,6 +30,7 @@ export class DefaultWsService implements WebSocketService { private stopSignal: boolean = false; private messageLoop?: NodeJS.Timeout; private recoveryLoop?: NodeJS.Timeout; + private readonly eventEmitter: EventEmitter; /** * Creates a new instance of DefaultWsService @@ -54,10 +55,27 @@ export class DefaultWsService implements WebSocketService { this.versionString = versionString; this.tokenTransport = new DefaultTransport(option, versionString); this.topicManager = new TopicManager(); + + // init EventEmitter + this.eventEmitter = new EventEmitter(); + + // if config eventCallback, register as event listener + if (this.wsOption.eventCallback) { + this.eventEmitter.on('ws_event', (event: WebSocketEvent, msg: string, msg2: string) => { + try { + this.wsOption.eventCallback!(event, msg); + } catch (err) { + console.error('Exception in eventCallback:', err); + } + }); + } + this.client = new WebSocketClient( new DefaultWsTokenProvider(this.tokenTransport, domain, privateChannel), this.wsOption, + this.eventEmitter ); + } /** @@ -68,9 +86,8 @@ export class DefaultWsService implements WebSocketService { */ private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { try { - if (this.wsOption.eventCallback) { - this.wsOption.eventCallback(event, msg); - } + // use EventEmitter send event + this.eventEmitter.emit('ws_event', event, msg, msg2); } catch (err) { console.error('Exception in notify_event:', err); } From cb2512a04bef4e8b4ae678e01a8aeb3be4642be6 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 13:45:21 +0800 Subject: [PATCH 046/106] fix(nodejs):modify timeout reconnect logic --- .../src/internal/infra/default_ws_client.ts | 61 ++++++++++++++----- .../src/internal/infra/default_ws_service.ts | 26 +++++--- 2 files changed, 65 insertions(+), 22 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index ab220e8f..f3872b9a 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -91,6 +91,7 @@ export class WebSocketClient { this.eventEmitter = externalEventEmitter || new EventEmitter(); this.lastPingTime = null; + this.reconnect(); } // # Start the WebSocket client @@ -105,7 +106,6 @@ export class WebSocketClient { this.connected = true; this.notifyEvent(WebSocketEvent.EventConnected, ''); this.run(); - this.reconnect(); }) .catch((err) => { console.error('Failed to start WebSocket client:', err); @@ -393,7 +393,12 @@ export class WebSocketClient { console.debug('[KeepAlive] Start checking...'); if (!this.tokenInfo || this.shutdown || this.closed) { - console.debug('[KeepAlive] Skip - tokenInfo/shutdown/closed check failed'); + console.debug('[KeepAlive] Skip - basic check failed'); + return; + } + + if (this.disconnected || !this.connected) { + console.debug('[KeepAlive] Skip - connection is not active'); return; } @@ -410,13 +415,15 @@ export class WebSocketClient { console.debug('[KeepAlive] Sending ping message...'); const pingMsg = this.newPingMessage(); try { - this.write(pingMsg, timeout).catch((e) => - console.error('[KeepAlive] Heartbeat ping error:', e), - ); + this.write(pingMsg, timeout).catch((e) => { + console.error('[KeepAlive] Heartbeat ping error:', e); + this.disconnected = true; + }); console.debug('[KeepAlive] Ping sent'); } catch (e) { console.error('[KeepAlive] Heartbeat ping error:', e); this.metric.pingErr++; + this.disconnected = true; } this.lastPingTime = currentTime; } else { @@ -424,12 +431,17 @@ export class WebSocketClient { } } - private reconnect(): void { + private async reconnect(): void { const reconnectLoop = async () => { while (!this.reconnectClosed) { if (this.disconnected && !this.shutdown) { console.log('Broken WebSocket connection, starting reconnection'); - await this.close(); + try { + await this.close(); + } catch (err) { + console.error('Error closing connection:', err); + } + this.notifyEvent(WebSocketEvent.EventTryReconnect, ''); this.disconnected = false; @@ -443,27 +455,29 @@ export class WebSocketClient { attempt < this.options.reconnectAttempts) ) { console.log( - `Reconnecting in ${this.options.reconnectInterval} seconds... (attempt ${attempt})`, + `Reconnecting in ${this.options.reconnectInterval/1000} seconds... (attempt ${attempt + 1}/${this.options.reconnectAttempts})`, ); await new Promise((resolve) => - setTimeout(resolve, this.options.reconnectInterval * 1000), + setTimeout(resolve, this.options.reconnectInterval), ); try { await this.dial(); this.notifyEvent(WebSocketEvent.EventConnected, ''); this.connected = true; + this.closed = false; this.run(); reconnected = true; this.reconnected = true; + console.log('Successfully reconnected to WebSocket server'); } catch (err) { - console.error(`Reconnect attempt ${attempt} failed:`, err); + console.error(`Reconnect attempt ${attempt + 1} failed:`, err); attempt++; } } if (!reconnected) { - this.notifyEvent(WebSocketEvent.EventClientFail, ''); + this.notifyEvent(WebSocketEvent.EventClientFail, 'Failed to reconnect after all attempts'); console.error('Failed to reconnect after all attempts.'); } } @@ -472,7 +486,8 @@ export class WebSocketClient { }; reconnectLoop().catch((err) => { - console.error('Error in reconnect loop:', err); + console.error('Critical error in reconnect loop:', err); + this.notifyEvent(WebSocketEvent.EventClientFail, `Critical error: ${err.message}`); }); } @@ -518,16 +533,34 @@ export class WebSocketClient { // Close WebSocket connection if (this.conn) { + const closeTimeout = setTimeout(() => { + console.log('WebSocket close timeout, forcing close'); + this.conn = null; + this.connected = false; + this.closed = true; + resolve(); + }, 3000); + // Listen for close event before closing this.conn.once('close', () => { + clearTimeout(closeTimeout); this.conn = null; this.connected = false; this.closed = true; resolve(); }); - // Close the connection - this.conn.close(); + try { + // Close the connection + this.conn.close(); + } catch (err) { + console.error('Error during WebSocket close:', err); + clearTimeout(closeTimeout); + this.conn = null; + this.connected = false; + this.closed = true; + resolve(); + } } else { // If no connection exists, resolve immediately this.connected = false; diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 211dc0f8..dd761047 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -182,15 +182,25 @@ export class DefaultWsService implements WebSocketService { const oldTopicManager = this.topicManager; this.topicManager = new TopicManager(); - // Create an array of promises for all resubscribe operations - const resubscribePromises: Promise[] = []; - oldTopicManager.range((key, value) => { - resubscribePromises.push(this.resubscribe(value)); - return true; - }); + try { + const resubscribePromises: Promise[] = []; + oldTopicManager.range((key, value) => { + if (!value.isEmpty()) { + resubscribePromises.push(this.resubscribe(value)); + } + return true; + }); - // Wait for all resubscribe operations to complete - await Promise.all(resubscribePromises); + await Promise.all(resubscribePromises); + console.log('All topics resubscribed successfully'); + } catch (err) { + console.error('Error during resubscribe:', err); + this.notifyEvent( + WebSocketEvent.EventReSubscribeError, + `Failed to resubscribe: ${err}`, + ); + this.topicManager = oldTopicManager; + } this.client.clearReconnectedFlag(); } From 212d156cc24494a3e6c14890e60e4a5ada2dc7d6 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 14:14:09 +0800 Subject: [PATCH 047/106] =?UTF-8?q?feat(nodejs)=EF=BC=9Aupdate=20restful?= =?UTF-8?q?=20transport=20impl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/infra/default_transport.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index e7450379..47d9a9d9 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -40,26 +40,26 @@ export class DefaultTransport implements Transport { private createHttpClient(trans_option: TransportOption): AxiosInstance { const instance = axios.create({ - timeout: trans_option.timeout, + timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, headers: { Connection: trans_option.keepAlive ? 'keep-alive' : 'close', }, httpAgent: trans_option.keepAlive ? new HttpAgent({ - maxSockets: trans_option.maxConnsPerHost || 100, - maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, - timeout: trans_option.timeout || 60000, + maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, keepAlive: true, - keepAliveMsecs: trans_option.idleConnTimeout || 30000, + keepAliveMsecs: trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, }) : undefined, httpsAgent: trans_option.keepAlive ? new HttpsAgent({ - maxSockets: trans_option.maxConnsPerHost || 100, - maxFreeSockets: trans_option.maxIdleConnsPerHost || 10, - timeout: trans_option.timeout || 60000, + maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, keepAlive: true, - keepAliveMsecs: trans_option.idleConnTimeout || 30000, + keepAliveMsecs: trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, }) : undefined, } as CreateAxiosDefaults); From 4bb53f45af36ed8632861fc08a33bc001c3096cd Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 20 Jan 2025 16:47:26 +0800 Subject: [PATCH 048/106] feat(nodejs): update var as requried --- .../plugin/generator/NodeSdkGenerator.java | 2 +- .../src/main/resources/node-sdk/api.mustache | 2 +- .../main/resources/node-sdk/model.mustache | 81 +- .../main/resources/node-sdk/model_ws.mustache | 34 +- .../sdk/plugin/SdkGeneratorTest.java | 4 +- .../generate/account/account/api_account.ts | 30 +- .../account/model_get_account_info_resp.ts | 80 +- .../account/model_get_apikey_info_resp.ts | 57 +- ...model_get_cross_margin_account_accounts.ts | 56 +- .../model_get_cross_margin_account_req.ts | 37 +- .../model_get_cross_margin_account_resp.ts | 47 +- .../account/model_get_futures_account_req.ts | 30 +- .../account/model_get_futures_account_resp.ts | 65 +- .../model_get_futures_ledger_data_list.ts | 61 +- .../account/model_get_futures_ledger_req.ts | 42 +- .../account/model_get_futures_ledger_resp.ts | 30 +- ...odel_get_isolated_margin_account_assets.ts | 43 +- ...olated_margin_account_assets_base_asset.ts | 58 +- ...lated_margin_account_assets_quote_asset.ts | 58 +- ...ted_margin_account_detail_v1_base_asset.ts | 53 +- ...ed_margin_account_detail_v1_quote_asset.ts | 53 +- ...t_isolated_margin_account_detail_v1_req.ts | 28 +- ..._isolated_margin_account_detail_v1_resp.ts | 47 +- ..._isolated_margin_account_list_v1_assets.ts | 43 +- ...argin_account_list_v1_assets_base_asset.ts | 56 +- ...rgin_account_list_v1_assets_quote_asset.ts | 56 +- ...get_isolated_margin_account_list_v1_req.ts | 34 +- ...et_isolated_margin_account_list_v1_resp.ts | 37 +- .../model_get_isolated_margin_account_req.ts | 38 +- .../model_get_isolated_margin_account_resp.ts | 42 +- ...odel_get_margin_account_detail_accounts.ts | 48 +- .../model_get_margin_account_detail_resp.ts | 32 +- .../model_get_margin_hf_ledger_data.ts | 28 +- .../account/model_get_margin_hf_ledger_req.ts | 36 +- .../model_get_margin_hf_ledger_resp.ts | 25 +- .../model_get_spot_account_detail_req.ts | 24 +- .../model_get_spot_account_detail_resp.ts | 40 +- .../model_get_spot_account_list_data.ts | 46 +- .../model_get_spot_account_list_req.ts | 25 +- .../model_get_spot_account_list_resp.ts | 25 +- .../model_get_spot_account_type_resp.ts | 25 +- .../account/model_get_spot_hf_ledger_data.ts | 71 +- .../account/model_get_spot_hf_ledger_req.ts | 36 +- .../account/model_get_spot_hf_ledger_resp.ts | 25 +- .../account/model_get_spot_ledger_items.ts | 27 +- .../account/model_get_spot_ledger_req.ts | 42 +- .../account/model_get_spot_ledger_resp.ts | 45 +- .../generate/account/deposit/api_deposit.ts | 14 +- .../model_add_deposit_address_v1_req.ts | 38 +- .../model_add_deposit_address_v1_resp.ts | 50 +- .../model_add_deposit_address_v3_req.ts | 46 +- .../model_add_deposit_address_v3_resp.ts | 55 +- .../model_get_deposit_address_v1_req.ts | 31 +- .../model_get_deposit_address_v1_resp.ts | 26 +- .../model_get_deposit_address_v2_data.ts | 24 +- .../model_get_deposit_address_v2_req.ts | 24 +- .../model_get_deposit_address_v2_resp.ts | 25 +- .../model_get_deposit_address_v3_data.ts | 56 +- .../model_get_deposit_address_v3_req.ts | 26 +- .../model_get_deposit_address_v3_resp.ts | 25 +- .../model_get_deposit_history_items.ts | 30 +- .../model_get_deposit_history_old_items.ts | 23 +- .../model_get_deposit_history_old_req.ts | 27 +- .../model_get_deposit_history_old_resp.ts | 45 +- .../deposit/model_get_deposit_history_req.ts | 35 +- .../deposit/model_get_deposit_history_resp.ts | 45 +- sdk/node/src/generate/account/fee/api_fee.ts | 6 +- .../account/fee/model_get_basic_fee_req.ts | 30 +- .../account/fee/model_get_basic_fee_resp.ts | 30 +- .../fee/model_get_futures_actual_fee_req.ts | 24 +- .../fee/model_get_futures_actual_fee_resp.ts | 35 +- .../fee/model_get_spot_actual_fee_data.ts | 31 +- .../fee/model_get_spot_actual_fee_req.ts | 24 +- .../fee/model_get_spot_actual_fee_resp.ts | 25 +- .../account/subaccount/api_sub_account.ts | 26 +- .../model_add_sub_account_api_req.ts | 60 +- .../model_add_sub_account_api_resp.ts | 61 +- ..._add_sub_account_futures_permission_req.ts | 35 +- ...add_sub_account_futures_permission_resp.ts | 29 +- ...l_add_sub_account_margin_permission_req.ts | 33 +- ..._add_sub_account_margin_permission_resp.ts | 27 +- .../subaccount/model_add_sub_account_req.ts | 46 +- .../subaccount/model_add_sub_account_resp.ts | 40 +- .../model_delete_sub_account_api_req.ts | 26 +- .../model_delete_sub_account_api_resp.ts | 30 +- ...et_futures_sub_account_list_v2_accounts.ts | 63 +- ...del_get_futures_sub_account_list_v2_req.ts | 30 +- ...el_get_futures_sub_account_list_v2_resp.ts | 32 +- ...get_futures_sub_account_list_v2_summary.ts | 58 +- ...t_spot_sub_account_detail_main_accounts.ts | 27 +- ...spot_sub_account_detail_margin_accounts.ts | 27 +- .../model_get_spot_sub_account_detail_req.ts | 25 +- .../model_get_spot_sub_account_detail_resp.ts | 52 +- ..._spot_sub_account_detail_trade_accounts.ts | 27 +- ...model_get_spot_sub_account_list_v1_data.ts | 46 +- ..._sub_account_list_v1_data_main_accounts.ts | 27 +- ...ub_account_list_v1_data_margin_accounts.ts | 27 +- ...sub_account_list_v1_data_trade_accounts.ts | 27 +- ...model_get_spot_sub_account_list_v1_resp.ts | 27 +- ...odel_get_spot_sub_account_list_v2_items.ts | 46 +- ...sub_account_list_v2_items_main_accounts.ts | 27 +- ...b_account_list_v2_items_margin_accounts.ts | 27 +- ...ub_account_list_v2_items_trade_accounts.ts | 27 +- .../model_get_spot_sub_account_list_v2_req.ts | 37 +- ...model_get_spot_sub_account_list_v2_resp.ts | 47 +- ...l_get_spot_sub_accounts_summary_v1_data.ts | 48 +- ...l_get_spot_sub_accounts_summary_v1_resp.ts | 27 +- ..._get_spot_sub_accounts_summary_v2_items.ts | 73 +- ...el_get_spot_sub_accounts_summary_v2_req.ts | 33 +- ...l_get_spot_sub_accounts_summary_v2_resp.ts | 47 +- .../model_get_sub_account_api_list_data.ts | 26 +- .../model_get_sub_account_api_list_req.ts | 25 +- .../model_get_sub_account_api_list_resp.ts | 25 +- .../model_modify_sub_account_api_req.ts | 60 +- .../model_modify_sub_account_api_resp.ts | 36 +- .../generate/account/transfer/api_transfer.ts | 14 +- .../transfer/model_flex_transfer_req.ts | 70 +- .../transfer/model_flex_transfer_resp.ts | 25 +- .../model_futures_account_transfer_in_req.ts | 45 +- .../model_futures_account_transfer_in_resp.ts | 27 +- .../model_futures_account_transfer_out_req.ts | 45 +- ...model_futures_account_transfer_out_resp.ts | 107 +- ...tures_account_transfer_out_ledger_items.ts | 29 +- ...futures_account_transfer_out_ledger_req.ts | 46 +- ...utures_account_transfer_out_ledger_resp.ts | 47 +- .../transfer/model_get_transfer_quotas_req.ts | 32 +- .../model_get_transfer_quotas_resp.ts | 45 +- .../transfer/model_inner_transfer_req.ts | 63 +- .../transfer/model_inner_transfer_resp.ts | 25 +- .../model_sub_account_transfer_req.ts | 67 +- .../model_sub_account_transfer_resp.ts | 25 +- .../account/withdrawal/api_withdrawal.ts | 12 +- .../withdrawal/model_cancel_withdrawal_req.ts | 24 +- .../model_cancel_withdrawal_resp.ts | 25 +- .../model_get_withdrawal_history_items.ts | 30 +- .../model_get_withdrawal_history_old_items.ts | 24 +- .../model_get_withdrawal_history_old_req.ts | 41 +- .../model_get_withdrawal_history_old_resp.ts | 47 +- .../model_get_withdrawal_history_req.ts | 41 +- .../model_get_withdrawal_history_resp.ts | 45 +- .../model_get_withdrawal_quotas_req.ts | 31 +- .../model_get_withdrawal_quotas_resp.ts | 100 +- .../withdrawal/model_withdrawal_v1_req.ts | 62 +- .../withdrawal/model_withdrawal_v1_resp.ts | 25 +- .../withdrawal/model_withdrawal_v3_req.ts | 69 +- .../withdrawal/model_withdrawal_v3_resp.ts | 25 +- .../affiliate/affiliate/api_affiliate.ts | 2 +- .../affiliate/model_get_account_ltv.ts | 41 +- .../affiliate/model_get_account_margins.ts | 31 +- .../affiliate/model_get_account_orders.ts | 36 +- .../affiliate/model_get_account_resp.ts | 50 +- .../broker/apibroker/api_api_broker.ts | 2 +- .../broker/apibroker/model_get_rebase_req.ts | 26 +- .../broker/apibroker/model_get_rebase_resp.ts | 25 +- .../generate/broker/ndbroker/api_nd_broker.ts | 26 +- .../ndbroker/model_add_sub_account_api_req.ts | 59 +- .../model_add_sub_account_api_resp.ts | 60 +- .../ndbroker/model_add_sub_account_req.ts | 31 +- .../ndbroker/model_add_sub_account_resp.ts | 40 +- .../model_delete_sub_account_api_req.ts | 25 +- .../model_delete_sub_account_api_resp.ts | 25 +- .../ndbroker/model_get_broker_info_req.ts | 26 +- .../ndbroker/model_get_broker_info_resp.ts | 35 +- .../ndbroker/model_get_deposit_detail_req.ts | 25 +- .../ndbroker/model_get_deposit_detail_resp.ts | 90 +- .../ndbroker/model_get_deposit_list_data.ts | 86 +- .../ndbroker/model_get_deposit_list_req.ts | 35 +- .../ndbroker/model_get_deposit_list_resp.ts | 25 +- .../broker/ndbroker/model_get_rebase_req.ts | 26 +- .../broker/ndbroker/model_get_rebase_resp.ts | 25 +- .../model_get_sub_account_api_data.ts | 51 +- .../ndbroker/model_get_sub_account_api_req.ts | 25 +- .../model_get_sub_account_api_resp.ts | 25 +- .../ndbroker/model_get_sub_account_items.ts | 36 +- .../ndbroker/model_get_sub_account_req.ts | 38 +- .../ndbroker/model_get_sub_account_resp.ts | 45 +- .../model_get_transfer_history_req.ts | 24 +- .../model_get_transfer_history_resp.ts | 80 +- .../ndbroker/model_get_withdraw_detail_req.ts | 24 +- .../model_get_withdraw_detail_resp.ts | 90 +- .../model_modify_sub_account_api_req.ts | 59 +- .../model_modify_sub_account_api_resp.ts | 55 +- .../broker/ndbroker/model_transfer_req.ts | 75 +- .../broker/ndbroker/model_transfer_resp.ts | 25 +- .../copytrading/futures/api_futures.ts | 22 +- .../futures/model_add_isolated_margin_req.ts | 45 +- .../futures/model_add_isolated_margin_resp.ts | 200 +- .../futures/model_add_order_req.ts | 128 +- .../futures/model_add_order_resp.ts | 30 +- .../futures/model_add_order_test_req.ts | 134 +- .../futures/model_add_order_test_resp.ts | 30 +- .../futures/model_add_tpsl_order_req.ts | 134 +- .../futures/model_add_tpsl_order_resp.ts | 30 +- .../model_cancel_order_by_client_oid_req.ts | 25 +- .../model_cancel_order_by_client_oid_resp.ts | 27 +- .../futures/model_cancel_order_by_id_req.ts | 24 +- .../futures/model_cancel_order_by_id_resp.ts | 25 +- .../futures/model_get_max_open_size_req.ts | 26 +- .../futures/model_get_max_open_size_resp.ts | 35 +- .../model_get_max_withdraw_margin_req.ts | 24 +- .../model_get_max_withdraw_margin_resp.ts | 25 +- .../model_modify_auto_deposit_status_req.ts | 38 +- .../model_modify_auto_deposit_status_resp.ts | 27 +- ...el_modify_isolated_margin_risk_limt_req.ts | 40 +- ...l_modify_isolated_margin_risk_limt_resp.ts | 27 +- .../model_remove_isolated_margin_req.ts | 38 +- .../model_remove_isolated_margin_resp.ts | 25 +- sdk/node/src/generate/earn/earn/api_earn.ts | 18 +- .../earn/model_get_account_holding_items.ts | 92 +- .../earn/model_get_account_holding_req.ts | 40 +- .../earn/model_get_account_holding_resp.ts | 45 +- .../model_get_eth_staking_products_data.ts | 115 +- .../model_get_eth_staking_products_req.ts | 24 +- .../model_get_eth_staking_products_resp.ts | 27 +- .../model_get_kcs_staking_products_data.ts | 123 +- .../model_get_kcs_staking_products_req.ts | 24 +- .../model_get_kcs_staking_products_resp.ts | 27 +- .../earn/model_get_promotion_products_data.ts | 131 +- .../earn/model_get_promotion_products_req.ts | 24 +- .../earn/model_get_promotion_products_resp.ts | 25 +- .../earn/earn/model_get_redeem_preview_req.ts | 25 +- .../earn/model_get_redeem_preview_resp.ts | 55 +- .../earn/model_get_savings_products_data.ts | 131 +- .../earn/model_get_savings_products_req.ts | 24 +- .../earn/model_get_savings_products_resp.ts | 25 +- .../earn/model_get_staking_products_data.ts | 131 +- .../earn/model_get_staking_products_req.ts | 24 +- .../earn/model_get_staking_products_resp.ts | 25 +- .../generate/earn/earn/model_purchase_req.ts | 45 +- .../generate/earn/earn/model_purchase_resp.ts | 30 +- .../generate/earn/earn/model_redeem_req.ts | 27 +- .../generate/earn/earn/model_redeem_resp.ts | 40 +- .../futures/fundingfees/api_funding_fees.ts | 6 +- .../model_get_current_funding_rate_req.ts | 24 +- .../model_get_current_funding_rate_resp.ts | 57 +- ...l_get_private_funding_history_data_list.ts | 73 +- .../model_get_private_funding_history_req.ts | 30 +- .../model_get_private_funding_history_resp.ts | 32 +- .../model_get_public_funding_history_data.ts | 31 +- .../model_get_public_funding_history_req.ts | 26 +- .../model_get_public_funding_history_resp.ts | 27 +- .../futuresprivate/model_all_order_event.ts | 21 +- .../model_all_position_event.ts | 21 +- .../futuresprivate/model_balance_event.ts | 21 +- .../model_cross_leverage_data_value.ts | 17 +- .../model_cross_leverage_event.ts | 21 +- .../futuresprivate/model_margin_mode_event.ts | 21 +- .../futuresprivate/model_order_event.ts | 21 +- .../futuresprivate/model_position_event.ts | 21 +- .../futuresprivate/model_stop_orders_event.ts | 21 +- .../futurespublic/model_announcement_event.ts | 21 +- .../futurespublic/model_execution_event.ts | 21 +- .../futurespublic/model_instrument_event.ts | 21 +- .../futurespublic/model_klines_event.ts | 21 +- .../model_orderbook_increment_event.ts | 21 +- .../model_orderbook_level50_event.ts | 21 +- .../model_orderbook_level5_event.ts | 21 +- .../model_symbol_snapshot_event.ts | 21 +- .../futurespublic/model_ticker_v1_event.ts | 21 +- .../futurespublic/model_ticker_v2_event.ts | 21 +- .../src/generate/futures/market/api_market.ts | 34 +- .../market/model_get24hr_stats_resp.ts | 25 +- .../market/model_get_all_symbols_data.ts | 318 +- .../market/model_get_all_symbols_resp.ts | 25 +- .../market/model_get_all_tickers_data.ts | 71 +- .../market/model_get_all_tickers_resp.ts | 25 +- .../market/model_get_full_order_book_req.ts | 24 +- .../market/model_get_full_order_book_resp.ts | 45 +- ...model_get_interest_rate_index_data_list.ts | 36 +- .../model_get_interest_rate_index_req.ts | 48 +- .../model_get_interest_rate_index_resp.ts | 30 +- .../futures/market/model_get_klines_req.ts | 27 +- .../futures/market/model_get_klines_resp.ts | 25 +- .../market/model_get_mark_price_req.ts | 24 +- .../market/model_get_mark_price_resp.ts | 45 +- .../market/model_get_part_order_book_req.ts | 25 +- .../market/model_get_part_order_book_resp.ts | 45 +- .../model_get_premium_index_data_list.ts | 36 +- .../market/model_get_premium_index_req.ts | 48 +- .../market/model_get_premium_index_resp.ts | 30 +- ...odel_get_private_token_instance_servers.ts | 43 +- .../market/model_get_private_token_resp.ts | 30 +- ...model_get_public_token_instance_servers.ts | 41 +- .../market/model_get_public_token_resp.ts | 30 +- .../market/model_get_server_time_resp.ts | 25 +- .../market/model_get_service_status_resp.ts | 30 +- .../model_get_spot_index_price_data_list.ts | 41 +- ..._index_price_data_list_decomposion_list.ts | 33 +- .../market/model_get_spot_index_price_req.ts | 48 +- .../market/model_get_spot_index_price_resp.ts | 30 +- .../futures/market/model_get_symbol_req.ts | 24 +- .../futures/market/model_get_symbol_resp.ts | 330 +- .../futures/market/model_get_ticker_req.ts | 24 +- .../futures/market/model_get_ticker_resp.ts | 75 +- .../market/model_get_trade_history_data.ts | 61 +- .../market/model_get_trade_history_req.ts | 24 +- .../market/model_get_trade_history_resp.ts | 25 +- .../src/generate/futures/order/api_order.ts | 36 +- .../futures/order/model_add_order_req.ts | 125 +- .../futures/order/model_add_order_resp.ts | 30 +- .../futures/order/model_add_order_test_req.ts | 131 +- .../order/model_add_order_test_resp.ts | 30 +- .../futures/order/model_add_tpsl_order_req.ts | 131 +- .../order/model_add_tpsl_order_resp.ts | 30 +- .../order/model_batch_add_orders_data.ts | 41 +- .../order/model_batch_add_orders_item.ts | 131 +- .../order/model_batch_add_orders_req.ts | 24 +- .../order/model_batch_add_orders_resp.ts | 25 +- ...el_batch_cancel_orders_client_oids_list.ts | 40 +- .../order/model_batch_cancel_orders_data.ts | 36 +- .../order/model_batch_cancel_orders_req.ts | 38 +- .../order/model_batch_cancel_orders_resp.ts | 25 +- .../order/model_cancel_all_orders_v1_req.ts | 24 +- .../order/model_cancel_all_orders_v1_resp.ts | 25 +- .../order/model_cancel_all_orders_v3_req.ts | 24 +- .../order/model_cancel_all_orders_v3_resp.ts | 25 +- .../order/model_cancel_all_stop_orders_req.ts | 24 +- .../model_cancel_all_stop_orders_resp.ts | 25 +- .../model_cancel_order_by_client_oid_req.ts | 25 +- .../model_cancel_order_by_client_oid_resp.ts | 27 +- .../order/model_cancel_order_by_id_req.ts | 24 +- .../order/model_cancel_order_by_id_resp.ts | 25 +- .../order/model_get_open_order_value_req.ts | 24 +- .../order/model_get_open_order_value_resp.ts | 45 +- .../model_get_order_by_client_oid_req.ts | 24 +- .../model_get_order_by_client_oid_resp.ts | 210 +- .../order/model_get_order_by_order_id_req.ts | 24 +- .../order/model_get_order_by_order_id_resp.ts | 206 +- .../order/model_get_order_list_items.ts | 206 +- .../futures/order/model_get_order_list_req.ts | 31 +- .../order/model_get_order_list_resp.ts | 45 +- .../model_get_recent_closed_orders_data.ts | 206 +- .../model_get_recent_closed_orders_req.ts | 24 +- .../model_get_recent_closed_orders_resp.ts | 27 +- .../model_get_recent_trade_history_data.ts | 136 +- .../model_get_recent_trade_history_req.ts | 24 +- .../model_get_recent_trade_history_resp.ts | 27 +- .../order/model_get_stop_order_list_items.ts | 206 +- .../order/model_get_stop_order_list_req.ts | 36 +- .../order/model_get_stop_order_list_resp.ts | 45 +- .../order/model_get_trade_history_items.ts | 136 +- .../order/model_get_trade_history_req.ts | 44 +- .../order/model_get_trade_history_resp.ts | 45 +- .../futures/positions/api_positions.ts | 28 +- .../model_add_isolated_margin_req.ts | 45 +- .../model_add_isolated_margin_resp.ts | 205 +- .../model_get_cross_margin_leverage_req.ts | 24 +- .../model_get_cross_margin_leverage_resp.ts | 32 +- ...del_get_isolated_margin_risk_limit_data.ts | 53 +- ...odel_get_isolated_margin_risk_limit_req.ts | 24 +- ...del_get_isolated_margin_risk_limit_resp.ts | 27 +- .../positions/model_get_margin_mode_req.ts | 24 +- .../positions/model_get_margin_mode_resp.ts | 30 +- .../positions/model_get_max_open_size_req.ts | 26 +- .../positions/model_get_max_open_size_resp.ts | 35 +- .../model_get_max_withdraw_margin_req.ts | 24 +- .../model_get_max_withdraw_margin_resp.ts | 25 +- .../model_get_position_details_req.ts | 24 +- .../model_get_position_details_resp.ts | 188 +- .../positions/model_get_position_list_data.ts | 184 +- .../positions/model_get_position_list_req.ts | 24 +- .../positions/model_get_position_list_resp.ts | 25 +- .../model_get_positions_history_items.ts | 96 +- .../model_get_positions_history_req.ts | 40 +- .../model_get_positions_history_resp.ts | 45 +- .../model_modify_auto_deposit_status_req.ts | 38 +- .../model_modify_auto_deposit_status_resp.ts | 27 +- ...el_modify_isolated_margin_risk_limt_req.ts | 40 +- ...l_modify_isolated_margin_risk_limt_resp.ts | 27 +- .../model_modify_margin_leverage_req.ts | 38 +- .../model_modify_margin_leverage_resp.ts | 30 +- .../model_remove_isolated_margin_req.ts | 38 +- .../model_remove_isolated_margin_resp.ts | 25 +- .../positions/model_switch_margin_mode_req.ts | 38 +- .../model_switch_margin_mode_resp.ts | 30 +- .../src/generate/margin/credit/api_credit.ts | 22 +- .../credit/model_get_loan_market_data.ts | 28 +- ...odel_get_loan_market_interest_rate_data.ts | 26 +- ...model_get_loan_market_interest_rate_req.ts | 24 +- ...odel_get_loan_market_interest_rate_resp.ts | 27 +- .../credit/model_get_loan_market_req.ts | 24 +- .../credit/model_get_loan_market_resp.ts | 25 +- .../credit/model_get_purchase_orders_items.ts | 56 +- .../credit/model_get_purchase_orders_req.ts | 40 +- .../credit/model_get_purchase_orders_resp.ts | 45 +- .../credit/model_get_redeem_orders_items.ts | 51 +- .../credit/model_get_redeem_orders_req.ts | 40 +- .../credit/model_get_redeem_orders_resp.ts | 45 +- .../credit/model_modify_purchase_req.ts | 45 +- .../credit/model_modify_purchase_resp.ts | 25 +- .../margin/credit/model_purchase_req.ts | 45 +- .../margin/credit/model_purchase_resp.ts | 25 +- .../margin/credit/model_redeem_req.ts | 45 +- .../margin/credit/model_redeem_resp.ts | 25 +- .../src/generate/margin/debit/api_debit.ts | 12 +- .../generate/margin/debit/model_borrow_req.ts | 60 +- .../margin/debit/model_borrow_resp.ts | 30 +- .../debit/model_get_borrow_history_items.ts | 51 +- .../debit/model_get_borrow_history_req.ts | 49 +- .../debit/model_get_borrow_history_resp.ts | 50 +- .../debit/model_get_interest_history_items.ts | 36 +- .../debit/model_get_interest_history_req.ts | 48 +- .../debit/model_get_interest_history_resp.ts | 50 +- .../debit/model_get_repay_history_items.ts | 56 +- .../debit/model_get_repay_history_req.ts | 49 +- .../debit/model_get_repay_history_resp.ts | 50 +- .../margin/debit/model_modify_leverage_req.ts | 39 +- .../debit/model_modify_leverage_resp.ts | 25 +- .../generate/margin/debit/model_repay_req.ts | 53 +- .../generate/margin/debit/model_repay_resp.ts | 35 +- ..._cross_margin_position_asset_list_value.ts | 19 +- .../model_cross_margin_position_event.ts | 21 +- ...ted_margin_position_change_assets_value.ts | 19 +- .../model_isolated_margin_position_event.ts | 23 +- .../marginpublic/model_index_price_event.ts | 21 +- .../marginpublic/model_mark_price_event.ts | 21 +- .../src/generate/margin/market/api_market.ts | 12 +- .../model_get_cross_margin_symbols_items.ts | 96 +- .../model_get_cross_margin_symbols_req.ts | 24 +- .../model_get_cross_margin_symbols_resp.ts | 32 +- .../margin/market/model_get_etf_info_data.ts | 46 +- .../margin/market/model_get_etf_info_req.ts | 24 +- .../margin/market/model_get_etf_info_resp.ts | 25 +- .../model_get_isolated_margin_symbols_data.ts | 86 +- .../model_get_isolated_margin_symbols_resp.ts | 27 +- .../market/model_get_margin_config_resp.ts | 40 +- .../market/model_get_mark_price_detail_req.ts | 24 +- .../model_get_mark_price_detail_resp.ts | 35 +- .../market/model_get_mark_price_list_data.ts | 31 +- .../market/model_get_mark_price_list_resp.ts | 25 +- .../src/generate/margin/order/api_order.ts | 26 +- .../margin/order/model_add_order_req.ts | 107 +- .../margin/order/model_add_order_resp.ts | 40 +- .../margin/order/model_add_order_test_req.ts | 107 +- .../margin/order/model_add_order_test_resp.ts | 40 +- .../order/model_add_order_test_v1_req.ts | 107 +- .../order/model_add_order_test_v1_resp.ts | 40 +- .../margin/order/model_add_order_v1_req.ts | 107 +- .../margin/order/model_add_order_v1_resp.ts | 40 +- .../model_cancel_all_orders_by_symbol_req.ts | 25 +- .../model_cancel_all_orders_by_symbol_resp.ts | 27 +- .../model_cancel_order_by_client_oid_req.ts | 25 +- .../model_cancel_order_by_client_oid_resp.ts | 27 +- .../model_cancel_order_by_order_id_req.ts | 25 +- .../model_cancel_order_by_order_id_resp.ts | 25 +- .../order/model_get_closed_orders_items.ts | 185 +- .../order/model_get_closed_orders_req.ts | 37 +- .../order/model_get_closed_orders_resp.ts | 30 +- .../order/model_get_open_orders_data.ts | 185 +- .../margin/order/model_get_open_orders_req.ts | 25 +- .../order/model_get_open_orders_resp.ts | 25 +- .../model_get_order_by_client_oid_req.ts | 25 +- .../model_get_order_by_client_oid_resp.ts | 189 +- .../order/model_get_order_by_order_id_req.ts | 25 +- .../order/model_get_order_by_order_id_resp.ts | 193 +- .../model_get_symbols_with_open_order_req.ts | 24 +- .../model_get_symbols_with_open_order_resp.ts | 32 +- .../order/model_get_trade_history_items.ts | 116 +- .../order/model_get_trade_history_req.ts | 38 +- .../order/model_get_trade_history_resp.ts | 30 +- .../margin/risklimit/api_risk_limit.ts | 2 +- .../model_get_margin_risk_limit_data.ts | 47 +- .../model_get_margin_risk_limit_req.ts | 26 +- .../model_get_margin_risk_limit_resp.ts | 25 +- .../src/generate/spot/market/api_market.ts | 36 +- .../spot/market/model_get24hr_stats_req.ts | 24 +- .../spot/market/model_get24hr_stats_resp.ts | 100 +- .../market/model_get_all_currencies_data.ts | 61 +- .../model_get_all_currencies_data_chains.ts | 94 +- .../market/model_get_all_currencies_resp.ts | 25 +- .../spot/market/model_get_all_symbols_data.ts | 121 +- .../spot/market/model_get_all_symbols_req.ts | 24 +- .../spot/market/model_get_all_symbols_resp.ts | 25 +- .../spot/market/model_get_all_tickers_resp.ts | 30 +- .../market/model_get_all_tickers_ticker.ts | 106 +- .../market/model_get_announcements_items.ts | 51 +- .../market/model_get_announcements_req.ts | 41 +- .../market/model_get_announcements_resp.ts | 45 +- .../spot/market/model_get_currency_chains.ts | 91 +- .../spot/market/model_get_currency_req.ts | 25 +- .../spot/market/model_get_currency_resp.ts | 65 +- .../spot/market/model_get_fiat_price_req.ts | 31 +- .../spot/market/model_get_fiat_price_resp.ts | 4500 +++++++++++++---- .../market/model_get_full_order_book_req.ts | 24 +- .../market/model_get_full_order_book_resp.ts | 40 +- .../spot/market/model_get_klines_req.ts | 39 +- .../spot/market/model_get_klines_resp.ts | 25 +- .../spot/market/model_get_market_list_resp.ts | 25 +- .../market/model_get_part_order_book_req.ts | 25 +- .../market/model_get_part_order_book_resp.ts | 40 +- ...odel_get_private_token_instance_servers.ts | 43 +- .../market/model_get_private_token_resp.ts | 30 +- ...model_get_public_token_instance_servers.ts | 41 +- .../market/model_get_public_token_resp.ts | 30 +- .../spot/market/model_get_server_time_resp.ts | 25 +- .../market/model_get_service_status_resp.ts | 30 +- .../spot/market/model_get_symbol_req.ts | 24 +- .../spot/market/model_get_symbol_resp.ts | 125 +- .../spot/market/model_get_ticker_req.ts | 24 +- .../spot/market/model_get_ticker_resp.ts | 60 +- .../market/model_get_trade_history_data.ts | 41 +- .../market/model_get_trade_history_req.ts | 24 +- .../market/model_get_trade_history_resp.ts | 25 +- sdk/node/src/generate/spot/order/api_order.ts | 96 +- .../spot/order/model_add_oco_order_req.ts | 75 +- .../spot/order/model_add_oco_order_resp.ts | 25 +- .../spot/order/model_add_order_old_req.ts | 94 +- .../spot/order/model_add_order_old_resp.ts | 25 +- .../spot/order/model_add_order_req.ts | 82 +- .../spot/order/model_add_order_resp.ts | 30 +- .../spot/order/model_add_order_sync_req.ts | 82 +- .../spot/order/model_add_order_sync_resp.ts | 65 +- .../order/model_add_order_test_old_req.ts | 94 +- .../order/model_add_order_test_old_resp.ts | 25 +- .../spot/order/model_add_order_test_req.ts | 82 +- .../spot/order/model_add_order_test_resp.ts | 30 +- .../spot/order/model_add_stop_order_req.ts | 89 +- .../spot/order/model_add_stop_order_resp.ts | 30 +- .../spot/order/model_batch_add_orders_data.ts | 24 +- .../order/model_batch_add_orders_old_data.ts | 121 +- .../model_batch_add_orders_old_order_list.ts | 107 +- .../order/model_batch_add_orders_old_req.ts | 32 +- .../order/model_batch_add_orders_old_resp.ts | 25 +- .../model_batch_add_orders_order_list.ts | 88 +- .../spot/order/model_batch_add_orders_req.ts | 31 +- .../spot/order/model_batch_add_orders_resp.ts | 25 +- .../order/model_batch_add_orders_sync_data.ts | 31 +- .../model_batch_add_orders_sync_order_list.ts | 88 +- .../order/model_batch_add_orders_sync_req.ts | 31 +- .../order/model_batch_add_orders_sync_resp.ts | 25 +- .../model_batch_cancel_oco_orders_req.ts | 25 +- .../model_batch_cancel_oco_orders_resp.ts | 25 +- .../order/model_batch_cancel_order_old_req.ts | 31 +- .../model_batch_cancel_order_old_resp.ts | 25 +- .../model_batch_cancel_stop_order_req.ts | 26 +- .../model_batch_cancel_stop_order_resp.ts | 25 +- .../model_cancel_all_orders_by_symbol_req.ts | 24 +- .../model_cancel_all_orders_by_symbol_resp.ts | 27 +- .../model_cancel_all_orders_failed_symbols.ts | 19 +- .../order/model_cancel_all_orders_resp.ts | 30 +- ...odel_cancel_oco_order_by_client_oid_req.ts | 24 +- ...del_cancel_oco_order_by_client_oid_resp.ts | 27 +- .../model_cancel_oco_order_by_order_id_req.ts | 24 +- ...model_cancel_oco_order_by_order_id_resp.ts | 27 +- ...odel_cancel_order_by_client_oid_old_req.ts | 25 +- ...del_cancel_order_by_client_oid_old_resp.ts | 37 +- .../model_cancel_order_by_client_oid_req.ts | 25 +- .../model_cancel_order_by_client_oid_resp.ts | 27 +- ...del_cancel_order_by_client_oid_sync_req.ts | 25 +- ...el_cancel_order_by_client_oid_sync_resp.ts | 52 +- .../model_cancel_order_by_order_id_old_req.ts | 25 +- ...model_cancel_order_by_order_id_old_resp.ts | 27 +- .../model_cancel_order_by_order_id_req.ts | 25 +- .../model_cancel_order_by_order_id_resp.ts | 25 +- ...model_cancel_order_by_order_id_sync_req.ts | 25 +- ...odel_cancel_order_by_order_id_sync_resp.ts | 52 +- .../order/model_cancel_partial_order_req.ts | 26 +- .../order/model_cancel_partial_order_resp.ts | 30 +- ...del_cancel_stop_order_by_client_oid_req.ts | 25 +- ...el_cancel_stop_order_by_client_oid_resp.ts | 32 +- ...model_cancel_stop_order_by_order_id_req.ts | 24 +- ...odel_cancel_stop_order_by_order_id_resp.ts | 27 +- .../order/model_get_closed_orders_items.ts | 174 +- .../spot/order/model_get_closed_orders_req.ts | 36 +- .../order/model_get_closed_orders_resp.ts | 30 +- .../generate/spot/order/model_get_dcp_resp.ts | 23 +- .../model_get_oco_order_by_client_oid_req.ts | 24 +- .../model_get_oco_order_by_client_oid_resp.ts | 47 +- .../model_get_oco_order_by_order_id_req.ts | 24 +- .../model_get_oco_order_by_order_id_resp.ts | 45 +- ...get_oco_order_detail_by_order_id_orders.ts | 53 +- ...el_get_oco_order_detail_by_order_id_req.ts | 24 +- ...l_get_oco_order_detail_by_order_id_resp.ts | 52 +- .../order/model_get_oco_order_list_items.ts | 41 +- .../order/model_get_oco_order_list_req.ts | 41 +- .../order/model_get_oco_order_list_resp.ts | 45 +- .../spot/order/model_get_open_orders_data.ts | 174 +- .../spot/order/model_get_open_orders_req.ts | 24 +- .../spot/order/model_get_open_orders_resp.ts | 25 +- .../model_get_order_by_client_oid_old_req.ts | 24 +- .../model_get_order_by_client_oid_old_resp.ts | 172 +- .../model_get_order_by_client_oid_req.ts | 25 +- .../model_get_order_by_client_oid_resp.ts | 178 +- .../model_get_order_by_order_id_old_req.ts | 24 +- .../model_get_order_by_order_id_old_resp.ts | 170 +- .../order/model_get_order_by_order_id_req.ts | 25 +- .../order/model_get_order_by_order_id_resp.ts | 178 +- .../order/model_get_orders_list_old_items.ts | 166 +- .../order/model_get_orders_list_old_req.ts | 56 +- .../order/model_get_orders_list_old_resp.ts | 45 +- .../model_get_recent_orders_list_old_data.ts | 166 +- .../model_get_recent_orders_list_old_req.ts | 37 +- .../model_get_recent_orders_list_old_resp.ts | 27 +- ...model_get_recent_trade_history_old_data.ts | 34 +- .../model_get_recent_trade_history_old_req.ts | 31 +- ...model_get_recent_trade_history_old_resp.ts | 27 +- ...model_get_stop_order_by_client_oid_data.ts | 48 +- .../model_get_stop_order_by_client_oid_req.ts | 25 +- ...model_get_stop_order_by_client_oid_resp.ts | 27 +- .../model_get_stop_order_by_order_id_req.ts | 24 +- .../model_get_stop_order_by_order_id_resp.ts | 52 +- .../order/model_get_stop_orders_list_items.ts | 48 +- .../order/model_get_stop_orders_list_req.ts | 33 +- .../order/model_get_stop_orders_list_resp.ts | 24 +- .../model_get_symbols_with_open_order_resp.ts | 27 +- .../order/model_get_trade_history_items.ts | 116 +- .../model_get_trade_history_old_items.ts | 34 +- .../order/model_get_trade_history_old_req.ts | 44 +- .../order/model_get_trade_history_old_resp.ts | 45 +- .../spot/order/model_get_trade_history_req.ts | 37 +- .../order/model_get_trade_history_resp.ts | 30 +- .../spot/order/model_modify_order_req.ts | 35 +- .../spot/order/model_modify_order_resp.ts | 30 +- .../generate/spot/order/model_set_dcp_req.ts | 32 +- .../generate/spot/order/model_set_dcp_resp.ts | 30 +- .../spot/spotprivate/model_account_event.ts | 21 +- .../model_account_relation_context.ts | 17 +- .../spot/spotprivate/model_order_v1_event.ts | 21 +- .../spot/spotprivate/model_order_v2_event.ts | 21 +- .../spotpublic/model_all_tickers_event.ts | 21 +- .../spot/spotpublic/model_klines_event.ts | 21 +- .../spotpublic/model_market_snapshot_data.ts | 17 +- ...el_market_snapshot_data_market_change1h.ts | 19 +- ...l_market_snapshot_data_market_change24h.ts | 19 +- ...el_market_snapshot_data_market_change4h.ts | 19 +- .../spotpublic/model_market_snapshot_event.ts | 21 +- .../model_orderbook_increment_changes.ts | 17 +- .../model_orderbook_increment_event.ts | 21 +- .../model_orderbook_level1_event.ts | 21 +- .../model_orderbook_level50_changes.ts | 17 +- .../model_orderbook_level50_event.ts | 21 +- .../model_orderbook_level5_event.ts | 21 +- .../spotpublic/model_symbol_snapshot_data.ts | 17 +- ...el_symbol_snapshot_data_market_change1h.ts | 19 +- ...l_symbol_snapshot_data_market_change24h.ts | 19 +- ...el_symbol_snapshot_data_market_change4h.ts | 19 +- .../spotpublic/model_symbol_snapshot_event.ts | 21 +- .../spot/spotpublic/model_ticker_event.ts | 21 +- .../spot/spotpublic/model_trade_event.ts | 21 +- sdk/node/src/generate/version.ts | 2 +- .../viplending/viplending/api_vip_lending.ts | 4 +- .../model_get_account_detail_ltv.ts | 41 +- .../model_get_account_detail_margins.ts | 31 +- .../model_get_account_detail_orders.ts | 36 +- .../model_get_account_detail_resp.ts | 50 +- .../viplending/model_get_accounts_data.ts | 46 +- .../viplending/model_get_accounts_resp.ts | 25 +- .../src/internal/infra/default_transport.ts | 51 +- sdk/node/src/internal/interfaces/response.ts | 11 - .../src/internal/interfaces/serializable.ts | 25 +- sdk/node/src/internal/interfaces/transport.ts | 12 +- 651 files changed, 22611 insertions(+), 10515 deletions(-) delete mode 100644 sdk/node/src/internal/interfaces/response.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index d4edb891..67b050ac 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -535,7 +535,7 @@ public ModelsMap postProcessModels(ModelsMap objs) { if (codegenModel != null) { imports.computeIfAbsent("class-transformer", ImportModel::new). - component.addAll(Arrays.asList("plainToInstance", "instanceToPlain")); + component.addAll(Arrays.asList("plainToClassFromExist", "instanceToPlain")); if (codegenModel.getVendorExtensions().containsKey("x-response-model")) { imports.computeIfAbsent("class-transformer", ImportModel::new).component.add("Exclude"); diff --git a/generator/plugin/src/main/resources/node-sdk/api.mustache b/generator/plugin/src/main/resources/node-sdk/api.mustache index 8cd4a910..7bd9bbfe 100644 --- a/generator/plugin/src/main/resources/node-sdk/api.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api.mustache @@ -30,7 +30,7 @@ export class {{classname}}Impl implements {{classname}} { {{#operations}} {{#operation}} {{vendorExtensions.x-meta.method}}({{#hasParams}}req :{{vendorExtensions.x-meta.methodServiceFmt}}Req{{/hasParams}}): Promise<{{vendorExtensions.x-meta.methodServiceFmt}}Resp> { - return this.transport.call("{{vendorExtensions.x-meta.domain}}", {{vendorExtensions.x-meta.broker}}, "{{httpMethod}}", "{{path}}", {{#hasParams}}req{{/hasParams}}{{^hasParams}}null{{/hasParams}}, new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(), {{#vendorExtensions.x-request-force-json}}true{{/vendorExtensions.x-request-force-json}}{{^vendorExtensions.x-request-force-json}}false{{/vendorExtensions.x-request-force-json}}) + return this.transport.call("{{vendorExtensions.x-meta.domain}}", {{vendorExtensions.x-meta.broker}}, "{{httpMethod}}", "{{path}}", {{#hasParams}}req{{/hasParams}}{{^hasParams}}null{{/hasParams}}, {{vendorExtensions.x-meta.methodServiceFmt}}Resp, {{#vendorExtensions.x-request-force-json}}true{{/vendorExtensions.x-request-force-json}}{{^vendorExtensions.x-request-force-json}}false{{/vendorExtensions.x-request-force-json}}) } {{/operation}} diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index a1856e64..86d5a772 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -6,14 +6,14 @@ {{/vendorExtensions.x-imports}} {{#vendorExtensions.x-response-model}} import { RestResponse } from '@model/common'; -import {Response} from '@internal/interfaces/response'; +import {Response} from '@internal/interfaces/serializable'; -export class {{classname}} implements Response<{{classname}}, RestResponse> { +export class {{classname}} implements Response { {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; -export class {{classname}} implements Serializable<{{classname}}>{ +export class {{classname}} implements Serializable{ {{/vendorExtensions.x-response-model}} {{#vars}} /** @@ -28,9 +28,17 @@ export class {{classname}} implements Serializable<{{classname}}>{ {{#vendorExtensions.x-typed}} {{{.}}} {{/vendorExtensions.x-typed}} - {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; + {{{vendorExtensions.x-default-value}}} {{/vars}} - + private constructor() { +{{#vars}} + {{#required}} + // @ts-ignore + this.{{name}} = null; + {{/required}} +{{/vars}} + } {{#vendorExtensions.x-response-model}} /** * common response @@ -43,17 +51,16 @@ export class {{classname}} implements Serializable<{{classname}}>{ } {{#vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, {data : jsonObject}); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, {data : jsonObject}); + static fromJson(input: string): {{classname}} { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): {{classname}} { + return plainToClassFromExist(new {{classname}}(), {data : jsonObject}); } {{/vendorExtensions.x-original-response}} @@ -64,7 +71,7 @@ export class {{classname}} implements Serializable<{{classname}}>{ * The builder pattern allows step-by-step construction of a `{{classname}}` object. */ static builder(): {{classname}}Builder { - return new {{classname}}Builder(); + return new {{classname}}Builder(new {{classname}}()); } /** @@ -75,45 +82,57 @@ export class {{classname}} implements Serializable<{{classname}}>{ /** * {{#description}}{{{.}}}{{/description}} */ - {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; {{/vars}} }): {{classname}} { let obj = new {{classname}}() {{#vars}} + {{^defaultValue}} obj.{{name}} = data.{{name}} + {{/defaultValue}} + {{#defaultValue}} + if (data.{{name}}) { + obj.{{name}} = data.{{name}} + } else { + {{#isEnum}} + obj.{{name}} = {{classname}}.{{{.}}} + {{/isEnum}} + {{^isEnum}} + obj.{{name}} = {{{.}}} + {{/isEnum}} + } + {{/defaultValue}} {{/vars}} return obj } {{#vendorExtensions.x-request-raw-array}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, {items : jsonObject}); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.items)); } - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, {items: jsonObject}); + static fromJson(input: string): {{classname}} { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): {{classname}} { + return plainToClassFromExist(new {{classname}}(), {items: jsonObject}); } {{/vendorExtensions.x-request-raw-array}} {{/vendorExtensions.x-request-model}} {{^vendorExtensions.x-original-response}} {{^vendorExtensions.x-request-raw-array}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, jsonObject); + static fromJson(input: string): {{classname}} { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): {{classname}} { + return plainToClassFromExist(new {{classname}}(), jsonObject); } {{/vendorExtensions.x-request-raw-array}} @@ -139,7 +158,9 @@ export namespace {{classname}} { {{#vendorExtensions.x-request-model}} export class {{classname}}Builder { - obj :{{classname}} = new {{classname}}() + constructor(readonly obj: {{classname}}) { + this.obj = obj; + } {{#vars}} /** * {{#description}}{{{.}}}{{/description}} @@ -151,7 +172,7 @@ export class {{classname}}Builder { {{/vars}} build():{{classname}} { - return this.obj + return this.obj; } } diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index db31aab2..9b80aaff 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -7,14 +7,14 @@ {{#vendorExtensions.x-response-model}} import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class {{classname}} implements Response<{{classname}}, WsMessage>{ +export class {{classname}} implements Response{ {{/vendorExtensions.x-response-model}} {{^vendorExtensions.x-response-model}} import { Serializable } from '@internal/interfaces/serializable'; -export class {{classname}} implements Serializable<{{classname}}>{ +export class {{classname}} implements Serializable{ {{/vendorExtensions.x-response-model}} {{#vars}} @@ -40,32 +40,30 @@ export class {{classname}} implements Serializable<{{classname}}>{ {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, {data : jsonObject}); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, {data : jsonObject}); + static fromJson(input: string): {{classname}} { + return this.fromObject(JSON.parse(input)); } -{{/vendorExtensions.x-original-response}} -{{^vendorExtensions.x-original-response}} - fromJson(input: string): {{classname}} { - const jsonObject = JSON.parse(input) - return plainToInstance( {{classname}}, jsonObject); + static fromObject(jsonObject: Object): {{classname}} { + return plainToClassFromExist(new {{classname}}(), {data : jsonObject}); } +{{/vendorExtensions.x-original-response}} +{{^vendorExtensions.x-original-response}} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): {{classname}} { - return plainToInstance( {{classname}}, jsonObject); + static fromJson(input: string): {{classname}} { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): {{classname}} { + return plainToClassFromExist(new {{classname}}(), jsonObject); } {{/vendorExtensions.x-original-response}} @@ -97,7 +95,7 @@ export class {{classname}}CallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = (new {{classname}}()).fromObject(msg.data) + let event = {{classname}}.fromObject(msg.data) event.setCommonResponse(msg) this.callback(msg.topic, msg.subject, event) } diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index c0ba0db8..748e8e8d 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,8 +8,8 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-futures-order.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-futures.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-deposit.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; private static final String CSV_PATH = "../../spec"; diff --git a/sdk/node/src/generate/account/account/api_account.ts b/sdk/node/src/generate/account/account/api_account.ts index 0405c07f..5a41195a 100644 --- a/sdk/node/src/generate/account/account/api_account.ts +++ b/sdk/node/src/generate/account/account/api_account.ts @@ -289,7 +289,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v2/user-info', null, - new GetAccountInfoResp(), + GetAccountInfoResp, false, ); } @@ -301,7 +301,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/user/api-key', null, - new GetApikeyInfoResp(), + GetApikeyInfoResp, false, ); } @@ -313,7 +313,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/hf/accounts/opened', null, - new GetSpotAccountTypeResp(), + GetSpotAccountTypeResp, false, ); } @@ -325,7 +325,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/accounts', req, - new GetSpotAccountListResp(), + GetSpotAccountListResp, false, ); } @@ -337,7 +337,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/accounts/{accountId}', req, - new GetSpotAccountDetailResp(), + GetSpotAccountDetailResp, false, ); } @@ -349,7 +349,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v3/margin/accounts', req, - new GetCrossMarginAccountResp(), + GetCrossMarginAccountResp, false, ); } @@ -363,7 +363,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v3/isolated/accounts', req, - new GetIsolatedMarginAccountResp(), + GetIsolatedMarginAccountResp, false, ); } @@ -375,7 +375,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/account-overview', req, - new GetFuturesAccountResp(), + GetFuturesAccountResp, false, ); } @@ -387,7 +387,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/accounts/ledgers', req, - new GetSpotLedgerResp(), + GetSpotLedgerResp, false, ); } @@ -399,7 +399,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/hf/accounts/ledgers', req, - new GetSpotHFLedgerResp(), + GetSpotHFLedgerResp, false, ); } @@ -411,7 +411,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v3/hf/margin/account/ledgers', req, - new GetMarginHFLedgerResp(), + GetMarginHFLedgerResp, false, ); } @@ -423,7 +423,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/transaction-history', req, - new GetFuturesLedgerResp(), + GetFuturesLedgerResp, false, ); } @@ -435,7 +435,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/margin/account', null, - new GetMarginAccountDetailResp(), + GetMarginAccountDetailResp, false, ); } @@ -449,7 +449,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/isolated/accounts', req, - new GetIsolatedMarginAccountListV1Resp(), + GetIsolatedMarginAccountListV1Resp, false, ); } @@ -463,7 +463,7 @@ export class AccountAPIImpl implements AccountAPI { 'GET', '/api/v1/isolated/account/{symbol}', req, - new GetIsolatedMarginAccountDetailV1Resp(), + GetIsolatedMarginAccountDetailV1Resp, false, ); } diff --git a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts index e808e307..3760c904 100644 --- a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts @@ -1,59 +1,96 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAccountInfoResp implements Response { +export class GetAccountInfoResp implements Response { /** * User VIP level */ - level?: number; + level: number; + /** * Number of sub-accounts */ - subQuantity?: number; + subQuantity: number; + /** * Number of sub-accounts with spot trading permissions enabled */ - spotSubQuantity?: number; + spotSubQuantity: number; + /** * Number of sub-accounts with margin trading permissions enabled */ - marginSubQuantity?: number; + marginSubQuantity: number; + /** * Number of sub-accounts with futures trading permissions enabled */ - futuresSubQuantity?: number; + futuresSubQuantity: number; + /** * Number of sub-accounts with option trading permissions enabled */ - optionSubQuantity?: number; + optionSubQuantity: number; + /** * Max number of sub-accounts = maxDefaultSubQuantity + maxSpotSubQuantity */ - maxSubQuantity?: number; + maxSubQuantity: number; + /** * Max number of default open sub-accounts (according to VIP level) */ - maxDefaultSubQuantity?: number; + maxDefaultSubQuantity: number; + /** * Max number of sub-accounts with additional Spot trading permissions */ - maxSpotSubQuantity?: number; + maxSpotSubQuantity: number; + /** * Max number of sub-accounts with additional margin trading permissions */ - maxMarginSubQuantity?: number; + maxMarginSubQuantity: number; + /** * Max number of sub-accounts with additional futures trading permissions */ - maxFuturesSubQuantity?: number; + maxFuturesSubQuantity: number; + /** * Max number of sub-accounts with additional Option trading permissions */ - maxOptionSubQuantity?: number; + maxOptionSubQuantity: number; + private constructor() { + // @ts-ignore + this.level = null; + // @ts-ignore + this.subQuantity = null; + // @ts-ignore + this.spotSubQuantity = null; + // @ts-ignore + this.marginSubQuantity = null; + // @ts-ignore + this.futuresSubQuantity = null; + // @ts-ignore + this.optionSubQuantity = null; + // @ts-ignore + this.maxSubQuantity = null; + // @ts-ignore + this.maxDefaultSubQuantity = null; + // @ts-ignore + this.maxSpotSubQuantity = null; + // @ts-ignore + this.maxMarginSubQuantity = null; + // @ts-ignore + this.maxFuturesSubQuantity = null; + // @ts-ignore + this.maxOptionSubQuantity = null; + } /** * common response */ @@ -64,16 +101,15 @@ export class GetAccountInfoResp implements Response { +export class GetApikeyInfoResp implements Response { /** * Remarks */ - remark?: string; + remark: string; + /** * Apikey */ - apiKey?: string; + apiKey: string; + /** * API Version */ - apiVersion?: number; + apiVersion: number; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144), possible values: General, Spot, Margin, Futures, InnerTransfer, Transfer, Earn */ - permission?: string; + permission: string; + /** * IP whitelist */ ipWhitelist?: string; + /** * Apikey create time */ - createdAt?: number; + createdAt: number; + /** * Account UID */ - uid?: number; + uid: number; + /** * Whether it is the master account. */ - isMaster?: boolean; + isMaster: boolean; + /** * Sub Name, There is no such param for the master account */ subName?: string; + private constructor() { + // @ts-ignore + this.remark = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.apiVersion = null; + // @ts-ignore + this.permission = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.isMaster = null; + } /** * common response */ @@ -52,16 +76,15 @@ export class GetApikeyInfoResp implements Response { +export class GetCrossMarginAccountAccounts implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Total Assets */ - total?: string; + total: string; + /** * Account available assets (total assets - frozen) */ - available?: string; + available: string; + /** * Account frozen assets */ - hold?: string; + hold: string; + /** * Liabilities */ - liability?: string; + liability: string; + /** * The user\'s remaining maximum loan amount */ - maxBorrowSize?: string; + maxBorrowSize: string; + /** * Support borrow or not */ - borrowEnabled?: boolean; + borrowEnabled: boolean; + /** * Support transfer or not */ - transferInEnabled?: boolean; + transferInEnabled: boolean; - fromJson(input: string): GetCrossMarginAccountAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCrossMarginAccountAccounts, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.total = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.hold = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.maxBorrowSize = null; + // @ts-ignore + this.borrowEnabled = null; + // @ts-ignore + this.transferInEnabled = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCrossMarginAccountAccounts { - return plainToInstance(GetCrossMarginAccountAccounts, jsonObject); + static fromJson(input: string): GetCrossMarginAccountAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCrossMarginAccountAccounts { + return plainToClassFromExist(new GetCrossMarginAccountAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts index 404652a6..ba4e227e 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetCrossMarginAccountReq implements Serializable { +export class GetCrossMarginAccountReq implements Serializable { /** * quote currency, currently only supports USDT, KCS, BTC, USDT as default */ quoteCurrency?: GetCrossMarginAccountReq.QuoteCurrencyEnum = GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT; + /** * Query account type (default MARGIN), MARGIN - only query low frequency cross margin account, MARGIN_V2-only query high frequency cross margin account, ALL - consistent aggregate query with the web side */ queryType?: GetCrossMarginAccountReq.QueryTypeEnum = GetCrossMarginAccountReq.QueryTypeEnum.MARGIN; + private constructor() {} /** * Creates a new instance of the `GetCrossMarginAccountReq` class. * The builder pattern allows step-by-step construction of a `GetCrossMarginAccountReq` object. */ static builder(): GetCrossMarginAccountReqBuilder { - return new GetCrossMarginAccountReqBuilder(); + return new GetCrossMarginAccountReqBuilder(new GetCrossMarginAccountReq()); } /** @@ -37,22 +39,29 @@ export class GetCrossMarginAccountReq implements Serializable -{ +export class GetCrossMarginAccountResp implements Response { /** * Total Assets in Quote Currency */ - totalAssetOfQuoteCurrency?: string; + totalAssetOfQuoteCurrency: string; + /** * Total Liability in Quote Currency */ - totalLiabilityOfQuoteCurrency?: string; + totalLiabilityOfQuoteCurrency: string; + /** * debt ratio */ - debtRatio?: string; + debtRatio: string; + /** * Position status; EFFECTIVE-effective, BANKRUPTCY-bankruptcy liquidation, LIQUIDATION-closing, REPAY-repayment, BORROW borrowing */ - status?: GetCrossMarginAccountResp.StatusEnum; + status: GetCrossMarginAccountResp.StatusEnum; + /** * Margin account list */ @Type(() => GetCrossMarginAccountAccounts) - accounts?: Array; + accounts: Array; + private constructor() { + // @ts-ignore + this.totalAssetOfQuoteCurrency = null; + // @ts-ignore + this.totalLiabilityOfQuoteCurrency = null; + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.accounts = null; + } /** * common response */ @@ -40,17 +54,16 @@ export class GetCrossMarginAccountResp this.commonResponse = response; } - fromJson(input: string): GetCrossMarginAccountResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCrossMarginAccountResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCrossMarginAccountResp { - return plainToInstance(GetCrossMarginAccountResp, jsonObject); + static fromJson(input: string): GetCrossMarginAccountResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCrossMarginAccountResp { + return plainToClassFromExist(new GetCrossMarginAccountResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts index 02d8bca7..3963ce8b 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesAccountReq implements Serializable { +export class GetFuturesAccountReq implements Serializable { /** * Currecny, Default XBT */ currency?: string = 'XBT'; + private constructor() {} /** * Creates a new instance of the `GetFuturesAccountReq` class. * The builder pattern allows step-by-step construction of a `GetFuturesAccountReq` object. */ static builder(): GetFuturesAccountReqBuilder { - return new GetFuturesAccountReqBuilder(); + return new GetFuturesAccountReqBuilder(new GetFuturesAccountReq()); } /** @@ -27,26 +28,31 @@ export class GetFuturesAccountReq implements Serializable currency?: string; }): GetFuturesAccountReq { let obj = new GetFuturesAccountReq(); - obj.currency = data.currency; + if (data.currency) { + obj.currency = data.currency; + } else { + obj.currency = 'XBT'; + } return obj; } - fromJson(input: string): GetFuturesAccountReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesAccountReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesAccountReq { - return plainToInstance(GetFuturesAccountReq, jsonObject); + static fromJson(input: string): GetFuturesAccountReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesAccountReq { + return plainToClassFromExist(new GetFuturesAccountReq(), jsonObject); } } export class GetFuturesAccountReqBuilder { - obj: GetFuturesAccountReq = new GetFuturesAccountReq(); + constructor(readonly obj: GetFuturesAccountReq) { + this.obj = obj; + } /** * Currecny, Default XBT */ diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts index c82ccc61..859cd213 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts @@ -1,47 +1,75 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFuturesAccountResp implements Response { +export class GetFuturesAccountResp implements Response { /** * Account equity = marginBalance + Unrealised PNL */ - accountEquity?: number; + accountEquity: number; + /** * Unrealised profit and loss */ - unrealisedPNL?: number; + unrealisedPNL: number; + /** * Margin balance = positionMargin + orderMargin + frozenFunds + availableBalance - unrealisedPNL */ - marginBalance?: number; + marginBalance: number; + /** * Position margin */ - positionMargin?: number; + positionMargin: number; + /** * Order margin */ - orderMargin?: number; + orderMargin: number; + /** * Frozen funds for out-transfer */ - frozenFunds?: number; + frozenFunds: number; + /** * Available balance */ - availableBalance?: number; + availableBalance: number; + /** * Currency */ - currency?: string; + currency: string; + /** * Cross margin risk rate */ - riskRatio?: number; + riskRatio: number; + private constructor() { + // @ts-ignore + this.accountEquity = null; + // @ts-ignore + this.unrealisedPNL = null; + // @ts-ignore + this.marginBalance = null; + // @ts-ignore + this.positionMargin = null; + // @ts-ignore + this.orderMargin = null; + // @ts-ignore + this.frozenFunds = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.riskRatio = null; + } /** * common response */ @@ -52,16 +80,15 @@ export class GetFuturesAccountResp implements Response { +export class GetFuturesLedgerDataList implements Serializable { /** * ledger time */ - time?: number; + time: number; + /** * Type: RealisedPNL, Deposit, Withdrawal, TransferIn, TransferOut */ - type?: string; + type: string; + /** * Transaction amount */ - amount?: number; + amount: number; + /** * Fee */ - fee?: number; + fee: number; + /** * Account equity */ - accountEquity?: number; + accountEquity: number; + /** * Status: Completed, Pending */ - status?: string; + status: string; + /** * Ticker symbol of the contract */ - remark?: string; + remark: string; + /** * Offset */ - offset?: number; + offset: number; + /** * Currency */ - currency?: string; + currency: string; - fromJson(input: string): GetFuturesLedgerDataList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesLedgerDataList, jsonObject); + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.accountEquity = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.offset = null; + // @ts-ignore + this.currency = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesLedgerDataList { - return plainToInstance(GetFuturesLedgerDataList, jsonObject); + static fromJson(input: string): GetFuturesLedgerDataList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesLedgerDataList { + return plainToClassFromExist(new GetFuturesLedgerDataList(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts index 86b4c42e..245e0998 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesLedgerReq implements Serializable { +export class GetFuturesLedgerReq implements Serializable { /** * Currency of transaction history, XBT or USDT */ currency?: string; + /** * Type RealisedPNL-Realised profit and loss, Deposit-Deposit, Withdrawal-withdraw, Transferin-Transfer in, TransferOut-Transfer out */ type?: string; + /** * Start offset. Generally, the only attribute of the last returned result of the previous request is used, and the first page is returned by default */ offset?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ forward?: boolean = true; + /** * Displayed size per page. The default size is 50 */ maxCount?: number = 50; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetFuturesLedgerReq` class. * The builder pattern allows step-by-step construction of a `GetFuturesLedgerReq` object. */ static builder(): GetFuturesLedgerReqBuilder { - return new GetFuturesLedgerReqBuilder(); + return new GetFuturesLedgerReqBuilder(new GetFuturesLedgerReq()); } /** @@ -78,29 +85,38 @@ export class GetFuturesLedgerReq implements Serializable { obj.currency = data.currency; obj.type = data.type; obj.offset = data.offset; - obj.forward = data.forward; - obj.maxCount = data.maxCount; + if (data.forward) { + obj.forward = data.forward; + } else { + obj.forward = true; + } + if (data.maxCount) { + obj.maxCount = data.maxCount; + } else { + obj.maxCount = 50; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetFuturesLedgerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesLedgerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesLedgerReq { - return plainToInstance(GetFuturesLedgerReq, jsonObject); + static fromJson(input: string): GetFuturesLedgerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesLedgerReq { + return plainToClassFromExist(new GetFuturesLedgerReq(), jsonObject); } } export class GetFuturesLedgerReqBuilder { - obj: GetFuturesLedgerReq = new GetFuturesLedgerReq(); + constructor(readonly obj: GetFuturesLedgerReq) { + this.obj = obj; + } /** * Currency of transaction history, XBT or USDT */ diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts index 012dd4bd..77e33c17 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetFuturesLedgerDataList } from './model_get_futures_ledger_data_list'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFuturesLedgerResp implements Response { +export class GetFuturesLedgerResp implements Response { /** * */ @Type(() => GetFuturesLedgerDataList) - dataList?: Array; + dataList: Array; + /** * Is it the last page. If it is false, it means it is the last page, and if it is true, it means need to turn the page. */ - hasMore?: boolean; + hasMore: boolean; + private constructor() { + // @ts-ignore + this.dataList = null; + // @ts-ignore + this.hasMore = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetFuturesLedgerResp implements Response -{ +export class GetIsolatedMarginAccountAssets implements Serializable { /** * Symbol */ - symbol?: string; + symbol: string; + /** * Position status; EFFECTIVE-effective, BANKRUPTCY-bankruptcy liquidation, LIQUIDATION-closing, REPAY-repayment, BORROW borrowing */ - status?: GetIsolatedMarginAccountAssets.StatusEnum; + status: GetIsolatedMarginAccountAssets.StatusEnum; + /** * debt ratio */ - debtRatio?: string; + debtRatio: string; + /** * */ @Type(() => GetIsolatedMarginAccountAssetsBaseAsset) - baseAsset?: GetIsolatedMarginAccountAssetsBaseAsset; + baseAsset: GetIsolatedMarginAccountAssetsBaseAsset; + /** * */ @Type(() => GetIsolatedMarginAccountAssetsQuoteAsset) - quoteAsset?: GetIsolatedMarginAccountAssetsQuoteAsset; + quoteAsset: GetIsolatedMarginAccountAssetsQuoteAsset; - fromJson(input: string): GetIsolatedMarginAccountAssets { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountAssets, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.baseAsset = null; + // @ts-ignore + this.quoteAsset = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountAssets { - return plainToInstance(GetIsolatedMarginAccountAssets, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountAssets { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssets { + return plainToClassFromExist(new GetIsolatedMarginAccountAssets(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts index e5772397..323461f5 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts @@ -1,54 +1,76 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountAssetsBaseAsset - implements Serializable -{ +export class GetIsolatedMarginAccountAssetsBaseAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Support borrow or not */ - borrowEnabled?: boolean; + borrowEnabled: boolean; + /** * Support transfer or not */ - transferInEnabled?: boolean; + transferInEnabled: boolean; + /** * Liabilities */ - liability?: string; + liability: string; + /** * Total Assets */ - total?: string; + total: string; + /** * Account available assets (total assets - frozen) */ - available?: string; + available: string; + /** * Account frozen assets */ - hold?: string; + hold: string; + /** * The user\'s remaining maximum loan amount */ - maxBorrowSize?: string; + maxBorrowSize: string; - fromJson(input: string): GetIsolatedMarginAccountAssetsBaseAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountAssetsBaseAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.borrowEnabled = null; + // @ts-ignore + this.transferInEnabled = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.total = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.hold = null; + // @ts-ignore + this.maxBorrowSize = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsBaseAsset { - return plainToInstance(GetIsolatedMarginAccountAssetsBaseAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountAssetsBaseAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsBaseAsset { + return plainToClassFromExist(new GetIsolatedMarginAccountAssetsBaseAsset(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts index eea675c1..bf9b2f12 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts @@ -1,54 +1,76 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountAssetsQuoteAsset - implements Serializable -{ +export class GetIsolatedMarginAccountAssetsQuoteAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Support borrow or not */ - borrowEnabled?: boolean; + borrowEnabled: boolean; + /** * Support transfer or not */ - transferInEnabled?: boolean; + transferInEnabled: boolean; + /** * Liabilities */ - liability?: string; + liability: string; + /** * Total Assets */ - total?: string; + total: string; + /** * Account available assets (total assets - frozen) */ - available?: string; + available: string; + /** * Account frozen assets */ - hold?: string; + hold: string; + /** * The user\'s remaining maximum loan amount */ - maxBorrowSize?: string; + maxBorrowSize: string; - fromJson(input: string): GetIsolatedMarginAccountAssetsQuoteAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountAssetsQuoteAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.borrowEnabled = null; + // @ts-ignore + this.transferInEnabled = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.total = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.hold = null; + // @ts-ignore + this.maxBorrowSize = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsQuoteAsset { - return plainToInstance(GetIsolatedMarginAccountAssetsQuoteAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountAssetsQuoteAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsQuoteAsset { + return plainToClassFromExist(new GetIsolatedMarginAccountAssetsQuoteAsset(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts index 93fec048..b04a8a66 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts @@ -1,50 +1,69 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountDetailV1BaseAsset - implements Serializable -{ +export class GetIsolatedMarginAccountDetailV1BaseAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Current currency total asset amount */ - totalBalance?: string; + totalBalance: string; + /** * Current currency holding asset amount */ - holdBalance?: string; + holdBalance: string; + /** * Current available asset amount */ - availableBalance?: string; + availableBalance: string; + /** * Liabilities */ - liability?: string; + liability: string; + /** * */ - interest?: string; + interest: string; + /** * */ - borrowableAmount?: string; + borrowableAmount: string; - fromJson(input: string): GetIsolatedMarginAccountDetailV1BaseAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountDetailV1BaseAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.totalBalance = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.borrowableAmount = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1BaseAsset { - return plainToInstance(GetIsolatedMarginAccountDetailV1BaseAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountDetailV1BaseAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1BaseAsset { + return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1BaseAsset(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts index 32360058..28ffea8e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts @@ -1,50 +1,69 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountDetailV1QuoteAsset - implements Serializable -{ +export class GetIsolatedMarginAccountDetailV1QuoteAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Current currency total asset amount */ - totalBalance?: string; + totalBalance: string; + /** * Current currency holding asset amount */ - holdBalance?: string; + holdBalance: string; + /** * Current available asset amount */ - availableBalance?: string; + availableBalance: string; + /** * Liabilities */ - liability?: string; + liability: string; + /** * */ - interest?: string; + interest: string; + /** * */ - borrowableAmount?: string; + borrowableAmount: string; - fromJson(input: string): GetIsolatedMarginAccountDetailV1QuoteAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountDetailV1QuoteAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.totalBalance = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.borrowableAmount = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1QuoteAsset { - return plainToInstance(GetIsolatedMarginAccountDetailV1QuoteAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountDetailV1QuoteAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1QuoteAsset { + return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1QuoteAsset(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts index cac8794d..fa6e2875 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts @@ -1,24 +1,25 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountDetailV1Req - implements Serializable -{ +export class GetIsolatedMarginAccountDetailV1Req implements Serializable { /** * */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginAccountDetailV1Req` class. * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountDetailV1Req` object. */ static builder(): GetIsolatedMarginAccountDetailV1ReqBuilder { - return new GetIsolatedMarginAccountDetailV1ReqBuilder(); + return new GetIsolatedMarginAccountDetailV1ReqBuilder( + new GetIsolatedMarginAccountDetailV1Req(), + ); } /** @@ -35,22 +36,23 @@ export class GetIsolatedMarginAccountDetailV1Req return obj; } - fromJson(input: string): GetIsolatedMarginAccountDetailV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountDetailV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Req { - return plainToInstance(GetIsolatedMarginAccountDetailV1Req, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountDetailV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Req { + return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1Req(), jsonObject); } } export class GetIsolatedMarginAccountDetailV1ReqBuilder { - obj: GetIsolatedMarginAccountDetailV1Req = new GetIsolatedMarginAccountDetailV1Req(); + constructor(readonly obj: GetIsolatedMarginAccountDetailV1Req) { + this.obj = obj; + } /** * */ diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts index e43989df..63baef8f 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts @@ -1,37 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetIsolatedMarginAccountDetailV1BaseAsset } from './model_get_isolated_margin_account_detail_v1_base_asset'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetIsolatedMarginAccountDetailV1QuoteAsset } from './model_get_isolated_margin_account_detail_v1_quote_asset'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountDetailV1Resp - implements Response -{ +export class GetIsolatedMarginAccountDetailV1Resp implements Response { /** * Symbol */ - symbol?: string; + symbol: string; + /** * The position status: Existing liabilities-DEBT, No liabilities-CLEAR, Bankrupcy (after position enters a negative balance)-BANKRUPTCY, Existing borrowings-IN_BORROW, Existing repayments-IN_REPAY, Under liquidation-IN_LIQUIDATION, Under auto-renewal assets-IN_AUTO_RENEW . */ - status?: GetIsolatedMarginAccountDetailV1Resp.StatusEnum; + status: GetIsolatedMarginAccountDetailV1Resp.StatusEnum; + /** * debt ratio */ - debtRatio?: string; + debtRatio: string; + /** * */ @Type(() => GetIsolatedMarginAccountDetailV1BaseAsset) - baseAsset?: GetIsolatedMarginAccountDetailV1BaseAsset; + baseAsset: GetIsolatedMarginAccountDetailV1BaseAsset; + /** * */ @Type(() => GetIsolatedMarginAccountDetailV1QuoteAsset) - quoteAsset?: GetIsolatedMarginAccountDetailV1QuoteAsset; + quoteAsset: GetIsolatedMarginAccountDetailV1QuoteAsset; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.baseAsset = null; + // @ts-ignore + this.quoteAsset = null; + } /** * common response */ @@ -42,17 +56,16 @@ export class GetIsolatedMarginAccountDetailV1Resp this.commonResponse = response; } - fromJson(input: string): GetIsolatedMarginAccountDetailV1Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountDetailV1Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Resp { - return plainToInstance(GetIsolatedMarginAccountDetailV1Resp, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountDetailV1Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Resp { + return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts index 8b813726..fc64c79e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets.ts @@ -1,47 +1,60 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { GetIsolatedMarginAccountListV1AssetsBaseAsset } from './model_get_isolated_margin_account_list_v1_assets_base_asset'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { GetIsolatedMarginAccountListV1AssetsQuoteAsset } from './model_get_isolated_margin_account_list_v1_assets_quote_asset'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountListV1Assets - implements Serializable -{ +export class GetIsolatedMarginAccountListV1Assets implements Serializable { /** * Symbol */ - symbol?: string; + symbol: string; + /** * The position status: Existing liabilities-DEBT, No liabilities-CLEAR, Bankrupcy (after position enters a negative balance)-BANKRUPTCY, Existing borrowings-IN_BORROW, Existing repayments-IN_REPAY, Under liquidation-IN_LIQUIDATION, Under auto-renewal assets-IN_AUTO_RENEW . */ - status?: GetIsolatedMarginAccountListV1Assets.StatusEnum; + status: GetIsolatedMarginAccountListV1Assets.StatusEnum; + /** * debt ratio */ - debtRatio?: string; + debtRatio: string; + /** * */ @Type(() => GetIsolatedMarginAccountListV1AssetsBaseAsset) - baseAsset?: GetIsolatedMarginAccountListV1AssetsBaseAsset; + baseAsset: GetIsolatedMarginAccountListV1AssetsBaseAsset; + /** * */ @Type(() => GetIsolatedMarginAccountListV1AssetsQuoteAsset) - quoteAsset?: GetIsolatedMarginAccountListV1AssetsQuoteAsset; + quoteAsset: GetIsolatedMarginAccountListV1AssetsQuoteAsset; - fromJson(input: string): GetIsolatedMarginAccountListV1Assets { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountListV1Assets, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.baseAsset = null; + // @ts-ignore + this.quoteAsset = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Assets { - return plainToInstance(GetIsolatedMarginAccountListV1Assets, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountListV1Assets { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Assets { + return plainToClassFromExist(new GetIsolatedMarginAccountListV1Assets(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts index 6251c734..542856d2 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts @@ -1,50 +1,72 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountListV1AssetsBaseAsset - implements Serializable -{ +export class GetIsolatedMarginAccountListV1AssetsBaseAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Current currency total asset amount */ - totalBalance?: string; + totalBalance: string; + /** * Current currency holding asset amount */ - holdBalance?: string; + holdBalance: string; + /** * Current available asset amount */ - availableBalance?: string; + availableBalance: string; + /** * Liabilities */ - liability?: string; + liability: string; + /** * */ - interest?: string; + interest: string; + /** * */ - borrowableAmount?: string; + borrowableAmount: string; - fromJson(input: string): GetIsolatedMarginAccountListV1AssetsBaseAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountListV1AssetsBaseAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.totalBalance = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.borrowableAmount = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsBaseAsset { - return plainToInstance(GetIsolatedMarginAccountListV1AssetsBaseAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountListV1AssetsBaseAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsBaseAsset { + return plainToClassFromExist( + new GetIsolatedMarginAccountListV1AssetsBaseAsset(), + jsonObject, + ); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts index eae6889f..aa84a856 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts @@ -1,50 +1,72 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountListV1AssetsQuoteAsset - implements Serializable -{ +export class GetIsolatedMarginAccountListV1AssetsQuoteAsset implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Current currency total asset amount */ - totalBalance?: string; + totalBalance: string; + /** * Current currency holding asset amount */ - holdBalance?: string; + holdBalance: string; + /** * Current available asset amount */ - availableBalance?: string; + availableBalance: string; + /** * Liabilities */ - liability?: string; + liability: string; + /** * */ - interest?: string; + interest: string; + /** * */ - borrowableAmount?: string; + borrowableAmount: string; - fromJson(input: string): GetIsolatedMarginAccountListV1AssetsQuoteAsset { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountListV1AssetsQuoteAsset, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.totalBalance = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.borrowableAmount = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsQuoteAsset { - return plainToInstance(GetIsolatedMarginAccountListV1AssetsQuoteAsset, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountListV1AssetsQuoteAsset { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsQuoteAsset { + return plainToClassFromExist( + new GetIsolatedMarginAccountListV1AssetsQuoteAsset(), + jsonObject, + ); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts index 268bf4e5..3a9f67a1 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts @@ -1,23 +1,24 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountListV1Req - implements Serializable -{ +export class GetIsolatedMarginAccountListV1Req implements Serializable { /** * quote currency, currently only supports USDT, KCS, BTC, USDT as default */ balanceCurrency?: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum = GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC; + private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginAccountListV1Req` class. * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountListV1Req` object. */ static builder(): GetIsolatedMarginAccountListV1ReqBuilder { - return new GetIsolatedMarginAccountListV1ReqBuilder(); + return new GetIsolatedMarginAccountListV1ReqBuilder( + new GetIsolatedMarginAccountListV1Req(), + ); } /** @@ -30,21 +31,24 @@ export class GetIsolatedMarginAccountListV1Req balanceCurrency?: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum; }): GetIsolatedMarginAccountListV1Req { let obj = new GetIsolatedMarginAccountListV1Req(); - obj.balanceCurrency = data.balanceCurrency; + if (data.balanceCurrency) { + obj.balanceCurrency = data.balanceCurrency; + } else { + obj.balanceCurrency = GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC; + } return obj; } - fromJson(input: string): GetIsolatedMarginAccountListV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountListV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Req { - return plainToInstance(GetIsolatedMarginAccountListV1Req, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountListV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Req { + return plainToClassFromExist(new GetIsolatedMarginAccountListV1Req(), jsonObject); } } @@ -66,7 +70,9 @@ export namespace GetIsolatedMarginAccountListV1Req { } export class GetIsolatedMarginAccountListV1ReqBuilder { - obj: GetIsolatedMarginAccountListV1Req = new GetIsolatedMarginAccountListV1Req(); + constructor(readonly obj: GetIsolatedMarginAccountListV1Req) { + this.obj = obj; + } /** * quote currency, currently only supports USDT, KCS, BTC, USDT as default */ diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts index 5e21a96e..f75e78d6 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts @@ -1,27 +1,35 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetIsolatedMarginAccountListV1Assets } from './model_get_isolated_margin_account_list_v1_assets'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountListV1Resp - implements Response -{ +export class GetIsolatedMarginAccountListV1Resp implements Response { /** * The total balance of the isolated margin account(in the request coin) */ - totalConversionBalance?: string; + totalConversionBalance: string; + /** * Total liabilities of the isolated margin account(in the request coin) */ - liabilityConversionBalance?: string; + liabilityConversionBalance: string; + /** * Account list */ @Type(() => GetIsolatedMarginAccountListV1Assets) - assets?: Array; + assets: Array; + private constructor() { + // @ts-ignore + this.totalConversionBalance = null; + // @ts-ignore + this.liabilityConversionBalance = null; + // @ts-ignore + this.assets = null; + } /** * common response */ @@ -32,16 +40,15 @@ export class GetIsolatedMarginAccountListV1Resp this.commonResponse = response; } - fromJson(input: string): GetIsolatedMarginAccountListV1Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountListV1Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Resp { - return plainToInstance(GetIsolatedMarginAccountListV1Resp, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountListV1Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Resp { + return plainToClassFromExist(new GetIsolatedMarginAccountListV1Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts index 12dbe92e..a706a8f7 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_req.ts @@ -1,30 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginAccountReq implements Serializable { +export class GetIsolatedMarginAccountReq implements Serializable { /** * For isolated trading pairs, query all without passing */ symbol?: string; + /** * quote currency, currently only supports USDT, KCS, BTC, USDT as default */ quoteCurrency?: GetIsolatedMarginAccountReq.QuoteCurrencyEnum = GetIsolatedMarginAccountReq.QuoteCurrencyEnum.USDT; + /** * Query account type (default ISOLATED), ISOLATED- - only query low frequency isolated margin account, ISOLATED_V2-only query high frequency isolated margin account, ALL - consistent aggregate query with the web side */ queryType?: GetIsolatedMarginAccountReq.QueryTypeEnum = GetIsolatedMarginAccountReq.QueryTypeEnum.ISOLATED; + private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginAccountReq` class. * The builder pattern allows step-by-step construction of a `GetIsolatedMarginAccountReq` object. */ static builder(): GetIsolatedMarginAccountReqBuilder { - return new GetIsolatedMarginAccountReqBuilder(); + return new GetIsolatedMarginAccountReqBuilder(new GetIsolatedMarginAccountReq()); } /** @@ -46,22 +49,29 @@ export class GetIsolatedMarginAccountReq implements Serializable -{ +export class GetIsolatedMarginAccountResp implements Response { /** * Total Assets in Quote Currency */ - totalAssetOfQuoteCurrency?: string; + totalAssetOfQuoteCurrency: string; + /** * Total Liability in Quote Currency */ - totalLiabilityOfQuoteCurrency?: string; + totalLiabilityOfQuoteCurrency: string; + /** * timestamp */ - timestamp?: number; + timestamp: number; + /** * */ @Type(() => GetIsolatedMarginAccountAssets) - assets?: Array; + assets: Array; + private constructor() { + // @ts-ignore + this.totalAssetOfQuoteCurrency = null; + // @ts-ignore + this.totalLiabilityOfQuoteCurrency = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.assets = null; + } /** * common response */ @@ -36,16 +47,15 @@ export class GetIsolatedMarginAccountResp this.commonResponse = response; } - fromJson(input: string): GetIsolatedMarginAccountResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginAccountResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginAccountResp { - return plainToInstance(GetIsolatedMarginAccountResp, jsonObject); + static fromJson(input: string): GetIsolatedMarginAccountResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginAccountResp { + return plainToClassFromExist(new GetIsolatedMarginAccountResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts index 4d8fd427..dd639d7a 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts @@ -1,46 +1,62 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarginAccountDetailAccounts - implements Serializable -{ +export class GetMarginAccountDetailAccounts implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Total funds in the account */ - totalBalance?: string; + totalBalance: string; + /** * Available funds in the account */ - availableBalance?: string; + availableBalance: string; + /** * Funds on hold in the account */ - holdBalance?: string; + holdBalance: string; + /** * Total liabilities */ - liability?: string; + liability: string; + /** * Available size to borrow */ - maxBorrowSize?: string; + maxBorrowSize: string; - fromJson(input: string): GetMarginAccountDetailAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginAccountDetailAccounts, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.totalBalance = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.liability = null; + // @ts-ignore + this.maxBorrowSize = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginAccountDetailAccounts { - return plainToInstance(GetMarginAccountDetailAccounts, jsonObject); + static fromJson(input: string): GetMarginAccountDetailAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginAccountDetailAccounts { + return plainToClassFromExist(new GetMarginAccountDetailAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts index f694db43..ad52b4b1 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts @@ -1,23 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetMarginAccountDetailAccounts } from './model_get_margin_account_detail_accounts'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarginAccountDetailResp - implements Response -{ +export class GetMarginAccountDetailResp implements Response { /** * Debt ratio */ - debtRatio?: string; + debtRatio: string; + /** * Margin account list */ @Type(() => GetMarginAccountDetailAccounts) - accounts?: Array; + accounts: Array; + private constructor() { + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.accounts = null; + } /** * common response */ @@ -28,16 +33,15 @@ export class GetMarginAccountDetailResp this.commonResponse = response; } - fromJson(input: string): GetMarginAccountDetailResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginAccountDetailResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginAccountDetailResp { - return plainToInstance(GetMarginAccountDetailResp, jsonObject); + static fromJson(input: string): GetMarginAccountDetailResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginAccountDetailResp { + return plainToClassFromExist(new GetMarginAccountDetailResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts index 17f24560..16eaddd9 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts @@ -1,64 +1,74 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarginHFLedgerData implements Serializable { +export class GetMarginHFLedgerData implements Serializable { /** * */ id?: number; + /** * currency */ currency?: string; + /** * Change in funds balance */ amount?: string; + /** * Deposit or withdrawal fee */ fee?: string; + /** * Total balance of funds after change */ balance?: string; + /** * Master account type TRADE_HF */ accountType?: string; + /** * Trnasaction type,such as TRANSFER, TRADE_EXCHANGE, etc. */ bizType?: string; + /** * Direction of transfer( out or in) */ direction?: string; + /** * Ledger creation time */ createdAt?: number; + /** * Core transaction parameter */ context?: string; + /** * */ tax?: string; - fromJson(input: string): GetMarginHFLedgerData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginHFLedgerData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginHFLedgerData { - return plainToInstance(GetMarginHFLedgerData, jsonObject); + static fromJson(input: string): GetMarginHFLedgerData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginHFLedgerData { + return plainToClassFromExist(new GetMarginHFLedgerData(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts index be97ed2e..1f979f20 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarginHFLedgerReq implements Serializable { +export class GetMarginHFLedgerReq implements Serializable { /** * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty */ currency?: string; + /** * direction: in, out */ direction?: GetMarginHFLedgerReq.DirectionEnum; + /** * Transaction type: TRANSFER- transfer funds, MARGIN_EXCHANGE - cross margin trade, ISOLATED_EXCHANGE - isolated margin trade, LIQUIDATION - liquidation, ASSERT_RETURN - forced liquidation asset return */ bizType?: string; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. */ lastId?: number; + /** * Default100,Max200 */ limit?: number = 100; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetMarginHFLedgerReq` class. * The builder pattern allows step-by-step construction of a `GetMarginHFLedgerReq` object. */ static builder(): GetMarginHFLedgerReqBuilder { - return new GetMarginHFLedgerReqBuilder(); + return new GetMarginHFLedgerReqBuilder(new GetMarginHFLedgerReq()); } /** @@ -79,23 +86,26 @@ export class GetMarginHFLedgerReq implements Serializable obj.direction = data.direction; obj.bizType = data.bizType; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 100; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetMarginHFLedgerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginHFLedgerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginHFLedgerReq { - return plainToInstance(GetMarginHFLedgerReq, jsonObject); + static fromJson(input: string): GetMarginHFLedgerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginHFLedgerReq { + return plainToClassFromExist(new GetMarginHFLedgerReq(), jsonObject); } } @@ -113,7 +123,9 @@ export namespace GetMarginHFLedgerReq { } export class GetMarginHFLedgerReqBuilder { - obj: GetMarginHFLedgerReq = new GetMarginHFLedgerReq(); + constructor(readonly obj: GetMarginHFLedgerReq) { + this.obj = obj; + } /** * currency, optional,can select more than one,separate with commas,select no more than 10 currencys,the default will be to query for all currencys if left empty */ diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts index 2f7c7aca..6ce7aae5 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetMarginHFLedgerData } from './model_get_margin_hf_ledger_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarginHFLedgerResp implements Response { +export class GetMarginHFLedgerResp implements Response { /** * */ @Type(() => GetMarginHFLedgerData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetMarginHFLedgerResp implements Response { +export class GetSpotAccountDetailReq implements Serializable { /** * Path parameter. Account ID */ @Reflect.metadata('path', 'accountId') accountId?: string; + private constructor() {} /** * Creates a new instance of the `GetSpotAccountDetailReq` class. * The builder pattern allows step-by-step construction of a `GetSpotAccountDetailReq` object. */ static builder(): GetSpotAccountDetailReqBuilder { - return new GetSpotAccountDetailReqBuilder(); + return new GetSpotAccountDetailReqBuilder(new GetSpotAccountDetailReq()); } /** @@ -33,22 +34,23 @@ export class GetSpotAccountDetailReq implements Serializable { +export class GetSpotAccountDetailResp implements Response { /** * The currency of the account */ - currency?: string; + currency: string; + /** * Total funds in the account */ - balance?: string; + balance: string; + /** * Funds available to withdraw or trade */ - available?: string; + available: string; + /** * Funds on hold (not available for use) */ - holds?: string; + holds: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.balance = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.holds = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class GetSpotAccountDetailResp implements Response { +export class GetSpotAccountListData implements Serializable { /** * Account ID */ - id?: string; + id: string; + /** * Currency */ - currency?: string; + currency: string; + /** * Account type:,main、trade、isolated(abandon)、margin(abandon) */ - type?: GetSpotAccountListData.TypeEnum; + type: GetSpotAccountListData.TypeEnum; + /** * Total funds in the account */ - balance?: string; + balance: string; + /** * Funds available to withdraw or trade */ - available?: string; + available: string; + /** * Funds on hold (not available for use) */ - holds?: string; + holds: string; - fromJson(input: string): GetSpotAccountListData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotAccountListData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.balance = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.holds = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotAccountListData { - return plainToInstance(GetSpotAccountListData, jsonObject); + static fromJson(input: string): GetSpotAccountListData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotAccountListData { + return plainToClassFromExist(new GetSpotAccountListData(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts index d1fd69f3..ff03367c 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotAccountListReq implements Serializable { +export class GetSpotAccountListReq implements Serializable { /** * currency */ currency?: string; + /** * Account type main、trade */ type?: GetSpotAccountListReq.TypeEnum; + private constructor() {} /** * Creates a new instance of the `GetSpotAccountListReq` class. * The builder pattern allows step-by-step construction of a `GetSpotAccountListReq` object. */ static builder(): GetSpotAccountListReqBuilder { - return new GetSpotAccountListReqBuilder(); + return new GetSpotAccountListReqBuilder(new GetSpotAccountListReq()); } /** @@ -40,17 +42,16 @@ export class GetSpotAccountListReq implements Serializable { +export class GetSpotAccountListResp implements Response { /** * */ @Type(() => GetSpotAccountListData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSpotAccountListResp implements Response { +export class GetSpotAccountTypeResp implements Response { /** * Spot account type. True means the current user is a high-frequency spot user, False means the current user is a low-frequency spot user */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetSpotAccountTypeResp implements Response { +export class GetSpotHFLedgerData implements Serializable { /** * Unique id */ - id?: string; + id: string; + /** * currency */ - currency?: string; + currency: string; + /** * Change in funds balance */ - amount?: string; + amount: string; + /** * Deposit or withdrawal fee */ - fee?: string; + fee: string; + /** * */ - tax?: string; + tax: string; + /** * Total balance of funds after change */ - balance?: string; + balance: string; + /** * Master account type TRADE_HF */ - accountType?: string; + accountType: string; + /** * Trnasaction type,such as TRANSFER, TRADE_EXCHANGE, etc. */ - bizType?: string; + bizType: string; + /** * Direction of transfer( out or in) */ - direction?: GetSpotHFLedgerData.DirectionEnum; + direction: GetSpotHFLedgerData.DirectionEnum; + /** * Created time */ - createdAt?: string; + createdAt: string; + /** * Core transaction parameter */ - context?: string; + context: string; - fromJson(input: string): GetSpotHFLedgerData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotHFLedgerData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.balance = null; + // @ts-ignore + this.accountType = null; + // @ts-ignore + this.bizType = null; + // @ts-ignore + this.direction = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.context = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotHFLedgerData { - return plainToInstance(GetSpotHFLedgerData, jsonObject); + static fromJson(input: string): GetSpotHFLedgerData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotHFLedgerData { + return plainToClassFromExist(new GetSpotHFLedgerData(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts index 996d6ad6..a223af72 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotHFLedgerReq implements Serializable { +export class GetSpotHFLedgerReq implements Serializable { /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. */ currency?: string; + /** * direction: in, out */ direction?: GetSpotHFLedgerReq.DirectionEnum; + /** * Transaction type: TRANSFER-transfer funds,TRADE_EXCHANGE-Trade */ bizType?: GetSpotHFLedgerReq.BizTypeEnum; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. */ lastId?: number; + /** * Default100,Max200 */ limit?: number = 100; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetSpotHFLedgerReq` class. * The builder pattern allows step-by-step construction of a `GetSpotHFLedgerReq` object. */ static builder(): GetSpotHFLedgerReqBuilder { - return new GetSpotHFLedgerReqBuilder(); + return new GetSpotHFLedgerReqBuilder(new GetSpotHFLedgerReq()); } /** @@ -79,23 +86,26 @@ export class GetSpotHFLedgerReq implements Serializable { obj.direction = data.direction; obj.bizType = data.bizType; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 100; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetSpotHFLedgerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotHFLedgerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotHFLedgerReq { - return plainToInstance(GetSpotHFLedgerReq, jsonObject); + static fromJson(input: string): GetSpotHFLedgerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotHFLedgerReq { + return plainToClassFromExist(new GetSpotHFLedgerReq(), jsonObject); } } @@ -123,7 +133,9 @@ export namespace GetSpotHFLedgerReq { } export class GetSpotHFLedgerReqBuilder { - obj: GetSpotHFLedgerReq = new GetSpotHFLedgerReq(); + constructor(readonly obj: GetSpotHFLedgerReq) { + this.obj = obj; + } /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. */ diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts index e3f600ee..209529a0 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetSpotHFLedgerData } from './model_get_spot_hf_ledger_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotHFLedgerResp implements Response { +export class GetSpotHFLedgerResp implements Response { /** * */ @Type(() => GetSpotHFLedgerData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSpotHFLedgerResp implements Response { +export class GetSpotLedgerItems implements Serializable { /** * unique id */ id?: string; + /** * The currency of an account */ currency?: string; + /** * The total amount of assets (fees included) involved in assets changes such as transaction, withdrawal and bonus distribution. */ amount?: string; + /** * Fees generated in transaction, withdrawal, etc. */ fee?: string; + /** * Remaining funds after the transaction. */ balance?: string; + /** * The account type of the master user: MAIN, TRADE, MARGIN or CONTRACT. */ accountType?: string; + /** * Business type leading to the changes in funds, such as exchange, withdrawal, deposit, KUCOIN_BONUS, REFERRAL_BONUS, Lendings etc. */ bizType?: string; + /** * Side, out or in */ direction?: string; + /** * Time of the event */ createdAt?: number; + /** * Business related information such as order ID, serial No., etc. */ context?: string; - fromJson(input: string): GetSpotLedgerItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotLedgerItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotLedgerItems { - return plainToInstance(GetSpotLedgerItems, jsonObject); + static fromJson(input: string): GetSpotLedgerItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotLedgerItems { + return plainToClassFromExist(new GetSpotLedgerItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts index a7296c45..617a38f0 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotLedgerReq implements Serializable { +export class GetSpotLedgerReq implements Serializable { /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. */ currency?: string; + /** * direction: in, out */ direction?: GetSpotLedgerReq.DirectionEnum; + /** * Type: DEPOSIT -deposit, WITHDRAW -withdraw, TRANSFER -transfer, SUB_TRANSFER -subaccount transfer,TRADE_EXCHANGE -trade, MARGIN_EXCHANGE -margin trade, KUCOIN_BONUS -bonus, BROKER_TRANSFER -Broker transfer record */ bizType?: string; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetSpotLedgerReq` class. * The builder pattern allows step-by-step construction of a `GetSpotLedgerReq` object. */ static builder(): GetSpotLedgerReqBuilder { - return new GetSpotLedgerReqBuilder(); + return new GetSpotLedgerReqBuilder(new GetSpotLedgerReq()); } /** @@ -80,22 +87,29 @@ export class GetSpotLedgerReq implements Serializable { obj.bizType = data.bizType; obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetSpotLedgerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotLedgerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotLedgerReq { - return plainToInstance(GetSpotLedgerReq, jsonObject); + static fromJson(input: string): GetSpotLedgerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotLedgerReq { + return plainToClassFromExist(new GetSpotLedgerReq(), jsonObject); } } @@ -113,7 +127,9 @@ export namespace GetSpotLedgerReq { } export class GetSpotLedgerReqBuilder { - obj: GetSpotLedgerReq = new GetSpotLedgerReq(); + constructor(readonly obj: GetSpotLedgerReq) { + this.obj = obj; + } /** * Currency ( you can choose more than one currency). You can specify 10 currencies at most for one time. If not specified, all currencies will be inquired by default. */ diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts index e1d0e783..35cafa4b 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetSpotLedgerItems } from './model_get_spot_ledger_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotLedgerResp implements Response { +export class GetSpotLedgerResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetSpotLedgerItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetSpotLedgerResp implements Response { +export class AddDepositAddressV1Req implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. */ chain?: string = 'eth'; + private constructor() { + // @ts-ignore + this.currency = null; + } /** * Creates a new instance of the `AddDepositAddressV1Req` class. * The builder pattern allows step-by-step construction of a `AddDepositAddressV1Req` object. */ static builder(): AddDepositAddressV1ReqBuilder { - return new AddDepositAddressV1ReqBuilder(); + return new AddDepositAddressV1ReqBuilder(new AddDepositAddressV1Req()); } /** @@ -28,7 +33,7 @@ export class AddDepositAddressV1Req implements Serializable { +export class AddDepositAddressV1Resp implements Response { /** * Deposit address */ - address?: string; + address: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ - memo?: string; + memo: string; + /** * The chainName of currency */ - chain?: string; + chain: string; + /** * The chainId of currency */ - chainId?: string; + chainId: string; + /** * Deposit account type: main (funding account), trade (spot trading account) */ - to?: AddDepositAddressV1Resp.ToEnum; + to: AddDepositAddressV1Resp.ToEnum; + /** * currency */ - currency?: string; + currency: string; + private constructor() { + // @ts-ignore + this.address = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.chain = null; + // @ts-ignore + this.chainId = null; + // @ts-ignore + this.to = null; + // @ts-ignore + this.currency = null; + } /** * common response */ @@ -40,17 +59,16 @@ export class AddDepositAddressV1Resp implements Response { +export class AddDepositAddressV3Req implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. */ chain?: string = 'eth'; + /** * Deposit account type: main (funding account), trade (spot trading account), the default is main */ to?: AddDepositAddressV3Req.ToEnum = AddDepositAddressV3Req.ToEnum.MAIN; + /** * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. */ amount?: string; + private constructor() { + // @ts-ignore + this.currency = null; + } /** * Creates a new instance of the `AddDepositAddressV3Req` class. * The builder pattern allows step-by-step construction of a `AddDepositAddressV3Req` object. */ static builder(): AddDepositAddressV3ReqBuilder { - return new AddDepositAddressV3ReqBuilder(); + return new AddDepositAddressV3ReqBuilder(new AddDepositAddressV3Req()); } /** @@ -36,7 +43,7 @@ export class AddDepositAddressV3Req implements Serializable { +export class AddDepositAddressV3Resp implements Response { /** * Deposit address */ - address?: string; + address: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ - memo?: string; + memo: string; + /** * The chainId of currency */ - chainId?: string; + chainId: string; + /** * Deposit account type: main (funding account), trade (spot trading account) */ - to?: string; + to: string; + /** * Expiration time, Lightning network expiration time, non-Lightning network this field is invalid */ - expirationDate?: number; + expirationDate: number; + /** * currency */ - currency?: string; + currency: string; + /** * The chainName of currency */ - chainName?: string; + chainName: string; + private constructor() { + // @ts-ignore + this.address = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.chainId = null; + // @ts-ignore + this.to = null; + // @ts-ignore + this.expirationDate = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.chainName = null; + } /** * common response */ @@ -44,16 +66,15 @@ export class AddDepositAddressV3Resp implements Response { +export class GetDepositAddressV1Req implements Serializable { /** * currency */ currency?: string; + /** * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. */ chain?: string = 'eth'; + private constructor() {} /** * Creates a new instance of the `GetDepositAddressV1Req` class. * The builder pattern allows step-by-step construction of a `GetDepositAddressV1Req` object. */ static builder(): GetDepositAddressV1ReqBuilder { - return new GetDepositAddressV1ReqBuilder(); + return new GetDepositAddressV1ReqBuilder(new GetDepositAddressV1Req()); } /** @@ -36,26 +38,31 @@ export class GetDepositAddressV1Req implements Serializable { +export class GetDepositAddressV1Resp implements Response { /** * Deposit address */ address?: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ memo?: string; + /** * The chainName of currency */ chain?: string; + /** * The chainId of currency */ chainId?: string; + /** * Deposit account type: main (funding account), trade (spot trading account) */ to?: GetDepositAddressV1Resp.ToEnum; + /** * currency */ currency?: string; + /** * The token contract address. */ contractAddress?: string; + private constructor() {} /** * common response */ @@ -44,17 +51,16 @@ export class GetDepositAddressV1Resp implements Response { +export class GetDepositAddressV2Data implements Serializable { /** * Deposit address */ address?: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ memo?: string; + /** * The chainName of currency */ chain?: string; + /** * The chainId of currency */ chainId?: string; + /** * Deposit account type: main (funding account), trade (spot trading account) */ to?: GetDepositAddressV2Data.ToEnum; + /** * currency */ currency?: string; + /** * The token contract address. */ contractAddress?: string; - fromJson(input: string): GetDepositAddressV2Data { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositAddressV2Data, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositAddressV2Data { - return plainToInstance(GetDepositAddressV2Data, jsonObject); + static fromJson(input: string): GetDepositAddressV2Data { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositAddressV2Data { + return plainToClassFromExist(new GetDepositAddressV2Data(), jsonObject); } } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts index e65a3315..ce347b61 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetDepositAddressV2Req implements Serializable { +export class GetDepositAddressV2Req implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetDepositAddressV2Req` class. * The builder pattern allows step-by-step construction of a `GetDepositAddressV2Req` object. */ static builder(): GetDepositAddressV2ReqBuilder { - return new GetDepositAddressV2ReqBuilder(); + return new GetDepositAddressV2ReqBuilder(new GetDepositAddressV2Req()); } /** @@ -31,22 +32,23 @@ export class GetDepositAddressV2Req implements Serializable { +export class GetDepositAddressV2Resp implements Response { /** * */ @Type(() => GetDepositAddressV2Data) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetDepositAddressV2Resp implements Response { +export class GetDepositAddressV3Data implements Serializable { /** * Deposit address */ - address?: string; + address: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ - memo?: string; + memo: string; + /** * The chainId of currency */ - chainId?: string; + chainId: string; + /** * Deposit account type: main (funding account), trade (spot trading account) */ - to?: string; + to: string; + /** * Expiration time, Lightning network expiration time, non-Lightning network this field is invalid */ - expirationDate?: number; + expirationDate: number; + /** * currency */ - currency?: string; + currency: string; + /** * The token contract address. */ - contractAddress?: string; + contractAddress: string; + /** * The chainName of currency */ - chainName?: string; + chainName: string; - fromJson(input: string): GetDepositAddressV3Data { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositAddressV3Data, jsonObject); + private constructor() { + // @ts-ignore + this.address = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.chainId = null; + // @ts-ignore + this.to = null; + // @ts-ignore + this.expirationDate = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.contractAddress = null; + // @ts-ignore + this.chainName = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositAddressV3Data { - return plainToInstance(GetDepositAddressV3Data, jsonObject); + static fromJson(input: string): GetDepositAddressV3Data { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositAddressV3Data { + return plainToClassFromExist(new GetDepositAddressV3Data(), jsonObject); } } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts index 0c06578e..a2a64318 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetDepositAddressV3Req implements Serializable { +export class GetDepositAddressV3Req implements Serializable { /** * currency */ currency?: string; + /** * Deposit amount. This parameter is only used when applying for invoices on the Lightning Network. This parameter is invalid if it is not passed through the Lightning Network. */ amount?: string; + /** * The chain Id of currency. */ chain?: string; + private constructor() {} /** * Creates a new instance of the `GetDepositAddressV3Req` class. * The builder pattern allows step-by-step construction of a `GetDepositAddressV3Req` object. */ static builder(): GetDepositAddressV3ReqBuilder { - return new GetDepositAddressV3ReqBuilder(); + return new GetDepositAddressV3ReqBuilder(new GetDepositAddressV3Req()); } /** @@ -49,22 +52,23 @@ export class GetDepositAddressV3Req implements Serializable { +export class GetDepositAddressV3Resp implements Response { /** * */ @Type(() => GetDepositAddressV3Data) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetDepositAddressV3Resp implements Response { +export class GetDepositHistoryItems implements Serializable { /** * Currency */ currency?: string; + /** * The chainName of currency */ chain?: string; + /** * Status */ status?: GetDepositHistoryItems.StatusEnum; + /** * Deposit address */ address?: string; + /** * Address remark. If there’s no remark, it is empty. */ memo?: string; + /** * Internal deposit or not */ isInner?: boolean; + /** * Deposit amount */ amount?: string; + /** * Fees charged for deposit */ fee?: string; + /** * Wallet Txid */ walletTxId?: string; + /** * Creation time of the database record */ createdAt?: number; + /** * Update time of the database record */ updatedAt?: number; + /** * remark */ remark?: string; + /** * Whether there is any debt.A quick rollback will cause the deposit to fail. If the deposit fails, you will need to repay the balance. */ arrears?: boolean; - fromJson(input: string): GetDepositHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositHistoryItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositHistoryItems { - return plainToInstance(GetDepositHistoryItems, jsonObject); + static fromJson(input: string): GetDepositHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositHistoryItems { + return plainToClassFromExist(new GetDepositHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts index 172bef48..efb0223b 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts @@ -1,45 +1,50 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetDepositHistoryOldItems implements Serializable { +export class GetDepositHistoryOldItems implements Serializable { /** * Currency */ currency?: string; + /** * Creation time of the database record */ createAt?: number; + /** * Deposit amount */ amount?: string; + /** * Wallet Txid */ walletTxId?: string; + /** * Internal deposit or not */ isInner?: boolean; + /** * */ status?: GetDepositHistoryOldItems.StatusEnum; - fromJson(input: string): GetDepositHistoryOldItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositHistoryOldItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositHistoryOldItems { - return plainToInstance(GetDepositHistoryOldItems, jsonObject); + static fromJson(input: string): GetDepositHistoryOldItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositHistoryOldItems { + return plainToClassFromExist(new GetDepositHistoryOldItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts index b0af0119..016c0def 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts @@ -1,32 +1,36 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetDepositHistoryOldReq implements Serializable { +export class GetDepositHistoryOldReq implements Serializable { /** * currency */ currency?: string; + /** * Status. Available value: PROCESSING, SUCCESS, and FAILURE */ status?: GetDepositHistoryOldReq.StatusEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetDepositHistoryOldReq` class. * The builder pattern allows step-by-step construction of a `GetDepositHistoryOldReq` object. */ static builder(): GetDepositHistoryOldReqBuilder { - return new GetDepositHistoryOldReqBuilder(); + return new GetDepositHistoryOldReqBuilder(new GetDepositHistoryOldReq()); } /** @@ -58,17 +62,16 @@ export class GetDepositHistoryOldReq implements Serializable { +export class GetDepositHistoryOldResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetDepositHistoryOldItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetDepositHistoryOldResp implements Response { +export class GetDepositHistoryReq implements Serializable { /** * currency */ currency?: string; + /** * Status. Available value: PROCESSING, SUCCESS, and FAILURE */ status?: GetDepositHistoryReq.StatusEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetDepositHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetDepositHistoryReq` object. */ static builder(): GetDepositHistoryReqBuilder { - return new GetDepositHistoryReqBuilder(); + return new GetDepositHistoryReqBuilder(new GetDepositHistoryReq()); } /** @@ -72,21 +78,24 @@ export class GetDepositHistoryReq implements Serializable obj.startAt = data.startAt; obj.endAt = data.endAt; obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetDepositHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositHistoryReq { - return plainToInstance(GetDepositHistoryReq, jsonObject); + static fromJson(input: string): GetDepositHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositHistoryReq { + return plainToClassFromExist(new GetDepositHistoryReq(), jsonObject); } } @@ -108,7 +117,9 @@ export namespace GetDepositHistoryReq { } export class GetDepositHistoryReqBuilder { - obj: GetDepositHistoryReq = new GetDepositHistoryReq(); + constructor(readonly obj: GetDepositHistoryReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts index bd476878..44027000 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetDepositHistoryItems } from './model_get_deposit_history_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetDepositHistoryResp implements Response { +export class GetDepositHistoryResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetDepositHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetDepositHistoryResp implements Response { +export class GetBasicFeeReq implements Serializable { /** * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency */ currencyType?: GetBasicFeeReq.CurrencyTypeEnum = GetBasicFeeReq.CurrencyTypeEnum._0; + private constructor() {} /** * Creates a new instance of the `GetBasicFeeReq` class. * The builder pattern allows step-by-step construction of a `GetBasicFeeReq` object. */ static builder(): GetBasicFeeReqBuilder { - return new GetBasicFeeReqBuilder(); + return new GetBasicFeeReqBuilder(new GetBasicFeeReq()); } /** @@ -27,21 +28,24 @@ export class GetBasicFeeReq implements Serializable { currencyType?: GetBasicFeeReq.CurrencyTypeEnum; }): GetBasicFeeReq { let obj = new GetBasicFeeReq(); - obj.currencyType = data.currencyType; + if (data.currencyType) { + obj.currencyType = data.currencyType; + } else { + obj.currencyType = GetBasicFeeReq.CurrencyTypeEnum._0; + } return obj; } - fromJson(input: string): GetBasicFeeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetBasicFeeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetBasicFeeReq { - return plainToInstance(GetBasicFeeReq, jsonObject); + static fromJson(input: string): GetBasicFeeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetBasicFeeReq { + return plainToClassFromExist(new GetBasicFeeReq(), jsonObject); } } @@ -59,7 +63,9 @@ export namespace GetBasicFeeReq { } export class GetBasicFeeReqBuilder { - obj: GetBasicFeeReq = new GetBasicFeeReq(); + constructor(readonly obj: GetBasicFeeReq) { + this.obj = obj; + } /** * Currency type: 0-crypto currency, 1-fiat currency. default is 0-crypto currency */ diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts index fbca3bd8..87b0c96c 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetBasicFeeResp implements Response { +export class GetBasicFeeResp implements Response { /** * Base taker fee rate */ - takerFeeRate?: string; + takerFeeRate: string; + /** * Base maker fee rate */ - makerFeeRate?: string; + makerFeeRate: string; + private constructor() { + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.makerFeeRate = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class GetBasicFeeResp implements Response this.commonResponse = response; } - fromJson(input: string): GetBasicFeeResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetBasicFeeResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetBasicFeeResp { - return plainToInstance(GetBasicFeeResp, jsonObject); + static fromJson(input: string): GetBasicFeeResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetBasicFeeResp { + return plainToClassFromExist(new GetBasicFeeResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts index 5a0cc0d9..45c6d163 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesActualFeeReq implements Serializable { +export class GetFuturesActualFeeReq implements Serializable { /** * Trading pair */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetFuturesActualFeeReq` class. * The builder pattern allows step-by-step construction of a `GetFuturesActualFeeReq` object. */ static builder(): GetFuturesActualFeeReqBuilder { - return new GetFuturesActualFeeReqBuilder(); + return new GetFuturesActualFeeReqBuilder(new GetFuturesActualFeeReq()); } /** @@ -31,22 +32,23 @@ export class GetFuturesActualFeeReq implements Serializable { +export class GetFuturesActualFeeResp implements Response { /** * The unique identity of the trading pair and will not change even if the trading pair is renamed */ - symbol?: string; + symbol: string; + /** * Actual taker fee rate of the trading pair */ - takerFeeRate?: string; + takerFeeRate: string; + /** * Actual maker fee rate of the trading pair */ - makerFeeRate?: string; + makerFeeRate: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.makerFeeRate = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class GetFuturesActualFeeResp implements Response { +export class GetSpotActualFeeData implements Serializable { /** * The unique identity of the trading pair and will not change even if the trading pair is renamed */ - symbol?: string; + symbol: string; + /** * Actual taker fee rate of the symbol */ - takerFeeRate?: string; + takerFeeRate: string; + /** * Actual maker fee rate of the symbol */ - makerFeeRate?: string; + makerFeeRate: string; - fromJson(input: string): GetSpotActualFeeData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotActualFeeData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.makerFeeRate = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotActualFeeData { - return plainToInstance(GetSpotActualFeeData, jsonObject); + static fromJson(input: string): GetSpotActualFeeData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotActualFeeData { + return plainToClassFromExist(new GetSpotActualFeeData(), jsonObject); } } diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts index 75710c45..f943632e 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotActualFeeReq implements Serializable { +export class GetSpotActualFeeReq implements Serializable { /** * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) */ symbols?: string; + private constructor() {} /** * Creates a new instance of the `GetSpotActualFeeReq` class. * The builder pattern allows step-by-step construction of a `GetSpotActualFeeReq` object. */ static builder(): GetSpotActualFeeReqBuilder { - return new GetSpotActualFeeReqBuilder(); + return new GetSpotActualFeeReqBuilder(new GetSpotActualFeeReq()); } /** @@ -31,22 +32,23 @@ export class GetSpotActualFeeReq implements Serializable { return obj; } - fromJson(input: string): GetSpotActualFeeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotActualFeeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotActualFeeReq { - return plainToInstance(GetSpotActualFeeReq, jsonObject); + static fromJson(input: string): GetSpotActualFeeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotActualFeeReq { + return plainToClassFromExist(new GetSpotActualFeeReq(), jsonObject); } } export class GetSpotActualFeeReqBuilder { - obj: GetSpotActualFeeReq = new GetSpotActualFeeReq(); + constructor(readonly obj: GetSpotActualFeeReq) { + this.obj = obj; + } /** * Trading pair (optional, you can inquire fee rates of 10 trading pairs each time at most) */ diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts index 68826b5d..886a3f0d 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetSpotActualFeeData } from './model_get_spot_actual_fee_data'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotActualFeeResp implements Response { +export class GetSpotActualFeeResp implements Response { /** * */ @Type(() => GetSpotActualFeeData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSpotActualFeeResp implements Response { +export class AddSubAccountApiReq implements Serializable { /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) */ - passphrase?: string; + passphrase: string; + /** * Remarks(1~24 characters) */ - remark?: string; + remark: string; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") */ permission?: string = 'General'; + /** * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) */ ipWhitelist?: string; + /** * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 */ expire?: AddSubAccountApiReq.ExpireEnum = AddSubAccountApiReq.ExpireEnum._1; + /** * Sub-account name, create sub account name of API Key. */ - subName?: string; + subName: string; + private constructor() { + // @ts-ignore + this.passphrase = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.subName = null; + } /** * Creates a new instance of the `AddSubAccountApiReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountApiReq` object. */ static builder(): AddSubAccountApiReqBuilder { - return new AddSubAccountApiReqBuilder(); + return new AddSubAccountApiReqBuilder(new AddSubAccountApiReq()); } /** @@ -44,11 +57,11 @@ export class AddSubAccountApiReq implements Serializable { /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) */ - passphrase?: string; + passphrase: string; /** * Remarks(1~24 characters) */ - remark?: string; + remark: string; /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") */ @@ -64,29 +77,36 @@ export class AddSubAccountApiReq implements Serializable { /** * Sub-account name, create sub account name of API Key. */ - subName?: string; + subName: string; }): AddSubAccountApiReq { let obj = new AddSubAccountApiReq(); obj.passphrase = data.passphrase; obj.remark = data.remark; - obj.permission = data.permission; + if (data.permission) { + obj.permission = data.permission; + } else { + obj.permission = 'General'; + } obj.ipWhitelist = data.ipWhitelist; - obj.expire = data.expire; + if (data.expire) { + obj.expire = data.expire; + } else { + obj.expire = AddSubAccountApiReq.ExpireEnum._1; + } obj.subName = data.subName; return obj; } - fromJson(input: string): AddSubAccountApiReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountApiReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountApiReq { - return plainToInstance(AddSubAccountApiReq, jsonObject); + static fromJson(input: string): AddSubAccountApiReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountApiReq { + return plainToClassFromExist(new AddSubAccountApiReq(), jsonObject); } } @@ -116,7 +136,9 @@ export namespace AddSubAccountApiReq { } export class AddSubAccountApiReqBuilder { - obj: AddSubAccountApiReq = new AddSubAccountApiReq(); + constructor(readonly obj: AddSubAccountApiReq) { + this.obj = obj; + } /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) */ diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts index 58eeab7b..f7a445ee 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts @@ -1,47 +1,73 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountApiResp implements Response { +export class AddSubAccountApiResp implements Response { /** * Sub-account name */ - subName?: string; + subName: string; + /** * Remarks */ - remark?: string; + remark: string; + /** * API Key */ - apiKey?: string; + apiKey: string; + /** * API Secret Key */ - apiSecret?: string; + apiSecret: string; + /** * API Version */ - apiVersion?: number; + apiVersion: number; + /** * Password */ - passphrase?: string; + passphrase: string; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) */ - permission?: string; + permission: string; + /** * IP whitelist */ ipWhitelist?: string; + /** * Time of the event */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.subName = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.apiSecret = null; + // @ts-ignore + this.apiVersion = null; + // @ts-ignore + this.passphrase = null; + // @ts-ignore + this.permission = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -52,16 +78,15 @@ export class AddSubAccountApiResp implements Response -{ +export class AddSubAccountFuturesPermissionReq implements Serializable { /** * Sub account UID */ - uid?: string; + uid: string; + private constructor() { + // @ts-ignore + this.uid = null; + } /** * Creates a new instance of the `AddSubAccountFuturesPermissionReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountFuturesPermissionReq` object. */ static builder(): AddSubAccountFuturesPermissionReqBuilder { - return new AddSubAccountFuturesPermissionReqBuilder(); + return new AddSubAccountFuturesPermissionReqBuilder( + new AddSubAccountFuturesPermissionReq(), + ); } /** @@ -26,29 +30,30 @@ export class AddSubAccountFuturesPermissionReq /** * Sub account UID */ - uid?: string; + uid: string; }): AddSubAccountFuturesPermissionReq { let obj = new AddSubAccountFuturesPermissionReq(); obj.uid = data.uid; return obj; } - fromJson(input: string): AddSubAccountFuturesPermissionReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountFuturesPermissionReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountFuturesPermissionReq { - return plainToInstance(AddSubAccountFuturesPermissionReq, jsonObject); + static fromJson(input: string): AddSubAccountFuturesPermissionReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountFuturesPermissionReq { + return plainToClassFromExist(new AddSubAccountFuturesPermissionReq(), jsonObject); } } export class AddSubAccountFuturesPermissionReqBuilder { - obj: AddSubAccountFuturesPermissionReq = new AddSubAccountFuturesPermissionReq(); + constructor(readonly obj: AddSubAccountFuturesPermissionReq) { + this.obj = obj; + } /** * Sub account UID */ diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts index dceaf4fb..a11c61a5 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts @@ -1,17 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountFuturesPermissionResp - implements Response -{ +export class AddSubAccountFuturesPermissionResp implements Response { /** * */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,17 @@ export class AddSubAccountFuturesPermissionResp this.commonResponse = response; } - fromJson(input: string): AddSubAccountFuturesPermissionResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountFuturesPermissionResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): AddSubAccountFuturesPermissionResp { - return plainToInstance(AddSubAccountFuturesPermissionResp, { data: jsonObject }); + static fromJson(input: string): AddSubAccountFuturesPermissionResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountFuturesPermissionResp { + return plainToClassFromExist(new AddSubAccountFuturesPermissionResp(), { + data: jsonObject, + }); } } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts index 8db73f32..62c26620 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_req.ts @@ -1,22 +1,24 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddSubAccountMarginPermissionReq - implements Serializable -{ +export class AddSubAccountMarginPermissionReq implements Serializable { /** * Sub account UID */ - uid?: string; + uid: string; + private constructor() { + // @ts-ignore + this.uid = null; + } /** * Creates a new instance of the `AddSubAccountMarginPermissionReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountMarginPermissionReq` object. */ static builder(): AddSubAccountMarginPermissionReqBuilder { - return new AddSubAccountMarginPermissionReqBuilder(); + return new AddSubAccountMarginPermissionReqBuilder(new AddSubAccountMarginPermissionReq()); } /** @@ -26,29 +28,30 @@ export class AddSubAccountMarginPermissionReq /** * Sub account UID */ - uid?: string; + uid: string; }): AddSubAccountMarginPermissionReq { let obj = new AddSubAccountMarginPermissionReq(); obj.uid = data.uid; return obj; } - fromJson(input: string): AddSubAccountMarginPermissionReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountMarginPermissionReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountMarginPermissionReq { - return plainToInstance(AddSubAccountMarginPermissionReq, jsonObject); + static fromJson(input: string): AddSubAccountMarginPermissionReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountMarginPermissionReq { + return plainToClassFromExist(new AddSubAccountMarginPermissionReq(), jsonObject); } } export class AddSubAccountMarginPermissionReqBuilder { - obj: AddSubAccountMarginPermissionReq = new AddSubAccountMarginPermissionReq(); + constructor(readonly obj: AddSubAccountMarginPermissionReq) { + this.obj = obj; + } /** * Sub account UID */ diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts index 6e3a149c..bb1155fd 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_margin_permission_resp.ts @@ -1,17 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountMarginPermissionResp - implements Response -{ +export class AddSubAccountMarginPermissionResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class AddSubAccountMarginPermissionResp this.commonResponse = response; } - fromJson(input: string): AddSubAccountMarginPermissionResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountMarginPermissionResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): AddSubAccountMarginPermissionResp { - return plainToInstance(AddSubAccountMarginPermissionResp, { data: jsonObject }); + static fromJson(input: string): AddSubAccountMarginPermissionResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountMarginPermissionResp { + return plainToClassFromExist(new AddSubAccountMarginPermissionResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts index 2cbe0317..0a78dc23 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts @@ -1,32 +1,43 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddSubAccountReq implements Serializable { +export class AddSubAccountReq implements Serializable { /** * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) */ - password?: string; + password: string; + /** * Remarks(1~24 characters) */ remarks?: string; + /** * Sub-account name(must contain 7-32 characters, at least one number and one letter. Cannot contain any spaces.) */ - subName?: string; + subName: string; + /** * Permission (types include Spot, Futures, Margin permissions, which can be used alone or in combination). */ - access?: AddSubAccountReq.AccessEnum; + access: AddSubAccountReq.AccessEnum; + private constructor() { + // @ts-ignore + this.password = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.access = null; + } /** * Creates a new instance of the `AddSubAccountReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountReq` object. */ static builder(): AddSubAccountReqBuilder { - return new AddSubAccountReqBuilder(); + return new AddSubAccountReqBuilder(new AddSubAccountReq()); } /** @@ -36,7 +47,7 @@ export class AddSubAccountReq implements Serializable { /** * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) */ - password?: string; + password: string; /** * Remarks(1~24 characters) */ @@ -44,11 +55,11 @@ export class AddSubAccountReq implements Serializable { /** * Sub-account name(must contain 7-32 characters, at least one number and one letter. Cannot contain any spaces.) */ - subName?: string; + subName: string; /** * Permission (types include Spot, Futures, Margin permissions, which can be used alone or in combination). */ - access?: AddSubAccountReq.AccessEnum; + access: AddSubAccountReq.AccessEnum; }): AddSubAccountReq { let obj = new AddSubAccountReq(); obj.password = data.password; @@ -58,17 +69,16 @@ export class AddSubAccountReq implements Serializable { return obj; } - fromJson(input: string): AddSubAccountReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountReq { - return plainToInstance(AddSubAccountReq, jsonObject); + static fromJson(input: string): AddSubAccountReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountReq { + return plainToClassFromExist(new AddSubAccountReq(), jsonObject); } } @@ -90,7 +100,9 @@ export namespace AddSubAccountReq { } export class AddSubAccountReqBuilder { - obj: AddSubAccountReq = new AddSubAccountReq(); + constructor(readonly obj: AddSubAccountReq) { + this.obj = obj; + } /** * Password(7-24 characters, must contain letters and numbers, cannot only contain numbers or include special characters) */ diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts index 0867d4c7..c5bb84c0 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountResp implements Response { +export class AddSubAccountResp implements Response { /** * Sub-account UID */ - uid?: number; + uid: number; + /** * Sub-account name */ - subName?: string; + subName: string; + /** * Remarks */ - remarks?: string; + remarks: string; + /** * Permission */ - access?: string; + access: string; + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.remarks = null; + // @ts-ignore + this.access = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddSubAccountResp implements Response { +export class DeleteSubAccountApiReq implements Serializable { /** * API-Key */ apiKey?: string; + /** * Sub-account name. */ subName?: string; + /** * Password(Password of the API key) */ passphrase?: string; + private constructor() {} /** * Creates a new instance of the `DeleteSubAccountApiReq` class. * The builder pattern allows step-by-step construction of a `DeleteSubAccountApiReq` object. */ static builder(): DeleteSubAccountApiReqBuilder { - return new DeleteSubAccountApiReqBuilder(); + return new DeleteSubAccountApiReqBuilder(new DeleteSubAccountApiReq()); } /** @@ -49,22 +52,23 @@ export class DeleteSubAccountApiReq implements Serializable { +export class DeleteSubAccountApiResp implements Response { /** * The username of a sub-user. */ - subName?: string; + subName: string; + /** * The APIKEY of a sub-user. */ - apiKey?: string; + apiKey: string; + private constructor() { + // @ts-ignore + this.subName = null; + // @ts-ignore + this.apiKey = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class DeleteSubAccountApiResp implements Response -{ +export class GetFuturesSubAccountListV2Accounts implements Serializable { /** * Account name, main account is main */ - accountName?: string; + accountName: string; + /** * */ - accountEquity?: number; + accountEquity: number; + /** * */ - unrealisedPNL?: number; + unrealisedPNL: number; + /** * */ - marginBalance?: number; + marginBalance: number; + /** * */ - positionMargin?: number; + positionMargin: number; + /** * */ - orderMargin?: number; + orderMargin: number; + /** * */ - frozenFunds?: number; + frozenFunds: number; + /** * */ - availableBalance?: number; + availableBalance: number; + /** * currency */ - currency?: string; + currency: string; - fromJson(input: string): GetFuturesSubAccountListV2Accounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesSubAccountListV2Accounts, jsonObject); + private constructor() { + // @ts-ignore + this.accountName = null; + // @ts-ignore + this.accountEquity = null; + // @ts-ignore + this.unrealisedPNL = null; + // @ts-ignore + this.marginBalance = null; + // @ts-ignore + this.positionMargin = null; + // @ts-ignore + this.orderMargin = null; + // @ts-ignore + this.frozenFunds = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.currency = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesSubAccountListV2Accounts { - return plainToInstance(GetFuturesSubAccountListV2Accounts, jsonObject); + static fromJson(input: string): GetFuturesSubAccountListV2Accounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Accounts { + return plainToClassFromExist(new GetFuturesSubAccountListV2Accounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts index 3ce816b8..f9703adc 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesSubAccountListV2Req implements Serializable { +export class GetFuturesSubAccountListV2Req implements Serializable { /** * Currecny, Default XBT */ currency?: string = 'XBT'; + private constructor() {} /** * Creates a new instance of the `GetFuturesSubAccountListV2Req` class. * The builder pattern allows step-by-step construction of a `GetFuturesSubAccountListV2Req` object. */ static builder(): GetFuturesSubAccountListV2ReqBuilder { - return new GetFuturesSubAccountListV2ReqBuilder(); + return new GetFuturesSubAccountListV2ReqBuilder(new GetFuturesSubAccountListV2Req()); } /** @@ -27,26 +28,31 @@ export class GetFuturesSubAccountListV2Req implements Serializable -{ +export class GetFuturesSubAccountListV2Resp implements Response { /** * */ @Type(() => GetFuturesSubAccountListV2Summary) - summary?: GetFuturesSubAccountListV2Summary; + summary: GetFuturesSubAccountListV2Summary; + /** * Account List */ @Type(() => GetFuturesSubAccountListV2Accounts) - accounts?: Array; + accounts: Array; + private constructor() { + // @ts-ignore + this.summary = null; + // @ts-ignore + this.accounts = null; + } /** * common response */ @@ -30,16 +35,15 @@ export class GetFuturesSubAccountListV2Resp this.commonResponse = response; } - fromJson(input: string): GetFuturesSubAccountListV2Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesSubAccountListV2Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesSubAccountListV2Resp { - return plainToInstance(GetFuturesSubAccountListV2Resp, jsonObject); + static fromJson(input: string): GetFuturesSubAccountListV2Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Resp { + return plainToClassFromExist(new GetFuturesSubAccountListV2Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts index ce67cc85..12c905cd 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts @@ -1,54 +1,76 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesSubAccountListV2Summary - implements Serializable -{ +export class GetFuturesSubAccountListV2Summary implements Serializable { /** * Total Account Equity */ - accountEquityTotal?: number; + accountEquityTotal: number; + /** * Total unrealisedPNL */ - unrealisedPNLTotal?: number; + unrealisedPNLTotal: number; + /** * Total Margin Balance */ - marginBalanceTotal?: number; + marginBalanceTotal: number; + /** * Total Position margin */ - positionMarginTotal?: number; + positionMarginTotal: number; + /** * */ - orderMarginTotal?: number; + orderMarginTotal: number; + /** * Total frozen funds for withdrawal and out-transfer */ - frozenFundsTotal?: number; + frozenFundsTotal: number; + /** * total available balance */ - availableBalanceTotal?: number; + availableBalanceTotal: number; + /** * */ - currency?: string; + currency: string; - fromJson(input: string): GetFuturesSubAccountListV2Summary { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesSubAccountListV2Summary, jsonObject); + private constructor() { + // @ts-ignore + this.accountEquityTotal = null; + // @ts-ignore + this.unrealisedPNLTotal = null; + // @ts-ignore + this.marginBalanceTotal = null; + // @ts-ignore + this.positionMarginTotal = null; + // @ts-ignore + this.orderMarginTotal = null; + // @ts-ignore + this.frozenFundsTotal = null; + // @ts-ignore + this.availableBalanceTotal = null; + // @ts-ignore + this.currency = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesSubAccountListV2Summary { - return plainToInstance(GetFuturesSubAccountListV2Summary, jsonObject); + static fromJson(input: string): GetFuturesSubAccountListV2Summary { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Summary { + return plainToClassFromExist(new GetFuturesSubAccountListV2Summary(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts index 3cde49a1..5d50759f 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountDetailMainAccounts - implements Serializable -{ +export class GetSpotSubAccountDetailMainAccounts implements Serializable { /** * Currency */ currency?: string; + /** * Total funds in an account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountDetailMainAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountDetailMainAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountDetailMainAccounts { - return plainToInstance(GetSpotSubAccountDetailMainAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountDetailMainAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountDetailMainAccounts { + return plainToClassFromExist(new GetSpotSubAccountDetailMainAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts index 4b7053c6..2c55c801 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountDetailMarginAccounts - implements Serializable -{ +export class GetSpotSubAccountDetailMarginAccounts implements Serializable { /** * Currency */ currency?: string; + /** * Total funds in an account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountDetailMarginAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountDetailMarginAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountDetailMarginAccounts { - return plainToInstance(GetSpotSubAccountDetailMarginAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountDetailMarginAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountDetailMarginAccounts { + return plainToClassFromExist(new GetSpotSubAccountDetailMarginAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts index e8a0a53f..b96dc5e3 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountDetailReq implements Serializable { +export class GetSpotSubAccountDetailReq implements Serializable { /** * the userID of a sub-account. */ @Reflect.metadata('path', 'subUserId') subUserId?: string; + /** * false: do not display the currency which asset is 0, true: display all currency */ includeBaseAmount?: boolean; + private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountDetailReq` class. * The builder pattern allows step-by-step construction of a `GetSpotSubAccountDetailReq` object. */ static builder(): GetSpotSubAccountDetailReqBuilder { - return new GetSpotSubAccountDetailReqBuilder(); + return new GetSpotSubAccountDetailReqBuilder(new GetSpotSubAccountDetailReq()); } /** @@ -42,22 +44,23 @@ export class GetSpotSubAccountDetailReq implements Serializable -{ +export class GetSpotSubAccountDetailResp implements Response { /** * The user ID of a sub-user. */ - subUserId?: string; + subUserId: string; + /** * The username of a sub-user. */ - subName?: string; + subName: string; + /** * Funding Account */ @Type(() => GetSpotSubAccountDetailMainAccounts) - mainAccounts?: Array; + mainAccounts: Array; + /** * Spot Account */ @Type(() => GetSpotSubAccountDetailTradeAccounts) - tradeAccounts?: Array; + tradeAccounts: Array; + /** * Margin Account */ @Type(() => GetSpotSubAccountDetailMarginAccounts) - marginAccounts?: Array; + marginAccounts: Array; + /** * This param is deprecated and only valid for some old users */ - tradeHFAccounts?: Array; + tradeHFAccounts: Array; + private constructor() { + // @ts-ignore + this.subUserId = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.mainAccounts = null; + // @ts-ignore + this.tradeAccounts = null; + // @ts-ignore + this.marginAccounts = null; + // @ts-ignore + this.tradeHFAccounts = null; + } /** * common response */ @@ -48,16 +65,15 @@ export class GetSpotSubAccountDetailResp this.commonResponse = response; } - fromJson(input: string): GetSpotSubAccountDetailResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountDetailResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountDetailResp { - return plainToInstance(GetSpotSubAccountDetailResp, jsonObject); + static fromJson(input: string): GetSpotSubAccountDetailResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountDetailResp { + return plainToClassFromExist(new GetSpotSubAccountDetailResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts index 24f4c5a1..e6380343 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountDetailTradeAccounts - implements Serializable -{ +export class GetSpotSubAccountDetailTradeAccounts implements Serializable { /** * Currency */ currency?: string; + /** * Total funds in an account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountDetailTradeAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountDetailTradeAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountDetailTradeAccounts { - return plainToInstance(GetSpotSubAccountDetailTradeAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountDetailTradeAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountDetailTradeAccounts { + return plainToClassFromExist(new GetSpotSubAccountDetailTradeAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts index 205adb4e..4081793f 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts @@ -2,49 +2,67 @@ import { GetSpotSubAccountListV1DataMarginAccounts } from './model_get_spot_sub_account_list_v1_data_margin_accounts'; import { GetSpotSubAccountListV1DataMainAccounts } from './model_get_spot_sub_account_list_v1_data_main_accounts'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { GetSpotSubAccountListV1DataTradeAccounts } from './model_get_spot_sub_account_list_v1_data_trade_accounts'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV1Data implements Serializable { +export class GetSpotSubAccountListV1Data implements Serializable { /** * The user ID of the sub-user. */ - subUserId?: string; + subUserId: string; + /** * The username of the sub-user. */ - subName?: string; + subName: string; + /** * Funding Account */ @Type(() => GetSpotSubAccountListV1DataMainAccounts) - mainAccounts?: Array; + mainAccounts: Array; + /** * Spot Account */ @Type(() => GetSpotSubAccountListV1DataTradeAccounts) - tradeAccounts?: Array; + tradeAccounts: Array; + /** * Margin Account */ @Type(() => GetSpotSubAccountListV1DataMarginAccounts) - marginAccounts?: Array; + marginAccounts: Array; + /** * This param is deprecated and only valid for some old users */ - tradeHFAccounts?: Array; + tradeHFAccounts: Array; - fromJson(input: string): GetSpotSubAccountListV1Data { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV1Data, jsonObject); + private constructor() { + // @ts-ignore + this.subUserId = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.mainAccounts = null; + // @ts-ignore + this.tradeAccounts = null; + // @ts-ignore + this.marginAccounts = null; + // @ts-ignore + this.tradeHFAccounts = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV1Data { - return plainToInstance(GetSpotSubAccountListV1Data, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV1Data { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV1Data { + return plainToClassFromExist(new GetSpotSubAccountListV1Data(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts index 87f8b663..96a74b30 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV1DataMainAccounts - implements Serializable -{ +export class GetSpotSubAccountListV1DataMainAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV1DataMainAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV1DataMainAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMainAccounts { - return plainToInstance(GetSpotSubAccountListV1DataMainAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV1DataMainAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMainAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV1DataMainAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts index 65db2ea6..a1cd44bb 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV1DataMarginAccounts - implements Serializable -{ +export class GetSpotSubAccountListV1DataMarginAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV1DataMarginAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV1DataMarginAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMarginAccounts { - return plainToInstance(GetSpotSubAccountListV1DataMarginAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV1DataMarginAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMarginAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV1DataMarginAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts index 383a2b37..8fd493bc 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV1DataTradeAccounts - implements Serializable -{ +export class GetSpotSubAccountListV1DataTradeAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV1DataTradeAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV1DataTradeAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV1DataTradeAccounts { - return plainToInstance(GetSpotSubAccountListV1DataTradeAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV1DataTradeAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataTradeAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV1DataTradeAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts index 6dbb3af2..d4f9c3ea 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts @@ -1,19 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetSpotSubAccountListV1Data } from './model_get_spot_sub_account_list_v1_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV1Resp - implements Response -{ +export class GetSpotSubAccountListV1Resp implements Response { /** * */ @Type(() => GetSpotSubAccountListV1Data) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetSpotSubAccountListV1Resp this.commonResponse = response; } - fromJson(input: string): GetSpotSubAccountListV1Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV1Resp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV1Resp { - return plainToInstance(GetSpotSubAccountListV1Resp, { data: jsonObject }); + static fromJson(input: string): GetSpotSubAccountListV1Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV1Resp { + return plainToClassFromExist(new GetSpotSubAccountListV1Resp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts index e43a3c75..e7e5886c 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts @@ -1,50 +1,68 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetSpotSubAccountListV2ItemsMarginAccounts } from './model_get_spot_sub_account_list_v2_items_margin_accounts'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { GetSpotSubAccountListV2ItemsMainAccounts } from './model_get_spot_sub_account_list_v2_items_main_accounts'; import { GetSpotSubAccountListV2ItemsTradeAccounts } from './model_get_spot_sub_account_list_v2_items_trade_accounts'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV2Items implements Serializable { +export class GetSpotSubAccountListV2Items implements Serializable { /** * The user ID of the sub-user. */ - subUserId?: string; + subUserId: string; + /** * The username of the sub-user. */ - subName?: string; + subName: string; + /** * Funding Account */ @Type(() => GetSpotSubAccountListV2ItemsMainAccounts) - mainAccounts?: Array; + mainAccounts: Array; + /** * Spot Account */ @Type(() => GetSpotSubAccountListV2ItemsTradeAccounts) - tradeAccounts?: Array; + tradeAccounts: Array; + /** * Margin Account */ @Type(() => GetSpotSubAccountListV2ItemsMarginAccounts) - marginAccounts?: Array; + marginAccounts: Array; + /** * This param is deprecated and only valid for some old users */ - tradeHFAccounts?: Array; + tradeHFAccounts: Array; - fromJson(input: string): GetSpotSubAccountListV2Items { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV2Items, jsonObject); + private constructor() { + // @ts-ignore + this.subUserId = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.mainAccounts = null; + // @ts-ignore + this.tradeAccounts = null; + // @ts-ignore + this.marginAccounts = null; + // @ts-ignore + this.tradeHFAccounts = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV2Items { - return plainToInstance(GetSpotSubAccountListV2Items, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV2Items { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV2Items { + return plainToClassFromExist(new GetSpotSubAccountListV2Items(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts index d08fe610..1e52c452 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV2ItemsMainAccounts - implements Serializable -{ +export class GetSpotSubAccountListV2ItemsMainAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV2ItemsMainAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV2ItemsMainAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMainAccounts { - return plainToInstance(GetSpotSubAccountListV2ItemsMainAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV2ItemsMainAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMainAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV2ItemsMainAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts index 2fc857b1..c3302d39 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV2ItemsMarginAccounts - implements Serializable -{ +export class GetSpotSubAccountListV2ItemsMarginAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV2ItemsMarginAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV2ItemsMarginAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMarginAccounts { - return plainToInstance(GetSpotSubAccountListV2ItemsMarginAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV2ItemsMarginAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMarginAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV2ItemsMarginAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts index 207a3d74..245afedb 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts @@ -1,54 +1,59 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV2ItemsTradeAccounts - implements Serializable -{ +export class GetSpotSubAccountListV2ItemsTradeAccounts implements Serializable { /** * The currency of the account. */ currency?: string; + /** * Total funds in the account. */ balance?: string; + /** * Funds available to withdraw or trade. */ available?: string; + /** * Funds on hold (not available for use). */ holds?: string; + /** * Calculated on this currency. */ baseCurrency?: string; + /** * The base currency price. */ baseCurrencyPrice?: string; + /** * The base currency amount. */ baseAmount?: string; + /** * */ tag?: string; - fromJson(input: string): GetSpotSubAccountListV2ItemsTradeAccounts { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV2ItemsTradeAccounts, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsTradeAccounts { - return plainToInstance(GetSpotSubAccountListV2ItemsTradeAccounts, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV2ItemsTradeAccounts { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsTradeAccounts { + return plainToClassFromExist(new GetSpotSubAccountListV2ItemsTradeAccounts(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts index a121d858..e0107806 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountListV2Req implements Serializable { +export class GetSpotSubAccountListV2Req implements Serializable { /** * Current request page. Default is 1 */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 100, default is 10. */ pageSize?: number = 10; + private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountListV2Req` class. * The builder pattern allows step-by-step construction of a `GetSpotSubAccountListV2Req` object. */ static builder(): GetSpotSubAccountListV2ReqBuilder { - return new GetSpotSubAccountListV2ReqBuilder(); + return new GetSpotSubAccountListV2ReqBuilder(new GetSpotSubAccountListV2Req()); } /** @@ -35,27 +37,36 @@ export class GetSpotSubAccountListV2Req implements Serializable -{ +export class GetSpotSubAccountListV2Resp implements Response { /** * */ - currentPage?: number; + currentPage: number; + /** * */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetSpotSubAccountListV2Items) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -40,16 +54,15 @@ export class GetSpotSubAccountListV2Resp this.commonResponse = response; } - fromJson(input: string): GetSpotSubAccountListV2Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountListV2Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountListV2Resp { - return plainToInstance(GetSpotSubAccountListV2Resp, jsonObject); + static fromJson(input: string): GetSpotSubAccountListV2Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountListV2Resp { + return plainToClassFromExist(new GetSpotSubAccountListV2Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts index 0a551455..a3f47ae9 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts @@ -1,46 +1,62 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountsSummaryV1Data - implements Serializable -{ +export class GetSpotSubAccountsSummaryV1Data implements Serializable { /** * */ - userId?: string; + userId: string; + /** * */ - uid?: number; + uid: number; + /** * */ - subName?: string; + subName: string; + /** * */ - type?: number; + type: number; + /** * */ - remarks?: string; + remarks: string; + /** * Sub-account Permission */ - access?: string; + access: string; - fromJson(input: string): GetSpotSubAccountsSummaryV1Data { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountsSummaryV1Data, jsonObject); + private constructor() { + // @ts-ignore + this.userId = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.remarks = null; + // @ts-ignore + this.access = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Data { - return plainToInstance(GetSpotSubAccountsSummaryV1Data, jsonObject); + static fromJson(input: string): GetSpotSubAccountsSummaryV1Data { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Data { + return plainToClassFromExist(new GetSpotSubAccountsSummaryV1Data(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts index 170eefb1..ec18bf14 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts @@ -1,19 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetSpotSubAccountsSummaryV1Data } from './model_get_spot_sub_accounts_summary_v1_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountsSummaryV1Resp - implements Response -{ +export class GetSpotSubAccountsSummaryV1Resp implements Response { /** * */ @Type(() => GetSpotSubAccountsSummaryV1Data) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetSpotSubAccountsSummaryV1Resp this.commonResponse = response; } - fromJson(input: string): GetSpotSubAccountsSummaryV1Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountsSummaryV1Resp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Resp { - return plainToInstance(GetSpotSubAccountsSummaryV1Resp, { data: jsonObject }); + static fromJson(input: string): GetSpotSubAccountsSummaryV1Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Resp { + return plainToClassFromExist(new GetSpotSubAccountsSummaryV1Resp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts index 5be764b3..f362d6dd 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts @@ -1,67 +1,98 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountsSummaryV2Items - implements Serializable -{ +export class GetSpotSubAccountsSummaryV2Items implements Serializable { /** * Sub-account User Id */ - userId?: string; + userId: string; + /** * Sub-account UID */ - uid?: number; + uid: number; + /** * Sub-account name */ - subName?: string; + subName: string; + /** * Sub-account; 2:Enable, 3:Frozen */ - status?: GetSpotSubAccountsSummaryV2Items.StatusEnum; + status: GetSpotSubAccountsSummaryV2Items.StatusEnum; + /** * Sub-account type */ - type?: GetSpotSubAccountsSummaryV2Items.TypeEnum; + type: GetSpotSubAccountsSummaryV2Items.TypeEnum; + /** * Sub-account Permission */ - access?: string; + access: string; + /** * Time of the event */ - createdAt?: number; + createdAt: number; + /** * Remarks */ - remarks?: string; + remarks: string; + /** * Subaccount Permissions */ - tradeTypes?: Array; + tradeTypes: Array; + /** * Subaccount active permissions,If do not have the corresponding permissions, need to log in to the sub-account and go to the corresponding web page to activate */ - openedTradeTypes?: Array; + openedTradeTypes: Array; + /** * */ - hostedStatus?: string; + hostedStatus: string; - fromJson(input: string): GetSpotSubAccountsSummaryV2Items { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountsSummaryV2Items, jsonObject); + private constructor() { + // @ts-ignore + this.userId = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.access = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.remarks = null; + // @ts-ignore + this.tradeTypes = null; + // @ts-ignore + this.openedTradeTypes = null; + // @ts-ignore + this.hostedStatus = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Items { - return plainToInstance(GetSpotSubAccountsSummaryV2Items, jsonObject); + static fromJson(input: string): GetSpotSubAccountsSummaryV2Items { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Items { + return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Items(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts index 69434973..baef2654 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts @@ -1,26 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountsSummaryV2Req - implements Serializable -{ +export class GetSpotSubAccountsSummaryV2Req implements Serializable { /** * Current request page. Default is 1 */ currentPage?: number; + /** * Number of results per request. Minimum is 1, maximum is 100, default is 10. */ pageSize?: number = 10; + private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountsSummaryV2Req` class. * The builder pattern allows step-by-step construction of a `GetSpotSubAccountsSummaryV2Req` object. */ static builder(): GetSpotSubAccountsSummaryV2ReqBuilder { - return new GetSpotSubAccountsSummaryV2ReqBuilder(); + return new GetSpotSubAccountsSummaryV2ReqBuilder(new GetSpotSubAccountsSummaryV2Req()); } /** @@ -38,26 +38,31 @@ export class GetSpotSubAccountsSummaryV2Req }): GetSpotSubAccountsSummaryV2Req { let obj = new GetSpotSubAccountsSummaryV2Req(); obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 10; + } return obj; } - fromJson(input: string): GetSpotSubAccountsSummaryV2Req { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountsSummaryV2Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Req { - return plainToInstance(GetSpotSubAccountsSummaryV2Req, jsonObject); + static fromJson(input: string): GetSpotSubAccountsSummaryV2Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Req { + return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Req(), jsonObject); } } export class GetSpotSubAccountsSummaryV2ReqBuilder { - obj: GetSpotSubAccountsSummaryV2Req = new GetSpotSubAccountsSummaryV2Req(); + constructor(readonly obj: GetSpotSubAccountsSummaryV2Req) { + this.obj = obj; + } /** * Current request page. Default is 1 */ diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts index e4b395fc..0152c466 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts @@ -1,35 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetSpotSubAccountsSummaryV2Items } from './model_get_spot_sub_accounts_summary_v2_items'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotSubAccountsSummaryV2Resp - implements Response -{ +export class GetSpotSubAccountsSummaryV2Resp implements Response { /** * Current request page */ - currentPage?: number; + currentPage: number; + /** * Number of results per request. Minimum is 1, maximum is 100 */ - pageSize?: number; + pageSize: number; + /** * Total number of messages */ - totalNum?: number; + totalNum: number; + /** * Total number of page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetSpotSubAccountsSummaryV2Items) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -40,16 +54,15 @@ export class GetSpotSubAccountsSummaryV2Resp this.commonResponse = response; } - fromJson(input: string): GetSpotSubAccountsSummaryV2Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotSubAccountsSummaryV2Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Resp { - return plainToInstance(GetSpotSubAccountsSummaryV2Resp, jsonObject); + static fromJson(input: string): GetSpotSubAccountsSummaryV2Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Resp { + return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts index b5206854..071470fb 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts @@ -1,56 +1,64 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSubAccountApiListData implements Serializable { +export class GetSubAccountApiListData implements Serializable { /** * Sub Name */ subName?: string; + /** * Remarks */ remark?: string; + /** * API Key */ apiKey?: string; + /** * API Version */ apiVersion?: number; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) */ permission?: string; + /** * IP whitelist */ ipWhitelist?: string; + /** * Apikey create time */ createdAt?: number; + /** * Sub-account UID */ uid?: number; + /** * Whether it is the master account. */ isMaster?: boolean; - fromJson(input: string): GetSubAccountApiListData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSubAccountApiListData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSubAccountApiListData { - return plainToInstance(GetSubAccountApiListData, jsonObject); + static fromJson(input: string): GetSubAccountApiListData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSubAccountApiListData { + return plainToClassFromExist(new GetSubAccountApiListData(), jsonObject); } } diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts index 1118d6e6..26e42b80 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSubAccountApiListReq implements Serializable { +export class GetSubAccountApiListReq implements Serializable { /** * API-Key */ apiKey?: string; + /** * Sub-account name. */ subName?: string; + private constructor() {} /** * Creates a new instance of the `GetSubAccountApiListReq` class. * The builder pattern allows step-by-step construction of a `GetSubAccountApiListReq` object. */ static builder(): GetSubAccountApiListReqBuilder { - return new GetSubAccountApiListReqBuilder(); + return new GetSubAccountApiListReqBuilder(new GetSubAccountApiListReq()); } /** @@ -40,22 +42,23 @@ export class GetSubAccountApiListReq implements Serializable { +export class GetSubAccountApiListResp implements Response { /** * */ @Type(() => GetSubAccountApiListData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSubAccountApiListResp implements Response { +export class ModifySubAccountApiReq implements Serializable { /** * Password(Must contain 7-32 characters. Cannot contain any spaces.) */ - passphrase?: string; + passphrase: string; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144)(Only General、Spot、Futures、Margin、InnerTransfer(Flex Transfer) permissions can be set, such as \"General, Trade\". The default is \"General\") */ permission?: string = 'General'; + /** * IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP) */ ipWhitelist?: string; + /** * API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360 */ expire?: ModifySubAccountApiReq.ExpireEnum = ModifySubAccountApiReq.ExpireEnum._1; + /** * Sub-account name, create sub account name of API Key. */ - subName?: string; + subName: string; + /** * API-Key(Sub-account APIKey) */ - apiKey?: string; + apiKey: string; + private constructor() { + // @ts-ignore + this.passphrase = null; + // @ts-ignore + this.subName = null; + // @ts-ignore + this.apiKey = null; + } /** * Creates a new instance of the `ModifySubAccountApiReq` class. * The builder pattern allows step-by-step construction of a `ModifySubAccountApiReq` object. */ static builder(): ModifySubAccountApiReqBuilder { - return new ModifySubAccountApiReqBuilder(); + return new ModifySubAccountApiReqBuilder(new ModifySubAccountApiReq()); } /** @@ -44,7 +57,7 @@ export class ModifySubAccountApiReq implements Serializable { +export class ModifySubAccountApiResp implements Response { /** * Sub-account name */ - subName?: string; + subName: string; + /** * API Key */ - apiKey?: string; + apiKey: string; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) */ - permission?: string; + permission: string; + /** * IP whitelist */ ipWhitelist?: string; + private constructor() { + // @ts-ignore + this.subName = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.permission = null; + } /** * common response */ @@ -32,16 +43,15 @@ export class ModifySubAccountApiResp implements Response { +export class FlexTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ - clientOid?: string; + clientOid: string; + /** * currency */ - currency?: string; + currency: string; + /** * Transfer amount, the amount is a positive integer multiple of the currency precision. */ - amount?: string; + amount: string; + /** * Transfer out UserId, This is required when transferring sub-account to master-account. It is optional for internal transfers. */ fromUserId?: string; + /** * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 */ - fromAccountType?: FlexTransferReq.FromAccountTypeEnum; + fromAccountType: FlexTransferReq.FromAccountTypeEnum; + /** * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT */ fromAccountTag?: string; + /** * Transfer type:INTERNAL(Transfer within account)、PARENT_TO_SUB(Transfer from master-account to sub-account),SUB_TO_PARENT(Transfer from sub-account to master-account) */ - type?: FlexTransferReq.TypeEnum; + type: FlexTransferReq.TypeEnum; + /** * Transfer in UserId, This is required when transferring master-account to sub-account. It is optional for internal transfers. */ toUserId?: string; + /** * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 */ - toAccountType?: FlexTransferReq.ToAccountTypeEnum; + toAccountType: FlexTransferReq.ToAccountTypeEnum; + /** * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT */ toAccountTag?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fromAccountType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.toAccountType = null; + } /** * Creates a new instance of the `FlexTransferReq` class. * The builder pattern allows step-by-step construction of a `FlexTransferReq` object. */ static builder(): FlexTransferReqBuilder { - return new FlexTransferReqBuilder(); + return new FlexTransferReqBuilder(new FlexTransferReq()); } /** @@ -60,15 +83,15 @@ export class FlexTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ - clientOid?: string; + clientOid: string; /** * currency */ - currency?: string; + currency: string; /** * Transfer amount, the amount is a positive integer multiple of the currency precision. */ - amount?: string; + amount: string; /** * Transfer out UserId, This is required when transferring sub-account to master-account. It is optional for internal transfers. */ @@ -76,7 +99,7 @@ export class FlexTransferReq implements Serializable { /** * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 */ - fromAccountType?: FlexTransferReq.FromAccountTypeEnum; + fromAccountType: FlexTransferReq.FromAccountTypeEnum; /** * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT */ @@ -84,7 +107,7 @@ export class FlexTransferReq implements Serializable { /** * Transfer type:INTERNAL(Transfer within account)、PARENT_TO_SUB(Transfer from master-account to sub-account),SUB_TO_PARENT(Transfer from sub-account to master-account) */ - type?: FlexTransferReq.TypeEnum; + type: FlexTransferReq.TypeEnum; /** * Transfer in UserId, This is required when transferring master-account to sub-account. It is optional for internal transfers. */ @@ -92,7 +115,7 @@ export class FlexTransferReq implements Serializable { /** * Account type:MAIN、TRADE、CONTRACT、MARGIN、ISOLATED、MARGIN_V2、ISOLATED_V2 */ - toAccountType?: FlexTransferReq.ToAccountTypeEnum; + toAccountType: FlexTransferReq.ToAccountTypeEnum; /** * Symbol, required when the account type is ISOLATED or ISOLATED_V2, for example: BTC-USDT */ @@ -112,17 +135,16 @@ export class FlexTransferReq implements Serializable { return obj; } - fromJson(input: string): FlexTransferReq { - const jsonObject = JSON.parse(input); - return plainToInstance(FlexTransferReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): FlexTransferReq { - return plainToInstance(FlexTransferReq, jsonObject); + static fromJson(input: string): FlexTransferReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): FlexTransferReq { + return plainToClassFromExist(new FlexTransferReq(), jsonObject); } } @@ -212,7 +234,9 @@ export namespace FlexTransferReq { } export class FlexTransferReqBuilder { - obj: FlexTransferReq = new FlexTransferReq(); + constructor(readonly obj: FlexTransferReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts index 4ce0fdc8..58defd89 100644 --- a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class FlexTransferResp implements Response { +export class FlexTransferResp implements Response { /** * Transfer order ID */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class FlexTransferResp implements Response { +export class FuturesAccountTransferInReq implements Serializable { /** * Currency, including XBT,USDT... */ - currency?: string; + currency: string; + /** * Amount to be transfered in */ - amount?: number; + amount: number; + /** * Payment account type, including MAIN,TRADE */ - payAccountType?: FuturesAccountTransferInReq.PayAccountTypeEnum; + payAccountType: FuturesAccountTransferInReq.PayAccountTypeEnum; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.payAccountType = null; + } /** * Creates a new instance of the `FuturesAccountTransferInReq` class. * The builder pattern allows step-by-step construction of a `FuturesAccountTransferInReq` object. */ static builder(): FuturesAccountTransferInReqBuilder { - return new FuturesAccountTransferInReqBuilder(); + return new FuturesAccountTransferInReqBuilder(new FuturesAccountTransferInReq()); } /** @@ -32,15 +42,15 @@ export class FuturesAccountTransferInReq implements Serializable -{ +export class FuturesAccountTransferInResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class FuturesAccountTransferInResp this.commonResponse = response; } - fromJson(input: string): FuturesAccountTransferInResp { - const jsonObject = JSON.parse(input); - return plainToInstance(FuturesAccountTransferInResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): FuturesAccountTransferInResp { - return plainToInstance(FuturesAccountTransferInResp, { data: jsonObject }); + static fromJson(input: string): FuturesAccountTransferInResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): FuturesAccountTransferInResp { + return plainToClassFromExist(new FuturesAccountTransferInResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts index 6fe25ec2..6c72973c 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts @@ -1,28 +1,38 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class FuturesAccountTransferOutReq implements Serializable { +export class FuturesAccountTransferOutReq implements Serializable { /** * Currency, including XBT,USDT... */ - currency?: string; + currency: string; + /** * Amount to be transfered out, the maximum cannot exceed 1000000000 */ - amount?: number; + amount: number; + /** * Receive account type, including MAIN,TRADE */ - recAccountType?: FuturesAccountTransferOutReq.RecAccountTypeEnum; + recAccountType: FuturesAccountTransferOutReq.RecAccountTypeEnum; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.recAccountType = null; + } /** * Creates a new instance of the `FuturesAccountTransferOutReq` class. * The builder pattern allows step-by-step construction of a `FuturesAccountTransferOutReq` object. */ static builder(): FuturesAccountTransferOutReqBuilder { - return new FuturesAccountTransferOutReqBuilder(); + return new FuturesAccountTransferOutReqBuilder(new FuturesAccountTransferOutReq()); } /** @@ -32,15 +42,15 @@ export class FuturesAccountTransferOutReq implements Serializable -{ +export class FuturesAccountTransferOutResp implements Response { /** * Transfer order ID */ - applyId?: string; + applyId: string; + /** * Business number */ - bizNo?: string; + bizNo: string; + /** * Pay account type */ - payAccountType?: string; + payAccountType: string; + /** * Pay account sub type */ - payTag?: string; + payTag: string; + /** * User remark */ - remark?: string; + remark: string; + /** * Receive account type */ - recAccountType?: string; + recAccountType: string; + /** * Receive account sub type */ - recTag?: string; + recTag: string; + /** * Receive account tx remark */ - recRemark?: string; + recRemark: string; + /** * Receive system */ - recSystem?: string; + recSystem: string; + /** * Status:APPLY, PROCESSING, PENDING_APPROVAL, APPROVED, REJECTED, PENDING_CANCEL, CANCEL, SUCCESS */ - status?: string; + status: string; + /** * Currency */ - currency?: string; + currency: string; + /** * Transfer amout */ - amount?: string; + amount: string; + /** * Transfer fee */ - fee?: string; + fee: string; + /** * Serial number */ - sn?: number; + sn: number; + /** * Fail Reason */ - reason?: string; + reason: string; + /** * Create time */ - createdAt?: number; + createdAt: number; + /** * Update time */ - updatedAt?: number; + updatedAt: number; + private constructor() { + // @ts-ignore + this.applyId = null; + // @ts-ignore + this.bizNo = null; + // @ts-ignore + this.payAccountType = null; + // @ts-ignore + this.payTag = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.recAccountType = null; + // @ts-ignore + this.recTag = null; + // @ts-ignore + this.recRemark = null; + // @ts-ignore + this.recSystem = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.sn = null; + // @ts-ignore + this.reason = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + } /** * common response */ @@ -86,16 +136,15 @@ export class FuturesAccountTransferOutResp this.commonResponse = response; } - fromJson(input: string): FuturesAccountTransferOutResp { - const jsonObject = JSON.parse(input); - return plainToInstance(FuturesAccountTransferOutResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): FuturesAccountTransferOutResp { - return plainToInstance(FuturesAccountTransferOutResp, jsonObject); + static fromJson(input: string): FuturesAccountTransferOutResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): FuturesAccountTransferOutResp { + return plainToClassFromExist(new FuturesAccountTransferOutResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts index bf1bf807..d0c833d0 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts @@ -1,63 +1,70 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesAccountTransferOutLedgerItems - implements Serializable -{ +export class GetFuturesAccountTransferOutLedgerItems implements Serializable { /** * Transfer order ID */ applyId?: string; + /** * Currency */ currency?: string; + /** * Receive account tx remark */ recRemark?: string; + /** * Receive system */ recSystem?: string; + /** * Status PROCESSING, SUCCESS, FAILURE */ status?: GetFuturesAccountTransferOutLedgerItems.StatusEnum; + /** * Transaction amount */ amount?: string; + /** * Reason caused the failure */ reason?: string; + /** * Offset */ offset?: number; + /** * Request application time */ createdAt?: number; + /** * User remark */ remark?: string; - fromJson(input: string): GetFuturesAccountTransferOutLedgerItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesAccountTransferOutLedgerItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerItems { - return plainToInstance(GetFuturesAccountTransferOutLedgerItems, jsonObject); + static fromJson(input: string): GetFuturesAccountTransferOutLedgerItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerItems { + return plainToClassFromExist(new GetFuturesAccountTransferOutLedgerItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts index 175b8a74..0a9f83c8 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts @@ -1,46 +1,53 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFuturesAccountTransferOutLedgerReq - implements Serializable -{ +export class GetFuturesAccountTransferOutLedgerReq implements Serializable { /** * currency */ currency?: string; + /** * Status PROCESSING, SUCCESS, FAILURE */ type?: GetFuturesAccountTransferOutLedgerReq.TypeEnum; + /** * Status List PROCESSING, SUCCESS, FAILURE */ tag?: Array; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page, The default currentPage is 1 */ currentPage?: number = 1; + /** * pageSize, The default pageSize is 50 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetFuturesAccountTransferOutLedgerReq` class. * The builder pattern allows step-by-step construction of a `GetFuturesAccountTransferOutLedgerReq` object. */ static builder(): GetFuturesAccountTransferOutLedgerReqBuilder { - return new GetFuturesAccountTransferOutLedgerReqBuilder(); + return new GetFuturesAccountTransferOutLedgerReqBuilder( + new GetFuturesAccountTransferOutLedgerReq(), + ); } /** @@ -82,22 +89,29 @@ export class GetFuturesAccountTransferOutLedgerReq obj.tag = data.tag; obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetFuturesAccountTransferOutLedgerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesAccountTransferOutLedgerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerReq { - return plainToInstance(GetFuturesAccountTransferOutLedgerReq, jsonObject); + static fromJson(input: string): GetFuturesAccountTransferOutLedgerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerReq { + return plainToClassFromExist(new GetFuturesAccountTransferOutLedgerReq(), jsonObject); } } @@ -123,7 +137,9 @@ export namespace GetFuturesAccountTransferOutLedgerReq { } export class GetFuturesAccountTransferOutLedgerReqBuilder { - obj: GetFuturesAccountTransferOutLedgerReq = new GetFuturesAccountTransferOutLedgerReq(); + constructor(readonly obj: GetFuturesAccountTransferOutLedgerReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts index b1b74c43..ae1d4d7e 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts @@ -1,35 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetFuturesAccountTransferOutLedgerItems } from './model_get_futures_account_transfer_out_ledger_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFuturesAccountTransferOutLedgerResp - implements Response -{ +export class GetFuturesAccountTransferOutLedgerResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetFuturesAccountTransferOutLedgerItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -40,16 +54,15 @@ export class GetFuturesAccountTransferOutLedgerResp this.commonResponse = response; } - fromJson(input: string): GetFuturesAccountTransferOutLedgerResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFuturesAccountTransferOutLedgerResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerResp { - return plainToInstance(GetFuturesAccountTransferOutLedgerResp, jsonObject); + static fromJson(input: string): GetFuturesAccountTransferOutLedgerResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerResp { + return plainToClassFromExist(new GetFuturesAccountTransferOutLedgerResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts index 06d9f29d..9dbf7924 100644 --- a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTransferQuotasReq implements Serializable { +export class GetTransferQuotasReq implements Serializable { /** * currency */ currency?: string; + /** * The account type:MAIN、TRADE、MARGIN、ISOLATED */ type?: GetTransferQuotasReq.TypeEnum; + /** * Trading pair, required when the account type is ISOLATED; other types are not passed, e.g.: BTC-USDT */ tag?: string = 'BTC-USDT'; + private constructor() {} /** * Creates a new instance of the `GetTransferQuotasReq` class. * The builder pattern allows step-by-step construction of a `GetTransferQuotasReq` object. */ static builder(): GetTransferQuotasReqBuilder { - return new GetTransferQuotasReqBuilder(); + return new GetTransferQuotasReqBuilder(new GetTransferQuotasReq()); } /** @@ -45,21 +48,24 @@ export class GetTransferQuotasReq implements Serializable let obj = new GetTransferQuotasReq(); obj.currency = data.currency; obj.type = data.type; - obj.tag = data.tag; + if (data.tag) { + obj.tag = data.tag; + } else { + obj.tag = 'BTC-USDT'; + } return obj; } - fromJson(input: string): GetTransferQuotasReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTransferQuotasReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTransferQuotasReq { - return plainToInstance(GetTransferQuotasReq, jsonObject); + static fromJson(input: string): GetTransferQuotasReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTransferQuotasReq { + return plainToClassFromExist(new GetTransferQuotasReq(), jsonObject); } } @@ -89,7 +95,9 @@ export namespace GetTransferQuotasReq { } export class GetTransferQuotasReqBuilder { - obj: GetTransferQuotasReq = new GetTransferQuotasReq(); + constructor(readonly obj: GetTransferQuotasReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts index dd977e47..a08d885c 100644 --- a/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_transfer_quotas_resp.ts @@ -1,31 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTransferQuotasResp implements Response { +export class GetTransferQuotasResp implements Response { /** * Currency */ - currency?: string; + currency: string; + /** * Total funds in an account. */ - balance?: string; + balance: string; + /** * Funds available to withdraw or trade. */ - available?: string; + available: string; + /** * Funds on hold (not available for use). */ - holds?: string; + holds: string; + /** * Funds available to transfer. */ - transferable?: string; + transferable: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.balance = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.holds = null; + // @ts-ignore + this.transferable = null; + } /** * common response */ @@ -36,16 +52,15 @@ export class GetTransferQuotasResp implements Response { +export class InnerTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ - clientOid?: string; + clientOid: string; + /** * currency */ - currency?: string; + currency: string; + /** * Transfer amount, the amount is a positive integer multiple of the currency precision. */ - amount?: string; + amount: string; + /** * Receiving Account Type: main, trade, margin, isolated, margin_v2, isolated_v2, contract */ - to?: InnerTransferReq.ToEnum; + to: InnerTransferReq.ToEnum; + /** * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT */ fromTag?: string; + /** * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT */ toTag?: string; + /** * Payment Account Type: main, trade, margin, isolated, margin_v2, isolated_v2 */ - from?: InnerTransferReq.FromEnum; - + from: InnerTransferReq.FromEnum; + + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.to = null; + // @ts-ignore + this.from = null; + } /** * Creates a new instance of the `InnerTransferReq` class. * The builder pattern allows step-by-step construction of a `InnerTransferReq` object. */ static builder(): InnerTransferReqBuilder { - return new InnerTransferReqBuilder(); + return new InnerTransferReqBuilder(new InnerTransferReq()); } /** @@ -48,19 +66,19 @@ export class InnerTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ - clientOid?: string; + clientOid: string; /** * currency */ - currency?: string; + currency: string; /** * Transfer amount, the amount is a positive integer multiple of the currency precision. */ - amount?: string; + amount: string; /** * Receiving Account Type: main, trade, margin, isolated, margin_v2, isolated_v2, contract */ - to?: InnerTransferReq.ToEnum; + to: InnerTransferReq.ToEnum; /** * Trading pair, required when the payment account type is isolated, e.g.: BTC-USDT */ @@ -72,7 +90,7 @@ export class InnerTransferReq implements Serializable { /** * Payment Account Type: main, trade, margin, isolated, margin_v2, isolated_v2 */ - from?: InnerTransferReq.FromEnum; + from: InnerTransferReq.FromEnum; }): InnerTransferReq { let obj = new InnerTransferReq(); obj.clientOid = data.clientOid; @@ -85,17 +103,16 @@ export class InnerTransferReq implements Serializable { return obj; } - fromJson(input: string): InnerTransferReq { - const jsonObject = JSON.parse(input); - return plainToInstance(InnerTransferReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): InnerTransferReq { - return plainToInstance(InnerTransferReq, jsonObject); + static fromJson(input: string): InnerTransferReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): InnerTransferReq { + return plainToClassFromExist(new InnerTransferReq(), jsonObject); } } @@ -163,7 +180,9 @@ export namespace InnerTransferReq { } export class InnerTransferReqBuilder { - obj: InnerTransferReq = new InnerTransferReq(); + constructor(readonly obj: InnerTransferReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts index 998dced7..b223de04 100644 --- a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class InnerTransferResp implements Response { +export class InnerTransferResp implements Response { /** * Transfer order ID */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class InnerTransferResp implements Response { +export class SubAccountTransferReq implements Serializable { /** * Unique order id created by users to identify their orders, e.g. UUID, with a maximum length of 128 bits */ - clientOid?: string; + clientOid: string; + /** * currency */ - currency?: string; + currency: string; + /** * Transfer amount, the amount is a positive integer multiple of the currency precision. */ - amount?: string; + amount: string; + /** * OUT — the master user to sub user IN — the sub user to the master user. */ - direction?: SubAccountTransferReq.DirectionEnum; + direction: SubAccountTransferReq.DirectionEnum; + /** * Account type:MAIN、TRADE、CONTRACT、MARGIN */ accountType?: SubAccountTransferReq.AccountTypeEnum = SubAccountTransferReq.AccountTypeEnum.MAIN; + /** * Sub Account type:MAIN、TRADE、CONTRACT、MARGIN */ subAccountType?: SubAccountTransferReq.SubAccountTypeEnum = SubAccountTransferReq.SubAccountTypeEnum.MAIN; + /** * the user ID of a sub-account. */ subUserId?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.direction = null; + } /** * Creates a new instance of the `SubAccountTransferReq` class. * The builder pattern allows step-by-step construction of a `SubAccountTransferReq` object. */ static builder(): SubAccountTransferReqBuilder { - return new SubAccountTransferReqBuilder(); + return new SubAccountTransferReqBuilder(new SubAccountTransferReq()); } /** @@ -50,19 +66,19 @@ export class SubAccountTransferReq implements Serializable { +export class SubAccountTransferResp implements Response { /** * Transfer order ID */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class SubAccountTransferResp implements Response { +export class CancelWithdrawalReq implements Serializable { /** * Path parameter, a unique ID for a withdrawalId */ @Reflect.metadata('path', 'withdrawalId') withdrawalId?: string; + private constructor() {} /** * Creates a new instance of the `CancelWithdrawalReq` class. * The builder pattern allows step-by-step construction of a `CancelWithdrawalReq` object. */ static builder(): CancelWithdrawalReqBuilder { - return new CancelWithdrawalReqBuilder(); + return new CancelWithdrawalReqBuilder(new CancelWithdrawalReq()); } /** @@ -33,22 +34,23 @@ export class CancelWithdrawalReq implements Serializable { return obj; } - fromJson(input: string): CancelWithdrawalReq { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelWithdrawalReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelWithdrawalReq { - return plainToInstance(CancelWithdrawalReq, jsonObject); + static fromJson(input: string): CancelWithdrawalReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelWithdrawalReq { + return plainToClassFromExist(new CancelWithdrawalReq(), jsonObject); } } export class CancelWithdrawalReqBuilder { - obj: CancelWithdrawalReq = new CancelWithdrawalReq(); + constructor(readonly obj: CancelWithdrawalReq) { + this.obj = obj; + } /** * Path parameter, a unique ID for a withdrawalId */ diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts index 24d5726d..878b8109 100644 --- a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelWithdrawalResp implements Response { +export class CancelWithdrawalResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelWithdrawalResp implements Response { +export class GetWithdrawalHistoryItems implements Serializable { /** * Unique id */ id?: string; + /** * Currency */ currency?: string; + /** * The id of currency */ chain?: string; + /** * Status */ status?: GetWithdrawalHistoryItems.StatusEnum; + /** * Deposit address */ address?: string; + /** * Address remark. If there’s no remark, it is empty. */ memo?: string; + /** * Internal deposit or not */ isInner?: boolean; + /** * Deposit amount */ amount?: string; + /** * Fees charged for deposit */ fee?: string; + /** * Wallet Txid */ walletTxId?: string; + /** * Creation time of the database record */ createdAt?: number; + /** * Update time of the database record */ updatedAt?: number; + /** * remark */ remark?: string; - fromJson(input: string): GetWithdrawalHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetWithdrawalHistoryItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetWithdrawalHistoryItems { - return plainToInstance(GetWithdrawalHistoryItems, jsonObject); + static fromJson(input: string): GetWithdrawalHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetWithdrawalHistoryItems { + return plainToClassFromExist(new GetWithdrawalHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts index 465ef86f..f72aa35f 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts @@ -1,49 +1,55 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetWithdrawalHistoryOldItems implements Serializable { +export class GetWithdrawalHistoryOldItems implements Serializable { /** * Currency */ currency?: string; + /** * Creation time of the database record */ createAt?: number; + /** * Withdrawal amount */ amount?: string; + /** * Withdrawal address */ address?: string; + /** * Wallet Txid */ walletTxId?: string; + /** * Internal deposit or not */ isInner?: boolean; + /** * Status */ status?: GetWithdrawalHistoryOldItems.StatusEnum; - fromJson(input: string): GetWithdrawalHistoryOldItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetWithdrawalHistoryOldItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetWithdrawalHistoryOldItems { - return plainToInstance(GetWithdrawalHistoryOldItems, jsonObject); + static fromJson(input: string): GetWithdrawalHistoryOldItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetWithdrawalHistoryOldItems { + return plainToClassFromExist(new GetWithdrawalHistoryOldItems(), jsonObject); } } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts index a2a7cfb5..6c13d3b3 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts @@ -1,40 +1,46 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetWithdrawalHistoryOldReq implements Serializable { +export class GetWithdrawalHistoryOldReq implements Serializable { /** * currency */ currency?: string; + /** * Status. Available value: PROCESSING, SUCCESS, and FAILURE */ status?: GetWithdrawalHistoryOldReq.StatusEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetWithdrawalHistoryOldReq` class. * The builder pattern allows step-by-step construction of a `GetWithdrawalHistoryOldReq` object. */ static builder(): GetWithdrawalHistoryOldReqBuilder { - return new GetWithdrawalHistoryOldReqBuilder(); + return new GetWithdrawalHistoryOldReqBuilder(new GetWithdrawalHistoryOldReq()); } /** @@ -71,22 +77,29 @@ export class GetWithdrawalHistoryOldReq implements Serializable -{ +export class GetWithdrawalHistoryOldResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetWithdrawalHistoryOldItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -40,16 +54,15 @@ export class GetWithdrawalHistoryOldResp this.commonResponse = response; } - fromJson(input: string): GetWithdrawalHistoryOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetWithdrawalHistoryOldResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetWithdrawalHistoryOldResp { - return plainToInstance(GetWithdrawalHistoryOldResp, jsonObject); + static fromJson(input: string): GetWithdrawalHistoryOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetWithdrawalHistoryOldResp { + return plainToClassFromExist(new GetWithdrawalHistoryOldResp(), jsonObject); } } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts index fd442c2f..ca2195df 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts @@ -1,40 +1,46 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetWithdrawalHistoryReq implements Serializable { +export class GetWithdrawalHistoryReq implements Serializable { /** * currency */ currency?: string; + /** * Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE */ status?: GetWithdrawalHistoryReq.StatusEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetWithdrawalHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetWithdrawalHistoryReq` object. */ static builder(): GetWithdrawalHistoryReqBuilder { - return new GetWithdrawalHistoryReqBuilder(); + return new GetWithdrawalHistoryReqBuilder(new GetWithdrawalHistoryReq()); } /** @@ -71,22 +77,29 @@ export class GetWithdrawalHistoryReq implements Serializable { +export class GetWithdrawalHistoryResp implements Response { /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetWithdrawalHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetWithdrawalHistoryResp implements Response { +export class GetWithdrawalQuotasReq implements Serializable { /** * currency */ currency?: string; + /** * The chainId of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. The available value for BTC are Native, Segwit, TRC20, the parameters are bech32, btc, trx, default is Native. This only apply for multi-chain currency, and there is no need for single chain currency. */ chain?: string = 'eth'; + private constructor() {} /** * Creates a new instance of the `GetWithdrawalQuotasReq` class. * The builder pattern allows step-by-step construction of a `GetWithdrawalQuotasReq` object. */ static builder(): GetWithdrawalQuotasReqBuilder { - return new GetWithdrawalQuotasReqBuilder(); + return new GetWithdrawalQuotasReqBuilder(new GetWithdrawalQuotasReq()); } /** @@ -36,26 +38,31 @@ export class GetWithdrawalQuotasReq implements Serializable { +export class GetWithdrawalQuotasResp implements Response { /** * */ - currency?: string; + currency: string; + /** * */ - limitBTCAmount?: string; + limitBTCAmount: string; + /** * */ - usedBTCAmount?: string; + usedBTCAmount: string; + /** * withdrawal limit currency */ - quotaCurrency?: string; + quotaCurrency: string; + /** * The intraday available withdrawal amount(withdrawal limit currency) */ - limitQuotaCurrencyAmount?: string; + limitQuotaCurrencyAmount: string; + /** * The intraday cumulative withdrawal amount(withdrawal limit currency) */ - usedQuotaCurrencyAmount?: string; + usedQuotaCurrencyAmount: string; + /** * Remaining amount available to withdraw the current day */ - remainAmount?: string; + remainAmount: string; + /** * Current available withdrawal amount */ - availableAmount?: string; + availableAmount: string; + /** * Minimum withdrawal fee */ - withdrawMinFee?: string; + withdrawMinFee: string; + /** * Fees for internal withdrawal */ - innerWithdrawMinFee?: string; + innerWithdrawMinFee: string; + /** * Minimum withdrawal amount */ - withdrawMinSize?: string; + withdrawMinSize: string; + /** * Is the withdraw function enabled or not */ - isWithdrawEnabled?: boolean; + isWithdrawEnabled: boolean; + /** * Floating point precision. */ - precision?: number; + precision: number; + /** * The chainName of currency */ - chain?: string; + chain: string; + /** * Reasons for restriction, Usually empty */ - reason?: string; + reason: string; + /** * Total locked amount (including the amount locked into USDT for each currency) */ - lockedAmount?: string; + lockedAmount: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.limitBTCAmount = null; + // @ts-ignore + this.usedBTCAmount = null; + // @ts-ignore + this.quotaCurrency = null; + // @ts-ignore + this.limitQuotaCurrencyAmount = null; + // @ts-ignore + this.usedQuotaCurrencyAmount = null; + // @ts-ignore + this.remainAmount = null; + // @ts-ignore + this.availableAmount = null; + // @ts-ignore + this.withdrawMinFee = null; + // @ts-ignore + this.innerWithdrawMinFee = null; + // @ts-ignore + this.withdrawMinSize = null; + // @ts-ignore + this.isWithdrawEnabled = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.chain = null; + // @ts-ignore + this.reason = null; + // @ts-ignore + this.lockedAmount = null; + } /** * common response */ @@ -80,16 +129,15 @@ export class GetWithdrawalQuotasResp implements Response { +export class WithdrawalV1Req implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. */ chain?: string = 'eth'; + /** * Withdrawal address */ - address?: string; + address: string; + /** * Withdrawal amount, a positive number which is a multiple of the amount precision */ - amount?: number; + amount: number; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ memo?: string; + /** * Internal withdrawal or not. Default : false */ isInner?: boolean = false; + /** * remark */ remark?: string; + /** * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. */ feeDeductType?: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.address = null; + // @ts-ignore + this.amount = null; + } /** * Creates a new instance of the `WithdrawalV1Req` class. * The builder pattern allows step-by-step construction of a `WithdrawalV1Req` object. */ static builder(): WithdrawalV1ReqBuilder { - return new WithdrawalV1ReqBuilder(); + return new WithdrawalV1ReqBuilder(new WithdrawalV1Req()); } /** @@ -52,7 +67,7 @@ export class WithdrawalV1Req implements Serializable { /** * currency */ - currency?: string; + currency: string; /** * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. */ @@ -60,11 +75,11 @@ export class WithdrawalV1Req implements Serializable { /** * Withdrawal address */ - address?: string; + address: string; /** * Withdrawal amount, a positive number which is a multiple of the amount precision */ - amount?: number; + amount: number; /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ @@ -84,32 +99,41 @@ export class WithdrawalV1Req implements Serializable { }): WithdrawalV1Req { let obj = new WithdrawalV1Req(); obj.currency = data.currency; - obj.chain = data.chain; + if (data.chain) { + obj.chain = data.chain; + } else { + obj.chain = 'eth'; + } obj.address = data.address; obj.amount = data.amount; obj.memo = data.memo; - obj.isInner = data.isInner; + if (data.isInner) { + obj.isInner = data.isInner; + } else { + obj.isInner = false; + } obj.remark = data.remark; obj.feeDeductType = data.feeDeductType; return obj; } - fromJson(input: string): WithdrawalV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(WithdrawalV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): WithdrawalV1Req { - return plainToInstance(WithdrawalV1Req, jsonObject); + static fromJson(input: string): WithdrawalV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): WithdrawalV1Req { + return plainToClassFromExist(new WithdrawalV1Req(), jsonObject); } } export class WithdrawalV1ReqBuilder { - obj: WithdrawalV1Req = new WithdrawalV1Req(); + constructor(readonly obj: WithdrawalV1Req) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts index 5690ae79..b1ba188d 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class WithdrawalV1Resp implements Response { +export class WithdrawalV1Resp implements Response { /** * Withdrawal id, a unique ID for a withdrawal */ - withdrawalId?: string; + withdrawalId: string; + private constructor() { + // @ts-ignore + this.withdrawalId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class WithdrawalV1Resp implements Response { +export class WithdrawalV3Req implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. */ chain?: string = 'eth'; + /** * Withdrawal amount, a positive number which is a multiple of the amount precision */ - amount?: number; + amount: number; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ memo?: string; + /** * Internal withdrawal or not. Default : false */ isInner?: boolean = false; + /** * remark */ remark?: string; + /** * Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified 1. INTERNAL- deduct the transaction fees from your withdrawal amount 2. EXTERNAL- deduct the transaction fees from your main account 3. If you don\'t specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC. */ feeDeductType?: string; + /** * Withdrawal address */ - toAddress?: string; + toAddress: string; + /** * Withdrawal type, ADDRESS (withdrawal address), UID, MAIL (email), PHONE (mobile phone number). Note: If you withdraw by uid/mail/phone, there will have rate limited: 3 times/10 seconds, 50 times/24 hours (calculated on a rolling basis based on the first request time) */ - withdrawType?: WithdrawalV3Req.WithdrawTypeEnum; + withdrawType: WithdrawalV3Req.WithdrawTypeEnum; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.toAddress = null; + // @ts-ignore + this.withdrawType = null; + } /** * Creates a new instance of the `WithdrawalV3Req` class. * The builder pattern allows step-by-step construction of a `WithdrawalV3Req` object. */ static builder(): WithdrawalV3ReqBuilder { - return new WithdrawalV3ReqBuilder(); + return new WithdrawalV3ReqBuilder(new WithdrawalV3Req()); } /** @@ -56,7 +74,7 @@ export class WithdrawalV3Req implements Serializable { /** * currency */ - currency?: string; + currency: string; /** * The chainId of currency, For a currency with multiple chains, it is recommended to specify chain parameter instead of using the default chain; you can query the chainId through the response of the GET /api/v3/currencies/{currency} interface. */ @@ -64,7 +82,7 @@ export class WithdrawalV3Req implements Serializable { /** * Withdrawal amount, a positive number which is a multiple of the amount precision */ - amount?: number; + amount: number; /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ @@ -84,18 +102,26 @@ export class WithdrawalV3Req implements Serializable { /** * Withdrawal address */ - toAddress?: string; + toAddress: string; /** * Withdrawal type, ADDRESS (withdrawal address), UID, MAIL (email), PHONE (mobile phone number). Note: If you withdraw by uid/mail/phone, there will have rate limited: 3 times/10 seconds, 50 times/24 hours (calculated on a rolling basis based on the first request time) */ - withdrawType?: WithdrawalV3Req.WithdrawTypeEnum; + withdrawType: WithdrawalV3Req.WithdrawTypeEnum; }): WithdrawalV3Req { let obj = new WithdrawalV3Req(); obj.currency = data.currency; - obj.chain = data.chain; + if (data.chain) { + obj.chain = data.chain; + } else { + obj.chain = 'eth'; + } obj.amount = data.amount; obj.memo = data.memo; - obj.isInner = data.isInner; + if (data.isInner) { + obj.isInner = data.isInner; + } else { + obj.isInner = false; + } obj.remark = data.remark; obj.feeDeductType = data.feeDeductType; obj.toAddress = data.toAddress; @@ -103,17 +129,16 @@ export class WithdrawalV3Req implements Serializable { return obj; } - fromJson(input: string): WithdrawalV3Req { - const jsonObject = JSON.parse(input); - return plainToInstance(WithdrawalV3Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): WithdrawalV3Req { - return plainToInstance(WithdrawalV3Req, jsonObject); + static fromJson(input: string): WithdrawalV3Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): WithdrawalV3Req { + return plainToClassFromExist(new WithdrawalV3Req(), jsonObject); } } @@ -139,7 +164,9 @@ export namespace WithdrawalV3Req { } export class WithdrawalV3ReqBuilder { - obj: WithdrawalV3Req = new WithdrawalV3Req(); + constructor(readonly obj: WithdrawalV3Req) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts index cab37847..060cf60a 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class WithdrawalV3Resp implements Response { +export class WithdrawalV3Resp implements Response { /** * Withdrawal id, a unique ID for a withdrawal */ - withdrawalId?: string; + withdrawalId: string; + private constructor() { + // @ts-ignore + this.withdrawalId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class WithdrawalV3Resp implements Response { +export class GetAccountLtv implements Serializable { /** * LTV of Restricted Transfers to Funding Account */ - transferLtv?: string; + transferLtv: string; + /** * LTV of Reduce Only (Restricted Open Positions) */ - onlyClosePosLtv?: string; + onlyClosePosLtv: string; + /** * LTV of Delayed Liquidation */ - delayedLiquidationLtv?: string; + delayedLiquidationLtv: string; + /** * LTV of Instant Liquidation */ - instantLiquidationLtv?: string; + instantLiquidationLtv: string; + /** * Current LTV */ - currentLtv?: string; + currentLtv: string; - fromJson(input: string): GetAccountLtv { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountLtv, jsonObject); + private constructor() { + // @ts-ignore + this.transferLtv = null; + // @ts-ignore + this.onlyClosePosLtv = null; + // @ts-ignore + this.delayedLiquidationLtv = null; + // @ts-ignore + this.instantLiquidationLtv = null; + // @ts-ignore + this.currentLtv = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountLtv { - return plainToInstance(GetAccountLtv, jsonObject); + static fromJson(input: string): GetAccountLtv { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountLtv { + return plainToClassFromExist(new GetAccountLtv(), jsonObject); } } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts index f649d96e..47761f7f 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts @@ -1,32 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountMargins implements Serializable { +export class GetAccountMargins implements Serializable { /** * Margin Currency */ - marginCcy?: string; + marginCcy: string; + /** * Maintenance Quantity (Calculated with Margin Coefficient) */ - marginQty?: string; + marginQty: string; + /** * Margin Coefficient return real time margin discount rate to USDT */ - marginFactor?: string; + marginFactor: string; - fromJson(input: string): GetAccountMargins { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountMargins, jsonObject); + private constructor() { + // @ts-ignore + this.marginCcy = null; + // @ts-ignore + this.marginQty = null; + // @ts-ignore + this.marginFactor = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountMargins { - return plainToInstance(GetAccountMargins, jsonObject); + static fromJson(input: string): GetAccountMargins { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountMargins { + return plainToClassFromExist(new GetAccountMargins(), jsonObject); } } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts index e551a87f..7986f542 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts @@ -1,36 +1,48 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountOrders implements Serializable { +export class GetAccountOrders implements Serializable { /** * Loan Orders ID */ - orderId?: string; + orderId: string; + /** * Loan Currency */ - currency?: string; + currency: string; + /** * Principal to Be Repaid */ - principal?: string; + principal: string; + /** * Interest to Be Repaid */ - interest?: string; + interest: string; - fromJson(input: string): GetAccountOrders { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountOrders, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.principal = null; + // @ts-ignore + this.interest = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountOrders { - return plainToInstance(GetAccountOrders, jsonObject); + static fromJson(input: string): GetAccountOrders { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountOrders { + return plainToClassFromExist(new GetAccountOrders(), jsonObject); } } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts index 5ad3ab43..944e6ae8 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts @@ -1,41 +1,60 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetAccountMargins } from './model_get_account_margins'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAccountLtv } from './model_get_account_ltv'; import { GetAccountOrders } from './model_get_account_orders'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAccountResp implements Response { +export class GetAccountResp implements Response { /** * Master account UID */ - parentUid?: string; + parentUid: string; + /** * Loan Orders */ @Type(() => GetAccountOrders) - orders?: Array; + orders: Array; + /** * */ @Type(() => GetAccountLtv) - ltv?: GetAccountLtv; + ltv: GetAccountLtv; + /** * Total Margin Amount (USDT) */ - totalMarginAmount?: string; + totalMarginAmount: string; + /** * Total Maintenance Margin for Restricted Transfers (USDT) */ - transferMarginAmount?: string; + transferMarginAmount: string; + /** * Margins */ @Type(() => GetAccountMargins) - margins?: Array; + margins: Array; + private constructor() { + // @ts-ignore + this.parentUid = null; + // @ts-ignore + this.orders = null; + // @ts-ignore + this.ltv = null; + // @ts-ignore + this.totalMarginAmount = null; + // @ts-ignore + this.transferMarginAmount = null; + // @ts-ignore + this.margins = null; + } /** * common response */ @@ -46,16 +65,15 @@ export class GetAccountResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetAccountResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountResp { - return plainToInstance(GetAccountResp, jsonObject); + static fromJson(input: string): GetAccountResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountResp { + return plainToClassFromExist(new GetAccountResp(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.ts b/sdk/node/src/generate/broker/apibroker/api_api_broker.ts index 7e36a634..86f839c8 100644 --- a/sdk/node/src/generate/broker/apibroker/api_api_broker.ts +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.ts @@ -32,7 +32,7 @@ export class APIBrokerAPIImpl implements APIBrokerAPI { 'GET', '/api/v1/broker/api/rebase/download', req, - new GetRebaseResp(), + GetRebaseResp, false, ); } diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts index 02b6759b..a55ca67e 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRebaseReq implements Serializable { +export class GetRebaseReq implements Serializable { /** * Start time, for example: 20240610 */ begin?: string; + /** * End time, for example: 20241010 (query data with a maximum interval of 6 months) */ end?: string; + /** * Transaction type, 1: spot 2: futures */ tradeType?: GetRebaseReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetRebaseReq` class. * The builder pattern allows step-by-step construction of a `GetRebaseReq` object. */ static builder(): GetRebaseReqBuilder { - return new GetRebaseReqBuilder(); + return new GetRebaseReqBuilder(new GetRebaseReq()); } /** @@ -49,17 +52,16 @@ export class GetRebaseReq implements Serializable { return obj; } - fromJson(input: string): GetRebaseReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRebaseReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRebaseReq { - return plainToInstance(GetRebaseReq, jsonObject); + static fromJson(input: string): GetRebaseReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRebaseReq { + return plainToClassFromExist(new GetRebaseReq(), jsonObject); } } @@ -77,7 +79,9 @@ export namespace GetRebaseReq { } export class GetRebaseReqBuilder { - obj: GetRebaseReq = new GetRebaseReq(); + constructor(readonly obj: GetRebaseReq) { + this.obj = obj; + } /** * Start time, for example: 20240610 */ diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts index 3e68723e..db99944d 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetRebaseResp implements Response { +export class GetRebaseResp implements Response { /** * Rebate order file (link is valid for 1 day) */ - url?: string; + url: string; + private constructor() { + // @ts-ignore + this.url = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetRebaseResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetRebaseResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRebaseResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRebaseResp { - return plainToInstance(GetRebaseResp, jsonObject); + static fromJson(input: string): GetRebaseResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRebaseResp { + return plainToClassFromExist(new GetRebaseResp(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts index 7acb74a9..23c38686 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.ts @@ -248,7 +248,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v1/broker/nd/info', req, - new GetBrokerInfoResp(), + GetBrokerInfoResp, false, ); } @@ -260,7 +260,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'POST', '/api/v1/broker/nd/account', req, - new AddSubAccountResp(), + AddSubAccountResp, false, ); } @@ -272,7 +272,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v1/broker/nd/account', req, - new GetSubAccountResp(), + GetSubAccountResp, false, ); } @@ -284,7 +284,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'POST', '/api/v1/broker/nd/account/apikey', req, - new AddSubAccountApiResp(), + AddSubAccountApiResp, false, ); } @@ -296,7 +296,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v1/broker/nd/account/apikey', req, - new GetSubAccountAPIResp(), + GetSubAccountAPIResp, false, ); } @@ -308,7 +308,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'POST', '/api/v1/broker/nd/account/update-apikey', req, - new ModifySubAccountApiResp(), + ModifySubAccountApiResp, false, ); } @@ -320,7 +320,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'DELETE', '/api/v1/broker/nd/account/apikey', req, - new DeleteSubAccountAPIResp(), + DeleteSubAccountAPIResp, false, ); } @@ -332,7 +332,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'POST', '/api/v1/broker/nd/transfer', req, - new TransferResp(), + TransferResp, false, ); } @@ -344,7 +344,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v3/broker/nd/transfer/detail', req, - new GetTransferHistoryResp(), + GetTransferHistoryResp, false, ); } @@ -356,7 +356,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v1/asset/ndbroker/deposit/list', req, - new GetDepositListResp(), + GetDepositListResp, false, ); } @@ -368,7 +368,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v3/broker/nd/deposit/detail', req, - new GetDepositDetailResp(), + GetDepositDetailResp, false, ); } @@ -380,7 +380,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v3/broker/nd/withdraw/detail', req, - new GetWithdrawDetailResp(), + GetWithdrawDetailResp, false, ); } @@ -392,7 +392,7 @@ export class NDBrokerAPIImpl implements NDBrokerAPI { 'GET', '/api/v1/broker/nd/rebase/download', req, - new GetRebaseResp(), + GetRebaseResp, false, ); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts index d523aa72..b3a8d899 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts @@ -1,36 +1,52 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddSubAccountApiReq implements Serializable { +export class AddSubAccountApiReq implements Serializable { /** * Subaccount UID */ - uid?: string; + uid: string; + /** * API passphrase */ - passphrase?: string; + passphrase: string; + /** * IP whitelist list, supports up to 20 IPs */ - ipWhitelist?: Array; + ipWhitelist: Array; + /** * Permission group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) */ - permissions?: Array; + permissions: Array; + /** * apikey remarks (length 4~32) */ - label?: string; + label: string; + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.passphrase = null; + // @ts-ignore + this.ipWhitelist = null; + // @ts-ignore + this.permissions = null; + // @ts-ignore + this.label = null; + } /** * Creates a new instance of the `AddSubAccountApiReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountApiReq` object. */ static builder(): AddSubAccountApiReqBuilder { - return new AddSubAccountApiReqBuilder(); + return new AddSubAccountApiReqBuilder(new AddSubAccountApiReq()); } /** @@ -40,23 +56,23 @@ export class AddSubAccountApiReq implements Serializable { /** * Subaccount UID */ - uid?: string; + uid: string; /** * API passphrase */ - passphrase?: string; + passphrase: string; /** * IP whitelist list, supports up to 20 IPs */ - ipWhitelist?: Array; + ipWhitelist: Array; /** * Permission group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) */ - permissions?: Array; + permissions: Array; /** * apikey remarks (length 4~32) */ - label?: string; + label: string; }): AddSubAccountApiReq { let obj = new AddSubAccountApiReq(); obj.uid = data.uid; @@ -67,17 +83,16 @@ export class AddSubAccountApiReq implements Serializable { return obj; } - fromJson(input: string): AddSubAccountApiReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountApiReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountApiReq { - return plainToInstance(AddSubAccountApiReq, jsonObject); + static fromJson(input: string): AddSubAccountApiReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountApiReq { + return plainToClassFromExist(new AddSubAccountApiReq(), jsonObject); } } @@ -99,7 +114,9 @@ export namespace AddSubAccountApiReq { } export class AddSubAccountApiReqBuilder { - obj: AddSubAccountApiReq = new AddSubAccountApiReq(); + constructor(readonly obj: AddSubAccountApiReq) { + this.obj = obj; + } /** * Subaccount UID */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts index 1e2e5c3d..a3e2b545 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts @@ -1,43 +1,68 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountApiResp implements Response { +export class AddSubAccountApiResp implements Response { /** * Sub-Account UID */ - uid?: string; + uid: string; + /** * apikey remarks */ - label?: string; + label: string; + /** * apiKey */ - apiKey?: string; + apiKey: string; + /** * secretKey */ - secretKey?: string; + secretKey: string; + /** * apiVersion */ - apiVersion?: number; + apiVersion: number; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list */ - permissions?: Array; + permissions: Array; + /** * IP whitelist list */ - ipWhitelist?: Array; + ipWhitelist: Array; + /** * Creation time, unix timestamp (milliseconds) */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.label = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.secretKey = null; + // @ts-ignore + this.apiVersion = null; + // @ts-ignore + this.permissions = null; + // @ts-ignore + this.ipWhitelist = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -48,16 +73,15 @@ export class AddSubAccountApiResp implements Response { +export class AddSubAccountReq implements Serializable { /** * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. */ - accountName?: string; + accountName: string; + private constructor() { + // @ts-ignore + this.accountName = null; + } /** * Creates a new instance of the `AddSubAccountReq` class. * The builder pattern allows step-by-step construction of a `AddSubAccountReq` object. */ static builder(): AddSubAccountReqBuilder { - return new AddSubAccountReqBuilder(); + return new AddSubAccountReqBuilder(new AddSubAccountReq()); } /** @@ -24,29 +28,30 @@ export class AddSubAccountReq implements Serializable { /** * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. */ - accountName?: string; + accountName: string; }): AddSubAccountReq { let obj = new AddSubAccountReq(); obj.accountName = data.accountName; return obj; } - fromJson(input: string): AddSubAccountReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddSubAccountReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddSubAccountReq { - return plainToInstance(AddSubAccountReq, jsonObject); + static fromJson(input: string): AddSubAccountReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddSubAccountReq { + return plainToClassFromExist(new AddSubAccountReq(), jsonObject); } } export class AddSubAccountReqBuilder { - obj: AddSubAccountReq = new AddSubAccountReq(); + constructor(readonly obj: AddSubAccountReq) { + this.obj = obj; + } /** * Sub Account Name, Note that this name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication. */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts index 0dda673b..739002c0 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddSubAccountResp implements Response { +export class AddSubAccountResp implements Response { /** * Sub-Account name */ - accountName?: string; + accountName: string; + /** * Sub-Account UID */ - uid?: string; + uid: string; + /** * Creation time, unix timestamp (milliseconds) */ - createdAt?: number; + createdAt: number; + /** * Subaccount VIP level */ - level?: number; + level: number; + private constructor() { + // @ts-ignore + this.accountName = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.level = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddSubAccountResp implements Response { +export class DeleteSubAccountAPIReq implements Serializable { /** * Sub-account UID */ uid?: string; + /** * Sub-account apiKey */ apiKey?: string; + private constructor() {} /** * Creates a new instance of the `DeleteSubAccountAPIReq` class. * The builder pattern allows step-by-step construction of a `DeleteSubAccountAPIReq` object. */ static builder(): DeleteSubAccountAPIReqBuilder { - return new DeleteSubAccountAPIReqBuilder(); + return new DeleteSubAccountAPIReqBuilder(new DeleteSubAccountAPIReq()); } /** @@ -40,22 +42,23 @@ export class DeleteSubAccountAPIReq implements Serializable { +export class DeleteSubAccountAPIResp implements Response { /** * */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class DeleteSubAccountAPIResp implements Response { +export class GetBrokerInfoReq implements Serializable { /** * Start time, for example: 20230110 */ begin?: string; + /** * End time, for example: 20230210 (query data with a maximum interval of 6 months) */ end?: string; + /** * Transaction type, 1: spot 2: futures */ tradeType?: GetBrokerInfoReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetBrokerInfoReq` class. * The builder pattern allows step-by-step construction of a `GetBrokerInfoReq` object. */ static builder(): GetBrokerInfoReqBuilder { - return new GetBrokerInfoReqBuilder(); + return new GetBrokerInfoReqBuilder(new GetBrokerInfoReq()); } /** @@ -49,17 +52,16 @@ export class GetBrokerInfoReq implements Serializable { return obj; } - fromJson(input: string): GetBrokerInfoReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetBrokerInfoReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetBrokerInfoReq { - return plainToInstance(GetBrokerInfoReq, jsonObject); + static fromJson(input: string): GetBrokerInfoReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetBrokerInfoReq { + return plainToClassFromExist(new GetBrokerInfoReq(), jsonObject); } } @@ -77,7 +79,9 @@ export namespace GetBrokerInfoReq { } export class GetBrokerInfoReqBuilder { - obj: GetBrokerInfoReq = new GetBrokerInfoReq(); + constructor(readonly obj: GetBrokerInfoReq) { + this.obj = obj; + } /** * Start time, for example: 20230110 */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts index 3e587e72..aaf462ce 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts @@ -1,23 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetBrokerInfoResp implements Response { +export class GetBrokerInfoResp implements Response { /** * Number of sub-accounts created */ - accountSize?: number; + accountSize: number; + /** * The maximum number of sub-accounts allowed to be created, null means no limit */ - maxAccountSize?: number; + maxAccountSize: number; + /** * Broker level */ - level?: number; + level: number; + private constructor() { + // @ts-ignore + this.accountSize = null; + // @ts-ignore + this.maxAccountSize = null; + // @ts-ignore + this.level = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class GetBrokerInfoResp implements Response { +export class GetDepositDetailReq implements Serializable { /** * Currency */ currency?: string; + /** * Hash Value */ hash?: string; + private constructor() {} /** * Creates a new instance of the `GetDepositDetailReq` class. * The builder pattern allows step-by-step construction of a `GetDepositDetailReq` object. */ static builder(): GetDepositDetailReqBuilder { - return new GetDepositDetailReqBuilder(); + return new GetDepositDetailReqBuilder(new GetDepositDetailReq()); } /** @@ -40,22 +42,23 @@ export class GetDepositDetailReq implements Serializable { return obj; } - fromJson(input: string): GetDepositDetailReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositDetailReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositDetailReq { - return plainToInstance(GetDepositDetailReq, jsonObject); + static fromJson(input: string): GetDepositDetailReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositDetailReq { + return plainToClassFromExist(new GetDepositDetailReq(), jsonObject); } } export class GetDepositDetailReqBuilder { - obj: GetDepositDetailReq = new GetDepositDetailReq(); + constructor(readonly obj: GetDepositDetailReq) { + this.obj = obj; + } /** * Currency */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts index 7125d62c..9dabb1cb 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts @@ -1,67 +1,110 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetDepositDetailResp implements Response { +export class GetDepositDetailResp implements Response { /** * chain id of currency */ - chain?: string; + chain: string; + /** * Hash */ - hash?: string; + hash: string; + /** * Wallet Transaction ID */ - walletTxId?: string; + walletTxId: string; + /** * UID */ - uid?: number; + uid: number; + /** * Update Time (milliseconds) */ - updatedAt?: number; + updatedAt: number; + /** * Amount */ - amount?: string; + amount: string; + /** * Memo */ - memo?: string; + memo: string; + /** * Fee */ - fee?: string; + fee: string; + /** * Address */ - address?: string; + address: string; + /** * Remark */ - remark?: string; + remark: string; + /** * Is Internal (true or false) */ - isInner?: boolean; + isInner: boolean; + /** * Currency */ - currency?: string; + currency: string; + /** * Status (PROCESSING, SUCCESS, FAILURE) */ - status?: GetDepositDetailResp.StatusEnum; + status: GetDepositDetailResp.StatusEnum; + /** * Creation Time (milliseconds) */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.chain = null; + // @ts-ignore + this.hash = null; + // @ts-ignore + this.walletTxId = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.address = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.isInner = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -72,17 +115,16 @@ export class GetDepositDetailResp implements Response { +export class GetDepositListData implements Serializable { /** * deposit uid */ - uid?: number; + uid: number; + /** * hash */ - hash?: string; + hash: string; + /** * Deposit address */ - address?: string; + address: string; + /** * Address remark. If there’s no remark, it is empty. When you withdraw from other platforms to the KuCoin, you need to fill in memo(tag). If you do not fill memo (tag), your deposit may not be available, please be cautious. */ - memo?: string; + memo: string; + /** * Deposit amount */ - amount?: string; + amount: string; + /** * Fees charged for deposit */ - fee?: string; + fee: string; + /** * currency */ - currency?: string; + currency: string; + /** * Internal deposit or not */ - isInner?: boolean; + isInner: boolean; + /** * Wallet Txid */ - walletTxId?: string; + walletTxId: string; + /** * Status. Available value: PROCESSING, SUCCESS, FAILURE */ - status?: GetDepositListData.StatusEnum; + status: GetDepositListData.StatusEnum; + /** * remark */ - remark?: string; + remark: string; + /** * chain name of currency */ - chain?: string; + chain: string; + /** * Creation time of the database record */ - createdAt?: number; + createdAt: number; + /** * Update time of the database record */ - updatedAt?: number; + updatedAt: number; - fromJson(input: string): GetDepositListData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositListData, jsonObject); + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.hash = null; + // @ts-ignore + this.address = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.isInner = null; + // @ts-ignore + this.walletTxId = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.chain = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositListData { - return plainToInstance(GetDepositListData, jsonObject); + static fromJson(input: string): GetDepositListData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositListData { + return plainToClassFromExist(new GetDepositListData(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts index 6ffac8a2..652ebb70 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts @@ -1,40 +1,46 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetDepositListReq implements Serializable { +export class GetDepositListReq implements Serializable { /** * currency */ currency?: string; + /** * Status. Available value: PROCESSING, SUCCESS, FAILURE */ status?: string; + /** * hash */ hash?: string; + /** * Start time (milisecond) */ startTimestamp?: number; + /** * End time (milisecond),Default sorting in descending order */ endTimestamp?: number; + /** * Maximum number of returned items, maximum 1000, default 1000 */ limit?: number = 1000; + private constructor() {} /** * Creates a new instance of the `GetDepositListReq` class. * The builder pattern allows step-by-step construction of a `GetDepositListReq` object. */ static builder(): GetDepositListReqBuilder { - return new GetDepositListReqBuilder(); + return new GetDepositListReqBuilder(new GetDepositListReq()); } /** @@ -72,26 +78,31 @@ export class GetDepositListReq implements Serializable { obj.hash = data.hash; obj.startTimestamp = data.startTimestamp; obj.endTimestamp = data.endTimestamp; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 1000; + } return obj; } - fromJson(input: string): GetDepositListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDepositListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDepositListReq { - return plainToInstance(GetDepositListReq, jsonObject); + static fromJson(input: string): GetDepositListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDepositListReq { + return plainToClassFromExist(new GetDepositListReq(), jsonObject); } } export class GetDepositListReqBuilder { - obj: GetDepositListReq = new GetDepositListReq(); + constructor(readonly obj: GetDepositListReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts index 9261deb6..8821c8f2 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetDepositListData } from './model_get_deposit_list_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetDepositListResp implements Response { +export class GetDepositListResp implements Response { /** * */ @Type(() => GetDepositListData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetDepositListResp implements Response { +export class GetRebaseReq implements Serializable { /** * Start time, for example: 20240610 */ begin?: string; + /** * End time, for example: 20241010 (query data with a maximum interval of 6 months) */ end?: string; + /** * Transaction type, 1: spot 2: futures */ tradeType?: GetRebaseReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetRebaseReq` class. * The builder pattern allows step-by-step construction of a `GetRebaseReq` object. */ static builder(): GetRebaseReqBuilder { - return new GetRebaseReqBuilder(); + return new GetRebaseReqBuilder(new GetRebaseReq()); } /** @@ -49,17 +52,16 @@ export class GetRebaseReq implements Serializable { return obj; } - fromJson(input: string): GetRebaseReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRebaseReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRebaseReq { - return plainToInstance(GetRebaseReq, jsonObject); + static fromJson(input: string): GetRebaseReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRebaseReq { + return plainToClassFromExist(new GetRebaseReq(), jsonObject); } } @@ -77,7 +79,9 @@ export namespace GetRebaseReq { } export class GetRebaseReqBuilder { - obj: GetRebaseReq = new GetRebaseReq(); + constructor(readonly obj: GetRebaseReq) { + this.obj = obj; + } /** * Start time, for example: 20240610 */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts index 3e68723e..db99944d 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetRebaseResp implements Response { +export class GetRebaseResp implements Response { /** * Rebate order file (link is valid for 1 day) */ - url?: string; + url: string; + private constructor() { + // @ts-ignore + this.url = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetRebaseResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetRebaseResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRebaseResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRebaseResp { - return plainToInstance(GetRebaseResp, jsonObject); + static fromJson(input: string): GetRebaseResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRebaseResp { + return plainToClassFromExist(new GetRebaseResp(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts index 9cea5ef2..b8e6d003 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts @@ -1,49 +1,70 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSubAccountAPIData implements Serializable { +export class GetSubAccountAPIData implements Serializable { /** * Sub-Account UID */ - uid?: string; + uid: string; + /** * apikey remarks */ - label?: string; + label: string; + /** * apiKey */ - apiKey?: string; + apiKey: string; + /** * apiVersion */ - apiVersion?: number; + apiVersion: number; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list */ - permissions?: Array; + permissions: Array; + /** * IP whitelist list */ - ipWhitelist?: Array; + ipWhitelist: Array; + /** * Creation time, unix timestamp (milliseconds) */ - createdAt?: number; + createdAt: number; - fromJson(input: string): GetSubAccountAPIData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSubAccountAPIData, jsonObject); + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.label = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.apiVersion = null; + // @ts-ignore + this.permissions = null; + // @ts-ignore + this.ipWhitelist = null; + // @ts-ignore + this.createdAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSubAccountAPIData { - return plainToInstance(GetSubAccountAPIData, jsonObject); + static fromJson(input: string): GetSubAccountAPIData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSubAccountAPIData { + return plainToClassFromExist(new GetSubAccountAPIData(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts index a445ca15..ebe92bf4 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSubAccountAPIReq implements Serializable { +export class GetSubAccountAPIReq implements Serializable { /** * Sub-account UID */ uid?: string; + /** * Sub-account apiKey */ apiKey?: string; + private constructor() {} /** * Creates a new instance of the `GetSubAccountAPIReq` class. * The builder pattern allows step-by-step construction of a `GetSubAccountAPIReq` object. */ static builder(): GetSubAccountAPIReqBuilder { - return new GetSubAccountAPIReqBuilder(); + return new GetSubAccountAPIReqBuilder(new GetSubAccountAPIReq()); } /** @@ -40,22 +42,23 @@ export class GetSubAccountAPIReq implements Serializable { return obj; } - fromJson(input: string): GetSubAccountAPIReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSubAccountAPIReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSubAccountAPIReq { - return plainToInstance(GetSubAccountAPIReq, jsonObject); + static fromJson(input: string): GetSubAccountAPIReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSubAccountAPIReq { + return plainToClassFromExist(new GetSubAccountAPIReq(), jsonObject); } } export class GetSubAccountAPIReqBuilder { - obj: GetSubAccountAPIReq = new GetSubAccountAPIReq(); + constructor(readonly obj: GetSubAccountAPIReq) { + this.obj = obj; + } /** * Sub-account UID */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts index 87a9d782..b3048580 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetSubAccountAPIData } from './model_get_sub_account_api_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSubAccountAPIResp implements Response { +export class GetSubAccountAPIResp implements Response { /** * */ @Type(() => GetSubAccountAPIData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSubAccountAPIResp implements Response { +export class GetSubAccountItems implements Serializable { /** * Sub-account name */ - accountName?: string; + accountName: string; + /** * Sub-account UID */ - uid?: string; + uid: string; + /** * Creation time, unix timestamp (milliseconds) */ - createdAt?: number; + createdAt: number; + /** * Sub-account VIP level */ - level?: number; + level: number; - fromJson(input: string): GetSubAccountItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSubAccountItems, jsonObject); + private constructor() { + // @ts-ignore + this.accountName = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.level = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSubAccountItems { - return plainToInstance(GetSubAccountItems, jsonObject); + static fromJson(input: string): GetSubAccountItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSubAccountItems { + return plainToClassFromExist(new GetSubAccountItems(), jsonObject); } } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts index de548bb2..785badbf 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSubAccountReq implements Serializable { +export class GetSubAccountReq implements Serializable { /** * Sub-account UID */ uid?: string; + /** * Current page, default is 1 */ currentPage?: number = 1; + /** * The number returned per page, the default is 20, the maximum is 100 */ pageSize?: number = 20; + private constructor() {} /** * Creates a new instance of the `GetSubAccountReq` class. * The builder pattern allows step-by-step construction of a `GetSubAccountReq` object. */ static builder(): GetSubAccountReqBuilder { - return new GetSubAccountReqBuilder(); + return new GetSubAccountReqBuilder(new GetSubAccountReq()); } /** @@ -44,27 +47,36 @@ export class GetSubAccountReq implements Serializable { }): GetSubAccountReq { let obj = new GetSubAccountReq(); obj.uid = data.uid; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 20; + } return obj; } - fromJson(input: string): GetSubAccountReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSubAccountReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSubAccountReq { - return plainToInstance(GetSubAccountReq, jsonObject); + static fromJson(input: string): GetSubAccountReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSubAccountReq { + return plainToClassFromExist(new GetSubAccountReq(), jsonObject); } } export class GetSubAccountReqBuilder { - obj: GetSubAccountReq = new GetSubAccountReq(); + constructor(readonly obj: GetSubAccountReq) { + this.obj = obj; + } /** * Sub-account UID */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts index 356468a8..2bf332ca 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetSubAccountItems } from './model_get_sub_account_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSubAccountResp implements Response { +export class GetSubAccountResp implements Response { /** * Current page */ - currentPage?: number; + currentPage: number; + /** * Page Size */ - pageSize?: number; + pageSize: number; + /** * Total Number */ - totalNum?: number; + totalNum: number; + /** * Total Page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetSubAccountItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetSubAccountResp implements Response { +export class GetTransferHistoryReq implements Serializable { /** * Transfer Order ID */ orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetTransferHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTransferHistoryReq` object. */ static builder(): GetTransferHistoryReqBuilder { - return new GetTransferHistoryReqBuilder(); + return new GetTransferHistoryReqBuilder(new GetTransferHistoryReq()); } /** @@ -31,22 +32,23 @@ export class GetTransferHistoryReq implements Serializable { +export class GetTransferHistoryResp implements Response { /** * Transfer Order ID */ - orderId?: string; + orderId: string; + /** * Currency */ - currency?: string; + currency: string; + /** * Transfer Amount */ - amount?: string; + amount: string; + /** * UID of the user transferring out */ - fromUid?: number; + fromUid: number; + /** * From Account Type:Account Type: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED */ - fromAccountType?: GetTransferHistoryResp.FromAccountTypeEnum; + fromAccountType: GetTransferHistoryResp.FromAccountTypeEnum; + /** * Trading pair, required if the account type is ISOLATED, e.g., BTC-USDT */ - fromAccountTag?: string; + fromAccountTag: string; + /** * UID of the user transferring in */ - toUid?: number; + toUid: number; + /** * Account Type:Account Type: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED */ - toAccountType?: GetTransferHistoryResp.ToAccountTypeEnum; + toAccountType: GetTransferHistoryResp.ToAccountTypeEnum; + /** * To Trading pair, required if the account type is ISOLATED, e.g., BTC-USDT */ - toAccountTag?: string; + toAccountTag: string; + /** * Status: PROCESSING (processing), SUCCESS (successful), FAILURE (failed) */ - status?: GetTransferHistoryResp.StatusEnum; + status: GetTransferHistoryResp.StatusEnum; + /** * Failure Reason */ - reason?: string; + reason: string; + /** * Creation Time (Unix timestamp in milliseconds) */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.fromUid = null; + // @ts-ignore + this.fromAccountType = null; + // @ts-ignore + this.fromAccountTag = null; + // @ts-ignore + this.toUid = null; + // @ts-ignore + this.toAccountType = null; + // @ts-ignore + this.toAccountTag = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.reason = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -64,17 +101,16 @@ export class GetTransferHistoryResp implements Response { +export class GetWithdrawDetailReq implements Serializable { /** * Withdrawal ID */ withdrawalId?: string; + private constructor() {} /** * Creates a new instance of the `GetWithdrawDetailReq` class. * The builder pattern allows step-by-step construction of a `GetWithdrawDetailReq` object. */ static builder(): GetWithdrawDetailReqBuilder { - return new GetWithdrawDetailReqBuilder(); + return new GetWithdrawDetailReqBuilder(new GetWithdrawDetailReq()); } /** @@ -31,22 +32,23 @@ export class GetWithdrawDetailReq implements Serializable return obj; } - fromJson(input: string): GetWithdrawDetailReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetWithdrawDetailReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetWithdrawDetailReq { - return plainToInstance(GetWithdrawDetailReq, jsonObject); + static fromJson(input: string): GetWithdrawDetailReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetWithdrawDetailReq { + return plainToClassFromExist(new GetWithdrawDetailReq(), jsonObject); } } export class GetWithdrawDetailReqBuilder { - obj: GetWithdrawDetailReq = new GetWithdrawDetailReq(); + constructor(readonly obj: GetWithdrawDetailReq) { + this.obj = obj; + } /** * Withdrawal ID */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts index 6a423971..5e88f8b8 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts @@ -1,67 +1,110 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetWithdrawDetailResp implements Response { +export class GetWithdrawDetailResp implements Response { /** * Withdrawal ID */ - id?: string; + id: string; + /** * chain id of currency */ - chain?: string; + chain: string; + /** * Wallet Transaction ID */ - walletTxId?: string; + walletTxId: string; + /** * UID */ - uid?: number; + uid: number; + /** * Update Time (milliseconds) */ - updatedAt?: number; + updatedAt: number; + /** * Amount */ - amount?: string; + amount: string; + /** * Memo */ - memo?: string; + memo: string; + /** * Fee */ - fee?: string; + fee: string; + /** * Address */ - address?: string; + address: string; + /** * Remark */ - remark?: string; + remark: string; + /** * Is Internal (true or false) */ - isInner?: boolean; + isInner: boolean; + /** * Currency */ - currency?: string; + currency: string; + /** * Status (PROCESSING, WALLET_PROCESSING, REVIEW, SUCCESS, FAILURE) */ - status?: GetWithdrawDetailResp.StatusEnum; + status: GetWithdrawDetailResp.StatusEnum; + /** * Creation Time (milliseconds) */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.chain = null; + // @ts-ignore + this.walletTxId = null; + // @ts-ignore + this.uid = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.memo = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.address = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.isInner = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -72,17 +115,16 @@ export class GetWithdrawDetailResp implements Response { +export class ModifySubAccountApiReq implements Serializable { /** * Subaccount UID */ - uid?: string; + uid: string; + /** * IP whitelist list, supports up to 20 IPs */ - ipWhitelist?: Array; + ipWhitelist: Array; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) */ - permissions?: Array; + permissions: Array; + /** * apikey remarks (length 4~32) */ - label?: string; + label: string; + /** * Subaccount apiKey */ - apiKey?: string; + apiKey: string; + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.ipWhitelist = null; + // @ts-ignore + this.permissions = null; + // @ts-ignore + this.label = null; + // @ts-ignore + this.apiKey = null; + } /** * Creates a new instance of the `ModifySubAccountApiReq` class. * The builder pattern allows step-by-step construction of a `ModifySubAccountApiReq` object. */ static builder(): ModifySubAccountApiReqBuilder { - return new ModifySubAccountApiReqBuilder(); + return new ModifySubAccountApiReqBuilder(new ModifySubAccountApiReq()); } /** @@ -40,23 +56,23 @@ export class ModifySubAccountApiReq implements Serializable; + ipWhitelist: Array; /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list(Only General、Spot、Futures permissions can be set, such as \"General, Trade\". ) */ - permissions?: Array; + permissions: Array; /** * apikey remarks (length 4~32) */ - label?: string; + label: string; /** * Subaccount apiKey */ - apiKey?: string; + apiKey: string; }): ModifySubAccountApiReq { let obj = new ModifySubAccountApiReq(); obj.uid = data.uid; @@ -67,17 +83,16 @@ export class ModifySubAccountApiReq implements Serializable { +export class ModifySubAccountApiResp implements Response { /** * Sub-Account UID */ - uid?: string; + uid: string; + /** * apikey remarks */ - label?: string; + label: string; + /** * apiKey */ - apiKey?: string; + apiKey: string; + /** * apiVersion */ - apiVersion?: number; + apiVersion: number; + /** * [Permissions](https://www.kucoin.com/docs-new/doc-338144) group list */ - permissions?: Array; + permissions: Array; + /** * IP whitelist list */ - ipWhitelist?: Array; + ipWhitelist: Array; + /** * Creation time, unix timestamp (milliseconds) */ - createdAt?: number; + createdAt: number; + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.label = null; + // @ts-ignore + this.apiKey = null; + // @ts-ignore + this.apiVersion = null; + // @ts-ignore + this.permissions = null; + // @ts-ignore + this.ipWhitelist = null; + // @ts-ignore + this.createdAt = null; + } /** * common response */ @@ -44,16 +66,15 @@ export class ModifySubAccountApiResp implements Response { +export class TransferReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Transfer Amount (must be a positive integer in the currency\'s precision) */ - amount?: string; + amount: string; + /** * Fund transfer direction: OUT (Broker account is transferred to Broker sub-account), IN (Broker sub-account is transferred to Broker account) */ - direction?: TransferReq.DirectionEnum; + direction: TransferReq.DirectionEnum; + /** * Broker account types: MAIN (Funding account), TRADE (Spot trading account) */ - accountType?: TransferReq.AccountTypeEnum; + accountType: TransferReq.AccountTypeEnum; + /** * Broker subaccount uid, must be the Broker subaccount created by the current Broker user. */ - specialUid?: string; + specialUid: string; + /** * Broker sub-account types: MAIN (Funding account), TRADE (Spot trading account) */ - specialAccountType?: TransferReq.SpecialAccountTypeEnum; + specialAccountType: TransferReq.SpecialAccountTypeEnum; + /** * Client Order Id, The unique identifier created by the client. It is recommended to use UUID. The maximum length is 128 bits. */ - clientOid?: string; - + clientOid: string; + + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.direction = null; + // @ts-ignore + this.accountType = null; + // @ts-ignore + this.specialUid = null; + // @ts-ignore + this.specialAccountType = null; + // @ts-ignore + this.clientOid = null; + } /** * Creates a new instance of the `TransferReq` class. * The builder pattern allows step-by-step construction of a `TransferReq` object. */ static builder(): TransferReqBuilder { - return new TransferReqBuilder(); + return new TransferReqBuilder(new TransferReq()); } /** @@ -48,31 +70,31 @@ export class TransferReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; /** * Transfer Amount (must be a positive integer in the currency\'s precision) */ - amount?: string; + amount: string; /** * Fund transfer direction: OUT (Broker account is transferred to Broker sub-account), IN (Broker sub-account is transferred to Broker account) */ - direction?: TransferReq.DirectionEnum; + direction: TransferReq.DirectionEnum; /** * Broker account types: MAIN (Funding account), TRADE (Spot trading account) */ - accountType?: TransferReq.AccountTypeEnum; + accountType: TransferReq.AccountTypeEnum; /** * Broker subaccount uid, must be the Broker subaccount created by the current Broker user. */ - specialUid?: string; + specialUid: string; /** * Broker sub-account types: MAIN (Funding account), TRADE (Spot trading account) */ - specialAccountType?: TransferReq.SpecialAccountTypeEnum; + specialAccountType: TransferReq.SpecialAccountTypeEnum; /** * Client Order Id, The unique identifier created by the client. It is recommended to use UUID. The maximum length is 128 bits. */ - clientOid?: string; + clientOid: string; }): TransferReq { let obj = new TransferReq(); obj.currency = data.currency; @@ -85,17 +107,16 @@ export class TransferReq implements Serializable { return obj; } - fromJson(input: string): TransferReq { - const jsonObject = JSON.parse(input); - return plainToInstance(TransferReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TransferReq { - return plainToInstance(TransferReq, jsonObject); + static fromJson(input: string): TransferReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TransferReq { + return plainToClassFromExist(new TransferReq(), jsonObject); } } @@ -133,7 +154,9 @@ export namespace TransferReq { } export class TransferReqBuilder { - obj: TransferReq = new TransferReq(); + constructor(readonly obj: TransferReq) { + this.obj = obj; + } /** * Currency */ diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts index cec48a39..2d1b9430 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class TransferResp implements Response { +export class TransferResp implements Response { /** * */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class TransferResp implements Response { this.commonResponse = response; } - fromJson(input: string): TransferResp { - const jsonObject = JSON.parse(input); - return plainToInstance(TransferResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TransferResp { - return plainToInstance(TransferResp, jsonObject); + static fromJson(input: string): TransferResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TransferResp { + return plainToClassFromExist(new TransferResp(), jsonObject); } } diff --git a/sdk/node/src/generate/copytrading/futures/api_futures.ts b/sdk/node/src/generate/copytrading/futures/api_futures.ts index ec6a6b9c..2725ad75 100644 --- a/sdk/node/src/generate/copytrading/futures/api_futures.ts +++ b/sdk/node/src/generate/copytrading/futures/api_futures.ts @@ -214,7 +214,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/orders', req, - new AddOrderResp(), + AddOrderResp, false, ); } @@ -226,7 +226,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/orders/test', req, - new AddOrderTestResp(), + AddOrderTestResp, false, ); } @@ -238,7 +238,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/st-orders', req, - new AddTPSLOrderResp(), + AddTPSLOrderResp, false, ); } @@ -250,7 +250,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'DELETE', '/api/v1/copy-trade/futures/orders', req, - new CancelOrderByIdResp(), + CancelOrderByIdResp, false, ); } @@ -262,7 +262,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'DELETE', '/api/v1/copy-trade/futures/orders/client-order', req, - new CancelOrderByClientOidResp(), + CancelOrderByClientOidResp, false, ); } @@ -274,7 +274,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'GET', '/api/v1/copy-trade/futures/get-max-open-size', req, - new GetMaxOpenSizeResp(), + GetMaxOpenSizeResp, false, ); } @@ -286,7 +286,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'GET', '/api/v1/copy-trade/futures/position/margin/max-withdraw-margin', req, - new GetMaxWithdrawMarginResp(), + GetMaxWithdrawMarginResp, false, ); } @@ -298,7 +298,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/position/margin/deposit-margin', req, - new AddIsolatedMarginResp(), + AddIsolatedMarginResp, false, ); } @@ -310,7 +310,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/position/margin/withdraw-margin', req, - new RemoveIsolatedMarginResp(), + RemoveIsolatedMarginResp, false, ); } @@ -324,7 +324,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/position/risk-limit-level/change', req, - new ModifyIsolatedMarginRiskLimtResp(), + ModifyIsolatedMarginRiskLimtResp, false, ); } @@ -336,7 +336,7 @@ export class FuturesAPIImpl implements FuturesAPI { 'POST', '/api/v1/copy-trade/futures/position/margin/auto-deposit-status', req, - new ModifyAutoDepositStatusResp(), + ModifyAutoDepositStatusResp, false, ); } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts index 470ebc19..d4d5e9a7 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts @@ -1,28 +1,38 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddIsolatedMarginReq implements Serializable { +export class AddIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Margin amount (min. margin amount≥0.00001667XBT) */ - margin?: number; + margin: number; + /** * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 */ - bizNo?: string; + bizNo: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.margin = null; + // @ts-ignore + this.bizNo = null; + } /** * Creates a new instance of the `AddIsolatedMarginReq` class. * The builder pattern allows step-by-step construction of a `AddIsolatedMarginReq` object. */ static builder(): AddIsolatedMarginReqBuilder { - return new AddIsolatedMarginReqBuilder(); + return new AddIsolatedMarginReqBuilder(new AddIsolatedMarginReq()); } /** @@ -32,15 +42,15 @@ export class AddIsolatedMarginReq implements Serializable /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Margin amount (min. margin amount≥0.00001667XBT) */ - margin?: number; + margin: number; /** * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 */ - bizNo?: string; + bizNo: string; }): AddIsolatedMarginReq { let obj = new AddIsolatedMarginReq(); obj.symbol = data.symbol; @@ -49,22 +59,23 @@ export class AddIsolatedMarginReq implements Serializable return obj; } - fromJson(input: string): AddIsolatedMarginReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddIsolatedMarginReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddIsolatedMarginReq { - return plainToInstance(AddIsolatedMarginReq, jsonObject); + static fromJson(input: string): AddIsolatedMarginReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddIsolatedMarginReq { + return plainToClassFromExist(new AddIsolatedMarginReq(), jsonObject); } } export class AddIsolatedMarginReqBuilder { - obj: AddIsolatedMarginReq = new AddIsolatedMarginReq(); + constructor(readonly obj: AddIsolatedMarginReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts index 6da78ec9..b81d0885 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts @@ -1,155 +1,264 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddIsolatedMarginResp implements Response { +export class AddIsolatedMarginResp implements Response { /** * Position ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Auto deposit margin or not */ - autoDeposit?: boolean; + autoDeposit: boolean; + /** * Maintenance margin requirement */ - maintMarginReq?: string; + maintMarginReq: string; + /** * Risk limit */ - riskLimit?: number; + riskLimit: number; + /** * Leverage o the order */ - realLeverage?: string; + realLeverage: string; + /** * Cross mode or not */ - crossMode?: boolean; + crossMode: boolean; + /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; + /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; + /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; + /** * Current postion quantity */ - currentQty?: number; + currentQty: number; + /** * Current postion value */ - currentCost?: string; + currentCost: string; + /** * Current commission */ - currentComm?: string; + currentComm: string; + /** * Unrealised value */ - unrealisedCost?: string; + unrealisedCost: string; + /** * Accumulated realised gross profit value */ - realisedGrossCost?: string; + realisedGrossCost: string; + /** * Current realised position value */ - realisedCost?: string; + realisedCost: string; + /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; + /** * Mark price */ - markPrice?: string; + markPrice: string; + /** * Mark value */ - markValue?: string; + markValue: string; + /** * Position value */ - posCost?: string; + posCost: string; + /** * added margin */ - posCross?: string; + posCross: string; + /** * Leverage margin */ - posInit?: string; + posInit: string; + /** * Bankruptcy cost */ - posComm?: string; + posComm: string; + /** * Funding fees paid out */ - posLoss?: string; + posLoss: string; + /** * Position margin */ - posMargin?: string; + posMargin: string; + /** * Maintenance margin */ - posMaint?: string; + posMaint: string; + /** * Position margin */ - maintMargin?: string; + maintMargin: string; + /** * Accumulated realised gross profit value */ - realisedGrossPnl?: string; + realisedGrossPnl: string; + /** * Realised profit and loss */ - realisedPnl?: string; + realisedPnl: string; + /** * Unrealised profit and loss */ - unrealisedPnl?: string; + unrealisedPnl: string; + /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: string; + unrealisedPnlPcnt: string; + /** * Rate of return on investment */ - unrealisedRoePcnt?: string; + unrealisedRoePcnt: string; + /** * Average entry price */ - avgEntryPrice?: string; + avgEntryPrice: string; + /** * Liquidation price */ - liquidationPrice?: string; + liquidationPrice: string; + /** * Bankruptcy price */ - bankruptPrice?: string; + bankruptPrice: string; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.autoDeposit = null; + // @ts-ignore + this.maintMarginReq = null; + // @ts-ignore + this.riskLimit = null; + // @ts-ignore + this.realLeverage = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posCross = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posComm = null; + // @ts-ignore + this.posLoss = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.posMaint = null; + // @ts-ignore + this.maintMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.settleCurrency = null; + } /** * common response */ @@ -160,16 +269,15 @@ export class AddIsolatedMarginResp implements Response { +export class AddOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ leverage?: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + type: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderReq.StopEnum; + /** * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** * Need to be defined if stop is specified. */ stopPrice?: string; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddOrderReq.MarginModeEnum = AddOrderReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.size = null; + } /** * Creates a new instance of the `AddOrderReq` class. * The builder pattern allows step-by-step construction of a `AddOrderReq` object. */ static builder(): AddOrderReqBuilder { - return new AddOrderReqBuilder(); + return new AddOrderReqBuilder(new AddOrderReq()); } /** @@ -100,15 +131,15 @@ export class AddOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ @@ -116,7 +147,7 @@ export class AddOrderReq implements Serializable { /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderReq.TypeEnum; + type: AddOrderReq.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -156,7 +187,7 @@ export class AddOrderReq implements Serializable { /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ @@ -183,36 +214,71 @@ export class AddOrderReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stop = data.stop; obj.stopPriceType = data.stopPriceType; obj.stopPrice = data.stopPrice; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; - obj.marginMode = data.marginMode; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddOrderReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; return obj; } - fromJson(input: string): AddOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderReq { - return plainToInstance(AddOrderReq, jsonObject); + static fromJson(input: string): AddOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderReq { + return plainToClassFromExist(new AddOrderReq(), jsonObject); } } @@ -284,7 +350,9 @@ export namespace AddOrderReq { } export class AddOrderReqBuilder { - obj: AddOrderReq = new AddOrderReq(); + constructor(readonly obj: AddOrderReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts index b221e43d..7545d9d8 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderResp implements Response { +export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderResp implements Response { this.commonResponse = response; } - fromJson(input: string): AddOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderResp { - return plainToInstance(AddOrderResp, jsonObject); + static fromJson(input: string): AddOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderResp { + return plainToClassFromExist(new AddOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts index 5538c491..bffdee01 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts @@ -1,97 +1,130 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderTestReq implements Serializable { +export class AddOrderTestReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + type: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderTestReq.StopEnum; + /** * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** * Need to be defined if stop is specified. */ stopPrice?: string; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddOrderTestReq.MarginModeEnum = AddOrderTestReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.size = null; + } /** * Creates a new instance of the `AddOrderTestReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. */ static builder(): AddOrderTestReqBuilder { - return new AddOrderTestReqBuilder(); + return new AddOrderTestReqBuilder(new AddOrderTestReq()); } /** @@ -101,23 +134,23 @@ export class AddOrderTestReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderTestReq.TypeEnum; + type: AddOrderTestReq.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -157,7 +190,7 @@ export class AddOrderTestReq implements Serializable { /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ @@ -184,36 +217,71 @@ export class AddOrderTestReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderTestReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stop = data.stop; obj.stopPriceType = data.stopPriceType; obj.stopPrice = data.stopPrice; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; - obj.marginMode = data.marginMode; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddOrderTestReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; return obj; } - fromJson(input: string): AddOrderTestReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestReq { - return plainToInstance(AddOrderTestReq, jsonObject); + static fromJson(input: string): AddOrderTestReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestReq { + return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } } @@ -285,7 +353,9 @@ export namespace AddOrderTestReq { } export class AddOrderTestReqBuilder { - obj: AddOrderTestReq = new AddOrderTestReq(); + constructor(readonly obj: AddOrderTestReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts index 9eae886c..20e19e9d 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestResp implements Response { +export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderTestResp implements Response { +export class AddTPSLOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddTPSLOrderReq.SideEnum; + side: AddTPSLOrderReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + type: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'TP\', \'IP\' or \'MP\' */ stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddTPSLOrderReq.MarginModeEnum = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddTPSLOrderReq.TimeInForceEnum = AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + /** * Take profit price */ triggerStopUpPrice?: string; + /** * Stop loss price */ triggerStopDownPrice?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.size = null; + } /** * Creates a new instance of the `AddTPSLOrderReq` class. * The builder pattern allows step-by-step construction of a `AddTPSLOrderReq` object. */ static builder(): AddTPSLOrderReqBuilder { - return new AddTPSLOrderReqBuilder(); + return new AddTPSLOrderReqBuilder(new AddTPSLOrderReq()); } /** @@ -101,23 +134,23 @@ export class AddTPSLOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddTPSLOrderReq.SideEnum; + side: AddTPSLOrderReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddTPSLOrderReq.TypeEnum; + type: AddTPSLOrderReq.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -149,7 +182,7 @@ export class AddTPSLOrderReq implements Serializable { /** * Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ - size?: number; + size: number; /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ @@ -184,36 +217,71 @@ export class AddTPSLOrderReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddTPSLOrderReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stopPriceType = data.stopPriceType; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; - obj.marginMode = data.marginMode; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.triggerStopUpPrice = data.triggerStopUpPrice; obj.triggerStopDownPrice = data.triggerStopDownPrice; return obj; } - fromJson(input: string): AddTPSLOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddTPSLOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddTPSLOrderReq { - return plainToInstance(AddTPSLOrderReq, jsonObject); + static fromJson(input: string): AddTPSLOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddTPSLOrderReq { + return plainToClassFromExist(new AddTPSLOrderReq(), jsonObject); } } @@ -275,7 +343,9 @@ export namespace AddTPSLOrderReq { } export class AddTPSLOrderReqBuilder { - obj: AddTPSLOrderReq = new AddTPSLOrderReq(); + constructor(readonly obj: AddTPSLOrderReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts index c73bce1a..8e2bc803 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddTPSLOrderResp implements Response { +export class AddTPSLOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddTPSLOrderResp implements Response { +export class CancelOrderByClientOidReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * The user self-defined order id. */ clientOid?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. */ static builder(): CancelOrderByClientOidReqBuilder { - return new CancelOrderByClientOidReqBuilder(); + return new CancelOrderByClientOidReqBuilder(new CancelOrderByClientOidReq()); } /** @@ -40,22 +42,23 @@ export class CancelOrderByClientOidReq implements Serializable -{ +export class CancelOrderByClientOidResp implements Response { /** * */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidResp { - return plainToInstance(CancelOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts index 082ac8ec..e1d296ae 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByIdReq implements Serializable { +export class CancelOrderByIdReq implements Serializable { /** * Order id */ orderId?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByIdReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByIdReq` object. */ static builder(): CancelOrderByIdReqBuilder { - return new CancelOrderByIdReqBuilder(); + return new CancelOrderByIdReqBuilder(new CancelOrderByIdReq()); } /** @@ -31,22 +32,23 @@ export class CancelOrderByIdReq implements Serializable { return obj; } - fromJson(input: string): CancelOrderByIdReq { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByIdReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByIdReq { - return plainToInstance(CancelOrderByIdReq, jsonObject); + static fromJson(input: string): CancelOrderByIdReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByIdReq { + return plainToClassFromExist(new CancelOrderByIdReq(), jsonObject); } } export class CancelOrderByIdReqBuilder { - obj: CancelOrderByIdReq = new CancelOrderByIdReq(); + constructor(readonly obj: CancelOrderByIdReq) { + this.obj = obj; + } /** * Order id */ diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts index a5478a89..e95ecbcc 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelOrderByIdResp implements Response { +export class CancelOrderByIdResp implements Response { /** * The orderId that is to be canceled */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelOrderByIdResp implements Response { +export class GetMaxOpenSizeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Order price */ price?: string; + /** * Leverage */ leverage?: number; + private constructor() {} /** * Creates a new instance of the `GetMaxOpenSizeReq` class. * The builder pattern allows step-by-step construction of a `GetMaxOpenSizeReq` object. */ static builder(): GetMaxOpenSizeReqBuilder { - return new GetMaxOpenSizeReqBuilder(); + return new GetMaxOpenSizeReqBuilder(new GetMaxOpenSizeReq()); } /** @@ -49,22 +52,23 @@ export class GetMaxOpenSizeReq implements Serializable { return obj; } - fromJson(input: string): GetMaxOpenSizeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMaxOpenSizeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMaxOpenSizeReq { - return plainToInstance(GetMaxOpenSizeReq, jsonObject); + static fromJson(input: string): GetMaxOpenSizeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMaxOpenSizeReq { + return plainToClassFromExist(new GetMaxOpenSizeReq(), jsonObject); } } export class GetMaxOpenSizeReqBuilder { - obj: GetMaxOpenSizeReq = new GetMaxOpenSizeReq(); + constructor(readonly obj: GetMaxOpenSizeReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts index 7b48dfc9..a80ca962 100644 --- a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts @@ -1,23 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMaxOpenSizeResp implements Response { +export class GetMaxOpenSizeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Maximum buy size */ - maxBuyOpenSize?: string; + maxBuyOpenSize: string; + /** * Maximum buy size */ - maxSellOpenSize?: string; + maxSellOpenSize: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.maxBuyOpenSize = null; + // @ts-ignore + this.maxSellOpenSize = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class GetMaxOpenSizeResp implements Response { +export class GetMaxWithdrawMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMaxWithdrawMarginReq` class. * The builder pattern allows step-by-step construction of a `GetMaxWithdrawMarginReq` object. */ static builder(): GetMaxWithdrawMarginReqBuilder { - return new GetMaxWithdrawMarginReqBuilder(); + return new GetMaxWithdrawMarginReqBuilder(new GetMaxWithdrawMarginReq()); } /** @@ -31,22 +32,23 @@ export class GetMaxWithdrawMarginReq implements Serializable { +export class GetMaxWithdrawMarginResp implements Response { /** * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetMaxWithdrawMarginResp implements Response { +export class ModifyAutoDepositStatusReq implements Serializable { /** * Symbol of the contract */ - symbol?: string; + symbol: string; + /** * Status */ - status?: boolean; + status: boolean; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.status = null; + } /** * Creates a new instance of the `ModifyAutoDepositStatusReq` class. * The builder pattern allows step-by-step construction of a `ModifyAutoDepositStatusReq` object. */ static builder(): ModifyAutoDepositStatusReqBuilder { - return new ModifyAutoDepositStatusReqBuilder(); + return new ModifyAutoDepositStatusReqBuilder(new ModifyAutoDepositStatusReq()); } /** @@ -28,11 +35,11 @@ export class ModifyAutoDepositStatusReq implements Serializable -{ +export class ModifyAutoDepositStatusResp implements Response { /** * */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class ModifyAutoDepositStatusResp this.commonResponse = response; } - fromJson(input: string): ModifyAutoDepositStatusResp { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { - return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + static fromJson(input: string): ModifyAutoDepositStatusResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { + return plainToClassFromExist(new ModifyAutoDepositStatusResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts index 21e522a1..32341c24 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts @@ -1,26 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class ModifyIsolatedMarginRiskLimtReq - implements Serializable -{ +export class ModifyIsolatedMarginRiskLimtReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * level */ - level?: number; + level: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.level = null; + } /** * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class. * The builder pattern allows step-by-step construction of a `ModifyIsolatedMarginRiskLimtReq` object. */ static builder(): ModifyIsolatedMarginRiskLimtReqBuilder { - return new ModifyIsolatedMarginRiskLimtReqBuilder(); + return new ModifyIsolatedMarginRiskLimtReqBuilder(new ModifyIsolatedMarginRiskLimtReq()); } /** @@ -30,11 +35,11 @@ export class ModifyIsolatedMarginRiskLimtReq /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * level */ - level?: number; + level: number; }): ModifyIsolatedMarginRiskLimtReq { let obj = new ModifyIsolatedMarginRiskLimtReq(); obj.symbol = data.symbol; @@ -42,22 +47,23 @@ export class ModifyIsolatedMarginRiskLimtReq return obj; } - fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { - return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + static fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { + return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtReq(), jsonObject); } } export class ModifyIsolatedMarginRiskLimtReqBuilder { - obj: ModifyIsolatedMarginRiskLimtReq = new ModifyIsolatedMarginRiskLimtReq(); + constructor(readonly obj: ModifyIsolatedMarginRiskLimtReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts index ed84f474..39f9b626 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts @@ -1,17 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ModifyIsolatedMarginRiskLimtResp - implements Response -{ +export class ModifyIsolatedMarginRiskLimtResp implements Response { /** * To adjust the level will cancel the open order, the response can only indicate whether the submit of the adjustment request is successful or not. */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class ModifyIsolatedMarginRiskLimtResp this.commonResponse = response; } - fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { - return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + static fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { + return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts index f79475a4..a5b97a54 100644 --- a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts @@ -1,24 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class RemoveIsolatedMarginReq implements Serializable { +export class RemoveIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - withdrawAmount?: string; + withdrawAmount: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.withdrawAmount = null; + } /** * Creates a new instance of the `RemoveIsolatedMarginReq` class. * The builder pattern allows step-by-step construction of a `RemoveIsolatedMarginReq` object. */ static builder(): RemoveIsolatedMarginReqBuilder { - return new RemoveIsolatedMarginReqBuilder(); + return new RemoveIsolatedMarginReqBuilder(new RemoveIsolatedMarginReq()); } /** @@ -28,11 +35,11 @@ export class RemoveIsolatedMarginReq implements Serializable { +export class RemoveIsolatedMarginResp implements Response { /** * The size of the position deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class RemoveIsolatedMarginResp implements Response { +export class GetAccountHoldingItems implements Serializable { /** * Holding ID */ - orderId?: string; + orderId: string; + /** * Product ID */ - productId?: string; + productId: string; + /** * Product category */ - productCategory?: string; + productCategory: string; + /** * Product sub-type */ - productType?: string; + productType: string; + /** * currency */ - currency?: string; + currency: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Holding amount */ - holdAmount?: string; + holdAmount: string; + /** * Redeemed amount */ - redeemedAmount?: string; + redeemedAmount: string; + /** * Redeeming amount */ - redeemingAmount?: string; + redeemingAmount: string; + /** * Product earliest interest start time, in milliseconds */ - lockStartTime?: number; + lockStartTime: number; + /** * Product maturity time, in milliseconds */ lockEndTime?: number; + /** * Most recent subscription time, in milliseconds */ - purchaseTime?: number; + purchaseTime: number; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Status: LOCKED (holding), REDEEMING (redeeming) */ - status?: GetAccountHoldingItems.StatusEnum; + status: GetAccountHoldingItems.StatusEnum; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetAccountHoldingItems.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetAccountHoldingItems.EarlyRedeemSupportedEnum; - fromJson(input: string): GetAccountHoldingItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountHoldingItems, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.productId = null; + // @ts-ignore + this.productCategory = null; + // @ts-ignore + this.productType = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.holdAmount = null; + // @ts-ignore + this.redeemedAmount = null; + // @ts-ignore + this.redeemingAmount = null; + // @ts-ignore + this.lockStartTime = null; + // @ts-ignore + this.purchaseTime = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.earlyRedeemSupported = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountHoldingItems { - return plainToInstance(GetAccountHoldingItems, jsonObject); + static fromJson(input: string): GetAccountHoldingItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountHoldingItems { + return plainToClassFromExist(new GetAccountHoldingItems(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts index 41b13ede..a9292b62 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts @@ -1,36 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountHoldingReq implements Serializable { +export class GetAccountHoldingReq implements Serializable { /** * currency */ currency?: string; + /** * Product ID */ productId?: string; + /** * Product category */ productCategory?: GetAccountHoldingReq.ProductCategoryEnum; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 15; + private constructor() {} /** * Creates a new instance of the `GetAccountHoldingReq` class. * The builder pattern allows step-by-step construction of a `GetAccountHoldingReq` object. */ static builder(): GetAccountHoldingReqBuilder { - return new GetAccountHoldingReqBuilder(); + return new GetAccountHoldingReqBuilder(new GetAccountHoldingReq()); } /** @@ -62,22 +67,29 @@ export class GetAccountHoldingReq implements Serializable obj.currency = data.currency; obj.productId = data.productId; obj.productCategory = data.productCategory; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 15; + } return obj; } - fromJson(input: string): GetAccountHoldingReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountHoldingReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountHoldingReq { - return plainToInstance(GetAccountHoldingReq, jsonObject); + static fromJson(input: string): GetAccountHoldingReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountHoldingReq { + return plainToClassFromExist(new GetAccountHoldingReq(), jsonObject); } } @@ -107,7 +119,9 @@ export namespace GetAccountHoldingReq { } export class GetAccountHoldingReqBuilder { - obj: GetAccountHoldingReq = new GetAccountHoldingReq(); + constructor(readonly obj: GetAccountHoldingReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts index 60acf88d..00a6646e 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAccountHoldingItems } from './model_get_account_holding_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAccountHoldingResp implements Response { +export class GetAccountHoldingResp implements Response { /** * total number */ - totalNum?: number; + totalNum: number; + /** * */ @Type(() => GetAccountHoldingItems) - items?: Array; + items: Array; + /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total page */ - totalPage?: number; + totalPage: number; + private constructor() { + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.items = null; + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalPage = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetAccountHoldingResp implements Response { +export class GetETHStakingProductsData implements Serializable { /** * Product ID */ - id?: string; + id: string; + /** * Product category: ETH2 (ETH Staking) */ - category?: GetETHStakingProductsData.CategoryEnum; + category: GetETHStakingProductsData.CategoryEnum; + /** * Product subtype: DEMAND (demand) */ - type?: GetETHStakingProductsData.TypeEnum; + type: GetETHStakingProductsData.TypeEnum; + /** * Maximum precision supported */ - precision?: number; + precision: number; + /** * currency */ - currency?: string; + currency: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Min user subscribe amount */ - userLowerLimit?: string; + userLowerLimit: string; + /** * Max user subscribe amount */ - userUpperLimit?: string; + userUpperLimit: string; + /** * Products total subscribe amount */ - productUpperLimit?: string; + productUpperLimit: string; + /** * Products remain subscribe amount */ - productRemainAmount?: string; + productRemainAmount: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) */ - redeemType?: GetETHStakingProductsData.RedeemTypeEnum; + redeemType: GetETHStakingProductsData.RedeemTypeEnum; + /** * Income release type: DAILY (daily release), AFTER (release after product ends) */ - incomeReleaseType?: GetETHStakingProductsData.IncomeReleaseTypeEnum; + incomeReleaseType: GetETHStakingProductsData.IncomeReleaseTypeEnum; + /** * Subscription start time, in milliseconds */ applyStartTime?: number; + /** * Subscription end time, in milliseconds */ applyEndTime?: number; + /** * Product earliest interest start time, in milliseconds */ lockStartTime?: number; + /** * Product maturity time, in milliseconds */ lockEndTime?: number; + /** * Most recent interest date(millisecond) */ - interestDate?: number; + interestDate: number; + /** * Whether the product is exclusive for new users: 0 (no), 1 (yes) */ - newUserOnly?: GetETHStakingProductsData.NewUserOnlyEnum; + newUserOnly: GetETHStakingProductsData.NewUserOnlyEnum; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetETHStakingProductsData.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetETHStakingProductsData.EarlyRedeemSupportedEnum; + /** * Product duration (days) */ - duration?: number; + duration: number; + /** * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) */ - status?: GetETHStakingProductsData.StatusEnum; + status: GetETHStakingProductsData.StatusEnum; - fromJson(input: string): GetETHStakingProductsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetETHStakingProductsData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.category = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.userLowerLimit = null; + // @ts-ignore + this.userUpperLimit = null; + // @ts-ignore + this.productUpperLimit = null; + // @ts-ignore + this.productRemainAmount = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.redeemType = null; + // @ts-ignore + this.incomeReleaseType = null; + // @ts-ignore + this.interestDate = null; + // @ts-ignore + this.newUserOnly = null; + // @ts-ignore + this.earlyRedeemSupported = null; + // @ts-ignore + this.duration = null; + // @ts-ignore + this.status = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetETHStakingProductsData { - return plainToInstance(GetETHStakingProductsData, jsonObject); + static fromJson(input: string): GetETHStakingProductsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetETHStakingProductsData { + return plainToClassFromExist(new GetETHStakingProductsData(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts index ede916b8..4d439a71 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetETHStakingProductsReq implements Serializable { +export class GetETHStakingProductsReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetETHStakingProductsReq` class. * The builder pattern allows step-by-step construction of a `GetETHStakingProductsReq` object. */ static builder(): GetETHStakingProductsReqBuilder { - return new GetETHStakingProductsReqBuilder(); + return new GetETHStakingProductsReqBuilder(new GetETHStakingProductsReq()); } /** @@ -31,22 +32,23 @@ export class GetETHStakingProductsReq implements Serializable -{ +export class GetETHStakingProductsResp implements Response { /** * */ @Type(() => GetETHStakingProductsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetETHStakingProductsResp this.commonResponse = response; } - fromJson(input: string): GetETHStakingProductsResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetETHStakingProductsResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetETHStakingProductsResp { - return plainToInstance(GetETHStakingProductsResp, { data: jsonObject }); + static fromJson(input: string): GetETHStakingProductsResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetETHStakingProductsResp { + return plainToClassFromExist(new GetETHStakingProductsResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts index 8e23206a..0d337b76 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts @@ -1,113 +1,178 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetKcsStakingProductsData implements Serializable { +export class GetKcsStakingProductsData implements Serializable { /** * Product ID */ - id?: string; + id: string; + /** * currency */ - currency?: string; + currency: string; + /** * Product category: KCS_STAKING */ - category?: GetKcsStakingProductsData.CategoryEnum; + category: GetKcsStakingProductsData.CategoryEnum; + /** * Product subtype: TIME (fixed), DEMAND (demand) */ - type?: GetKcsStakingProductsData.TypeEnum; + type: GetKcsStakingProductsData.TypeEnum; + /** * Maximum precision supported */ - precision?: number; + precision: number; + /** * Products total subscribe amount */ - productUpperLimit?: string; + productUpperLimit: string; + /** * Max user subscribe amount */ - userUpperLimit?: string; + userUpperLimit: string; + /** * Min user subscribe amount */ - userLowerLimit?: string; + userLowerLimit: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Product earliest interest start time, in milliseconds */ - lockStartTime?: number; + lockStartTime: number; + /** * Product maturity time, in milliseconds */ lockEndTime?: number; + /** * Subscription start time, in milliseconds */ - applyStartTime?: number; + applyStartTime: number; + /** * Subscription end time, in milliseconds */ applyEndTime?: number; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetKcsStakingProductsData.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetKcsStakingProductsData.EarlyRedeemSupportedEnum; + /** * Products remain subscribe amount */ - productRemainAmount?: string; + productRemainAmount: string; + /** * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) */ - status?: GetKcsStakingProductsData.StatusEnum; + status: GetKcsStakingProductsData.StatusEnum; + /** * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) */ - redeemType?: GetKcsStakingProductsData.RedeemTypeEnum; + redeemType: GetKcsStakingProductsData.RedeemTypeEnum; + /** * Income release type: DAILY (daily release), AFTER (release after product ends) */ - incomeReleaseType?: GetKcsStakingProductsData.IncomeReleaseTypeEnum; + incomeReleaseType: GetKcsStakingProductsData.IncomeReleaseTypeEnum; + /** * Most recent interest date(millisecond) */ - interestDate?: number; + interestDate: number; + /** * Product duration (days) */ - duration?: number; + duration: number; + /** * Whether the product is exclusive for new users: 0 (no), 1 (yes) */ - newUserOnly?: GetKcsStakingProductsData.NewUserOnlyEnum; + newUserOnly: GetKcsStakingProductsData.NewUserOnlyEnum; - fromJson(input: string): GetKcsStakingProductsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKcsStakingProductsData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.category = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.productUpperLimit = null; + // @ts-ignore + this.userUpperLimit = null; + // @ts-ignore + this.userLowerLimit = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.lockStartTime = null; + // @ts-ignore + this.applyStartTime = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.earlyRedeemSupported = null; + // @ts-ignore + this.productRemainAmount = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.redeemType = null; + // @ts-ignore + this.incomeReleaseType = null; + // @ts-ignore + this.interestDate = null; + // @ts-ignore + this.duration = null; + // @ts-ignore + this.newUserOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetKcsStakingProductsData { - return plainToInstance(GetKcsStakingProductsData, jsonObject); + static fromJson(input: string): GetKcsStakingProductsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKcsStakingProductsData { + return plainToClassFromExist(new GetKcsStakingProductsData(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts index c8f0fdff..15eb581d 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetKcsStakingProductsReq implements Serializable { +export class GetKcsStakingProductsReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetKcsStakingProductsReq` class. * The builder pattern allows step-by-step construction of a `GetKcsStakingProductsReq` object. */ static builder(): GetKcsStakingProductsReqBuilder { - return new GetKcsStakingProductsReqBuilder(); + return new GetKcsStakingProductsReqBuilder(new GetKcsStakingProductsReq()); } /** @@ -31,22 +32,23 @@ export class GetKcsStakingProductsReq implements Serializable -{ +export class GetKcsStakingProductsResp implements Response { /** * */ @Type(() => GetKcsStakingProductsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetKcsStakingProductsResp this.commonResponse = response; } - fromJson(input: string): GetKcsStakingProductsResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKcsStakingProductsResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetKcsStakingProductsResp { - return plainToInstance(GetKcsStakingProductsResp, { data: jsonObject }); + static fromJson(input: string): GetKcsStakingProductsResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKcsStakingProductsResp { + return plainToClassFromExist(new GetKcsStakingProductsResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts index 44f76831..ef9b2545 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts @@ -1,113 +1,182 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPromotionProductsData implements Serializable { +export class GetPromotionProductsData implements Serializable { /** * Product ID */ - id?: string; + id: string; + /** * currency */ - currency?: string; + currency: string; + /** * Product category: ACTIVITY */ - category?: GetPromotionProductsData.CategoryEnum; + category: GetPromotionProductsData.CategoryEnum; + /** * Product subtype: TIME (fixed), DEMAND (demand) */ - type?: GetPromotionProductsData.TypeEnum; + type: GetPromotionProductsData.TypeEnum; + /** * Maximum precision supported */ - precision?: number; + precision: number; + /** * Products total subscribe amount */ - productUpperLimit?: string; + productUpperLimit: string; + /** * Max user subscribe amount */ - userUpperLimit?: string; + userUpperLimit: string; + /** * Min user subscribe amount */ - userLowerLimit?: string; + userLowerLimit: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Product earliest interest start time, in milliseconds */ - lockStartTime?: number; + lockStartTime: number; + /** * Product earliest interest end time, in milliseconds */ - lockEndTime?: number; + lockEndTime: number; + /** * Subscription start time, in milliseconds */ - applyStartTime?: number; + applyStartTime: number; + /** * Subscription end time, in milliseconds */ - applyEndTime?: number; + applyEndTime: number; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetPromotionProductsData.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetPromotionProductsData.EarlyRedeemSupportedEnum; + /** * Products remain subscribe amount */ - productRemainAmount?: string; + productRemainAmount: string; + /** * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) */ - status?: GetPromotionProductsData.StatusEnum; + status: GetPromotionProductsData.StatusEnum; + /** * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) */ - redeemType?: GetPromotionProductsData.RedeemTypeEnum; + redeemType: GetPromotionProductsData.RedeemTypeEnum; + /** * Income release type: DAILY (daily release), AFTER (release after product ends) */ - incomeReleaseType?: GetPromotionProductsData.IncomeReleaseTypeEnum; + incomeReleaseType: GetPromotionProductsData.IncomeReleaseTypeEnum; + /** * Most recent interest date(millisecond) */ - interestDate?: number; + interestDate: number; + /** * Product duration (days) */ - duration?: number; + duration: number; + /** * Whether the product is exclusive for new users: 0 (no), 1 (yes) */ - newUserOnly?: GetPromotionProductsData.NewUserOnlyEnum; + newUserOnly: GetPromotionProductsData.NewUserOnlyEnum; - fromJson(input: string): GetPromotionProductsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPromotionProductsData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.category = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.productUpperLimit = null; + // @ts-ignore + this.userUpperLimit = null; + // @ts-ignore + this.userLowerLimit = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.lockStartTime = null; + // @ts-ignore + this.lockEndTime = null; + // @ts-ignore + this.applyStartTime = null; + // @ts-ignore + this.applyEndTime = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.earlyRedeemSupported = null; + // @ts-ignore + this.productRemainAmount = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.redeemType = null; + // @ts-ignore + this.incomeReleaseType = null; + // @ts-ignore + this.interestDate = null; + // @ts-ignore + this.duration = null; + // @ts-ignore + this.newUserOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPromotionProductsData { - return plainToInstance(GetPromotionProductsData, jsonObject); + static fromJson(input: string): GetPromotionProductsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPromotionProductsData { + return plainToClassFromExist(new GetPromotionProductsData(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts index 2e936051..ac7a33bf 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPromotionProductsReq implements Serializable { +export class GetPromotionProductsReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetPromotionProductsReq` class. * The builder pattern allows step-by-step construction of a `GetPromotionProductsReq` object. */ static builder(): GetPromotionProductsReqBuilder { - return new GetPromotionProductsReqBuilder(); + return new GetPromotionProductsReqBuilder(new GetPromotionProductsReq()); } /** @@ -31,22 +32,23 @@ export class GetPromotionProductsReq implements Serializable { +export class GetPromotionProductsResp implements Response { /** * */ @Type(() => GetPromotionProductsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetPromotionProductsResp implements Response { +export class GetRedeemPreviewReq implements Serializable { /** * Holding ID */ orderId?: string; + /** * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 */ fromAccountType?: GetRedeemPreviewReq.FromAccountTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetRedeemPreviewReq` class. * The builder pattern allows step-by-step construction of a `GetRedeemPreviewReq` object. */ static builder(): GetRedeemPreviewReqBuilder { - return new GetRedeemPreviewReqBuilder(); + return new GetRedeemPreviewReqBuilder(new GetRedeemPreviewReq()); } /** @@ -40,17 +42,16 @@ export class GetRedeemPreviewReq implements Serializable { return obj; } - fromJson(input: string): GetRedeemPreviewReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRedeemPreviewReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRedeemPreviewReq { - return plainToInstance(GetRedeemPreviewReq, jsonObject); + static fromJson(input: string): GetRedeemPreviewReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRedeemPreviewReq { + return plainToClassFromExist(new GetRedeemPreviewReq(), jsonObject); } } @@ -68,7 +69,9 @@ export namespace GetRedeemPreviewReq { } export class GetRedeemPreviewReqBuilder { - obj: GetRedeemPreviewReq = new GetRedeemPreviewReq(); + constructor(readonly obj: GetRedeemPreviewReq) { + this.obj = obj; + } /** * Holding ID */ diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts index f580be89..9a49d829 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts @@ -1,39 +1,61 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetRedeemPreviewResp implements Response { +export class GetRedeemPreviewResp implements Response { /** * currency */ - currency?: string; + currency: string; + /** * Expected redemption amount */ - redeemAmount?: string; + redeemAmount: string; + /** * Penalty interest amount, incurred for early redemption of fixed-term products */ - penaltyInterestAmount?: string; + penaltyInterestAmount: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Expected deliver time (milliseconds) */ - deliverTime?: number; + deliverTime: number; + /** * Whether manual redemption is possible */ - manualRedeemable?: boolean; + manualRedeemable: boolean; + /** * Whether the entire holding must be redeemed, required for early redemption of fixed-term products */ - redeemAll?: boolean; + redeemAll: boolean; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.redeemAmount = null; + // @ts-ignore + this.penaltyInterestAmount = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.deliverTime = null; + // @ts-ignore + this.manualRedeemable = null; + // @ts-ignore + this.redeemAll = null; + } /** * common response */ @@ -44,16 +66,15 @@ export class GetRedeemPreviewResp implements Response { +export class GetSavingsProductsData implements Serializable { /** * Product ID */ - id?: string; + id: string; + /** * currency */ - currency?: string; + currency: string; + /** * Product category: DEMAND (savings) */ - category?: GetSavingsProductsData.CategoryEnum; + category: GetSavingsProductsData.CategoryEnum; + /** * Product subtype: TIME (fixed), DEMAND (demand) */ - type?: GetSavingsProductsData.TypeEnum; + type: GetSavingsProductsData.TypeEnum; + /** * Maximum precision supported */ - precision?: number; + precision: number; + /** * Products total subscribe amount */ - productUpperLimit?: string; + productUpperLimit: string; + /** * Max user subscribe amount */ - userUpperLimit?: string; + userUpperLimit: string; + /** * Min user subscribe amount */ - userLowerLimit?: string; + userLowerLimit: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Product earliest interest start time, in milliseconds */ - lockStartTime?: number; + lockStartTime: number; + /** * Product maturity time, in milliseconds */ - lockEndTime?: number; + lockEndTime: number; + /** * Subscription start time, in milliseconds */ - applyStartTime?: number; + applyStartTime: number; + /** * Subscription end time, in milliseconds */ - applyEndTime?: number; + applyEndTime: number; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetSavingsProductsData.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetSavingsProductsData.EarlyRedeemSupportedEnum; + /** * Products remain subscribe amount */ - productRemainAmount?: string; + productRemainAmount: string; + /** * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) */ - status?: GetSavingsProductsData.StatusEnum; + status: GetSavingsProductsData.StatusEnum; + /** * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) */ - redeemType?: GetSavingsProductsData.RedeemTypeEnum; + redeemType: GetSavingsProductsData.RedeemTypeEnum; + /** * Income release type: DAILY (daily release), AFTER (release after product ends) */ - incomeReleaseType?: GetSavingsProductsData.IncomeReleaseTypeEnum; + incomeReleaseType: GetSavingsProductsData.IncomeReleaseTypeEnum; + /** * Most recent interest date(millisecond) */ - interestDate?: number; + interestDate: number; + /** * Product duration (days) */ - duration?: number; + duration: number; + /** * Whether the product is exclusive for new users: 0 (no), 1 (yes) */ - newUserOnly?: GetSavingsProductsData.NewUserOnlyEnum; + newUserOnly: GetSavingsProductsData.NewUserOnlyEnum; - fromJson(input: string): GetSavingsProductsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSavingsProductsData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.category = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.productUpperLimit = null; + // @ts-ignore + this.userUpperLimit = null; + // @ts-ignore + this.userLowerLimit = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.lockStartTime = null; + // @ts-ignore + this.lockEndTime = null; + // @ts-ignore + this.applyStartTime = null; + // @ts-ignore + this.applyEndTime = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.earlyRedeemSupported = null; + // @ts-ignore + this.productRemainAmount = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.redeemType = null; + // @ts-ignore + this.incomeReleaseType = null; + // @ts-ignore + this.interestDate = null; + // @ts-ignore + this.duration = null; + // @ts-ignore + this.newUserOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSavingsProductsData { - return plainToInstance(GetSavingsProductsData, jsonObject); + static fromJson(input: string): GetSavingsProductsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSavingsProductsData { + return plainToClassFromExist(new GetSavingsProductsData(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts index a5c17d9b..022598d9 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSavingsProductsReq implements Serializable { +export class GetSavingsProductsReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetSavingsProductsReq` class. * The builder pattern allows step-by-step construction of a `GetSavingsProductsReq` object. */ static builder(): GetSavingsProductsReqBuilder { - return new GetSavingsProductsReqBuilder(); + return new GetSavingsProductsReqBuilder(new GetSavingsProductsReq()); } /** @@ -31,22 +32,23 @@ export class GetSavingsProductsReq implements Serializable { +export class GetSavingsProductsResp implements Response { /** * */ @Type(() => GetSavingsProductsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetSavingsProductsResp implements Response { +export class GetStakingProductsData implements Serializable { /** * Product ID */ - id?: string; + id: string; + /** * currency */ - currency?: string; + currency: string; + /** * Product category: STAKING */ - category?: GetStakingProductsData.CategoryEnum; + category: GetStakingProductsData.CategoryEnum; + /** * Product subtype: TIME (fixed), DEMAND (demand) */ - type?: GetStakingProductsData.TypeEnum; + type: GetStakingProductsData.TypeEnum; + /** * Maximum precision supported */ - precision?: number; + precision: number; + /** * Products total subscribe amount */ - productUpperLimit?: string; + productUpperLimit: string; + /** * Max user subscribe amount */ - userUpperLimit?: string; + userUpperLimit: string; + /** * Min user subscribe amount */ - userLowerLimit?: string; + userLowerLimit: string; + /** * Redemption waiting period (days) */ - redeemPeriod?: number; + redeemPeriod: number; + /** * Product earliest interest start time, in milliseconds */ - lockStartTime?: number; + lockStartTime: number; + /** * Product maturity time, in milliseconds */ - lockEndTime?: number; + lockEndTime: number; + /** * Subscription start time, in milliseconds */ - applyStartTime?: number; + applyStartTime: number; + /** * Subscription end time, in milliseconds */ - applyEndTime?: number; + applyEndTime: number; + /** * Annualized Rate of Return, for example, 0.035 is equal to 3.5% annualized rate of return */ - returnRate?: string; + returnRate: string; + /** * Income currency */ - incomeCurrency?: string; + incomeCurrency: string; + /** * Whether the fixed product supports early redemption: 0 (no), 1 (yes) */ - earlyRedeemSupported?: GetStakingProductsData.EarlyRedeemSupportedEnum; + earlyRedeemSupported: GetStakingProductsData.EarlyRedeemSupportedEnum; + /** * Products remain subscribe amount */ - productRemainAmount?: string; + productRemainAmount: string; + /** * Product status: ONGOING(Subscription in progress), PENDING(Preheating Subscription), FULL(Subscribed), INTERESTING (Interest in progress) */ - status?: GetStakingProductsData.StatusEnum; + status: GetStakingProductsData.StatusEnum; + /** * Redemption channel: MANUAL (manual redemption), TRANS_DEMAND (transfer to corresponding demand product upon maturity), AUTO (redeem to funding account upon maturity) */ - redeemType?: GetStakingProductsData.RedeemTypeEnum; + redeemType: GetStakingProductsData.RedeemTypeEnum; + /** * Income release type: DAILY (daily release), AFTER (release after product ends) */ - incomeReleaseType?: GetStakingProductsData.IncomeReleaseTypeEnum; + incomeReleaseType: GetStakingProductsData.IncomeReleaseTypeEnum; + /** * Most recent interest date(millisecond) */ - interestDate?: number; + interestDate: number; + /** * Product duration (days) */ - duration?: number; + duration: number; + /** * Whether the product is exclusive for new users: 0 (no), 1 (yes) */ - newUserOnly?: GetStakingProductsData.NewUserOnlyEnum; + newUserOnly: GetStakingProductsData.NewUserOnlyEnum; - fromJson(input: string): GetStakingProductsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStakingProductsData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.category = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.productUpperLimit = null; + // @ts-ignore + this.userUpperLimit = null; + // @ts-ignore + this.userLowerLimit = null; + // @ts-ignore + this.redeemPeriod = null; + // @ts-ignore + this.lockStartTime = null; + // @ts-ignore + this.lockEndTime = null; + // @ts-ignore + this.applyStartTime = null; + // @ts-ignore + this.applyEndTime = null; + // @ts-ignore + this.returnRate = null; + // @ts-ignore + this.incomeCurrency = null; + // @ts-ignore + this.earlyRedeemSupported = null; + // @ts-ignore + this.productRemainAmount = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.redeemType = null; + // @ts-ignore + this.incomeReleaseType = null; + // @ts-ignore + this.interestDate = null; + // @ts-ignore + this.duration = null; + // @ts-ignore + this.newUserOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStakingProductsData { - return plainToInstance(GetStakingProductsData, jsonObject); + static fromJson(input: string): GetStakingProductsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStakingProductsData { + return plainToClassFromExist(new GetStakingProductsData(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts index b6ffa373..3600980f 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStakingProductsReq implements Serializable { +export class GetStakingProductsReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetStakingProductsReq` class. * The builder pattern allows step-by-step construction of a `GetStakingProductsReq` object. */ static builder(): GetStakingProductsReqBuilder { - return new GetStakingProductsReqBuilder(); + return new GetStakingProductsReqBuilder(new GetStakingProductsReq()); } /** @@ -31,22 +32,23 @@ export class GetStakingProductsReq implements Serializable { +export class GetStakingProductsResp implements Response { /** * */ @Type(() => GetStakingProductsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetStakingProductsResp implements Response { +export class PurchaseReq implements Serializable { /** * Product Id */ - productId?: string; + productId: string; + /** * Subscription amount */ - amount?: string; + amount: string; + /** * MAIN (funding account), TRADE (spot trading account) */ - accountType?: PurchaseReq.AccountTypeEnum; + accountType: PurchaseReq.AccountTypeEnum; + private constructor() { + // @ts-ignore + this.productId = null; + // @ts-ignore + this.amount = null; + // @ts-ignore + this.accountType = null; + } /** * Creates a new instance of the `PurchaseReq` class. * The builder pattern allows step-by-step construction of a `PurchaseReq` object. */ static builder(): PurchaseReqBuilder { - return new PurchaseReqBuilder(); + return new PurchaseReqBuilder(new PurchaseReq()); } /** @@ -32,15 +42,15 @@ export class PurchaseReq implements Serializable { /** * Product Id */ - productId?: string; + productId: string; /** * Subscription amount */ - amount?: string; + amount: string; /** * MAIN (funding account), TRADE (spot trading account) */ - accountType?: PurchaseReq.AccountTypeEnum; + accountType: PurchaseReq.AccountTypeEnum; }): PurchaseReq { let obj = new PurchaseReq(); obj.productId = data.productId; @@ -49,17 +59,16 @@ export class PurchaseReq implements Serializable { return obj; } - fromJson(input: string): PurchaseReq { - const jsonObject = JSON.parse(input); - return plainToInstance(PurchaseReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): PurchaseReq { - return plainToInstance(PurchaseReq, jsonObject); + static fromJson(input: string): PurchaseReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): PurchaseReq { + return plainToClassFromExist(new PurchaseReq(), jsonObject); } } @@ -77,7 +86,9 @@ export namespace PurchaseReq { } export class PurchaseReqBuilder { - obj: PurchaseReq = new PurchaseReq(); + constructor(readonly obj: PurchaseReq) { + this.obj = obj; + } /** * Product Id */ diff --git a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts index 29dddfbb..6e2b28ac 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class PurchaseResp implements Response { +export class PurchaseResp implements Response { /** * Holding ID */ - orderId?: string; + orderId: string; + /** * Subscription order ID */ - orderTxId?: string; + orderTxId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderTxId = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class PurchaseResp implements Response { this.commonResponse = response; } - fromJson(input: string): PurchaseResp { - const jsonObject = JSON.parse(input); - return plainToInstance(PurchaseResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): PurchaseResp { - return plainToInstance(PurchaseResp, jsonObject); + static fromJson(input: string): PurchaseResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): PurchaseResp { + return plainToClassFromExist(new PurchaseResp(), jsonObject); } } diff --git a/sdk/node/src/generate/earn/earn/model_redeem_req.ts b/sdk/node/src/generate/earn/earn/model_redeem_req.ts index 2e579d7e..2025b391 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_req.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_req.ts @@ -1,32 +1,36 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class RedeemReq implements Serializable { +export class RedeemReq implements Serializable { /** * Holding ID */ orderId?: string; + /** * Redemption amount */ amount?: string; + /** * Account type: MAIN (funding account), TRADE (spot trading account). This parameter is valid only when orderId=ETH2 */ fromAccountType?: RedeemReq.FromAccountTypeEnum; + /** * Confirmation field for early redemption penalty: 1 (confirm early redemption, and the current holding will be fully redeemed). This parameter is valid only for fixed-term products */ confirmPunishRedeem?: string; + private constructor() {} /** * Creates a new instance of the `RedeemReq` class. * The builder pattern allows step-by-step construction of a `RedeemReq` object. */ static builder(): RedeemReqBuilder { - return new RedeemReqBuilder(); + return new RedeemReqBuilder(new RedeemReq()); } /** @@ -58,17 +62,16 @@ export class RedeemReq implements Serializable { return obj; } - fromJson(input: string): RedeemReq { - const jsonObject = JSON.parse(input); - return plainToInstance(RedeemReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RedeemReq { - return plainToInstance(RedeemReq, jsonObject); + static fromJson(input: string): RedeemReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RedeemReq { + return plainToClassFromExist(new RedeemReq(), jsonObject); } } @@ -86,7 +89,9 @@ export namespace RedeemReq { } export class RedeemReqBuilder { - obj: RedeemReq = new RedeemReq(); + constructor(readonly obj: RedeemReq) { + this.obj = obj; + } /** * Holding ID */ diff --git a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts index 788a8aec..3a8b9c10 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class RedeemResp implements Response { +export class RedeemResp implements Response { /** * Redemption order ID */ - orderTxId?: string; + orderTxId: string; + /** * Expected deliver time (milliseconds) */ - deliverTime?: number; + deliverTime: number; + /** * Redemption status: SUCCESS (successful), PENDING (redemption pending) */ - status?: RedeemResp.StatusEnum; + status: RedeemResp.StatusEnum; + /** * Redemption amount */ - amount?: string; + amount: string; + private constructor() { + // @ts-ignore + this.orderTxId = null; + // @ts-ignore + this.deliverTime = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.amount = null; + } /** * common response */ @@ -32,17 +45,16 @@ export class RedeemResp implements Response { this.commonResponse = response; } - fromJson(input: string): RedeemResp { - const jsonObject = JSON.parse(input); - return plainToInstance(RedeemResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RedeemResp { - return plainToInstance(RedeemResp, jsonObject); + static fromJson(input: string): RedeemResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RedeemResp { + return plainToClassFromExist(new RedeemResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts index 303ea43f..70f10d11 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.ts @@ -70,7 +70,7 @@ export class FundingFeesAPIImpl implements FundingFeesAPI { 'GET', '/api/v1/funding-rate/{symbol}/current', req, - new GetCurrentFundingRateResp(), + GetCurrentFundingRateResp, false, ); } @@ -82,7 +82,7 @@ export class FundingFeesAPIImpl implements FundingFeesAPI { 'GET', '/api/v1/contract/funding-rates', req, - new GetPublicFundingHistoryResp(), + GetPublicFundingHistoryResp, false, ); } @@ -96,7 +96,7 @@ export class FundingFeesAPIImpl implements FundingFeesAPI { 'GET', '/api/v1/funding-history', req, - new GetPrivateFundingHistoryResp(), + GetPrivateFundingHistoryResp, false, ); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts index badc3542..fbf4ec2b 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetCurrentFundingRateReq implements Serializable { +export class GetCurrentFundingRateReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetCurrentFundingRateReq` class. * The builder pattern allows step-by-step construction of a `GetCurrentFundingRateReq` object. */ static builder(): GetCurrentFundingRateReqBuilder { - return new GetCurrentFundingRateReqBuilder(); + return new GetCurrentFundingRateReqBuilder(new GetCurrentFundingRateReq()); } /** @@ -33,22 +34,23 @@ export class GetCurrentFundingRateReq implements Serializable -{ +export class GetCurrentFundingRateResp implements Response { /** * Funding Rate Symbol */ - symbol?: string; + symbol: string; + /** * Granularity (milisecond) */ - granularity?: number; + granularity: number; + /** * The funding rate settlement time point of the previous cycle (milisecond) */ - timePoint?: number; + timePoint: number; + /** * Current cycle funding rate */ - value?: number; + value: number; + /** * Predicted funding rate */ - predictedValue?: number; + predictedValue: number; + /** * Maximum Funding Rate */ - fundingRateCap?: number; + fundingRateCap: number; + /** * Minimum Funding Rate */ - fundingRateFloor?: number; + fundingRateFloor: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.predictedValue = null; + // @ts-ignore + this.fundingRateCap = null; + // @ts-ignore + this.fundingRateFloor = null; + } /** * common response */ @@ -46,16 +66,15 @@ export class GetCurrentFundingRateResp this.commonResponse = response; } - fromJson(input: string): GetCurrentFundingRateResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCurrentFundingRateResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCurrentFundingRateResp { - return plainToInstance(GetCurrentFundingRateResp, jsonObject); + static fromJson(input: string): GetCurrentFundingRateResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCurrentFundingRateResp { + return plainToClassFromExist(new GetCurrentFundingRateResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts index 5362e0e5..68dcbd92 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts @@ -1,67 +1,98 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPrivateFundingHistoryDataList - implements Serializable -{ +export class GetPrivateFundingHistoryDataList implements Serializable { /** * id */ - id?: number; + id: number; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Time point (milisecond) */ - timePoint?: number; + timePoint: number; + /** * Funding rate */ - fundingRate?: number; + fundingRate: number; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Position size */ - positionQty?: number; + positionQty: number; + /** * Position value at settlement period */ - positionCost?: number; + positionCost: number; + /** * Settled funding fees. A positive number means that the user received the funding fee, and vice versa. */ - funding?: number; + funding: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * context */ - context?: string; + context: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetPrivateFundingHistoryDataList.MarginModeEnum; + marginMode: GetPrivateFundingHistoryDataList.MarginModeEnum; - fromJson(input: string): GetPrivateFundingHistoryDataList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPrivateFundingHistoryDataList, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.fundingRate = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.positionQty = null; + // @ts-ignore + this.positionCost = null; + // @ts-ignore + this.funding = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.context = null; + // @ts-ignore + this.marginMode = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPrivateFundingHistoryDataList { - return plainToInstance(GetPrivateFundingHistoryDataList, jsonObject); + static fromJson(input: string): GetPrivateFundingHistoryDataList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPrivateFundingHistoryDataList { + return plainToClassFromExist(new GetPrivateFundingHistoryDataList(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts index 651aa624..1685b994 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPrivateFundingHistoryReq implements Serializable { +export class GetPrivateFundingHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Begin time (milisecond) */ from?: number; + /** * End time (milisecond) */ to?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ reverse?: boolean; + /** * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. */ offset?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ forward?: boolean; + /** * Max record count. The default record count is 10 */ maxCount?: number; + private constructor() {} /** * Creates a new instance of the `GetPrivateFundingHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetPrivateFundingHistoryReq` object. */ static builder(): GetPrivateFundingHistoryReqBuilder { - return new GetPrivateFundingHistoryReqBuilder(); + return new GetPrivateFundingHistoryReqBuilder(new GetPrivateFundingHistoryReq()); } /** @@ -85,22 +92,23 @@ export class GetPrivateFundingHistoryReq implements Serializable -{ +export class GetPrivateFundingHistoryResp implements Response { /** * */ @Type(() => GetPrivateFundingHistoryDataList) - dataList?: Array; + dataList: Array; + /** * Whether there are more pages */ - hasMore?: boolean; + hasMore: boolean; + private constructor() { + // @ts-ignore + this.dataList = null; + // @ts-ignore + this.hasMore = null; + } /** * common response */ @@ -28,16 +33,15 @@ export class GetPrivateFundingHistoryResp this.commonResponse = response; } - fromJson(input: string): GetPrivateFundingHistoryResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPrivateFundingHistoryResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPrivateFundingHistoryResp { - return plainToInstance(GetPrivateFundingHistoryResp, jsonObject); + static fromJson(input: string): GetPrivateFundingHistoryResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPrivateFundingHistoryResp { + return plainToClassFromExist(new GetPrivateFundingHistoryResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts index 591ed0f7..2d119eee 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts @@ -1,32 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPublicFundingHistoryData implements Serializable { +export class GetPublicFundingHistoryData implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Funding rate */ - fundingRate?: number; + fundingRate: number; + /** * Time point (milisecond) */ - timepoint?: number; + timepoint: number; - fromJson(input: string): GetPublicFundingHistoryData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPublicFundingHistoryData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.fundingRate = null; + // @ts-ignore + this.timepoint = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPublicFundingHistoryData { - return plainToInstance(GetPublicFundingHistoryData, jsonObject); + static fromJson(input: string): GetPublicFundingHistoryData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPublicFundingHistoryData { + return plainToClassFromExist(new GetPublicFundingHistoryData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts index 38c6de9b..3daf093d 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPublicFundingHistoryReq implements Serializable { +export class GetPublicFundingHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Begin time (milisecond) */ from?: number; + /** * End time (milisecond) */ to?: number; + private constructor() {} /** * Creates a new instance of the `GetPublicFundingHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetPublicFundingHistoryReq` object. */ static builder(): GetPublicFundingHistoryReqBuilder { - return new GetPublicFundingHistoryReqBuilder(); + return new GetPublicFundingHistoryReqBuilder(new GetPublicFundingHistoryReq()); } /** @@ -49,22 +52,23 @@ export class GetPublicFundingHistoryReq implements Serializable -{ +export class GetPublicFundingHistoryResp implements Response { /** * */ @Type(() => GetPublicFundingHistoryData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetPublicFundingHistoryResp this.commonResponse = response; } - fromJson(input: string): GetPublicFundingHistoryResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPublicFundingHistoryResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetPublicFundingHistoryResp { - return plainToInstance(GetPublicFundingHistoryResp, { data: jsonObject }); + static fromJson(input: string): GetPublicFundingHistoryResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPublicFundingHistoryResp { + return plainToClassFromExist(new GetPublicFundingHistoryResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index 629073f1..fa007bd4 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AllOrderEvent implements Response { +export class AllOrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ @@ -105,17 +105,16 @@ export class AllOrderEvent implements Response { this.commonResponse = response; } - fromJson(input: string): AllOrderEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(AllOrderEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AllOrderEvent { - return plainToInstance(AllOrderEvent, jsonObject); + static fromJson(input: string): AllOrderEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AllOrderEvent { + return plainToClassFromExist(new AllOrderEvent(), jsonObject); } } @@ -226,7 +225,7 @@ export class AllOrderEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new AllOrderEvent().fromObject(msg.data); + let event = AllOrderEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index b68fe861..aea686fa 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AllPositionEvent implements Response { +export class AllPositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ @@ -201,17 +201,16 @@ export class AllPositionEvent implements Response { this.commonResponse = response; } - fromJson(input: string): AllPositionEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(AllPositionEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AllPositionEvent { - return plainToInstance(AllPositionEvent, jsonObject); + static fromJson(input: string): AllPositionEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AllPositionEvent { + return plainToClassFromExist(new AllPositionEvent(), jsonObject); } } @@ -246,7 +245,7 @@ export class AllPositionEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new AllPositionEvent().fromObject(msg.data); + let event = AllPositionEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index 5510006d..5c47fa00 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BalanceEvent implements Response { +export class BalanceEvent implements Response { /** * Margin of the cross margin position */ @@ -77,17 +77,16 @@ export class BalanceEvent implements Response { this.commonResponse = response; } - fromJson(input: string): BalanceEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(BalanceEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BalanceEvent { - return plainToInstance(BalanceEvent, jsonObject); + static fromJson(input: string): BalanceEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BalanceEvent { + return plainToClassFromExist(new BalanceEvent(), jsonObject); } } @@ -99,7 +98,7 @@ export class BalanceEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new BalanceEvent().fromObject(msg.data); + let event = BalanceEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts index 8d742c7c..99e1ecc0 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -1,24 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class CrossLeverageDataValue implements Serializable { +export class CrossLeverageDataValue implements Serializable { /** * */ leverage?: string; - fromJson(input: string): CrossLeverageDataValue { - const jsonObject = JSON.parse(input); - return plainToInstance(CrossLeverageDataValue, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CrossLeverageDataValue { - return plainToInstance(CrossLeverageDataValue, jsonObject); + static fromJson(input: string): CrossLeverageDataValue { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CrossLeverageDataValue { + return plainToClassFromExist(new CrossLeverageDataValue(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index 2771741a..ff26acc1 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { CrossLeverageDataValue } from './model_cross_leverage_data_value'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CrossLeverageEvent implements Response { +export class CrossLeverageEvent implements Response { /** * */ @@ -22,17 +22,16 @@ export class CrossLeverageEvent implements Response { +export class MarginModeEvent implements Response { /** * The SYMBOL is the key with value \"CROSS\" or \"ISOLATED\" */ @@ -21,17 +21,16 @@ export class MarginModeEvent implements Response { this.commonResponse = response; } - fromJson(input: string): MarginModeEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(MarginModeEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarginModeEvent { - return plainToInstance(MarginModeEvent, jsonObject); + static fromJson(input: string): MarginModeEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarginModeEvent { + return plainToClassFromExist(new MarginModeEvent(), jsonObject); } } @@ -47,7 +46,7 @@ export class MarginModeEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new MarginModeEvent().fromObject(msg.data); + let event = MarginModeEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index 58edcb75..47e7b77c 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class OrderEvent implements Response { +export class OrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ @@ -105,17 +105,16 @@ export class OrderEvent implements Response { this.commonResponse = response; } - fromJson(input: string): OrderEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(OrderEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): OrderEvent { - return plainToInstance(OrderEvent, jsonObject); + static fromJson(input: string): OrderEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): OrderEvent { + return plainToClassFromExist(new OrderEvent(), jsonObject); } } @@ -226,7 +225,7 @@ export class OrderEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderEvent().fromObject(msg.data); + let event = OrderEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index 3f5409d3..a7bde21b 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class PositionEvent implements Response { +export class PositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ @@ -201,17 +201,16 @@ export class PositionEvent implements Response { this.commonResponse = response; } - fromJson(input: string): PositionEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(PositionEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): PositionEvent { - return plainToInstance(PositionEvent, jsonObject); + static fromJson(input: string): PositionEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): PositionEvent { + return plainToClassFromExist(new PositionEvent(), jsonObject); } } @@ -242,7 +241,7 @@ export class PositionEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new PositionEvent().fromObject(msg.data); + let event = PositionEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index bd4e902e..df4ba06c 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class StopOrdersEvent implements Response { +export class StopOrdersEvent implements Response { /** * */ @@ -69,17 +69,16 @@ export class StopOrdersEvent implements Response { this.commonResponse = response; } - fromJson(input: string): StopOrdersEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(StopOrdersEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): StopOrdersEvent { - return plainToInstance(StopOrdersEvent, jsonObject); + static fromJson(input: string): StopOrdersEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): StopOrdersEvent { + return plainToClassFromExist(new StopOrdersEvent(), jsonObject); } } @@ -148,7 +147,7 @@ export class StopOrdersEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new StopOrdersEvent().fromObject(msg.data); + let event = StopOrdersEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index 58f809be..67594953 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AnnouncementEvent implements Response { +export class AnnouncementEvent implements Response { /** * Symbol */ @@ -33,17 +33,16 @@ export class AnnouncementEvent implements Response this.commonResponse = response; } - fromJson(input: string): AnnouncementEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(AnnouncementEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AnnouncementEvent { - return plainToInstance(AnnouncementEvent, jsonObject); + static fromJson(input: string): AnnouncementEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AnnouncementEvent { + return plainToClassFromExist(new AnnouncementEvent(), jsonObject); } } @@ -59,7 +58,7 @@ export class AnnouncementEventCallbackWrapper implements WebSocketMessageCallbac } onMessage(msg: WsMessage): void { - let event = new AnnouncementEvent().fromObject(msg.data); + let event = AnnouncementEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index c81da20c..31785302 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ExecutionEvent implements Response { +export class ExecutionEvent implements Response { /** * */ @@ -53,17 +53,16 @@ export class ExecutionEvent implements Response { this.commonResponse = response; } - fromJson(input: string): ExecutionEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(ExecutionEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ExecutionEvent { - return plainToInstance(ExecutionEvent, jsonObject); + static fromJson(input: string): ExecutionEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ExecutionEvent { + return plainToClassFromExist(new ExecutionEvent(), jsonObject); } } @@ -75,7 +74,7 @@ export class ExecutionEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new ExecutionEvent().fromObject(msg.data); + let event = ExecutionEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index 0205e8e8..e02154f5 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class InstrumentEvent implements Response { +export class InstrumentEvent implements Response { /** * Granularity (predicted funding rate: 1-min granularity: 60000; Funding rate: 8-hours granularity: 28800000. ) */ @@ -37,17 +37,16 @@ export class InstrumentEvent implements Response { this.commonResponse = response; } - fromJson(input: string): InstrumentEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(InstrumentEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): InstrumentEvent { - return plainToInstance(InstrumentEvent, jsonObject); + static fromJson(input: string): InstrumentEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): InstrumentEvent { + return plainToClassFromExist(new InstrumentEvent(), jsonObject); } } @@ -63,7 +62,7 @@ export class InstrumentEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new InstrumentEvent().fromObject(msg.data); + let event = InstrumentEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index 5872a4e6..87cf1802 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class KlinesEvent implements Response { +export class KlinesEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ @@ -29,17 +29,16 @@ export class KlinesEvent implements Response { this.commonResponse = response; } - fromJson(input: string): KlinesEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(KlinesEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): KlinesEvent { - return plainToInstance(KlinesEvent, jsonObject); + static fromJson(input: string): KlinesEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): KlinesEvent { + return plainToClassFromExist(new KlinesEvent(), jsonObject); } } @@ -51,7 +50,7 @@ export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new KlinesEvent().fromObject(msg.data); + let event = KlinesEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index 5d60dd26..76eccda8 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class OrderbookIncrementEvent implements Response { +export class OrderbookIncrementEvent implements Response { /** * */ @@ -29,17 +29,16 @@ export class OrderbookIncrementEvent implements Response { +export class OrderbookLevel50Event implements Response { /** * */ @@ -37,17 +37,16 @@ export class OrderbookLevel50Event implements Response { +export class OrderbookLevel5Event implements Response { /** * */ @@ -37,17 +37,16 @@ export class OrderbookLevel5Event implements Response { +export class SymbolSnapshotEvent implements Response { /** * */ @@ -57,17 +57,16 @@ export class SymbolSnapshotEvent implements Response { +export class TickerV1Event implements Response { /** * */ @@ -61,17 +61,16 @@ export class TickerV1Event implements Response { this.commonResponse = response; } - fromJson(input: string): TickerV1Event { - const jsonObject = JSON.parse(input); - return plainToInstance(TickerV1Event, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TickerV1Event { - return plainToInstance(TickerV1Event, jsonObject); + static fromJson(input: string): TickerV1Event { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TickerV1Event { + return plainToClassFromExist(new TickerV1Event(), jsonObject); } } @@ -83,7 +82,7 @@ export class TickerV1EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerV1Event().fromObject(msg.data); + let event = TickerV1Event.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index f0dd5bcb..ebaa1d1f 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class TickerV2Event implements Response { +export class TickerV2Event implements Response { /** * */ @@ -45,17 +45,16 @@ export class TickerV2Event implements Response { this.commonResponse = response; } - fromJson(input: string): TickerV2Event { - const jsonObject = JSON.parse(input); - return plainToInstance(TickerV2Event, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TickerV2Event { - return plainToInstance(TickerV2Event, jsonObject); + static fromJson(input: string): TickerV2Event { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TickerV2Event { + return plainToClassFromExist(new TickerV2Event(), jsonObject); } } @@ -67,7 +66,7 @@ export class TickerV2EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerV2Event().fromObject(msg.data); + let event = TickerV2Event.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/futures/market/api_market.ts b/sdk/node/src/generate/futures/market/api_market.ts index bd27058b..492213ff 100644 --- a/sdk/node/src/generate/futures/market/api_market.ts +++ b/sdk/node/src/generate/futures/market/api_market.ts @@ -313,7 +313,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/contracts/{symbol}', req, - new GetSymbolResp(), + GetSymbolResp, false, ); } @@ -325,7 +325,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/contracts/active', null, - new GetAllSymbolsResp(), + GetAllSymbolsResp, false, ); } @@ -337,7 +337,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/ticker', req, - new GetTickerResp(), + GetTickerResp, false, ); } @@ -349,7 +349,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/allTickers', null, - new GetAllTickersResp(), + GetAllTickersResp, false, ); } @@ -361,7 +361,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/level2/snapshot', req, - new GetFullOrderBookResp(), + GetFullOrderBookResp, false, ); } @@ -373,7 +373,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/level2/depth{size}', req, - new GetPartOrderBookResp(), + GetPartOrderBookResp, false, ); } @@ -385,7 +385,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/trade/history', req, - new GetTradeHistoryResp(), + GetTradeHistoryResp, false, ); } @@ -397,7 +397,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/kline/query', req, - new GetKlinesResp(), + GetKlinesResp, false, ); } @@ -409,7 +409,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/mark-price/{symbol}/current', req, - new GetMarkPriceResp(), + GetMarkPriceResp, false, ); } @@ -421,7 +421,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/index/query', req, - new GetSpotIndexPriceResp(), + GetSpotIndexPriceResp, false, ); } @@ -433,7 +433,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/interest/query', req, - new GetInterestRateIndexResp(), + GetInterestRateIndexResp, false, ); } @@ -445,7 +445,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/premium/query', req, - new GetPremiumIndexResp(), + GetPremiumIndexResp, false, ); } @@ -457,7 +457,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/trade-statistics', null, - new Get24hrStatsResp(), + Get24hrStatsResp, false, ); } @@ -469,7 +469,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/timestamp', null, - new GetServerTimeResp(), + GetServerTimeResp, false, ); } @@ -481,7 +481,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/status', null, - new GetServiceStatusResp(), + GetServiceStatusResp, false, ); } @@ -493,7 +493,7 @@ export class MarketAPIImpl implements MarketAPI { 'POST', '/api/v1/bullet-public', null, - new GetPublicTokenResp(), + GetPublicTokenResp, false, ); } @@ -505,7 +505,7 @@ export class MarketAPIImpl implements MarketAPI { 'POST', '/api/v1/bullet-private', null, - new GetPrivateTokenResp(), + GetPrivateTokenResp, false, ); } diff --git a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts index 91770044..0677e8bd 100644 --- a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class Get24hrStatsResp implements Response { +export class Get24hrStatsResp implements Response { /** * 24-hour platform Futures trading volume. Unit is USD */ - turnoverOf24h?: number; + turnoverOf24h: number; + private constructor() { + // @ts-ignore + this.turnoverOf24h = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class Get24hrStatsResp implements Response { +export class GetAllSymbolsData implements Serializable { /** * Symbol */ - symbol?: string; + symbol: string; + /** * Contract group */ - rootSymbol?: string; + rootSymbol: string; + /** * Type of the contract */ - type?: GetAllSymbolsData.TypeEnum; + type: GetAllSymbolsData.TypeEnum; + /** * First Open Date(millisecond) */ - firstOpenDate?: number; + firstOpenDate: number; + /** * Expiration date(millisecond). Null means it will never expire */ expireDate?: number; + /** * Settlement date(millisecond). Null indicates that automatic settlement is not supported */ settleDate?: number; + /** * Base currency */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency */ - quoteCurrency?: string; + quoteCurrency: string; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + /** * Maximum order quantity */ - maxOrderQty?: number; + maxOrderQty: number; + /** * Maximum order price */ - maxPrice?: number; + maxPrice: number; + /** * Minimum lot size */ - lotSize?: number; + lotSize: number; + /** * Minimum price changes */ - tickSize?: number; + tickSize: number; + /** * Index price of tick size */ - indexPriceTickSize?: number; + indexPriceTickSize: number; + /** * The basic unit of the contract API is lots. For the number of coins in each lot, please refer to the param multiplier. For example, for XBTUSDTM, multiplier=0.001, which corresponds to the value of each XBTUSDTM contract being 0.001 BTC. There is also a special case. All coin-swap contracts, such as each XBTUSDM contract, correspond to 1 USD. */ - multiplier?: number; + multiplier: number; + /** * Initial margin requirement */ - initialMargin?: number; + initialMargin: number; + /** * Maintenance margin requirement */ - maintainMargin?: number; + maintainMargin: number; + /** * Maximum risk limit (unit: XBT) */ - maxRiskLimit?: number; + maxRiskLimit: number; + /** * Minimum risk limit (unit: XBT) */ - minRiskLimit?: number; + minRiskLimit: number; + /** * Risk limit increment value (unit: XBT) */ - riskStep?: number; + riskStep: number; + /** * Maker fee rate */ - makerFeeRate?: number; + makerFeeRate: number; + /** * Taker fee rate */ - takerFeeRate?: number; + takerFeeRate: number; + /** * Deprecated param */ - takerFixFee?: number; + takerFixFee: number; + /** * Deprecated param */ - makerFixFee?: number; + makerFixFee: number; + /** * Settlement fee */ - settlementFee?: number; + settlementFee: number; + /** * Enabled ADL or not */ - isDeleverage?: boolean; + isDeleverage: boolean; + /** * Deprecated param */ - isQuanto?: boolean; + isQuanto: boolean; + /** * Whether it is a reverse contract */ - isInverse?: boolean; + isInverse: boolean; + /** * Marking method */ - markMethod?: GetAllSymbolsData.MarkMethodEnum; + markMethod: GetAllSymbolsData.MarkMethodEnum; + /** * Fair price marking method, The Futures contract is null */ - fairMethod?: GetAllSymbolsData.FairMethodEnum; + fairMethod: GetAllSymbolsData.FairMethodEnum; + /** * Ticker symbol of the based currency */ - fundingBaseSymbol?: string; + fundingBaseSymbol: string; + /** * Ticker symbol of the quote currency */ - fundingQuoteSymbol?: string; + fundingQuoteSymbol: string; + /** * Funding rate symbol */ - fundingRateSymbol?: string; + fundingRateSymbol: string; + /** * Index symbol */ - indexSymbol?: string; + indexSymbol: string; + /** * Settlement Symbol */ - settlementSymbol?: string; + settlementSymbol: string; + /** * Contract status */ - status?: GetAllSymbolsData.StatusEnum; + status: GetAllSymbolsData.StatusEnum; + /** * Funding fee rate */ - fundingFeeRate?: number; + fundingFeeRate: number; + /** * Predicted funding fee rate */ - predictedFundingFeeRate?: number; + predictedFundingFeeRate: number; + /** * Funding interval(millisecond) */ - fundingRateGranularity?: number; + fundingRateGranularity: number; + /** * Open interest */ - openInterest?: string; + openInterest: string; + /** * 24-hour turnover */ - turnoverOf24h?: number; + turnoverOf24h: number; + /** * 24-hour volume */ - volumeOf24h?: number; + volumeOf24h: number; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Index price */ - indexPrice?: number; + indexPrice: number; + /** * Last trade price */ - lastTradePrice?: number; + lastTradePrice: number; + /** * Next funding rate time(millisecond) */ - nextFundingRateTime?: number; + nextFundingRateTime: number; + /** * Maximum leverage */ - maxLeverage?: number; + maxLeverage: number; + /** * The contract index price source exchange */ - sourceExchanges?: Array; + sourceExchanges: Array; + /** * Premium index symbol(1 minute) */ - premiumsSymbol1M?: string; + premiumsSymbol1M: string; + /** * Premium index symbol(8 hours) */ - premiumsSymbol8H?: string; + premiumsSymbol8H: string; + /** * Base currency interest rate symbol(1 minute) */ - fundingBaseSymbol1M?: string; + fundingBaseSymbol1M: string; + /** * Quote currency interest rate symbol(1 minute) */ - fundingQuoteSymbol1M?: string; + fundingQuoteSymbol1M: string; + /** * 24-hour lowest price */ - lowPrice?: number; + lowPrice: number; + /** * 24-hour highest price */ - highPrice?: number; + highPrice: number; + /** * 24-hour price change% */ - priceChgPct?: number; + priceChgPct: number; + /** * 24-hour price change */ - priceChg?: number; + priceChg: number; + /** * */ - k?: number; + k: number; + /** * */ - m?: number; + m: number; + /** * */ - f?: number; + f: number; + /** * */ - mmrLimit?: number; + mmrLimit: number; + /** * */ - mmrLevConstant?: number; + mmrLevConstant: number; + /** * Whether support Cross Margin */ - supportCross?: boolean; + supportCross: boolean; - fromJson(input: string): GetAllSymbolsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllSymbolsData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.rootSymbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.firstOpenDate = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.maxOrderQty = null; + // @ts-ignore + this.maxPrice = null; + // @ts-ignore + this.lotSize = null; + // @ts-ignore + this.tickSize = null; + // @ts-ignore + this.indexPriceTickSize = null; + // @ts-ignore + this.multiplier = null; + // @ts-ignore + this.initialMargin = null; + // @ts-ignore + this.maintainMargin = null; + // @ts-ignore + this.maxRiskLimit = null; + // @ts-ignore + this.minRiskLimit = null; + // @ts-ignore + this.riskStep = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.takerFixFee = null; + // @ts-ignore + this.makerFixFee = null; + // @ts-ignore + this.settlementFee = null; + // @ts-ignore + this.isDeleverage = null; + // @ts-ignore + this.isQuanto = null; + // @ts-ignore + this.isInverse = null; + // @ts-ignore + this.markMethod = null; + // @ts-ignore + this.fairMethod = null; + // @ts-ignore + this.fundingBaseSymbol = null; + // @ts-ignore + this.fundingQuoteSymbol = null; + // @ts-ignore + this.fundingRateSymbol = null; + // @ts-ignore + this.indexSymbol = null; + // @ts-ignore + this.settlementSymbol = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.fundingFeeRate = null; + // @ts-ignore + this.predictedFundingFeeRate = null; + // @ts-ignore + this.fundingRateGranularity = null; + // @ts-ignore + this.openInterest = null; + // @ts-ignore + this.turnoverOf24h = null; + // @ts-ignore + this.volumeOf24h = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.indexPrice = null; + // @ts-ignore + this.lastTradePrice = null; + // @ts-ignore + this.nextFundingRateTime = null; + // @ts-ignore + this.maxLeverage = null; + // @ts-ignore + this.sourceExchanges = null; + // @ts-ignore + this.premiumsSymbol1M = null; + // @ts-ignore + this.premiumsSymbol8H = null; + // @ts-ignore + this.fundingBaseSymbol1M = null; + // @ts-ignore + this.fundingQuoteSymbol1M = null; + // @ts-ignore + this.lowPrice = null; + // @ts-ignore + this.highPrice = null; + // @ts-ignore + this.priceChgPct = null; + // @ts-ignore + this.priceChg = null; + // @ts-ignore + this.k = null; + // @ts-ignore + this.m = null; + // @ts-ignore + this.f = null; + // @ts-ignore + this.mmrLimit = null; + // @ts-ignore + this.mmrLevConstant = null; + // @ts-ignore + this.supportCross = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllSymbolsData { - return plainToInstance(GetAllSymbolsData, jsonObject); + static fromJson(input: string): GetAllSymbolsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllSymbolsData { + return plainToClassFromExist(new GetAllSymbolsData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts index 10e4f4b9..ec363361 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetAllSymbolsData } from './model_get_all_symbols_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAllSymbolsResp implements Response { +export class GetAllSymbolsResp implements Response { /** * the list of all contracts */ @Type(() => GetAllSymbolsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetAllSymbolsResp implements Response { +export class GetAllTickersData implements Serializable { /** * Sequence number, used to judge whether the messages pushed by Websocket is continuous. */ - sequence?: number; + sequence: number; + /** * Symbol */ - symbol?: string; + symbol: string; + /** * Trade direction */ - side?: GetAllTickersData.SideEnum; + side: GetAllTickersData.SideEnum; + /** * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. */ - size?: number; + size: number; + /** * Transaction ID */ - tradeId?: string; + tradeId: string; + /** * Filled price */ - price?: string; + price: string; + /** * Best bid price */ - bestBidPrice?: string; + bestBidPrice: string; + /** * Best bid size */ - bestBidSize?: number; + bestBidSize: number; + /** * Best ask price */ - bestAskPrice?: string; + bestAskPrice: string; + /** * Best ask size */ - bestAskSize?: number; + bestAskSize: number; + /** * Filled time(nanosecond) */ - ts?: number; + ts: number; - fromJson(input: string): GetAllTickersData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllTickersData, jsonObject); + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.bestBidPrice = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.bestAskPrice = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.ts = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllTickersData { - return plainToInstance(GetAllTickersData, jsonObject); + static fromJson(input: string): GetAllTickersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllTickersData { + return plainToClassFromExist(new GetAllTickersData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts index 7f94ee57..201a8c40 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAllTickersData } from './model_get_all_tickers_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAllTickersResp implements Response { +export class GetAllTickersResp implements Response { /** * */ @Type(() => GetAllTickersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetAllTickersResp implements Response { +export class GetFullOrderBookReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetFullOrderBookReq` class. * The builder pattern allows step-by-step construction of a `GetFullOrderBookReq` object. */ static builder(): GetFullOrderBookReqBuilder { - return new GetFullOrderBookReqBuilder(); + return new GetFullOrderBookReqBuilder(new GetFullOrderBookReq()); } /** @@ -31,22 +32,23 @@ export class GetFullOrderBookReq implements Serializable { return obj; } - fromJson(input: string): GetFullOrderBookReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFullOrderBookReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFullOrderBookReq { - return plainToInstance(GetFullOrderBookReq, jsonObject); + static fromJson(input: string): GetFullOrderBookReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFullOrderBookReq { + return plainToClassFromExist(new GetFullOrderBookReq(), jsonObject); } } export class GetFullOrderBookReqBuilder { - obj: GetFullOrderBookReq = new GetFullOrderBookReq(); + constructor(readonly obj: GetFullOrderBookReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts index f1649104..f33a27c9 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts @@ -1,31 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFullOrderBookResp implements Response { +export class GetFullOrderBookResp implements Response { /** * Sequence number */ - sequence?: number; + sequence: number; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * bids, from high to low */ - bids?: Array>; + bids: Array>; + /** * asks, from low to high */ - asks?: Array>; + asks: Array>; + /** * Timestamp(nanosecond) */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.asks = null; + // @ts-ignore + this.ts = null; + } /** * common response */ @@ -36,16 +52,15 @@ export class GetFullOrderBookResp implements Response { +export class GetInterestRateIndexDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Granularity (milisecond) */ - granularity?: number; + granularity: number; + /** * Timestamp(milisecond) */ - timePoint?: number; + timePoint: number; + /** * Interest rate value */ - value?: number; + value: number; - fromJson(input: string): GetInterestRateIndexDataList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetInterestRateIndexDataList, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetInterestRateIndexDataList { - return plainToInstance(GetInterestRateIndexDataList, jsonObject); + static fromJson(input: string): GetInterestRateIndexDataList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetInterestRateIndexDataList { + return plainToClassFromExist(new GetInterestRateIndexDataList(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts index abeb0a18..191a7a14 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetInterestRateIndexReq implements Serializable { +export class GetInterestRateIndexReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: fundingBaseSymbol, fundingQuoteSymbol, fundingBaseSymbol1M, fundingQuoteSymbol1M](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. */ reverse?: boolean = true; + /** * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. */ offset?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ forward?: boolean = true; + /** * Max record count. The default record count is 10, The maximum length cannot exceed 100 */ maxCount?: number = 10; + private constructor() {} /** * Creates a new instance of the `GetInterestRateIndexReq` class. * The builder pattern allows step-by-step construction of a `GetInterestRateIndexReq` object. */ static builder(): GetInterestRateIndexReqBuilder { - return new GetInterestRateIndexReqBuilder(); + return new GetInterestRateIndexReqBuilder(new GetInterestRateIndexReq()); } /** @@ -78,29 +85,42 @@ export class GetInterestRateIndexReq implements Serializable { +export class GetInterestRateIndexResp implements Response { /** * */ @Type(() => GetInterestRateIndexDataList) - dataList?: Array; + dataList: Array; + /** * Whether there are more pages */ - hasMore?: boolean; + hasMore: boolean; + private constructor() { + // @ts-ignore + this.dataList = null; + // @ts-ignore + this.hasMore = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetInterestRateIndexResp implements Response { +export class GetKlinesReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Type of candlestick patterns(minute) */ granularity?: GetKlinesReq.GranularityEnum; + /** * Start time (milisecond) */ from?: number; + /** * End time (milisecond) */ to?: number; + private constructor() {} /** * Creates a new instance of the `GetKlinesReq` class. * The builder pattern allows step-by-step construction of a `GetKlinesReq` object. */ static builder(): GetKlinesReqBuilder { - return new GetKlinesReqBuilder(); + return new GetKlinesReqBuilder(new GetKlinesReq()); } /** @@ -58,17 +62,16 @@ export class GetKlinesReq implements Serializable { return obj; } - fromJson(input: string): GetKlinesReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKlinesReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetKlinesReq { - return plainToInstance(GetKlinesReq, jsonObject); + static fromJson(input: string): GetKlinesReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKlinesReq { + return plainToClassFromExist(new GetKlinesReq(), jsonObject); } } @@ -122,7 +125,9 @@ export namespace GetKlinesReq { } export class GetKlinesReqBuilder { - obj: GetKlinesReq = new GetKlinesReq(); + constructor(readonly obj: GetKlinesReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol, indexSymbol, premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts index 191dc903..6c384251 100644 --- a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetKlinesResp implements Response { +export class GetKlinesResp implements Response { /** * */ - data?: Array>; + data: Array>; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetKlinesResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetKlinesResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKlinesResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetKlinesResp { - return plainToInstance(GetKlinesResp, { data: jsonObject }); + static fromJson(input: string): GetKlinesResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKlinesResp { + return plainToClassFromExist(new GetKlinesResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts index b8d6d3fe..1cc847c7 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarkPriceReq implements Serializable { +export class GetMarkPriceReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMarkPriceReq` class. * The builder pattern allows step-by-step construction of a `GetMarkPriceReq` object. */ static builder(): GetMarkPriceReqBuilder { - return new GetMarkPriceReqBuilder(); + return new GetMarkPriceReqBuilder(new GetMarkPriceReq()); } /** @@ -33,22 +34,23 @@ export class GetMarkPriceReq implements Serializable { return obj; } - fromJson(input: string): GetMarkPriceReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarkPriceReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarkPriceReq { - return plainToInstance(GetMarkPriceReq, jsonObject); + static fromJson(input: string): GetMarkPriceReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarkPriceReq { + return plainToClassFromExist(new GetMarkPriceReq(), jsonObject); } } export class GetMarkPriceReqBuilder { - obj: GetMarkPriceReq = new GetMarkPriceReq(); + constructor(readonly obj: GetMarkPriceReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts index dc8071a7..e157cc1f 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts @@ -1,31 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarkPriceResp implements Response { +export class GetMarkPriceResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Granularity (milisecond) */ - granularity?: number; + granularity: number; + /** * Time point (milisecond) */ - timePoint?: number; + timePoint: number; + /** * Mark price */ - value?: number; + value: number; + /** * Index price */ - indexPrice?: number; + indexPrice: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.indexPrice = null; + } /** * common response */ @@ -36,16 +52,15 @@ export class GetMarkPriceResp implements Response { +export class GetPartOrderBookReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Get the depth layer, optional value: 20, 100 */ @Reflect.metadata('path', 'size') size?: string; + private constructor() {} /** * Creates a new instance of the `GetPartOrderBookReq` class. * The builder pattern allows step-by-step construction of a `GetPartOrderBookReq` object. */ static builder(): GetPartOrderBookReqBuilder { - return new GetPartOrderBookReqBuilder(); + return new GetPartOrderBookReqBuilder(new GetPartOrderBookReq()); } /** @@ -42,22 +44,23 @@ export class GetPartOrderBookReq implements Serializable { return obj; } - fromJson(input: string): GetPartOrderBookReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPartOrderBookReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPartOrderBookReq { - return plainToInstance(GetPartOrderBookReq, jsonObject); + static fromJson(input: string): GetPartOrderBookReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPartOrderBookReq { + return plainToClassFromExist(new GetPartOrderBookReq(), jsonObject); } } export class GetPartOrderBookReqBuilder { - obj: GetPartOrderBookReq = new GetPartOrderBookReq(); + constructor(readonly obj: GetPartOrderBookReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts index a33fba70..47e42d95 100644 --- a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts @@ -1,31 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPartOrderBookResp implements Response { +export class GetPartOrderBookResp implements Response { /** * Sequence number */ - sequence?: number; + sequence: number; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * bids, from high to low */ - bids?: Array>; + bids: Array>; + /** * asks, from low to high */ - asks?: Array>; + asks: Array>; + /** * Timestamp(nanosecond) */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.asks = null; + // @ts-ignore + this.ts = null; + } /** * common response */ @@ -36,16 +52,15 @@ export class GetPartOrderBookResp implements Response { +export class GetPremiumIndexDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Granularity(milisecond) */ - granularity?: number; + granularity: number; + /** * Timestamp(milisecond) */ - timePoint?: number; + timePoint: number; + /** * Premium index */ - value?: number; + value: number; - fromJson(input: string): GetPremiumIndexDataList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPremiumIndexDataList, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPremiumIndexDataList { - return plainToInstance(GetPremiumIndexDataList, jsonObject); + static fromJson(input: string): GetPremiumIndexDataList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPremiumIndexDataList { + return plainToClassFromExist(new GetPremiumIndexDataList(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts index 75c9507c..e7631120 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPremiumIndexReq implements Serializable { +export class GetPremiumIndexReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. */ reverse?: boolean = true; + /** * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. */ offset?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ forward?: boolean = true; + /** * Max record count. The default record count is 10, The maximum length cannot exceed 100 */ maxCount?: number = 10; + private constructor() {} /** * Creates a new instance of the `GetPremiumIndexReq` class. * The builder pattern allows step-by-step construction of a `GetPremiumIndexReq` object. */ static builder(): GetPremiumIndexReqBuilder { - return new GetPremiumIndexReqBuilder(); + return new GetPremiumIndexReqBuilder(new GetPremiumIndexReq()); } /** @@ -78,29 +85,42 @@ export class GetPremiumIndexReq implements Serializable { obj.symbol = data.symbol; obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.reverse = data.reverse; + if (data.reverse) { + obj.reverse = data.reverse; + } else { + obj.reverse = true; + } obj.offset = data.offset; - obj.forward = data.forward; - obj.maxCount = data.maxCount; + if (data.forward) { + obj.forward = data.forward; + } else { + obj.forward = true; + } + if (data.maxCount) { + obj.maxCount = data.maxCount; + } else { + obj.maxCount = 10; + } return obj; } - fromJson(input: string): GetPremiumIndexReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPremiumIndexReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPremiumIndexReq { - return plainToInstance(GetPremiumIndexReq, jsonObject); + static fromJson(input: string): GetPremiumIndexReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPremiumIndexReq { + return plainToClassFromExist(new GetPremiumIndexReq(), jsonObject); } } export class GetPremiumIndexReqBuilder { - obj: GetPremiumIndexReq = new GetPremiumIndexReq(); + constructor(readonly obj: GetPremiumIndexReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: premiumsSymbol1M, premiumsSymbol8H](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts index b37a3c72..14a437b3 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetPremiumIndexDataList } from './model_get_premium_index_data_list'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPremiumIndexResp implements Response { +export class GetPremiumIndexResp implements Response { /** * */ @Type(() => GetPremiumIndexDataList) - dataList?: Array; + dataList: Array; + /** * Whether there are more pages */ - hasMore?: boolean; + hasMore: boolean; + private constructor() { + // @ts-ignore + this.dataList = null; + // @ts-ignore + this.hasMore = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetPremiumIndexResp implements Response -{ +export class GetPrivateTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change */ - endpoint?: string; + endpoint: string; + /** * Whether to encrypt. Currently only supports wss, not ws */ - encrypt?: boolean; + encrypt: boolean; + /** * Network Protocol */ - protocol?: GetPrivateTokenInstanceServers.ProtocolEnum; + protocol: GetPrivateTokenInstanceServers.ProtocolEnum; + /** * Recommended ping interval(millisecond) */ - pingInterval?: number; + pingInterval: number; + /** * Heartbeat timeout(millisecond) */ - pingTimeout?: number; + pingTimeout: number; - fromJson(input: string): GetPrivateTokenInstanceServers { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + private constructor() { + // @ts-ignore + this.endpoint = null; + // @ts-ignore + this.encrypt = null; + // @ts-ignore + this.protocol = null; + // @ts-ignore + this.pingInterval = null; + // @ts-ignore + this.pingTimeout = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { - return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + static fromJson(input: string): GetPrivateTokenInstanceServers { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { + return plainToClassFromExist(new GetPrivateTokenInstanceServers(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts index c63fb8eb..30d35009 100644 --- a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPrivateTokenResp implements Response { +export class GetPrivateTokenResp implements Response { /** * The token required to establish a websocket connection */ - token?: string; + token: string; + /** * */ @Type(() => GetPrivateTokenInstanceServers) - instanceServers?: Array; + instanceServers: Array; + private constructor() { + // @ts-ignore + this.token = null; + // @ts-ignore + this.instanceServers = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetPrivateTokenResp implements Response { +export class GetPublicTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change */ - endpoint?: string; + endpoint: string; + /** * Whether to encrypt. Currently only supports wss, not ws */ - encrypt?: boolean; + encrypt: boolean; + /** * Network Protocol */ - protocol?: GetPublicTokenInstanceServers.ProtocolEnum; + protocol: GetPublicTokenInstanceServers.ProtocolEnum; + /** * Recommended ping interval(millisecond) */ - pingInterval?: number; + pingInterval: number; + /** * Heartbeat timeout(millisecond) */ - pingTimeout?: number; + pingTimeout: number; - fromJson(input: string): GetPublicTokenInstanceServers { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + private constructor() { + // @ts-ignore + this.endpoint = null; + // @ts-ignore + this.encrypt = null; + // @ts-ignore + this.protocol = null; + // @ts-ignore + this.pingInterval = null; + // @ts-ignore + this.pingTimeout = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPublicTokenInstanceServers { - return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + static fromJson(input: string): GetPublicTokenInstanceServers { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPublicTokenInstanceServers { + return plainToClassFromExist(new GetPublicTokenInstanceServers(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts index 032b4362..c6c5da8b 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPublicTokenResp implements Response { +export class GetPublicTokenResp implements Response { /** * The token required to establish a websocket connection */ - token?: string; + token: string; + /** * */ @Type(() => GetPublicTokenInstanceServers) - instanceServers?: Array; + instanceServers: Array; + private constructor() { + // @ts-ignore + this.token = null; + // @ts-ignore + this.instanceServers = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetPublicTokenResp implements Response { +export class GetServerTimeResp implements Response { /** * ServerTime(millisecond) */ - data?: number; + data: number; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetServerTimeResp implements Response { +export class GetServiceStatusResp implements Response { /** * */ - msg?: string; + msg: string; + /** * Status of service: open:normal transaction, close:Stop Trading/Maintenance, cancelonly:can only cancel the order but not place order */ - status?: GetServiceStatusResp.StatusEnum; + status: GetServiceStatusResp.StatusEnum; + private constructor() { + // @ts-ignore + this.msg = null; + // @ts-ignore + this.status = null; + } /** * common response */ @@ -24,17 +31,16 @@ export class GetServiceStatusResp implements Response { +export class GetSpotIndexPriceDataList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Granularity (milisecond) */ - granularity?: number; + granularity: number; + /** * Timestamp (milisecond) */ - timePoint?: number; + timePoint: number; + /** * Index Value */ - value?: number; + value: number; + /** * Component List */ @Type(() => GetSpotIndexPriceDataListDecomposionList) - decomposionList?: Array; + decomposionList: Array; - fromJson(input: string): GetSpotIndexPriceDataList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotIndexPriceDataList, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.decomposionList = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotIndexPriceDataList { - return plainToInstance(GetSpotIndexPriceDataList, jsonObject); + static fromJson(input: string): GetSpotIndexPriceDataList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotIndexPriceDataList { + return plainToClassFromExist(new GetSpotIndexPriceDataList(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts index 8dae5c7a..fc6caca2 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts @@ -1,34 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotIndexPriceDataListDecomposionList - implements Serializable -{ +export class GetSpotIndexPriceDataListDecomposionList implements Serializable { /** * Exchange */ - exchange?: string; + exchange: string; + /** * Price */ - price?: number; + price: number; + /** * Weight */ - weight?: number; + weight: number; - fromJson(input: string): GetSpotIndexPriceDataListDecomposionList { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotIndexPriceDataListDecomposionList, jsonObject); + private constructor() { + // @ts-ignore + this.exchange = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.weight = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotIndexPriceDataListDecomposionList { - return plainToInstance(GetSpotIndexPriceDataListDecomposionList, jsonObject); + static fromJson(input: string): GetSpotIndexPriceDataListDecomposionList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotIndexPriceDataListDecomposionList { + return plainToClassFromExist(new GetSpotIndexPriceDataListDecomposionList(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts index 6c77019a..a7d2035a 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetSpotIndexPriceReq implements Serializable { +export class GetSpotIndexPriceReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * This parameter functions to judge whether the lookup is reverse. True means “yes”. False means no. This parameter is set as True by default. */ reverse?: boolean = true; + /** * Start offset. The unique attribute of the last returned result of the last request. The data of the first page will be returned by default. */ offset?: number; + /** * This parameter functions to judge whether the lookup is forward or not. True means “yes” and False means “no”. This parameter is set as true by default */ forward?: boolean = true; + /** * Max record count. The default record count is 10, The maximum length cannot exceed 100 */ maxCount?: number = 10; + private constructor() {} /** * Creates a new instance of the `GetSpotIndexPriceReq` class. * The builder pattern allows step-by-step construction of a `GetSpotIndexPriceReq` object. */ static builder(): GetSpotIndexPriceReqBuilder { - return new GetSpotIndexPriceReqBuilder(); + return new GetSpotIndexPriceReqBuilder(new GetSpotIndexPriceReq()); } /** @@ -78,29 +85,42 @@ export class GetSpotIndexPriceReq implements Serializable obj.symbol = data.symbol; obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.reverse = data.reverse; + if (data.reverse) { + obj.reverse = data.reverse; + } else { + obj.reverse = true; + } obj.offset = data.offset; - obj.forward = data.forward; - obj.maxCount = data.maxCount; + if (data.forward) { + obj.forward = data.forward; + } else { + obj.forward = true; + } + if (data.maxCount) { + obj.maxCount = data.maxCount; + } else { + obj.maxCount = 10; + } return obj; } - fromJson(input: string): GetSpotIndexPriceReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSpotIndexPriceReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSpotIndexPriceReq { - return plainToInstance(GetSpotIndexPriceReq, jsonObject); + static fromJson(input: string): GetSpotIndexPriceReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSpotIndexPriceReq { + return plainToClassFromExist(new GetSpotIndexPriceReq(), jsonObject); } } export class GetSpotIndexPriceReqBuilder { - obj: GetSpotIndexPriceReq = new GetSpotIndexPriceReq(); + constructor(readonly obj: GetSpotIndexPriceReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: indexSymbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts index 75c4b05c..24684cea 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetSpotIndexPriceDataList } from './model_get_spot_index_price_data_list'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSpotIndexPriceResp implements Response { +export class GetSpotIndexPriceResp implements Response { /** * */ @Type(() => GetSpotIndexPriceDataList) - dataList?: Array; + dataList: Array; + /** * Whether there are more pages */ - hasMore?: boolean; + hasMore: boolean; + private constructor() { + // @ts-ignore + this.dataList = null; + // @ts-ignore + this.hasMore = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetSpotIndexPriceResp implements Response { +export class GetSymbolReq implements Serializable { /** * Path Parameter. Symbol of the contract */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetSymbolReq` class. * The builder pattern allows step-by-step construction of a `GetSymbolReq` object. */ static builder(): GetSymbolReqBuilder { - return new GetSymbolReqBuilder(); + return new GetSymbolReqBuilder(new GetSymbolReq()); } /** @@ -33,22 +34,23 @@ export class GetSymbolReq implements Serializable { return obj; } - fromJson(input: string): GetSymbolReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolReq { - return plainToInstance(GetSymbolReq, jsonObject); + static fromJson(input: string): GetSymbolReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolReq { + return plainToClassFromExist(new GetSymbolReq(), jsonObject); } } export class GetSymbolReqBuilder { - obj: GetSymbolReq = new GetSymbolReq(); + constructor(readonly obj: GetSymbolReq) { + this.obj = obj; + } /** * Path Parameter. Symbol of the contract */ diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts index fdfd5bef..de3a70db 100644 --- a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts @@ -1,259 +1,446 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSymbolResp implements Response { +export class GetSymbolResp implements Response { /** * Symbol */ - symbol?: string; + symbol: string; + /** * Contract group */ - rootSymbol?: string; + rootSymbol: string; + /** * Type of the contract */ - type?: GetSymbolResp.TypeEnum; + type: GetSymbolResp.TypeEnum; + /** * First Open Date(millisecond) */ - firstOpenDate?: number; + firstOpenDate: number; + /** * Expiration date(millisecond). Null means it will never expire */ - expireDate?: number; + expireDate: number; + /** * Settlement date(millisecond). Null indicates that automatic settlement is not supported */ - settleDate?: number; + settleDate: number; + /** * Base currency */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency */ - quoteCurrency?: string; + quoteCurrency: string; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + /** * Maximum order quantity */ - maxOrderQty?: number; + maxOrderQty: number; + /** * Maximum order price */ - maxPrice?: number; + maxPrice: number; + /** * Minimum lot size */ - lotSize?: number; + lotSize: number; + /** * Minimum price changes */ - tickSize?: number; + tickSize: number; + /** * Index price of tick size */ - indexPriceTickSize?: number; + indexPriceTickSize: number; + /** * The basic unit of the contract API is lots. For the number of coins in each lot, please refer to the param multiplier. For example, for XBTUSDTM, multiplier=0.001, which corresponds to the value of each XBTUSDTM contract being 0.001 BTC. There is also a special case. All coin-swap contracts, such as each XBTUSDM contract, correspond to 1 USD. */ - multiplier?: number; + multiplier: number; + /** * Initial margin requirement */ - initialMargin?: number; + initialMargin: number; + /** * Maintenance margin requirement */ - maintainMargin?: number; + maintainMargin: number; + /** * Maximum risk limit (unit: XBT) */ - maxRiskLimit?: number; + maxRiskLimit: number; + /** * Minimum risk limit (unit: XBT) */ - minRiskLimit?: number; + minRiskLimit: number; + /** * Risk limit increment value (unit: XBT) */ - riskStep?: number; + riskStep: number; + /** * Maker fee rate */ - makerFeeRate?: number; + makerFeeRate: number; + /** * Taker fee rate */ - takerFeeRate?: number; + takerFeeRate: number; + /** * Deprecated param */ - takerFixFee?: number; + takerFixFee: number; + /** * Deprecated param */ - makerFixFee?: number; + makerFixFee: number; + /** * Settlement fee */ - settlementFee?: number; + settlementFee: number; + /** * Enabled ADL or not */ - isDeleverage?: boolean; + isDeleverage: boolean; + /** * Deprecated param */ - isQuanto?: boolean; + isQuanto: boolean; + /** * Whether it is a reverse contract */ - isInverse?: boolean; + isInverse: boolean; + /** * Marking method */ - markMethod?: GetSymbolResp.MarkMethodEnum; + markMethod: GetSymbolResp.MarkMethodEnum; + /** * Fair price marking method, The Futures contract is null */ - fairMethod?: GetSymbolResp.FairMethodEnum; + fairMethod: GetSymbolResp.FairMethodEnum; + /** * Ticker symbol of the based currency */ - fundingBaseSymbol?: string; + fundingBaseSymbol: string; + /** * Ticker symbol of the quote currency */ - fundingQuoteSymbol?: string; + fundingQuoteSymbol: string; + /** * Funding rate symbol */ - fundingRateSymbol?: string; + fundingRateSymbol: string; + /** * Index symbol */ - indexSymbol?: string; + indexSymbol: string; + /** * Settlement Symbol */ - settlementSymbol?: string; + settlementSymbol: string; + /** * Contract status */ - status?: GetSymbolResp.StatusEnum; + status: GetSymbolResp.StatusEnum; + /** * Funding fee rate */ - fundingFeeRate?: number; + fundingFeeRate: number; + /** * Predicted funding fee rate */ - predictedFundingFeeRate?: number; + predictedFundingFeeRate: number; + /** * Funding interval(millisecond) */ - fundingRateGranularity?: number; + fundingRateGranularity: number; + /** * Open interest */ - openInterest?: string; + openInterest: string; + /** * 24-hour turnover */ - turnoverOf24h?: number; + turnoverOf24h: number; + /** * 24-hour volume */ - volumeOf24h?: number; + volumeOf24h: number; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Index price */ - indexPrice?: number; + indexPrice: number; + /** * Last trade price */ - lastTradePrice?: number; + lastTradePrice: number; + /** * Next funding rate time(millisecond) */ - nextFundingRateTime?: number; + nextFundingRateTime: number; + /** * Maximum leverage */ - maxLeverage?: number; + maxLeverage: number; + /** * The contract index price source exchange */ - sourceExchanges?: Array; + sourceExchanges: Array; + /** * Premium index symbol(1 minute) */ - premiumsSymbol1M?: string; + premiumsSymbol1M: string; + /** * Premium index symbol(8 hours) */ - premiumsSymbol8H?: string; + premiumsSymbol8H: string; + /** * Base currency interest rate symbol(1 minute) */ - fundingBaseSymbol1M?: string; + fundingBaseSymbol1M: string; + /** * Quote currency interest rate symbol(1 minute) */ - fundingQuoteSymbol1M?: string; + fundingQuoteSymbol1M: string; + /** * 24-hour lowest price */ - lowPrice?: number; + lowPrice: number; + /** * 24-hour highest price */ - highPrice?: number; + highPrice: number; + /** * 24-hour price change% */ - priceChgPct?: number; + priceChgPct: number; + /** * 24-hour price change */ - priceChg?: number; + priceChg: number; + /** * */ - k?: number; + k: number; + /** * */ - m?: number; + m: number; + /** * */ - f?: number; + f: number; + /** * */ - mmrLimit?: number; + mmrLimit: number; + /** * */ - mmrLevConstant?: number; + mmrLevConstant: number; + /** * Whether support Cross Margin */ - supportCross?: boolean; + supportCross: boolean; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.rootSymbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.firstOpenDate = null; + // @ts-ignore + this.expireDate = null; + // @ts-ignore + this.settleDate = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.maxOrderQty = null; + // @ts-ignore + this.maxPrice = null; + // @ts-ignore + this.lotSize = null; + // @ts-ignore + this.tickSize = null; + // @ts-ignore + this.indexPriceTickSize = null; + // @ts-ignore + this.multiplier = null; + // @ts-ignore + this.initialMargin = null; + // @ts-ignore + this.maintainMargin = null; + // @ts-ignore + this.maxRiskLimit = null; + // @ts-ignore + this.minRiskLimit = null; + // @ts-ignore + this.riskStep = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.takerFixFee = null; + // @ts-ignore + this.makerFixFee = null; + // @ts-ignore + this.settlementFee = null; + // @ts-ignore + this.isDeleverage = null; + // @ts-ignore + this.isQuanto = null; + // @ts-ignore + this.isInverse = null; + // @ts-ignore + this.markMethod = null; + // @ts-ignore + this.fairMethod = null; + // @ts-ignore + this.fundingBaseSymbol = null; + // @ts-ignore + this.fundingQuoteSymbol = null; + // @ts-ignore + this.fundingRateSymbol = null; + // @ts-ignore + this.indexSymbol = null; + // @ts-ignore + this.settlementSymbol = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.fundingFeeRate = null; + // @ts-ignore + this.predictedFundingFeeRate = null; + // @ts-ignore + this.fundingRateGranularity = null; + // @ts-ignore + this.openInterest = null; + // @ts-ignore + this.turnoverOf24h = null; + // @ts-ignore + this.volumeOf24h = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.indexPrice = null; + // @ts-ignore + this.lastTradePrice = null; + // @ts-ignore + this.nextFundingRateTime = null; + // @ts-ignore + this.maxLeverage = null; + // @ts-ignore + this.sourceExchanges = null; + // @ts-ignore + this.premiumsSymbol1M = null; + // @ts-ignore + this.premiumsSymbol8H = null; + // @ts-ignore + this.fundingBaseSymbol1M = null; + // @ts-ignore + this.fundingQuoteSymbol1M = null; + // @ts-ignore + this.lowPrice = null; + // @ts-ignore + this.highPrice = null; + // @ts-ignore + this.priceChgPct = null; + // @ts-ignore + this.priceChg = null; + // @ts-ignore + this.k = null; + // @ts-ignore + this.m = null; + // @ts-ignore + this.f = null; + // @ts-ignore + this.mmrLimit = null; + // @ts-ignore + this.mmrLevConstant = null; + // @ts-ignore + this.supportCross = null; + } /** * common response */ @@ -264,17 +451,16 @@ export class GetSymbolResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetSymbolResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolResp { - return plainToInstance(GetSymbolResp, jsonObject); + static fromJson(input: string): GetSymbolResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolResp { + return plainToClassFromExist(new GetSymbolResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts index d2fde2b6..1fe51c4a 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTickerReq implements Serializable { +export class GetTickerReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetTickerReq` class. * The builder pattern allows step-by-step construction of a `GetTickerReq` object. */ static builder(): GetTickerReqBuilder { - return new GetTickerReqBuilder(); + return new GetTickerReqBuilder(new GetTickerReq()); } /** @@ -31,22 +32,23 @@ export class GetTickerReq implements Serializable { return obj; } - fromJson(input: string): GetTickerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTickerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTickerReq { - return plainToInstance(GetTickerReq, jsonObject); + static fromJson(input: string): GetTickerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTickerReq { + return plainToClassFromExist(new GetTickerReq(), jsonObject); } } export class GetTickerReqBuilder { - obj: GetTickerReq = new GetTickerReq(); + constructor(readonly obj: GetTickerReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts index 8bf079f3..0e22994f 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts @@ -1,55 +1,89 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTickerResp implements Response { +export class GetTickerResp implements Response { /** * Sequence number, used to judge whether the messages pushed by Websocket is continuous. */ - sequence?: number; + sequence: number; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. */ - side?: GetTickerResp.SideEnum; + side: GetTickerResp.SideEnum; + /** * Filled quantity */ - size?: number; + size: number; + /** * Transaction ID */ - tradeId?: string; + tradeId: string; + /** * Filled price */ - price?: string; + price: string; + /** * Best bid price */ - bestBidPrice?: string; + bestBidPrice: string; + /** * Best bid size */ - bestBidSize?: number; + bestBidSize: number; + /** * Best ask price */ - bestAskPrice?: string; + bestAskPrice: string; + /** * Best ask size */ - bestAskSize?: number; + bestAskSize: number; + /** * Filled time(nanosecond) */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.bestBidPrice = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.bestAskPrice = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.ts = null; + } /** * common response */ @@ -60,17 +94,16 @@ export class GetTickerResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetTickerResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTickerResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTickerResp { - return plainToInstance(GetTickerResp, jsonObject); + static fromJson(input: string): GetTickerResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTickerResp { + return plainToClassFromExist(new GetTickerResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts index 70528653..ad395591 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts @@ -1,57 +1,84 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryData implements Serializable { +export class GetTradeHistoryData implements Serializable { /** * Sequence number */ - sequence?: number; + sequence: number; + /** * Deprecated param */ - contractId?: number; + contractId: number; + /** * Transaction ID */ - tradeId?: string; + tradeId: string; + /** * Maker order ID */ - makerOrderId?: string; + makerOrderId: string; + /** * Taker order ID */ - takerOrderId?: string; + takerOrderId: string; + /** * Filled timestamp(nanosecond) */ - ts?: number; + ts: number; + /** * Filled amount */ - size?: number; + size: number; + /** * Filled price */ - price?: string; + price: string; + /** * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. */ - side?: GetTradeHistoryData.SideEnum; + side: GetTradeHistoryData.SideEnum; - fromJson(input: string): GetTradeHistoryData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryData, jsonObject); + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.contractId = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.makerOrderId = null; + // @ts-ignore + this.takerOrderId = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.side = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryData { - return plainToInstance(GetTradeHistoryData, jsonObject); + static fromJson(input: string): GetTradeHistoryData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryData { + return plainToClassFromExist(new GetTradeHistoryData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts index 0ad93366..42b16dad 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryReq implements Serializable { +export class GetTradeHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. */ static builder(): GetTradeHistoryReqBuilder { - return new GetTradeHistoryReqBuilder(); + return new GetTradeHistoryReqBuilder(new GetTradeHistoryReq()); } /** @@ -31,22 +32,23 @@ export class GetTradeHistoryReq implements Serializable { return obj; } - fromJson(input: string): GetTradeHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryReq { - return plainToInstance(GetTradeHistoryReq, jsonObject); + static fromJson(input: string): GetTradeHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } } export class GetTradeHistoryReqBuilder { - obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + constructor(readonly obj: GetTradeHistoryReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts index be1b821e..198f4e8e 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetTradeHistoryData } from './model_get_trade_history_data'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTradeHistoryResp implements Response { +export class GetTradeHistoryResp implements Response { /** * */ @Type(() => GetTradeHistoryData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetTradeHistoryResp implements Response { +export class AddOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderReq.StopEnum; + /** * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderReq.StopPriceTypeEnum; + /** * Need to be defined if stop is specified. */ stopPrice?: string; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ stp?: AddOrderReq.StpEnum; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddOrderReq.MarginModeEnum = AddOrderReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ size?: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported */ qty?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported */ valueQty?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + } /** * Creates a new instance of the `AddOrderReq` class. * The builder pattern allows step-by-step construction of a `AddOrderReq` object. */ static builder(): AddOrderReqBuilder { - return new AddOrderReqBuilder(); + return new AddOrderReqBuilder(new AddOrderReq()); } /** @@ -112,19 +144,19 @@ export class AddOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ @@ -207,39 +239,74 @@ export class AddOrderReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stop = data.stop; obj.stopPriceType = data.stopPriceType; obj.stopPrice = data.stopPrice; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } obj.stp = data.stp; - obj.marginMode = data.marginMode; + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddOrderReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.qty = data.qty; obj.valueQty = data.valueQty; return obj; } - fromJson(input: string): AddOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderReq { - return plainToInstance(AddOrderReq, jsonObject); + static fromJson(input: string): AddOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderReq { + return plainToClassFromExist(new AddOrderReq(), jsonObject); } } @@ -325,7 +392,9 @@ export namespace AddOrderReq { } export class AddOrderReqBuilder { - obj: AddOrderReq = new AddOrderReq(); + constructor(readonly obj: AddOrderReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/futures/order/model_add_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_resp.ts index b221e43d..7545d9d8 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderResp implements Response { +export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderResp implements Response { this.commonResponse = response; } - fromJson(input: string): AddOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderResp { - return plainToInstance(AddOrderResp, jsonObject); + static fromJson(input: string): AddOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderResp { + return plainToClassFromExist(new AddOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts index b7f8846c..ea2fafac 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts @@ -1,109 +1,143 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderTestReq implements Serializable { +export class AddOrderTestReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + type: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: AddOrderTestReq.StopEnum; + /** * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: AddOrderTestReq.StopPriceTypeEnum; + /** * Need to be defined if stop is specified. */ stopPrice?: string; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ stp?: AddOrderTestReq.StpEnum; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddOrderTestReq.MarginModeEnum = AddOrderTestReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ size?: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported */ qty?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported */ valueQty?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `AddOrderTestReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. */ static builder(): AddOrderTestReqBuilder { - return new AddOrderTestReqBuilder(); + return new AddOrderTestReqBuilder(new AddOrderTestReq()); } /** @@ -113,23 +147,23 @@ export class AddOrderTestReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddOrderTestReq.TypeEnum; + type: AddOrderTestReq.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -208,39 +242,74 @@ export class AddOrderTestReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderTestReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stop = data.stop; obj.stopPriceType = data.stopPriceType; obj.stopPrice = data.stopPrice; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } obj.stp = data.stp; - obj.marginMode = data.marginMode; + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddOrderTestReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.qty = data.qty; obj.valueQty = data.valueQty; return obj; } - fromJson(input: string): AddOrderTestReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestReq { - return plainToInstance(AddOrderTestReq, jsonObject); + static fromJson(input: string): AddOrderTestReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestReq { + return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } } @@ -326,7 +395,9 @@ export namespace AddOrderTestReq { } export class AddOrderTestReqBuilder { - obj: AddOrderTestReq = new AddOrderTestReq(); + constructor(readonly obj: AddOrderTestReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts index 9eae886c..20e19e9d 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestResp implements Response { +export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderTestResp implements Response { +export class AddTPSLOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddTPSLOrderReq.SideEnum; + side: AddTPSLOrderReq.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + type: AddTPSLOrderReq.TypeEnum = AddTPSLOrderReq.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'TP\', \'IP\' or \'MP\' */ stopPriceType?: AddTPSLOrderReq.StopPriceTypeEnum; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ stp?: AddTPSLOrderReq.StpEnum; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: AddTPSLOrderReq.MarginModeEnum = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ size?: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: AddTPSLOrderReq.TimeInForceEnum = AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + /** * Take profit price */ triggerStopUpPrice?: string; + /** * Stop loss price */ triggerStopDownPrice?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported */ qty?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported */ valueQty?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `AddTPSLOrderReq` class. * The builder pattern allows step-by-step construction of a `AddTPSLOrderReq` object. */ static builder(): AddTPSLOrderReqBuilder { - return new AddTPSLOrderReqBuilder(); + return new AddTPSLOrderReqBuilder(new AddTPSLOrderReq()); } /** @@ -113,23 +147,23 @@ export class AddTPSLOrderReq implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddTPSLOrderReq.SideEnum; + side: AddTPSLOrderReq.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: AddTPSLOrderReq.TypeEnum; + type: AddTPSLOrderReq.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -208,20 +242,56 @@ export class AddTPSLOrderReq implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddTPSLOrderReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stopPriceType = data.stopPriceType; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } obj.stp = data.stp; - obj.marginMode = data.marginMode; + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = AddTPSLOrderReq.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.triggerStopUpPrice = data.triggerStopUpPrice; obj.triggerStopDownPrice = data.triggerStopDownPrice; @@ -230,17 +300,16 @@ export class AddTPSLOrderReq implements Serializable { return obj; } - fromJson(input: string): AddTPSLOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddTPSLOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddTPSLOrderReq { - return plainToInstance(AddTPSLOrderReq, jsonObject); + static fromJson(input: string): AddTPSLOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddTPSLOrderReq { + return plainToClassFromExist(new AddTPSLOrderReq(), jsonObject); } } @@ -316,7 +385,9 @@ export namespace AddTPSLOrderReq { } export class AddTPSLOrderReqBuilder { - obj: AddTPSLOrderReq = new AddTPSLOrderReq(); + constructor(readonly obj: AddTPSLOrderReq) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts index c73bce1a..8e2bc803 100644 --- a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddTPSLOrderResp implements Response { +export class AddTPSLOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddTPSLOrderResp implements Response { +export class BatchAddOrdersData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * */ - code?: string; + code: string; + /** * */ - msg?: string; + msg: string; - fromJson(input: string): BatchAddOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.code = null; + // @ts-ignore + this.msg = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersData { - return plainToInstance(BatchAddOrdersData, jsonObject); + static fromJson(input: string): BatchAddOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersData { + return plainToClassFromExist(new BatchAddOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts index 671030e1..deacf2ce 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts @@ -1,109 +1,143 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchAddOrdersItem implements Serializable { +export class BatchAddOrdersItem implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: BatchAddOrdersItem.SideEnum; + side: BatchAddOrdersItem.SideEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; + /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; + /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: BatchAddOrdersItem.TypeEnum = BatchAddOrdersItem.TypeEnum.LIMIT; + type: BatchAddOrdersItem.TypeEnum = BatchAddOrdersItem.TypeEnum.LIMIT; + /** * remark for the order, length cannot exceed 100 utf8 characters */ remark?: string; + /** * Either \'down\' or \'up\'. If stop is used,parameter stopPrice and stopPriceType also need to be provieded. */ stop?: BatchAddOrdersItem.StopEnum; + /** * Either \'TP\', \'IP\' or \'MP\', Need to be defined if stop is specified. */ stopPriceType?: BatchAddOrdersItem.StopPriceTypeEnum; + /** * Need to be defined if stop is specified. */ stopPrice?: string; + /** * A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. If set to true, only the orders reducing the position size will be executed. If the reduce-only order size exceeds the position size, the extra size will be canceled. */ reduceOnly?: boolean = false; + /** * A mark to close the position. Set to false by default. If closeOrder is set to true, the system will close the position and the position size will become 0. Side, Size and Leverage fields can be left empty and the system will determine the side and size automatically. */ closeOrder?: boolean = false; + /** * A mark to forcely hold the funds for an order, even though it\'s an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default. The system will forcely freeze certain amount of funds for this order, including orders whose direction is opposite to the current positions. This feature is to ensure that the order won’t be canceled by the matching engine in such a circumstance that not enough funds are frozen for the order. */ forceHold?: boolean = false; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ stp?: BatchAddOrdersItem.StpEnum; + /** * Margin mode: ISOLATED, CROSS, default: ISOLATED */ marginMode?: BatchAddOrdersItem.MarginModeEnum = BatchAddOrdersItem.MarginModeEnum.ISOLATED; + /** * Required for type is \'limit\' order, indicating the operating price */ price?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Lot), must be a positive integer. The quantity unit of coin-swap contracts is size(lot), and other units are not supported. */ size?: number; + /** * Optional for type is \'limit\' order, [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading, default is GTC */ timeInForce?: BatchAddOrdersItem.TimeInForceEnum = BatchAddOrdersItem.TimeInForceEnum.GOOD_TILL_CANCELED; + /** * Optional for type is \'limit\' order, post only flag, invalid when timeInForce is IOC. When postOnly is true, not allowed choose hidden or iceberg. The post-only flag ensures that the trader always pays the maker fee and provides liquidity to the order book. If any part of the order is going to pay taker fee, the order will be fully rejected. */ postOnly?: boolean = false; + /** * Optional for type is \'limit\' order, orders not displaying in order book. When hidden chose, not allowed choose postOnly. */ hidden?: boolean = false; + /** * Optional for type is \'limit\' order, Only visible portion of the order is displayed in the order book. When iceberg chose, not allowed choose postOnly. */ iceberg?: boolean = false; + /** * Optional for type is \'limit\' order, The maximum visible size of an iceberg order. please place order in size (lots), The units of qty (base currency) and valueQty (value) are not supported. */ visibleSize?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Base currency) must be an integer multiple of the multiplier. The unit of the quantity of coin-swap is size(lot), which is not supported */ qty?: string; + /** * **Choose one of size, qty, valueQty**, Order size (Value), USDS-Swap correspond to USDT or USDC. The unit of the quantity of coin-swap is size(lot), which is not supported */ valueQty?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `BatchAddOrdersItem` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersItem` object. */ static builder(): BatchAddOrdersItemBuilder { - return new BatchAddOrdersItemBuilder(); + return new BatchAddOrdersItemBuilder(new BatchAddOrdersItem()); } /** @@ -113,23 +147,23 @@ export class BatchAddOrdersItem implements Serializable { /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: BatchAddOrdersItem.SideEnum; + side: BatchAddOrdersItem.SideEnum; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * Used to calculate the margin to be frozen for the order. If you are to close the position, this parameter is not required. */ - leverage?: number; + leverage: number; /** * specify if the order is an \'limit\' order or \'market\' order */ - type?: BatchAddOrdersItem.TypeEnum; + type: BatchAddOrdersItem.TypeEnum; /** * remark for the order, length cannot exceed 100 utf8 characters */ @@ -208,39 +242,74 @@ export class BatchAddOrdersItem implements Serializable { obj.side = data.side; obj.symbol = data.symbol; obj.leverage = data.leverage; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = BatchAddOrdersItem.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stop = data.stop; obj.stopPriceType = data.stopPriceType; obj.stopPrice = data.stopPrice; - obj.reduceOnly = data.reduceOnly; - obj.closeOrder = data.closeOrder; - obj.forceHold = data.forceHold; + if (data.reduceOnly) { + obj.reduceOnly = data.reduceOnly; + } else { + obj.reduceOnly = false; + } + if (data.closeOrder) { + obj.closeOrder = data.closeOrder; + } else { + obj.closeOrder = false; + } + if (data.forceHold) { + obj.forceHold = data.forceHold; + } else { + obj.forceHold = false; + } obj.stp = data.stp; - obj.marginMode = data.marginMode; + if (data.marginMode) { + obj.marginMode = data.marginMode; + } else { + obj.marginMode = BatchAddOrdersItem.MarginModeEnum.ISOLATED; + } obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = BatchAddOrdersItem.TimeInForceEnum.GOOD_TILL_CANCELED; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.qty = data.qty; obj.valueQty = data.valueQty; return obj; } - fromJson(input: string): BatchAddOrdersItem { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersItem, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersItem { - return plainToInstance(BatchAddOrdersItem, jsonObject); + static fromJson(input: string): BatchAddOrdersItem { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersItem { + return plainToClassFromExist(new BatchAddOrdersItem(), jsonObject); } } @@ -326,7 +395,9 @@ export namespace BatchAddOrdersItem { } export class BatchAddOrdersItemBuilder { - obj: BatchAddOrdersItem = new BatchAddOrdersItem(); + constructor(readonly obj: BatchAddOrdersItem) { + this.obj = obj; + } /** * Unique order id created by users to identify their orders, the maximum length cannot exceed 40, e.g. UUID, Only allows numbers, characters, underline(_), and separator(-) */ diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts index 795f6499..9d3f9ca5 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { BatchAddOrdersItem } from './model_batch_add_orders_item'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchAddOrdersReq implements Serializable { +export class BatchAddOrdersReq implements Serializable { /** * */ @Type(() => BatchAddOrdersItem) items?: Array; + private constructor() {} /** * Creates a new instance of the `BatchAddOrdersReq` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersReq` object. */ static builder(): BatchAddOrdersReqBuilder { - return new BatchAddOrdersReqBuilder(); + return new BatchAddOrdersReqBuilder(new BatchAddOrdersReq()); } /** @@ -33,22 +34,23 @@ export class BatchAddOrdersReq implements Serializable { return obj; } - fromJson(input: string): BatchAddOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersReq, { items: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.items)); } - fromObject(jsonObject: Object): BatchAddOrdersReq { - return plainToInstance(BatchAddOrdersReq, { items: jsonObject }); + static fromJson(input: string): BatchAddOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersReq { + return plainToClassFromExist(new BatchAddOrdersReq(), { items: jsonObject }); } } export class BatchAddOrdersReqBuilder { - obj: BatchAddOrdersReq = new BatchAddOrdersReq(); + constructor(readonly obj: BatchAddOrdersReq) { + this.obj = obj; + } /** * */ diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts index a9a3d8e5..41e0771d 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { BatchAddOrdersData } from './model_batch_add_orders_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BatchAddOrdersResp implements Response { +export class BatchAddOrdersResp implements Response { /** * */ @Type(() => BatchAddOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class BatchAddOrdersResp implements Response -{ +export class BatchCancelOrdersClientOidsList implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.clientOid = null; + } /** * Creates a new instance of the `BatchCancelOrdersClientOidsList` class. * The builder pattern allows step-by-step construction of a `BatchCancelOrdersClientOidsList` object. */ static builder(): BatchCancelOrdersClientOidsListBuilder { - return new BatchCancelOrdersClientOidsListBuilder(); + return new BatchCancelOrdersClientOidsListBuilder(new BatchCancelOrdersClientOidsList()); } /** @@ -30,11 +35,11 @@ export class BatchCancelOrdersClientOidsList /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * */ - clientOid?: string; + clientOid: string; }): BatchCancelOrdersClientOidsList { let obj = new BatchCancelOrdersClientOidsList(); obj.symbol = data.symbol; @@ -42,22 +47,23 @@ export class BatchCancelOrdersClientOidsList return obj; } - fromJson(input: string): BatchCancelOrdersClientOidsList { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchCancelOrdersClientOidsList, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchCancelOrdersClientOidsList { - return plainToInstance(BatchCancelOrdersClientOidsList, jsonObject); + static fromJson(input: string): BatchCancelOrdersClientOidsList { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchCancelOrdersClientOidsList { + return plainToClassFromExist(new BatchCancelOrdersClientOidsList(), jsonObject); } } export class BatchCancelOrdersClientOidsListBuilder { - obj: BatchCancelOrdersClientOidsList = new BatchCancelOrdersClientOidsList(); + constructor(readonly obj: BatchCancelOrdersClientOidsList) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts index 02bf708d..149d68f6 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts @@ -1,36 +1,48 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchCancelOrdersData implements Serializable { +export class BatchCancelOrdersData implements Serializable { /** * */ - orderId?: string; + orderId: string; + /** * */ - clientOid?: string; + clientOid: string; + /** * */ - code?: string; + code: string; + /** * */ - msg?: string; + msg: string; - fromJson(input: string): BatchCancelOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchCancelOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.code = null; + // @ts-ignore + this.msg = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchCancelOrdersData { - return plainToInstance(BatchCancelOrdersData, jsonObject); + static fromJson(input: string): BatchCancelOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchCancelOrdersData { + return plainToClassFromExist(new BatchCancelOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts index 476cc011..e83bb418 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts @@ -1,26 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { BatchCancelOrdersClientOidsList } from './model_batch_cancel_orders_client_oids_list'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchCancelOrdersReq implements Serializable { +export class BatchCancelOrdersReq implements Serializable { /** * the list of orderId */ - orderIdsList?: Array; + orderIdsList: Array; + /** * the list of client orderId */ @Type(() => BatchCancelOrdersClientOidsList) - clientOidsList?: Array; + clientOidsList: Array; + private constructor() { + // @ts-ignore + this.orderIdsList = null; + // @ts-ignore + this.clientOidsList = null; + } /** * Creates a new instance of the `BatchCancelOrdersReq` class. * The builder pattern allows step-by-step construction of a `BatchCancelOrdersReq` object. */ static builder(): BatchCancelOrdersReqBuilder { - return new BatchCancelOrdersReqBuilder(); + return new BatchCancelOrdersReqBuilder(new BatchCancelOrdersReq()); } /** @@ -30,11 +37,11 @@ export class BatchCancelOrdersReq implements Serializable /** * the list of orderId */ - orderIdsList?: Array; + orderIdsList: Array; /** * the list of client orderId */ - clientOidsList?: Array; + clientOidsList: Array; }): BatchCancelOrdersReq { let obj = new BatchCancelOrdersReq(); obj.orderIdsList = data.orderIdsList; @@ -42,22 +49,23 @@ export class BatchCancelOrdersReq implements Serializable return obj; } - fromJson(input: string): BatchCancelOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchCancelOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchCancelOrdersReq { - return plainToInstance(BatchCancelOrdersReq, jsonObject); + static fromJson(input: string): BatchCancelOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchCancelOrdersReq { + return plainToClassFromExist(new BatchCancelOrdersReq(), jsonObject); } } export class BatchCancelOrdersReqBuilder { - obj: BatchCancelOrdersReq = new BatchCancelOrdersReq(); + constructor(readonly obj: BatchCancelOrdersReq) { + this.obj = obj; + } /** * the list of orderId */ diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts index 73079bd5..00c0f17a 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { BatchCancelOrdersData } from './model_batch_cancel_orders_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BatchCancelOrdersResp implements Response { +export class BatchCancelOrdersResp implements Response { /** * */ @Type(() => BatchCancelOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class BatchCancelOrdersResp implements Response { +export class CancelAllOrdersV1Req implements Serializable { /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelAllOrdersV1Req` class. * The builder pattern allows step-by-step construction of a `CancelAllOrdersV1Req` object. */ static builder(): CancelAllOrdersV1ReqBuilder { - return new CancelAllOrdersV1ReqBuilder(); + return new CancelAllOrdersV1ReqBuilder(new CancelAllOrdersV1Req()); } /** @@ -31,22 +32,23 @@ export class CancelAllOrdersV1Req implements Serializable return obj; } - fromJson(input: string): CancelAllOrdersV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelAllOrdersV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelAllOrdersV1Req { - return plainToInstance(CancelAllOrdersV1Req, jsonObject); + static fromJson(input: string): CancelAllOrdersV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelAllOrdersV1Req { + return plainToClassFromExist(new CancelAllOrdersV1Req(), jsonObject); } } export class CancelAllOrdersV1ReqBuilder { - obj: CancelAllOrdersV1Req = new CancelAllOrdersV1Req(); + constructor(readonly obj: CancelAllOrdersV1Req) { + this.obj = obj; + } /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts index 5cac2bef..691fba98 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelAllOrdersV1Resp implements Response { +export class CancelAllOrdersV1Resp implements Response { /** * Unique ID of the cancelled order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelAllOrdersV1Resp implements Response { +export class CancelAllOrdersV3Req implements Serializable { /** * Cancel all limit orders for a specific symbol only, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelAllOrdersV3Req` class. * The builder pattern allows step-by-step construction of a `CancelAllOrdersV3Req` object. */ static builder(): CancelAllOrdersV3ReqBuilder { - return new CancelAllOrdersV3ReqBuilder(); + return new CancelAllOrdersV3ReqBuilder(new CancelAllOrdersV3Req()); } /** @@ -31,22 +32,23 @@ export class CancelAllOrdersV3Req implements Serializable return obj; } - fromJson(input: string): CancelAllOrdersV3Req { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelAllOrdersV3Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelAllOrdersV3Req { - return plainToInstance(CancelAllOrdersV3Req, jsonObject); + static fromJson(input: string): CancelAllOrdersV3Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelAllOrdersV3Req { + return plainToClassFromExist(new CancelAllOrdersV3Req(), jsonObject); } } export class CancelAllOrdersV3ReqBuilder { - obj: CancelAllOrdersV3Req = new CancelAllOrdersV3Req(); + constructor(readonly obj: CancelAllOrdersV3Req) { + this.obj = obj; + } /** * Cancel all limit orders for a specific symbol only, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts index d636e07e..77794e7c 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelAllOrdersV3Resp implements Response { +export class CancelAllOrdersV3Resp implements Response { /** * Unique ID of the cancelled order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelAllOrdersV3Resp implements Response { +export class CancelAllStopOrdersReq implements Serializable { /** * Cancel all limit orders for a specific contract only, If not specified, all the limit orders will be deleted, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelAllStopOrdersReq` class. * The builder pattern allows step-by-step construction of a `CancelAllStopOrdersReq` object. */ static builder(): CancelAllStopOrdersReqBuilder { - return new CancelAllStopOrdersReqBuilder(); + return new CancelAllStopOrdersReqBuilder(new CancelAllStopOrdersReq()); } /** @@ -31,22 +32,23 @@ export class CancelAllStopOrdersReq implements Serializable { +export class CancelAllStopOrdersResp implements Response { /** * Unique ID of the cancelled order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelAllStopOrdersResp implements Response { +export class CancelOrderByClientOidReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * client order id */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. */ static builder(): CancelOrderByClientOidReqBuilder { - return new CancelOrderByClientOidReqBuilder(); + return new CancelOrderByClientOidReqBuilder(new CancelOrderByClientOidReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByClientOidReq implements Serializable -{ +export class CancelOrderByClientOidResp implements Response { /** * */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidResp { - return plainToInstance(CancelOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts index abe471e1..f42a9ec1 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByIdReq implements Serializable { +export class CancelOrderByIdReq implements Serializable { /** * */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByIdReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByIdReq` object. */ static builder(): CancelOrderByIdReqBuilder { - return new CancelOrderByIdReqBuilder(); + return new CancelOrderByIdReqBuilder(new CancelOrderByIdReq()); } /** @@ -33,22 +34,23 @@ export class CancelOrderByIdReq implements Serializable { return obj; } - fromJson(input: string): CancelOrderByIdReq { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByIdReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByIdReq { - return plainToInstance(CancelOrderByIdReq, jsonObject); + static fromJson(input: string): CancelOrderByIdReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByIdReq { + return plainToClassFromExist(new CancelOrderByIdReq(), jsonObject); } } export class CancelOrderByIdReqBuilder { - obj: CancelOrderByIdReq = new CancelOrderByIdReq(); + constructor(readonly obj: CancelOrderByIdReq) { + this.obj = obj; + } /** * */ diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts index a5478a89..e95ecbcc 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelOrderByIdResp implements Response { +export class CancelOrderByIdResp implements Response { /** * The orderId that is to be canceled */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelOrderByIdResp implements Response { +export class GetOpenOrderValueReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetOpenOrderValueReq` class. * The builder pattern allows step-by-step construction of a `GetOpenOrderValueReq` object. */ static builder(): GetOpenOrderValueReqBuilder { - return new GetOpenOrderValueReqBuilder(); + return new GetOpenOrderValueReqBuilder(new GetOpenOrderValueReq()); } /** @@ -31,22 +32,23 @@ export class GetOpenOrderValueReq implements Serializable return obj; } - fromJson(input: string): GetOpenOrderValueReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOpenOrderValueReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOpenOrderValueReq { - return plainToInstance(GetOpenOrderValueReq, jsonObject); + static fromJson(input: string): GetOpenOrderValueReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOpenOrderValueReq { + return plainToClassFromExist(new GetOpenOrderValueReq(), jsonObject); } } export class GetOpenOrderValueReqBuilder { - obj: GetOpenOrderValueReq = new GetOpenOrderValueReq(); + constructor(readonly obj: GetOpenOrderValueReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts index 22206e93..cf856bf3 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts @@ -1,31 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOpenOrderValueResp implements Response { +export class GetOpenOrderValueResp implements Response { /** * Total number of the unexecuted buy orders */ - openOrderBuySize?: number; + openOrderBuySize: number; + /** * Total number of the unexecuted sell orders */ - openOrderSellSize?: number; + openOrderSellSize: number; + /** * Value of all the unexecuted buy orders */ - openOrderBuyCost?: string; + openOrderBuyCost: string; + /** * Value of all the unexecuted sell orders */ - openOrderSellCost?: string; + openOrderSellCost: string; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + private constructor() { + // @ts-ignore + this.openOrderBuySize = null; + // @ts-ignore + this.openOrderSellSize = null; + // @ts-ignore + this.openOrderBuyCost = null; + // @ts-ignore + this.openOrderSellCost = null; + // @ts-ignore + this.settleCurrency = null; + } /** * common response */ @@ -36,16 +52,15 @@ export class GetOpenOrderValueResp implements Response { +export class GetOrderByClientOidReq implements Serializable { /** * The user self-defined order id. */ clientOid?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. */ static builder(): GetOrderByClientOidReqBuilder { - return new GetOrderByClientOidReqBuilder(); + return new GetOrderByClientOidReqBuilder(new GetOrderByClientOidReq()); } /** @@ -31,22 +32,23 @@ export class GetOrderByClientOidReq implements Serializable { +export class GetOrderByClientOidResp implements Response { /** * Order ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Order type, market order or limit order */ - type?: GetOrderByClientOidResp.TypeEnum; + type: GetOrderByClientOidResp.TypeEnum; + /** * Transaction side */ - side?: GetOrderByClientOidResp.SideEnum; + side: GetOrderByClientOidResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order quantity */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Executed size of funds */ - dealValue?: string; + dealValue: string; + /** * Executed quantity */ - dealSize?: number; + dealSize: number; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ - stp?: GetOrderByClientOidResp.StpEnum; + stp: GetOrderByClientOidResp.StpEnum; + /** * Stop order type (stop limit or stop market) */ - stop?: string; + stop: string; + /** * Trigger price type of stop orders */ - stopPriceType?: GetOrderByClientOidResp.StopPriceTypeEnum; + stopPriceType: GetOrderByClientOidResp.StopPriceTypeEnum; + /** * Mark to show whether the stop order is triggered */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * Trigger price of stop orders */ - stopPrice?: number; + stopPrice: number; + /** * Time in force policy type */ - timeInForce?: string; + timeInForce: string; + /** * Mark of post only */ - postOnly?: boolean; + postOnly: boolean; + /** * Mark of the hidden order */ - hidden?: boolean; + hidden: boolean; + /** * Mark of the iceberg order */ - iceberg?: boolean; + iceberg: boolean; + /** * Leverage of the order */ - leverage?: string; + leverage: string; + /** * A mark to forcely hold the funds for an order */ - forceHold?: boolean; + forceHold: boolean; + /** * A mark to close the position */ - closeOrder?: boolean; + closeOrder: boolean; + /** * Visible size of the iceberg order */ - visibleSize?: number; + visibleSize: number; + /** * Unique order id created by users to identify their orders */ - clientOid?: string; + clientOid: string; + /** * Remark */ - remark?: string; + remark: string; + /** * tag order source */ - tags?: string; + tags: string; + /** * Mark of the active orders */ - isActive?: boolean; + isActive: boolean; + /** * Mark of the canceled orders */ - cancelExist?: boolean; + cancelExist: boolean; + /** * Time the order created */ - createdAt?: number; + createdAt: number; + /** * last update time */ - updatedAt?: number; + updatedAt: number; + /** * Order Endtime */ - endAt?: number; + endAt: number; + /** * Order create time in nanosecond */ - orderTime?: number; + orderTime: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetOrderByClientOidResp.MarginModeEnum; + marginMode: GetOrderByClientOidResp.MarginModeEnum; + /** * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier */ - avgDealPrice?: string; + avgDealPrice: string; + /** * Value of the executed orders */ - filledSize?: number; + filledSize: number; + /** * Executed order quantity */ - filledValue?: string; + filledValue: string; + /** * order status: “open” or “done” */ - status?: GetOrderByClientOidResp.StatusEnum; + status: GetOrderByClientOidResp.StatusEnum; + /** * A mark to reduce the position size only */ - reduceOnly?: boolean; + reduceOnly: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.dealValue = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.forceHold = null; + // @ts-ignore + this.closeOrder = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.endAt = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.avgDealPrice = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.filledValue = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.reduceOnly = null; + } /** * common response */ @@ -168,17 +283,16 @@ export class GetOrderByClientOidResp implements Response { +export class GetOrderByOrderIdReq implements Serializable { /** * */ @@ -12,12 +12,13 @@ export class GetOrderByOrderIdReq implements Serializable @Reflect.metadata('path', 'order-id') order_id?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. */ static builder(): GetOrderByOrderIdReqBuilder { - return new GetOrderByOrderIdReqBuilder(); + return new GetOrderByOrderIdReqBuilder(new GetOrderByOrderIdReq()); } /** @@ -34,22 +35,23 @@ export class GetOrderByOrderIdReq implements Serializable return obj; } - fromJson(input: string): GetOrderByOrderIdReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderByOrderIdReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderByOrderIdReq { - return plainToInstance(GetOrderByOrderIdReq, jsonObject); + static fromJson(input: string): GetOrderByOrderIdReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } } export class GetOrderByOrderIdReqBuilder { - obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + constructor(readonly obj: GetOrderByOrderIdReq) { + this.obj = obj; + } /** * */ diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts index 70ce37fb..3857e7b3 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts @@ -1,163 +1,276 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOrderByOrderIdResp implements Response { +export class GetOrderByOrderIdResp implements Response { /** * Order ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Order type, market order or limit order */ - type?: GetOrderByOrderIdResp.TypeEnum; + type: GetOrderByOrderIdResp.TypeEnum; + /** * Transaction side */ - side?: GetOrderByOrderIdResp.SideEnum; + side: GetOrderByOrderIdResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order quantity */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Executed size of funds */ - dealValue?: string; + dealValue: string; + /** * Executed quantity */ - dealSize?: number; + dealSize: number; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB. Not supported DC at the moment. */ - stp?: GetOrderByOrderIdResp.StpEnum; + stp: GetOrderByOrderIdResp.StpEnum; + /** * Stop order type (stop limit or stop market) */ - stop?: string; + stop: string; + /** * Trigger price type of stop orders */ - stopPriceType?: GetOrderByOrderIdResp.StopPriceTypeEnum; + stopPriceType: GetOrderByOrderIdResp.StopPriceTypeEnum; + /** * Mark to show whether the stop order is triggered */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * Trigger price of stop orders */ - stopPrice?: number; + stopPrice: number; + /** * Time in force policy type */ - timeInForce?: string; + timeInForce: string; + /** * Mark of post only */ - postOnly?: boolean; + postOnly: boolean; + /** * Mark of the hidden order */ - hidden?: boolean; + hidden: boolean; + /** * Mark of the iceberg order */ - iceberg?: boolean; + iceberg: boolean; + /** * Leverage of the order */ - leverage?: string; + leverage: string; + /** * A mark to forcely hold the funds for an order */ - forceHold?: boolean; + forceHold: boolean; + /** * A mark to close the position */ - closeOrder?: boolean; + closeOrder: boolean; + /** * Visible size of the iceberg order */ - visibleSize?: number; + visibleSize: number; + /** * Unique order id created by users to identify their orders */ - clientOid?: string; + clientOid: string; + /** * Remark */ - remark?: string; + remark: string; + /** * tag order source */ - tags?: string; + tags: string; + /** * Mark of the active orders */ - isActive?: boolean; + isActive: boolean; + /** * Mark of the canceled orders */ - cancelExist?: boolean; + cancelExist: boolean; + /** * Time the order created */ - createdAt?: number; + createdAt: number; + /** * last update time */ - updatedAt?: number; + updatedAt: number; + /** * Order Endtime */ endAt?: number; + /** * Order create time in nanosecond */ - orderTime?: number; + orderTime: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetOrderByOrderIdResp.MarginModeEnum; + marginMode: GetOrderByOrderIdResp.MarginModeEnum; + /** * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier */ - avgDealPrice?: string; + avgDealPrice: string; + /** * Value of the executed orders */ - filledSize?: number; + filledSize: number; + /** * Executed order quantity */ - filledValue?: string; + filledValue: string; + /** * order status: “open” or “done” */ - status?: GetOrderByOrderIdResp.StatusEnum; + status: GetOrderByOrderIdResp.StatusEnum; + /** * A mark to reduce the position size only */ - reduceOnly?: boolean; + reduceOnly: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.dealValue = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.forceHold = null; + // @ts-ignore + this.closeOrder = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.avgDealPrice = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.filledValue = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.reduceOnly = null; + } /** * common response */ @@ -168,17 +281,16 @@ export class GetOrderByOrderIdResp implements Response { +export class GetOrderListItems implements Serializable { /** * Order ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Order type, market order or limit order */ - type?: string; + type: string; + /** * Transaction side */ - side?: string; + side: string; + /** * Order price */ - price?: string; + price: string; + /** * Order quantity */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Executed size of funds */ - dealValue?: string; + dealValue: string; + /** * Executed quantity */ - dealSize?: number; + dealSize: number; + /** * self trade prevention */ - stp?: string; + stp: string; + /** * Stop order type (stop limit or stop market) */ - stop?: string; + stop: string; + /** * Trigger price type of stop orders */ - stopPriceType?: string; + stopPriceType: string; + /** * Mark to show whether the stop order is triggered */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * Trigger price of stop orders */ - stopPrice?: number; + stopPrice: number; + /** * Time in force policy type */ - timeInForce?: string; + timeInForce: string; + /** * Mark of post only */ - postOnly?: boolean; + postOnly: boolean; + /** * Mark of the hidden order */ - hidden?: boolean; + hidden: boolean; + /** * Mark of the iceberg order */ - iceberg?: boolean; + iceberg: boolean; + /** * Leverage of the order */ - leverage?: string; + leverage: string; + /** * A mark to forcely hold the funds for an order */ - forceHold?: boolean; + forceHold: boolean; + /** * A mark to close the position */ - closeOrder?: boolean; + closeOrder: boolean; + /** * Visible size of the iceberg order */ - visibleSize?: number; + visibleSize: number; + /** * Unique order id created by users to identify their orders */ - clientOid?: string; + clientOid: string; + /** * Remark of the order */ - remark?: string; + remark: string; + /** * tag order source */ - tags?: string; + tags: string; + /** * Mark of the active orders */ - isActive?: boolean; + isActive: boolean; + /** * Mark of the canceled orders */ - cancelExist?: boolean; + cancelExist: boolean; + /** * Time the order created */ - createdAt?: number; + createdAt: number; + /** * last update time */ - updatedAt?: number; + updatedAt: number; + /** * End time */ - endAt?: number; + endAt: number; + /** * Order create time in nanosecond */ - orderTime?: number; + orderTime: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: string; + marginMode: string; + /** * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier */ - avgDealPrice?: string; + avgDealPrice: string; + /** * order status: “open” or “done” */ - status?: string; + status: string; + /** * Value of the executed orders */ - filledSize?: number; + filledSize: number; + /** * Executed order quantity */ - filledValue?: string; + filledValue: string; + /** * A mark to reduce the position size only */ - reduceOnly?: boolean; + reduceOnly: boolean; - fromJson(input: string): GetOrderListItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderListItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.dealValue = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.forceHold = null; + // @ts-ignore + this.closeOrder = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.endAt = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.avgDealPrice = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.filledValue = null; + // @ts-ignore + this.reduceOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderListItems { - return plainToInstance(GetOrderListItems, jsonObject); + static fromJson(input: string): GetOrderListItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderListItems { + return plainToClassFromExist(new GetOrderListItems(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts index de81407d..0ced54d9 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts @@ -1,48 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOrderListReq implements Serializable { +export class GetOrderListReq implements Serializable { /** * active or done, done as default. Only list orders for a specific status */ status?: GetOrderListReq.StatusEnum; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * buy or sell */ side?: GetOrderListReq.SideEnum; + /** * limit, market, limit_stop or market_stop */ type?: GetOrderListReq.TypeEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page, The default currentPage is 1 */ currentPage?: number; + /** * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 */ pageSize?: number; + private constructor() {} /** * Creates a new instance of the `GetOrderListReq` class. * The builder pattern allows step-by-step construction of a `GetOrderListReq` object. */ static builder(): GetOrderListReqBuilder { - return new GetOrderListReqBuilder(); + return new GetOrderListReqBuilder(new GetOrderListReq()); } /** @@ -94,17 +102,16 @@ export class GetOrderListReq implements Serializable { return obj; } - fromJson(input: string): GetOrderListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderListReq { - return plainToInstance(GetOrderListReq, jsonObject); + static fromJson(input: string): GetOrderListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderListReq { + return plainToClassFromExist(new GetOrderListReq(), jsonObject); } } @@ -142,7 +149,9 @@ export namespace GetOrderListReq { } export class GetOrderListReqBuilder { - obj: GetOrderListReq = new GetOrderListReq(); + constructor(readonly obj: GetOrderListReq) { + this.obj = obj; + } /** * active or done, done as default. Only list orders for a specific status */ diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts index 7b17af71..382eb1a7 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetOrderListItems } from './model_get_order_list_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOrderListResp implements Response { +export class GetOrderListResp implements Response { /** * Current request page, The default currentPage is 1 */ - currentPage?: number; + currentPage: number; + /** * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetOrderListItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetOrderListResp implements Response { +export class GetRecentClosedOrdersData implements Serializable { /** * Order ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Order type, market order or limit order */ - type?: string; + type: string; + /** * Transaction side */ - side?: string; + side: string; + /** * Order price */ - price?: string; + price: string; + /** * Order quantity */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Executed size of funds */ - dealValue?: string; + dealValue: string; + /** * Executed quantity */ - dealSize?: number; + dealSize: number; + /** * self trade prevention */ - stp?: string; + stp: string; + /** * Stop order type (stop limit or stop market) */ - stop?: string; + stop: string; + /** * Trigger price type of stop orders */ - stopPriceType?: string; + stopPriceType: string; + /** * Mark to show whether the stop order is triggered */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * Trigger price of stop orders */ - stopPrice?: number; + stopPrice: number; + /** * Time in force policy type */ - timeInForce?: string; + timeInForce: string; + /** * Mark of post only */ - postOnly?: boolean; + postOnly: boolean; + /** * Mark of the hidden order */ - hidden?: boolean; + hidden: boolean; + /** * Mark of the iceberg order */ - iceberg?: boolean; + iceberg: boolean; + /** * Leverage of the order */ - leverage?: string; + leverage: string; + /** * A mark to forcely hold the funds for an order */ - forceHold?: boolean; + forceHold: boolean; + /** * A mark to close the position */ - closeOrder?: boolean; + closeOrder: boolean; + /** * Visible size of the iceberg order */ - visibleSize?: number; + visibleSize: number; + /** * Unique order id created by users to identify their orders */ - clientOid?: string; + clientOid: string; + /** * Remark of the order */ - remark?: string; + remark: string; + /** * tag order source */ - tags?: string; + tags: string; + /** * Mark of the active orders */ - isActive?: boolean; + isActive: boolean; + /** * Mark of the canceled orders */ - cancelExist?: boolean; + cancelExist: boolean; + /** * Time the order created */ - createdAt?: number; + createdAt: number; + /** * last update time */ - updatedAt?: number; + updatedAt: number; + /** * End time */ - endAt?: number; + endAt: number; + /** * Order create time in nanosecond */ - orderTime?: number; + orderTime: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: string; + marginMode: string; + /** * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier */ - avgDealPrice?: string; + avgDealPrice: string; + /** * Value of the executed orders */ - filledSize?: number; + filledSize: number; + /** * Executed order quantity */ - filledValue?: string; + filledValue: string; + /** * order status: “open” or “done” */ - status?: string; + status: string; + /** * A mark to reduce the position size only */ - reduceOnly?: boolean; + reduceOnly: boolean; - fromJson(input: string): GetRecentClosedOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentClosedOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.dealValue = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.forceHold = null; + // @ts-ignore + this.closeOrder = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.endAt = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.avgDealPrice = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.filledValue = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.reduceOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRecentClosedOrdersData { - return plainToInstance(GetRecentClosedOrdersData, jsonObject); + static fromJson(input: string): GetRecentClosedOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentClosedOrdersData { + return plainToClassFromExist(new GetRecentClosedOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts index ee12fedb..dbd681ec 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentClosedOrdersReq implements Serializable { +export class GetRecentClosedOrdersReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetRecentClosedOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetRecentClosedOrdersReq` object. */ static builder(): GetRecentClosedOrdersReqBuilder { - return new GetRecentClosedOrdersReqBuilder(); + return new GetRecentClosedOrdersReqBuilder(new GetRecentClosedOrdersReq()); } /** @@ -31,22 +32,23 @@ export class GetRecentClosedOrdersReq implements Serializable -{ +export class GetRecentClosedOrdersResp implements Response { /** * */ @Type(() => GetRecentClosedOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetRecentClosedOrdersResp this.commonResponse = response; } - fromJson(input: string): GetRecentClosedOrdersResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentClosedOrdersResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetRecentClosedOrdersResp { - return plainToInstance(GetRecentClosedOrdersResp, { data: jsonObject }); + static fromJson(input: string): GetRecentClosedOrdersResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentClosedOrdersResp { + return plainToClassFromExist(new GetRecentClosedOrdersResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts index e4b4eb91..6b057fc3 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts @@ -1,117 +1,189 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentTradeHistoryData implements Serializable { +export class GetRecentTradeHistoryData implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Trade ID */ - tradeId?: string; + tradeId: string; + /** * Order ID */ - orderId?: string; + orderId: string; + /** * Transaction side */ - side?: GetRecentTradeHistoryData.SideEnum; + side: GetRecentTradeHistoryData.SideEnum; + /** * Liquidity- taker or maker */ - liquidity?: GetRecentTradeHistoryData.LiquidityEnum; + liquidity: GetRecentTradeHistoryData.LiquidityEnum; + /** * Whether to force processing as a taker */ - forceTaker?: boolean; + forceTaker: boolean; + /** * Filled price */ - price?: string; + price: string; + /** * Filled amount */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Opening transaction fee */ - openFeePay?: string; + openFeePay: string; + /** * Closing transaction fee */ - closeFeePay?: string; + closeFeePay: string; + /** * A mark to the stop order type */ - stop?: string; + stop: string; + /** * Fee Rate */ - feeRate?: string; + feeRate: string; + /** * Fixed fees(Deprecated field, no actual use of the value field) */ - fixFee?: string; + fixFee: string; + /** * Charging currency */ - feeCurrency?: string; + feeCurrency: string; + /** * trade time in nanosecond */ - tradeTime?: number; + tradeTime: number; + /** * Deprecated field, no actual use of the value field */ - subTradeType?: string; + subTradeType: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetRecentTradeHistoryData.MarginModeEnum; + marginMode: GetRecentTradeHistoryData.MarginModeEnum; + /** * Order Type */ - displayType?: GetRecentTradeHistoryData.DisplayTypeEnum; + displayType: GetRecentTradeHistoryData.DisplayTypeEnum; + /** * Transaction fee */ - fee?: string; + fee: string; + /** * Settle Currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Order type */ - orderType?: GetRecentTradeHistoryData.OrderTypeEnum; + orderType: GetRecentTradeHistoryData.OrderTypeEnum; + /** * Trade type (trade, liquid, cancel, adl or settlement) */ - tradeType?: GetRecentTradeHistoryData.TradeTypeEnum; + tradeType: GetRecentTradeHistoryData.TradeTypeEnum; + /** * Time the order created */ - createdAt?: number; + createdAt: number; - fromJson(input: string): GetRecentTradeHistoryData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentTradeHistoryData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.liquidity = null; + // @ts-ignore + this.forceTaker = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.openFeePay = null; + // @ts-ignore + this.closeFeePay = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.feeRate = null; + // @ts-ignore + this.fixFee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.tradeTime = null; + // @ts-ignore + this.subTradeType = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.displayType = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.orderType = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.createdAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRecentTradeHistoryData { - return plainToInstance(GetRecentTradeHistoryData, jsonObject); + static fromJson(input: string): GetRecentTradeHistoryData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentTradeHistoryData { + return plainToClassFromExist(new GetRecentTradeHistoryData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts index 79634593..4a4f4b3f 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentTradeHistoryReq implements Serializable { +export class GetRecentTradeHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetRecentTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetRecentTradeHistoryReq` object. */ static builder(): GetRecentTradeHistoryReqBuilder { - return new GetRecentTradeHistoryReqBuilder(); + return new GetRecentTradeHistoryReqBuilder(new GetRecentTradeHistoryReq()); } /** @@ -31,22 +32,23 @@ export class GetRecentTradeHistoryReq implements Serializable -{ +export class GetRecentTradeHistoryResp implements Response { /** * */ @Type(() => GetRecentTradeHistoryData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetRecentTradeHistoryResp this.commonResponse = response; } - fromJson(input: string): GetRecentTradeHistoryResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentTradeHistoryResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetRecentTradeHistoryResp { - return plainToInstance(GetRecentTradeHistoryResp, { data: jsonObject }); + static fromJson(input: string): GetRecentTradeHistoryResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentTradeHistoryResp { + return plainToClassFromExist(new GetRecentTradeHistoryResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts index ef89b8f6..65dba6dd 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts @@ -1,172 +1,286 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrderListItems implements Serializable { +export class GetStopOrderListItems implements Serializable { /** * Order ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Order type, market order or limit order */ - type?: string; + type: string; + /** * Transaction side */ - side?: string; + side: string; + /** * Order price */ - price?: string; + price: string; + /** * Order quantity */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Executed size of funds */ - dealValue?: string; + dealValue: string; + /** * Executed quantity */ - dealSize?: number; + dealSize: number; + /** * self trade prevention */ - stp?: string; + stp: string; + /** * Stop order type (stop limit or stop market) */ - stop?: string; + stop: string; + /** * Trigger price type of stop orders */ - stopPriceType?: string; + stopPriceType: string; + /** * Mark to show whether the stop order is triggered */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * Trigger price of stop orders */ - stopPrice?: string; + stopPrice: string; + /** * Time in force policy type */ - timeInForce?: string; + timeInForce: string; + /** * Mark of post only */ - postOnly?: boolean; + postOnly: boolean; + /** * Mark of the hidden order */ - hidden?: boolean; + hidden: boolean; + /** * Mark of the iceberg order */ - iceberg?: boolean; + iceberg: boolean; + /** * Leverage of the order */ - leverage?: string; + leverage: string; + /** * A mark to forcely hold the funds for an order */ - forceHold?: boolean; + forceHold: boolean; + /** * A mark to close the position */ - closeOrder?: boolean; + closeOrder: boolean; + /** * Visible size of the iceberg order */ - visibleSize?: number; + visibleSize: number; + /** * Unique order id created by users to identify their orders */ - clientOid?: string; + clientOid: string; + /** * Remark of the order */ - remark?: string; + remark: string; + /** * tag order source */ - tags?: string; + tags: string; + /** * Mark of the active orders */ - isActive?: boolean; + isActive: boolean; + /** * Mark of the canceled orders */ - cancelExist?: boolean; + cancelExist: boolean; + /** * Time the order created */ - createdAt?: number; + createdAt: number; + /** * last update time */ - updatedAt?: number; + updatedAt: number; + /** * End time */ - endAt?: number; + endAt: number; + /** * Order create time in nanosecond */ - orderTime?: number; + orderTime: number; + /** * settlement currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: string; + marginMode: string; + /** * Average transaction price, forward contract average transaction price = sum (transaction value) / sum (transaction quantity), reverse contract average transaction price = sum (transaction quantity) / sum (transaction value). Transaction quantity = lots * multiplier */ - avgDealPrice?: string; + avgDealPrice: string; + /** * Value of the executed orders */ - filledSize?: number; + filledSize: number; + /** * Executed order quantity */ - filledValue?: string; + filledValue: string; + /** * order status: “open” or “done” */ - status?: string; + status: string; + /** * A mark to reduce the position size only */ - reduceOnly?: boolean; + reduceOnly: boolean; - fromJson(input: string): GetStopOrderListItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrderListItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.dealValue = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.forceHold = null; + // @ts-ignore + this.closeOrder = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.updatedAt = null; + // @ts-ignore + this.endAt = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.avgDealPrice = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.filledValue = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.reduceOnly = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrderListItems { - return plainToInstance(GetStopOrderListItems, jsonObject); + static fromJson(input: string): GetStopOrderListItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrderListItems { + return plainToClassFromExist(new GetStopOrderListItems(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts index 70934678..66c9e049 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrderListReq implements Serializable { +export class GetStopOrderListReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * buy or sell */ side?: GetStopOrderListReq.SideEnum; + /** * limit, market */ type?: GetStopOrderListReq.TypeEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page, The default currentPage is 1 */ currentPage?: number; + /** * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetStopOrderListReq` class. * The builder pattern allows step-by-step construction of a `GetStopOrderListReq` object. */ static builder(): GetStopOrderListReqBuilder { - return new GetStopOrderListReqBuilder(); + return new GetStopOrderListReqBuilder(new GetStopOrderListReq()); } /** @@ -81,21 +88,24 @@ export class GetStopOrderListReq implements Serializable { obj.startAt = data.startAt; obj.endAt = data.endAt; obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetStopOrderListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrderListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrderListReq { - return plainToInstance(GetStopOrderListReq, jsonObject); + static fromJson(input: string): GetStopOrderListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrderListReq { + return plainToClassFromExist(new GetStopOrderListReq(), jsonObject); } } @@ -123,7 +133,9 @@ export namespace GetStopOrderListReq { } export class GetStopOrderListReqBuilder { - obj: GetStopOrderListReq = new GetStopOrderListReq(); + constructor(readonly obj: GetStopOrderListReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts index 00e4b211..e311d170 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetStopOrderListItems } from './model_get_stop_order_list_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetStopOrderListResp implements Response { +export class GetStopOrderListResp implements Response { /** * Current request page, The default currentPage is 1 */ - currentPage?: number; + currentPage: number; + /** * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetStopOrderListItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetStopOrderListResp implements Response { +export class GetTradeHistoryItems implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Trade ID */ - tradeId?: string; + tradeId: string; + /** * Order ID */ - orderId?: string; + orderId: string; + /** * Transaction side */ - side?: GetTradeHistoryItems.SideEnum; + side: GetTradeHistoryItems.SideEnum; + /** * Liquidity- taker or maker */ - liquidity?: GetTradeHistoryItems.LiquidityEnum; + liquidity: GetTradeHistoryItems.LiquidityEnum; + /** * Whether to force processing as a taker */ - forceTaker?: boolean; + forceTaker: boolean; + /** * Filled price */ - price?: string; + price: string; + /** * Filled amount */ - size?: number; + size: number; + /** * Order value */ - value?: string; + value: string; + /** * Opening transaction fee */ - openFeePay?: string; + openFeePay: string; + /** * Closing transaction fee */ - closeFeePay?: string; + closeFeePay: string; + /** * A mark to the stop order type */ - stop?: string; + stop: string; + /** * Fee Rate */ - feeRate?: string; + feeRate: string; + /** * Fixed fees(Deprecated field, no actual use of the value field) */ - fixFee?: string; + fixFee: string; + /** * Charging currency */ - feeCurrency?: string; + feeCurrency: string; + /** * trade time in nanosecond */ - tradeTime?: number; + tradeTime: number; + /** * Deprecated field, no actual use of the value field */ - subTradeType?: string; + subTradeType: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetTradeHistoryItems.MarginModeEnum; + marginMode: GetTradeHistoryItems.MarginModeEnum; + /** * Settle Currency */ - settleCurrency?: string; + settleCurrency: string; + /** * Order Type */ - displayType?: GetTradeHistoryItems.DisplayTypeEnum; + displayType: GetTradeHistoryItems.DisplayTypeEnum; + /** * */ - fee?: string; + fee: string; + /** * Order type */ - orderType?: GetTradeHistoryItems.OrderTypeEnum; + orderType: GetTradeHistoryItems.OrderTypeEnum; + /** * Trade type (trade, liquid, adl or settlement) */ - tradeType?: GetTradeHistoryItems.TradeTypeEnum; + tradeType: GetTradeHistoryItems.TradeTypeEnum; + /** * Time the order created */ - createdAt?: number; + createdAt: number; - fromJson(input: string): GetTradeHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.liquidity = null; + // @ts-ignore + this.forceTaker = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.value = null; + // @ts-ignore + this.openFeePay = null; + // @ts-ignore + this.closeFeePay = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.feeRate = null; + // @ts-ignore + this.fixFee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.tradeTime = null; + // @ts-ignore + this.subTradeType = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.displayType = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.orderType = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.createdAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryItems { - return plainToInstance(GetTradeHistoryItems, jsonObject); + static fromJson(input: string): GetTradeHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts index be80d32b..1a36cf65 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts @@ -1,52 +1,61 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryReq implements Serializable { +export class GetTradeHistoryReq implements Serializable { /** * List fills for a specific order only (If you specify orderId, other parameters can be ignored) */ orderId?: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Order side */ side?: GetTradeHistoryReq.SideEnum; + /** * Order Type */ type?: GetTradeHistoryReq.TypeEnum; + /** * Transaction type: trade, adl, liquid, settlement. Supports querying multiple types at the same time, separated by commas. Query all type when empty */ tradeTypes?: string; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page, The default currentPage is 1 */ currentPage?: number = 1; + /** * pageSize, The default pageSize is 50, The maximum cannot exceed 1000 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. */ static builder(): GetTradeHistoryReqBuilder { - return new GetTradeHistoryReqBuilder(); + return new GetTradeHistoryReqBuilder(new GetTradeHistoryReq()); } /** @@ -98,22 +107,29 @@ export class GetTradeHistoryReq implements Serializable { obj.tradeTypes = data.tradeTypes; obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetTradeHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryReq { - return plainToInstance(GetTradeHistoryReq, jsonObject); + static fromJson(input: string): GetTradeHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } } @@ -149,7 +165,9 @@ export namespace GetTradeHistoryReq { } export class GetTradeHistoryReqBuilder { - obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + constructor(readonly obj: GetTradeHistoryReq) { + this.obj = obj; + } /** * List fills for a specific order only (If you specify orderId, other parameters can be ignored) */ diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts index ca880aee..9855d59c 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetTradeHistoryItems } from './model_get_trade_history_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTradeHistoryResp implements Response { +export class GetTradeHistoryResp implements Response { /** * */ - currentPage?: number; + currentPage: number; + /** * */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetTradeHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetTradeHistoryResp implements Response { +export class AddIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Margin amount (min. margin amount≥0.00001667XBT) */ - margin?: number; + margin: number; + /** * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 */ - bizNo?: string; + bizNo: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.margin = null; + // @ts-ignore + this.bizNo = null; + } /** * Creates a new instance of the `AddIsolatedMarginReq` class. * The builder pattern allows step-by-step construction of a `AddIsolatedMarginReq` object. */ static builder(): AddIsolatedMarginReqBuilder { - return new AddIsolatedMarginReqBuilder(); + return new AddIsolatedMarginReqBuilder(new AddIsolatedMarginReq()); } /** @@ -32,15 +42,15 @@ export class AddIsolatedMarginReq implements Serializable /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Margin amount (min. margin amount≥0.00001667XBT) */ - margin?: number; + margin: number; /** * A unique ID generated by the user, to ensure the operation is processed by the system only once, The maximum length cannot exceed 36 */ - bizNo?: string; + bizNo: string; }): AddIsolatedMarginReq { let obj = new AddIsolatedMarginReq(); obj.symbol = data.symbol; @@ -49,22 +59,23 @@ export class AddIsolatedMarginReq implements Serializable return obj; } - fromJson(input: string): AddIsolatedMarginReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddIsolatedMarginReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddIsolatedMarginReq { - return plainToInstance(AddIsolatedMarginReq, jsonObject); + static fromJson(input: string): AddIsolatedMarginReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddIsolatedMarginReq { + return plainToClassFromExist(new AddIsolatedMarginReq(), jsonObject); } } export class AddIsolatedMarginReqBuilder { - obj: AddIsolatedMarginReq = new AddIsolatedMarginReq(); + constructor(readonly obj: AddIsolatedMarginReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts index 1140ab32..47b33e01 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts @@ -1,159 +1,271 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddIsolatedMarginResp implements Response { +export class AddIsolatedMarginResp implements Response { /** * Position ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Auto deposit margin or not */ - autoDeposit?: boolean; + autoDeposit: boolean; + /** * Maintenance margin requirement */ - maintMarginReq?: number; + maintMarginReq: number; + /** * Risk limit */ - riskLimit?: number; + riskLimit: number; + /** * Leverage o the order */ - realLeverage?: number; + realLeverage: number; + /** * Cross mode or not */ - crossMode?: boolean; + crossMode: boolean; + /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; + /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; + /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; + /** * Current postion quantity */ - currentQty?: number; + currentQty: number; + /** * Current postion value */ - currentCost?: number; + currentCost: number; + /** * Current commission */ - currentComm?: number; + currentComm: number; + /** * Unrealised value */ - unrealisedCost?: number; + unrealisedCost: number; + /** * Accumulated realised gross profit value */ - realisedGrossCost?: number; + realisedGrossCost: number; + /** * Current realised position value */ - realisedCost?: number; + realisedCost: number; + /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Mark value */ - markValue?: number; + markValue: number; + /** * Position value */ - posCost?: number; + posCost: number; + /** * added margin */ - posCross?: number; + posCross: number; + /** * Leverage margin */ - posInit?: number; + posInit: number; + /** * Bankruptcy cost */ - posComm?: number; + posComm: number; + /** * Funding fees paid out */ - posLoss?: number; + posLoss: number; + /** * Position margin */ - posMargin?: number; + posMargin: number; + /** * Maintenance margin */ - posMaint?: number; + posMaint: number; + /** * Position margin */ - maintMargin?: number; + maintMargin: number; + /** * Accumulated realised gross profit value */ - realisedGrossPnl?: number; + realisedGrossPnl: number; + /** * Realised profit and loss */ - realisedPnl?: number; + realisedPnl: number; + /** * Unrealised profit and loss */ - unrealisedPnl?: number; + unrealisedPnl: number; + /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: number; + unrealisedPnlPcnt: number; + /** * Rate of return on investment */ - unrealisedRoePcnt?: number; + unrealisedRoePcnt: number; + /** * Average entry price */ - avgEntryPrice?: number; + avgEntryPrice: number; + /** * Liquidation price */ - liquidationPrice?: number; + liquidationPrice: number; + /** * Bankruptcy price */ - bankruptPrice?: number; + bankruptPrice: number; + /** * userId */ - userId?: number; + userId: number; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.autoDeposit = null; + // @ts-ignore + this.maintMarginReq = null; + // @ts-ignore + this.riskLimit = null; + // @ts-ignore + this.realLeverage = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posCross = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posComm = null; + // @ts-ignore + this.posLoss = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.posMaint = null; + // @ts-ignore + this.maintMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.userId = null; + // @ts-ignore + this.settleCurrency = null; + } /** * common response */ @@ -164,16 +276,15 @@ export class AddIsolatedMarginResp implements Response { +export class GetCrossMarginLeverageReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetCrossMarginLeverageReq` class. * The builder pattern allows step-by-step construction of a `GetCrossMarginLeverageReq` object. */ static builder(): GetCrossMarginLeverageReqBuilder { - return new GetCrossMarginLeverageReqBuilder(); + return new GetCrossMarginLeverageReqBuilder(new GetCrossMarginLeverageReq()); } /** @@ -31,22 +32,23 @@ export class GetCrossMarginLeverageReq implements Serializable -{ +export class GetCrossMarginLeverageResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Leverage multiple */ - leverage?: string; + leverage: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + } /** * common response */ @@ -26,16 +31,15 @@ export class GetCrossMarginLeverageResp this.commonResponse = response; } - fromJson(input: string): GetCrossMarginLeverageResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCrossMarginLeverageResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCrossMarginLeverageResp { - return plainToInstance(GetCrossMarginLeverageResp, jsonObject); + static fromJson(input: string): GetCrossMarginLeverageResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCrossMarginLeverageResp { + return plainToClassFromExist(new GetCrossMarginLeverageResp(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts index 0494e8b9..96dbc79d 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts @@ -1,50 +1,69 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginRiskLimitData - implements Serializable -{ +export class GetIsolatedMarginRiskLimitData implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * level */ - level?: number; + level: number; + /** * Upper limit USDT(includes) */ - maxRiskLimit?: number; + maxRiskLimit: number; + /** * Lower limit USDT */ - minRiskLimit?: number; + minRiskLimit: number; + /** * Max leverage */ - maxLeverage?: number; + maxLeverage: number; + /** * Initial margin rate */ - initialMargin?: number; + initialMargin: number; + /** * Maintenance margin rate */ - maintainMargin?: number; + maintainMargin: number; - fromJson(input: string): GetIsolatedMarginRiskLimitData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginRiskLimitData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.level = null; + // @ts-ignore + this.maxRiskLimit = null; + // @ts-ignore + this.minRiskLimit = null; + // @ts-ignore + this.maxLeverage = null; + // @ts-ignore + this.initialMargin = null; + // @ts-ignore + this.maintainMargin = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitData { - return plainToInstance(GetIsolatedMarginRiskLimitData, jsonObject); + static fromJson(input: string): GetIsolatedMarginRiskLimitData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitData { + return plainToClassFromExist(new GetIsolatedMarginRiskLimitData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts index a04e77c9..c5ab05d4 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginRiskLimitReq implements Serializable { +export class GetIsolatedMarginRiskLimitReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginRiskLimitReq` class. * The builder pattern allows step-by-step construction of a `GetIsolatedMarginRiskLimitReq` object. */ static builder(): GetIsolatedMarginRiskLimitReqBuilder { - return new GetIsolatedMarginRiskLimitReqBuilder(); + return new GetIsolatedMarginRiskLimitReqBuilder(new GetIsolatedMarginRiskLimitReq()); } /** @@ -33,22 +34,23 @@ export class GetIsolatedMarginRiskLimitReq implements Serializable -{ +export class GetIsolatedMarginRiskLimitResp implements Response { /** * */ @Type(() => GetIsolatedMarginRiskLimitData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetIsolatedMarginRiskLimitResp this.commonResponse = response; } - fromJson(input: string): GetIsolatedMarginRiskLimitResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginRiskLimitResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitResp { - return plainToInstance(GetIsolatedMarginRiskLimitResp, { data: jsonObject }); + static fromJson(input: string): GetIsolatedMarginRiskLimitResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitResp { + return plainToClassFromExist(new GetIsolatedMarginRiskLimitResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts index 5e47f587..662b341a 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarginModeReq implements Serializable { +export class GetMarginModeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMarginModeReq` class. * The builder pattern allows step-by-step construction of a `GetMarginModeReq` object. */ static builder(): GetMarginModeReqBuilder { - return new GetMarginModeReqBuilder(); + return new GetMarginModeReqBuilder(new GetMarginModeReq()); } /** @@ -31,22 +32,23 @@ export class GetMarginModeReq implements Serializable { return obj; } - fromJson(input: string): GetMarginModeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginModeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginModeReq { - return plainToInstance(GetMarginModeReq, jsonObject); + static fromJson(input: string): GetMarginModeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginModeReq { + return plainToClassFromExist(new GetMarginModeReq(), jsonObject); } } export class GetMarginModeReqBuilder { - obj: GetMarginModeReq = new GetMarginModeReq(); + constructor(readonly obj: GetMarginModeReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts index 0ce2f2ec..d327cb41 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarginModeResp implements Response { +export class GetMarginModeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: GetMarginModeResp.MarginModeEnum; + marginMode: GetMarginModeResp.MarginModeEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.marginMode = null; + } /** * common response */ @@ -24,17 +31,16 @@ export class GetMarginModeResp implements Response { +export class GetMaxOpenSizeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Order price */ price?: string; + /** * Leverage */ leverage?: number; + private constructor() {} /** * Creates a new instance of the `GetMaxOpenSizeReq` class. * The builder pattern allows step-by-step construction of a `GetMaxOpenSizeReq` object. */ static builder(): GetMaxOpenSizeReqBuilder { - return new GetMaxOpenSizeReqBuilder(); + return new GetMaxOpenSizeReqBuilder(new GetMaxOpenSizeReq()); } /** @@ -49,22 +52,23 @@ export class GetMaxOpenSizeReq implements Serializable { return obj; } - fromJson(input: string): GetMaxOpenSizeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMaxOpenSizeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMaxOpenSizeReq { - return plainToInstance(GetMaxOpenSizeReq, jsonObject); + static fromJson(input: string): GetMaxOpenSizeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMaxOpenSizeReq { + return plainToClassFromExist(new GetMaxOpenSizeReq(), jsonObject); } } export class GetMaxOpenSizeReqBuilder { - obj: GetMaxOpenSizeReq = new GetMaxOpenSizeReq(); + constructor(readonly obj: GetMaxOpenSizeReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts index 9cde565a..1c971ce6 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts @@ -1,23 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMaxOpenSizeResp implements Response { +export class GetMaxOpenSizeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Maximum buy size */ - maxBuyOpenSize?: number; + maxBuyOpenSize: number; + /** * Maximum buy size */ - maxSellOpenSize?: number; + maxSellOpenSize: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.maxBuyOpenSize = null; + // @ts-ignore + this.maxSellOpenSize = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class GetMaxOpenSizeResp implements Response { +export class GetMaxWithdrawMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMaxWithdrawMarginReq` class. * The builder pattern allows step-by-step construction of a `GetMaxWithdrawMarginReq` object. */ static builder(): GetMaxWithdrawMarginReqBuilder { - return new GetMaxWithdrawMarginReqBuilder(); + return new GetMaxWithdrawMarginReqBuilder(new GetMaxWithdrawMarginReq()); } /** @@ -31,22 +32,23 @@ export class GetMaxWithdrawMarginReq implements Serializable { +export class GetMaxWithdrawMarginResp implements Response { /** * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetMaxWithdrawMarginResp implements Response { +export class GetPositionDetailsReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetPositionDetailsReq` class. * The builder pattern allows step-by-step construction of a `GetPositionDetailsReq` object. */ static builder(): GetPositionDetailsReqBuilder { - return new GetPositionDetailsReqBuilder(); + return new GetPositionDetailsReqBuilder(new GetPositionDetailsReq()); } /** @@ -31,22 +32,23 @@ export class GetPositionDetailsReq implements Serializable { +export class GetPositionDetailsResp implements Response { /** * Position ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Whether it is cross margin. */ - crossMode?: boolean; + crossMode: boolean; + /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; + /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; + /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; + /** * Current postion quantity */ - currentQty?: number; + currentQty: number; + /** * Current postion value */ - currentCost?: number; + currentCost: number; + /** * Current commission */ - currentComm?: number; + currentComm: number; + /** * Unrealised value */ - unrealisedCost?: number; + unrealisedCost: number; + /** * Accumulated realised gross profit value */ - realisedGrossCost?: number; + realisedGrossCost: number; + /** * Current realised position value */ - realisedCost?: number; + realisedCost: number; + /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Mark Value */ - markValue?: number; + markValue: number; + /** * Position value */ - posCost?: number; + posCost: number; + /** * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction */ - posInit?: number; + posInit: number; + /** * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) */ - posMargin?: number; + posMargin: number; + /** * Accumulated realised gross profit value */ - realisedGrossPnl?: number; + realisedGrossPnl: number; + /** * Realised profit and loss */ - realisedPnl?: number; + realisedPnl: number; + /** * Unrealised profit and loss */ - unrealisedPnl?: number; + unrealisedPnl: number; + /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: number; + unrealisedPnlPcnt: number; + /** * Rate of return on investment */ - unrealisedRoePcnt?: number; + unrealisedRoePcnt: number; + /** * Average entry price */ - avgEntryPrice?: number; + avgEntryPrice: number; + /** * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. */ - liquidationPrice?: number; + liquidationPrice: number; + /** * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. */ - bankruptPrice?: number; + bankruptPrice: number; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + /** * Reverse contract or not */ - isInverse?: boolean; + isInverse: boolean; + /** * Margin Mode: CROSS,ISOLATED */ - marginMode?: GetPositionDetailsResp.MarginModeEnum; + marginMode: GetPositionDetailsResp.MarginModeEnum; + /** * Position Side */ - positionSide?: GetPositionDetailsResp.PositionSideEnum; + positionSide: GetPositionDetailsResp.PositionSideEnum; + /** * Leverage */ - leverage?: number; + leverage: number; + /** * Auto deposit margin or not **Only applicable to Isolated Margin** */ autoDeposit?: boolean; + /** * Maintenance margin requirement **Only applicable to Isolated Margin** */ maintMarginReq?: number; + /** * Risk limit **Only applicable to Isolated Margin** */ riskLimit?: number; + /** * Leverage of the order **Only applicable to Isolated Margin** */ realLeverage?: number; + /** * added margin **Only applicable to Isolated Margin** */ posCross?: number; + /** * Additional margin calls (automatic, manual, adjusted risk limits) **Only applicable to Isolated Margin** */ posCrossMargin?: number; + /** * Bankruptcy cost **Only applicable to Isolated Margin** */ posComm?: number; + /** * Part of bankruptcy cost (positioning, add margin) **Only applicable to Isolated Margin** */ posCommCommon?: number; + /** * Funding fees paid out **Only applicable to Isolated Margin** */ posLoss?: number; + /** * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** */ posFunding?: number; + /** * Maintenance margin **Only applicable to Isolated Margin** */ posMaint?: number; + /** * Position margin **Only applicable to Isolated Margin** */ maintMargin?: number; + /** * Maintenance margin rate **Only applicable to Isolated Margin** */ maintainMargin?: number; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.isInverse = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.positionSide = null; + // @ts-ignore + this.leverage = null; + } /** * common response */ @@ -192,17 +299,16 @@ export class GetPositionDetailsResp implements Response { +export class GetPositionListData implements Serializable { /** * Position ID */ - id?: string; + id: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Whether it is cross margin. */ - crossMode?: boolean; + crossMode: boolean; + /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; + /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; + /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; + /** * Current postion quantity */ - currentQty?: number; + currentQty: number; + /** * Current postion value */ - currentCost?: number; + currentCost: number; + /** * Current commission */ - currentComm?: number; + currentComm: number; + /** * Unrealised value */ - unrealisedCost?: number; + unrealisedCost: number; + /** * Accumulated realised gross profit value */ - realisedGrossCost?: number; + realisedGrossCost: number; + /** * Current realised position value */ - realisedCost?: number; + realisedCost: number; + /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; + /** * Mark price */ - markPrice?: number; + markPrice: number; + /** * Mark Value */ - markValue?: number; + markValue: number; + /** * Position value */ - posCost?: number; + posCost: number; + /** * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction */ - posInit?: number; + posInit: number; + /** * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) */ - posMargin?: number; + posMargin: number; + /** * Accumulated realised gross profit value */ - realisedGrossPnl?: number; + realisedGrossPnl: number; + /** * Realised profit and loss */ - realisedPnl?: number; + realisedPnl: number; + /** * Unrealised profit and loss */ - unrealisedPnl?: number; + unrealisedPnl: number; + /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: number; + unrealisedPnlPcnt: number; + /** * Rate of return on investment */ - unrealisedRoePcnt?: number; + unrealisedRoePcnt: number; + /** * Average entry price */ - avgEntryPrice?: number; + avgEntryPrice: number; + /** * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. */ - liquidationPrice?: number; + liquidationPrice: number; + /** * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. */ - bankruptPrice?: number; + bankruptPrice: number; + /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; + /** * Reverse contract or not */ - isInverse?: boolean; + isInverse: boolean; + /** * Margin Mode: CROSS,ISOLATED */ - marginMode?: GetPositionListData.MarginModeEnum; + marginMode: GetPositionListData.MarginModeEnum; + /** * Position Side */ - positionSide?: GetPositionListData.PositionSideEnum; + positionSide: GetPositionListData.PositionSideEnum; + /** * Leverage */ - leverage?: number; + leverage: number; + /** * Auto deposit margin or not **Only applicable to Isolated Margin** */ autoDeposit?: boolean; + /** * Maintenance margin requirement **Only applicable to Isolated Margin** */ maintMarginReq?: number; + /** * Risk limit **Only applicable to Isolated Margin** */ riskLimit?: number; + /** * Leverage of the order **Only applicable to Isolated Margin** */ realLeverage?: number; + /** * added margin **Only applicable to Isolated Margin** */ posCross?: number; + /** * Additional margin calls (automatic, manual, adjusted risk limits) **Only applicable to Isolated Margin** */ posCrossMargin?: number; + /** * Bankruptcy cost **Only applicable to Isolated Margin** */ posComm?: number; + /** * Part of bankruptcy cost (positioning, add margin) **Only applicable to Isolated Margin** */ posCommCommon?: number; + /** * Funding fees paid out **Only applicable to Isolated Margin** */ posLoss?: number; + /** * The current remaining unsettled funding fee for the position **Only applicable to Isolated Margin** */ posFunding?: number; + /** * Maintenance margin **Only applicable to Isolated Margin** */ posMaint?: number; + /** * Position margin **Only applicable to Isolated Margin** */ maintMargin?: number; + /** * Maintenance margin rate **Only applicable to Isolated Margin** */ maintainMargin?: number; - fromJson(input: string): GetPositionListData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPositionListData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.isInverse = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.positionSide = null; + // @ts-ignore + this.leverage = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPositionListData { - return plainToInstance(GetPositionListData, jsonObject); + static fromJson(input: string): GetPositionListData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPositionListData { + return plainToClassFromExist(new GetPositionListData(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts index 2229ffbd..03913f7d 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPositionListReq implements Serializable { +export class GetPositionListReq implements Serializable { /** * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetPositionListReq` class. * The builder pattern allows step-by-step construction of a `GetPositionListReq` object. */ static builder(): GetPositionListReqBuilder { - return new GetPositionListReqBuilder(); + return new GetPositionListReqBuilder(new GetPositionListReq()); } /** @@ -31,22 +32,23 @@ export class GetPositionListReq implements Serializable { return obj; } - fromJson(input: string): GetPositionListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPositionListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPositionListReq { - return plainToInstance(GetPositionListReq, jsonObject); + static fromJson(input: string): GetPositionListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPositionListReq { + return plainToClassFromExist(new GetPositionListReq(), jsonObject); } } export class GetPositionListReqBuilder { - obj: GetPositionListReq = new GetPositionListReq(); + constructor(readonly obj: GetPositionListReq) { + this.obj = obj; + } /** * Currency code, Please refer to [rootSymbol](https://www.kucoin.com/docs-new/api-221752070) , such as USDT,XBT. Query all positions when empty */ diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts index dfa77a56..7febffa9 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetPositionListData } from './model_get_position_list_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPositionListResp implements Response { +export class GetPositionListResp implements Response { /** * */ @Type(() => GetPositionListData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetPositionListResp implements Response { +export class GetPositionsHistoryItems implements Serializable { /** * Close ID */ - closeId?: string; + closeId: string; + /** * User ID */ - userId?: string; + userId: string; + /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Currency used to settle trades */ - settleCurrency?: string; + settleCurrency: string; + /** * Leverage applied to the order */ - leverage?: string; + leverage: string; + /** * Type of closure */ - type?: string; + type: string; + /** * Net profit and loss (after deducting fees and funding costs) */ - pnl?: string; + pnl: string; + /** * Accumulated realised gross profit value */ - realisedGrossCost?: string; + realisedGrossCost: string; + /** * Accumulated realised profit withdrawn from the position */ - withdrawPnl?: string; + withdrawPnl: string; + /** * Accumulated trading fees */ - tradeFee?: string; + tradeFee: string; + /** * Accumulated funding fees */ - fundingFee?: string; + fundingFee: string; + /** * Time when the position was opened */ - openTime?: number; + openTime: number; + /** * Time when the position was closed (default sorted in descending order) */ - closeTime?: number; + closeTime: number; + /** * Opening price of the position */ - openPrice?: string; + openPrice: string; + /** * Closing price of the position */ - closePrice?: string; + closePrice: string; + /** * Margin Mode: CROSS,ISOLATED */ - marginMode?: GetPositionsHistoryItems.MarginModeEnum; + marginMode: GetPositionsHistoryItems.MarginModeEnum; - fromJson(input: string): GetPositionsHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPositionsHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.closeId = null; + // @ts-ignore + this.userId = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.leverage = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.pnl = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.withdrawPnl = null; + // @ts-ignore + this.tradeFee = null; + // @ts-ignore + this.fundingFee = null; + // @ts-ignore + this.openTime = null; + // @ts-ignore + this.closeTime = null; + // @ts-ignore + this.openPrice = null; + // @ts-ignore + this.closePrice = null; + // @ts-ignore + this.marginMode = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPositionsHistoryItems { - return plainToInstance(GetPositionsHistoryItems, jsonObject); + static fromJson(input: string): GetPositionsHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPositionsHistoryItems { + return plainToClassFromExist(new GetPositionsHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts index 32bcbba7..3565f409 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts @@ -1,36 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPositionsHistoryReq implements Serializable { +export class GetPositionsHistoryReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ symbol?: string; + /** * Closing start time(ms) */ from?: number; + /** * Closing end time(ms) */ to?: number; + /** * Number of requests per page, max 200, default 10 */ limit?: number = 10; + /** * Current page number, default 1 */ pageId?: number = 1; + private constructor() {} /** * Creates a new instance of the `GetPositionsHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetPositionsHistoryReq` object. */ static builder(): GetPositionsHistoryReqBuilder { - return new GetPositionsHistoryReqBuilder(); + return new GetPositionsHistoryReqBuilder(new GetPositionsHistoryReq()); } /** @@ -62,27 +67,36 @@ export class GetPositionsHistoryReq implements Serializable { +export class GetPositionsHistoryResp implements Response { /** * Current page number */ - currentPage?: number; + currentPage: number; + /** * Number of results per page */ - pageSize?: number; + pageSize: number; + /** * Total number of results */ - totalNum?: number; + totalNum: number; + /** * Total number of pages */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetPositionsHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetPositionsHistoryResp implements Response { +export class ModifyAutoDepositStatusReq implements Serializable { /** * Symbol of the contract */ - symbol?: string; + symbol: string; + /** * Status */ - status?: boolean; + status: boolean; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.status = null; + } /** * Creates a new instance of the `ModifyAutoDepositStatusReq` class. * The builder pattern allows step-by-step construction of a `ModifyAutoDepositStatusReq` object. */ static builder(): ModifyAutoDepositStatusReqBuilder { - return new ModifyAutoDepositStatusReqBuilder(); + return new ModifyAutoDepositStatusReqBuilder(new ModifyAutoDepositStatusReq()); } /** @@ -28,11 +35,11 @@ export class ModifyAutoDepositStatusReq implements Serializable -{ +export class ModifyAutoDepositStatusResp implements Response { /** * */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class ModifyAutoDepositStatusResp this.commonResponse = response; } - fromJson(input: string): ModifyAutoDepositStatusResp { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { - return plainToInstance(ModifyAutoDepositStatusResp, { data: jsonObject }); + static fromJson(input: string): ModifyAutoDepositStatusResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { + return plainToClassFromExist(new ModifyAutoDepositStatusResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts index 21e522a1..32341c24 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts @@ -1,26 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class ModifyIsolatedMarginRiskLimtReq - implements Serializable -{ +export class ModifyIsolatedMarginRiskLimtReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * level */ - level?: number; + level: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.level = null; + } /** * Creates a new instance of the `ModifyIsolatedMarginRiskLimtReq` class. * The builder pattern allows step-by-step construction of a `ModifyIsolatedMarginRiskLimtReq` object. */ static builder(): ModifyIsolatedMarginRiskLimtReqBuilder { - return new ModifyIsolatedMarginRiskLimtReqBuilder(); + return new ModifyIsolatedMarginRiskLimtReqBuilder(new ModifyIsolatedMarginRiskLimtReq()); } /** @@ -30,11 +35,11 @@ export class ModifyIsolatedMarginRiskLimtReq /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * level */ - level?: number; + level: number; }): ModifyIsolatedMarginRiskLimtReq { let obj = new ModifyIsolatedMarginRiskLimtReq(); obj.symbol = data.symbol; @@ -42,22 +47,23 @@ export class ModifyIsolatedMarginRiskLimtReq return obj; } - fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { - return plainToInstance(ModifyIsolatedMarginRiskLimtReq, jsonObject); + static fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { + return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtReq(), jsonObject); } } export class ModifyIsolatedMarginRiskLimtReqBuilder { - obj: ModifyIsolatedMarginRiskLimtReq = new ModifyIsolatedMarginRiskLimtReq(); + constructor(readonly obj: ModifyIsolatedMarginRiskLimtReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts index ed84f474..39f9b626 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts @@ -1,17 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ModifyIsolatedMarginRiskLimtResp - implements Response -{ +export class ModifyIsolatedMarginRiskLimtResp implements Response { /** * To adjust the level will cancel the open order, the response can only indicate whether the submit of the adjustment request is successful or not. */ - data?: boolean; + data: boolean; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class ModifyIsolatedMarginRiskLimtResp this.commonResponse = response; } - fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { - return plainToInstance(ModifyIsolatedMarginRiskLimtResp, { data: jsonObject }); + static fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { + return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts index f517060a..a21c30ae 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts @@ -1,24 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class ModifyMarginLeverageReq implements Serializable { +export class ModifyMarginLeverageReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Leverage multiple */ - leverage?: string; + leverage: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + } /** * Creates a new instance of the `ModifyMarginLeverageReq` class. * The builder pattern allows step-by-step construction of a `ModifyMarginLeverageReq` object. */ static builder(): ModifyMarginLeverageReqBuilder { - return new ModifyMarginLeverageReqBuilder(); + return new ModifyMarginLeverageReqBuilder(new ModifyMarginLeverageReq()); } /** @@ -28,11 +35,11 @@ export class ModifyMarginLeverageReq implements Serializable { +export class ModifyMarginLeverageResp implements Response { /** * */ - symbol?: string; + symbol: string; + /** * */ - leverage?: string; + leverage: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.leverage = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class ModifyMarginLeverageResp implements Response { +export class RemoveIsolatedMarginReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * The size of the position that can be deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - withdrawAmount?: string; + withdrawAmount: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.withdrawAmount = null; + } /** * Creates a new instance of the `RemoveIsolatedMarginReq` class. * The builder pattern allows step-by-step construction of a `RemoveIsolatedMarginReq` object. */ static builder(): RemoveIsolatedMarginReqBuilder { - return new RemoveIsolatedMarginReqBuilder(); + return new RemoveIsolatedMarginReqBuilder(new RemoveIsolatedMarginReq()); } /** @@ -28,11 +35,11 @@ export class RemoveIsolatedMarginReq implements Serializable { +export class RemoveIsolatedMarginResp implements Response { /** * The size of the position deposited. If it is USDT-margin, it represents the amount of USDT. If it is coin-margin, this value represents the number of coins */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class RemoveIsolatedMarginResp implements Response { +export class SwitchMarginModeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Modified margin model: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: SwitchMarginModeReq.MarginModeEnum; + marginMode: SwitchMarginModeReq.MarginModeEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.marginMode = null; + } /** * Creates a new instance of the `SwitchMarginModeReq` class. * The builder pattern allows step-by-step construction of a `SwitchMarginModeReq` object. */ static builder(): SwitchMarginModeReqBuilder { - return new SwitchMarginModeReqBuilder(); + return new SwitchMarginModeReqBuilder(new SwitchMarginModeReq()); } /** @@ -28,11 +35,11 @@ export class SwitchMarginModeReq implements Serializable { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Modified margin model: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: SwitchMarginModeReq.MarginModeEnum; + marginMode: SwitchMarginModeReq.MarginModeEnum; }): SwitchMarginModeReq { let obj = new SwitchMarginModeReq(); obj.symbol = data.symbol; @@ -40,17 +47,16 @@ export class SwitchMarginModeReq implements Serializable { return obj; } - fromJson(input: string): SwitchMarginModeReq { - const jsonObject = JSON.parse(input); - return plainToInstance(SwitchMarginModeReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SwitchMarginModeReq { - return plainToInstance(SwitchMarginModeReq, jsonObject); + static fromJson(input: string): SwitchMarginModeReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SwitchMarginModeReq { + return plainToClassFromExist(new SwitchMarginModeReq(), jsonObject); } } @@ -68,7 +74,9 @@ export namespace SwitchMarginModeReq { } export class SwitchMarginModeReqBuilder { - obj: SwitchMarginModeReq = new SwitchMarginModeReq(); + constructor(readonly obj: SwitchMarginModeReq) { + this.obj = obj; + } /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts index 0628e5ff..7bdcb513 100644 --- a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class SwitchMarginModeResp implements Response { +export class SwitchMarginModeResp implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; + /** * Margin mode: ISOLATED (isolated), CROSS (cross margin). */ - marginMode?: SwitchMarginModeResp.MarginModeEnum; + marginMode: SwitchMarginModeResp.MarginModeEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.marginMode = null; + } /** * common response */ @@ -24,17 +31,16 @@ export class SwitchMarginModeResp implements Response { - return this.transport.call( - 'spot', - false, - 'POST', - '/api/v3/redeem', - req, - new RedeemResp(), - false, - ); + return this.transport.call('spot', false, 'POST', '/api/v3/redeem', req, RedeemResp, false); } getRedeemOrders(req: GetRedeemOrdersReq): Promise { @@ -216,7 +208,7 @@ export class CreditAPIImpl implements CreditAPI { 'GET', '/api/v3/redeem/orders', req, - new GetRedeemOrdersResp(), + GetRedeemOrdersResp, false, ); } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts index 0d1cf7f4..a6d2fcd3 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts @@ -1,64 +1,74 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetLoanMarketData implements Serializable { +export class GetLoanMarketData implements Serializable { /** * Currency */ currency?: string; + /** * Whether purchase is supported. */ purchaseEnable?: boolean; + /** * Whether redeem is supported. */ redeemEnable?: boolean; + /** * Increment precision for purchase and redemption */ increment?: string; + /** * Minimum purchase amount */ minPurchaseSize?: string; + /** * Minimum lending rate */ minInterestRate?: string; + /** * Maximum lending rate */ maxInterestRate?: string; + /** * Increment precision for interest; default is 0.0001 */ interestIncrement?: string = '0.0001'; + /** * Maximum purchase amount */ maxPurchaseSize?: string; + /** * Latest market lending rate */ marketInterestRate?: string; + /** * Whether to allow automatic purchase: true: on, false: off */ autoPurchaseEnable?: boolean; - fromJson(input: string): GetLoanMarketData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetLoanMarketData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetLoanMarketData { - return plainToInstance(GetLoanMarketData, jsonObject); + static fromJson(input: string): GetLoanMarketData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetLoanMarketData { + return plainToClassFromExist(new GetLoanMarketData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts index f0c31ead..5ac017f4 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts @@ -1,28 +1,34 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetLoanMarketInterestRateData implements Serializable { +export class GetLoanMarketInterestRateData implements Serializable { /** * Time: YYYYMMDDHH00 */ - time?: string; + time: string; + /** * Market lending rate */ - marketInterestRate?: string; + marketInterestRate: string; - fromJson(input: string): GetLoanMarketInterestRateData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetLoanMarketInterestRateData, jsonObject); + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.marketInterestRate = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetLoanMarketInterestRateData { - return plainToInstance(GetLoanMarketInterestRateData, jsonObject); + static fromJson(input: string): GetLoanMarketInterestRateData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetLoanMarketInterestRateData { + return plainToClassFromExist(new GetLoanMarketInterestRateData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts index 21e7d5d2..526ce6d9 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetLoanMarketInterestRateReq implements Serializable { +export class GetLoanMarketInterestRateReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetLoanMarketInterestRateReq` class. * The builder pattern allows step-by-step construction of a `GetLoanMarketInterestRateReq` object. */ static builder(): GetLoanMarketInterestRateReqBuilder { - return new GetLoanMarketInterestRateReqBuilder(); + return new GetLoanMarketInterestRateReqBuilder(new GetLoanMarketInterestRateReq()); } /** @@ -31,22 +32,23 @@ export class GetLoanMarketInterestRateReq implements Serializable -{ +export class GetLoanMarketInterestRateResp implements Response { /** * */ @Type(() => GetLoanMarketInterestRateData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetLoanMarketInterestRateResp this.commonResponse = response; } - fromJson(input: string): GetLoanMarketInterestRateResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetLoanMarketInterestRateResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetLoanMarketInterestRateResp { - return plainToInstance(GetLoanMarketInterestRateResp, { data: jsonObject }); + static fromJson(input: string): GetLoanMarketInterestRateResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetLoanMarketInterestRateResp { + return plainToClassFromExist(new GetLoanMarketInterestRateResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts index ec29c4e6..be74e891 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetLoanMarketReq implements Serializable { +export class GetLoanMarketReq implements Serializable { /** * currency */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetLoanMarketReq` class. * The builder pattern allows step-by-step construction of a `GetLoanMarketReq` object. */ static builder(): GetLoanMarketReqBuilder { - return new GetLoanMarketReqBuilder(); + return new GetLoanMarketReqBuilder(new GetLoanMarketReq()); } /** @@ -31,22 +32,23 @@ export class GetLoanMarketReq implements Serializable { return obj; } - fromJson(input: string): GetLoanMarketReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetLoanMarketReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetLoanMarketReq { - return plainToInstance(GetLoanMarketReq, jsonObject); + static fromJson(input: string): GetLoanMarketReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetLoanMarketReq { + return plainToClassFromExist(new GetLoanMarketReq(), jsonObject); } } export class GetLoanMarketReqBuilder { - obj: GetLoanMarketReq = new GetLoanMarketReq(); + constructor(readonly obj: GetLoanMarketReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts index 3ac1c372..f33b8c0b 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetLoanMarketData } from './model_get_loan_market_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetLoanMarketResp implements Response { +export class GetLoanMarketResp implements Response { /** * */ @Type(() => GetLoanMarketData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetLoanMarketResp implements Response { +export class GetPurchaseOrdersItems implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; + /** * Total purchase size */ - purchaseSize?: string; + purchaseSize: string; + /** * Executed size */ - matchSize?: string; + matchSize: string; + /** * Target annualized interest rate */ - interestRate?: string; + interestRate: string; + /** * Redeemed amount */ - incomeSize?: string; + incomeSize: string; + /** * Time of purchase */ - applyTime?: number; + applyTime: number; + /** * Status: DONE-completed; PENDING-settling */ - status?: GetPurchaseOrdersItems.StatusEnum; + status: GetPurchaseOrdersItems.StatusEnum; - fromJson(input: string): GetPurchaseOrdersItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPurchaseOrdersItems, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.purchaseOrderNo = null; + // @ts-ignore + this.purchaseSize = null; + // @ts-ignore + this.matchSize = null; + // @ts-ignore + this.interestRate = null; + // @ts-ignore + this.incomeSize = null; + // @ts-ignore + this.applyTime = null; + // @ts-ignore + this.status = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPurchaseOrdersItems { - return plainToInstance(GetPurchaseOrdersItems, jsonObject); + static fromJson(input: string): GetPurchaseOrdersItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPurchaseOrdersItems { + return plainToClassFromExist(new GetPurchaseOrdersItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts index 1190eead..95bab12d 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts @@ -1,36 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetPurchaseOrdersReq implements Serializable { +export class GetPurchaseOrdersReq implements Serializable { /** * currency */ currency?: string; + /** * DONE-completed; PENDING-settling */ status?: GetPurchaseOrdersReq.StatusEnum; + /** * */ purchaseOrderNo?: string; + /** * Current page; default is 1 */ currentPage?: number = 1; + /** * Page size; 1<=pageSize<=100; default is 50 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetPurchaseOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetPurchaseOrdersReq` object. */ static builder(): GetPurchaseOrdersReqBuilder { - return new GetPurchaseOrdersReqBuilder(); + return new GetPurchaseOrdersReqBuilder(new GetPurchaseOrdersReq()); } /** @@ -62,22 +67,29 @@ export class GetPurchaseOrdersReq implements Serializable obj.currency = data.currency; obj.status = data.status; obj.purchaseOrderNo = data.purchaseOrderNo; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetPurchaseOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPurchaseOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPurchaseOrdersReq { - return plainToInstance(GetPurchaseOrdersReq, jsonObject); + static fromJson(input: string): GetPurchaseOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPurchaseOrdersReq { + return plainToClassFromExist(new GetPurchaseOrdersReq(), jsonObject); } } @@ -95,7 +107,9 @@ export namespace GetPurchaseOrdersReq { } export class GetPurchaseOrdersReqBuilder { - obj: GetPurchaseOrdersReq = new GetPurchaseOrdersReq(); + constructor(readonly obj: GetPurchaseOrdersReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts index 985b11d8..e907f8b4 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetPurchaseOrdersItems } from './model_get_purchase_orders_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPurchaseOrdersResp implements Response { +export class GetPurchaseOrdersResp implements Response { /** * Current Page */ - currentPage?: number; + currentPage: number; + /** * Page Size */ - pageSize?: number; + pageSize: number; + /** * Total Number */ - totalNum?: number; + totalNum: number; + /** * Total Page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetPurchaseOrdersItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetPurchaseOrdersResp implements Response { +export class GetRedeemOrdersItems implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; + /** * Redeem order id */ - redeemOrderNo?: string; + redeemOrderNo: string; + /** * Redemption size */ - redeemSize?: string; + redeemSize: string; + /** * Redeemed size */ - receiptSize?: string; + receiptSize: string; + /** * Time of redeem */ - applyTime?: string; + applyTime: string; + /** * Status: DONE-completed; PENDING-settling */ - status?: string; + status: string; - fromJson(input: string): GetRedeemOrdersItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRedeemOrdersItems, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.purchaseOrderNo = null; + // @ts-ignore + this.redeemOrderNo = null; + // @ts-ignore + this.redeemSize = null; + // @ts-ignore + this.receiptSize = null; + // @ts-ignore + this.applyTime = null; + // @ts-ignore + this.status = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRedeemOrdersItems { - return plainToInstance(GetRedeemOrdersItems, jsonObject); + static fromJson(input: string): GetRedeemOrdersItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRedeemOrdersItems { + return plainToClassFromExist(new GetRedeemOrdersItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts index 8511ae8b..6e0e164c 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts @@ -1,36 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRedeemOrdersReq implements Serializable { +export class GetRedeemOrdersReq implements Serializable { /** * currency */ currency?: string; + /** * DONE-completed; PENDING-settling */ status?: GetRedeemOrdersReq.StatusEnum; + /** * Redeem order id */ redeemOrderNo?: string; + /** * Current page; default is 1 */ currentPage?: number = 1; + /** * Page size; 1<=pageSize<=100; default is 50 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetRedeemOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetRedeemOrdersReq` object. */ static builder(): GetRedeemOrdersReqBuilder { - return new GetRedeemOrdersReqBuilder(); + return new GetRedeemOrdersReqBuilder(new GetRedeemOrdersReq()); } /** @@ -62,22 +67,29 @@ export class GetRedeemOrdersReq implements Serializable { obj.currency = data.currency; obj.status = data.status; obj.redeemOrderNo = data.redeemOrderNo; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetRedeemOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRedeemOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRedeemOrdersReq { - return plainToInstance(GetRedeemOrdersReq, jsonObject); + static fromJson(input: string): GetRedeemOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRedeemOrdersReq { + return plainToClassFromExist(new GetRedeemOrdersReq(), jsonObject); } } @@ -95,7 +107,9 @@ export namespace GetRedeemOrdersReq { } export class GetRedeemOrdersReqBuilder { - obj: GetRedeemOrdersReq = new GetRedeemOrdersReq(); + constructor(readonly obj: GetRedeemOrdersReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts index 21afb32f..49838130 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetRedeemOrdersItems } from './model_get_redeem_orders_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetRedeemOrdersResp implements Response { +export class GetRedeemOrdersResp implements Response { /** * Current Page */ - currentPage?: number; + currentPage: number; + /** * Page Size */ - pageSize?: number; + pageSize: number; + /** * Total Number */ - totalNum?: number; + totalNum: number; + /** * Total Page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetRedeemOrdersItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetRedeemOrdersResp implements Response { +export class ModifyPurchaseReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Modified purchase interest rate */ - interestRate?: string; + interestRate: string; + /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.interestRate = null; + // @ts-ignore + this.purchaseOrderNo = null; + } /** * Creates a new instance of the `ModifyPurchaseReq` class. * The builder pattern allows step-by-step construction of a `ModifyPurchaseReq` object. */ static builder(): ModifyPurchaseReqBuilder { - return new ModifyPurchaseReqBuilder(); + return new ModifyPurchaseReqBuilder(new ModifyPurchaseReq()); } /** @@ -32,15 +42,15 @@ export class ModifyPurchaseReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; /** * Modified purchase interest rate */ - interestRate?: string; + interestRate: string; /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; }): ModifyPurchaseReq { let obj = new ModifyPurchaseReq(); obj.currency = data.currency; @@ -49,22 +59,23 @@ export class ModifyPurchaseReq implements Serializable { return obj; } - fromJson(input: string): ModifyPurchaseReq { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyPurchaseReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyPurchaseReq { - return plainToInstance(ModifyPurchaseReq, jsonObject); + static fromJson(input: string): ModifyPurchaseReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyPurchaseReq { + return plainToClassFromExist(new ModifyPurchaseReq(), jsonObject); } } export class ModifyPurchaseReqBuilder { - obj: ModifyPurchaseReq = new ModifyPurchaseReq(); + constructor(readonly obj: ModifyPurchaseReq) { + this.obj = obj; + } /** * Currency */ diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts index 5d2d0613..c01927a5 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ModifyPurchaseResp implements Response { +export class ModifyPurchaseResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class ModifyPurchaseResp implements Response { +export class PurchaseReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * purchase amount */ - size?: string; + size: string; + /** * purchase interest rate */ - interestRate?: string; + interestRate: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.interestRate = null; + } /** * Creates a new instance of the `PurchaseReq` class. * The builder pattern allows step-by-step construction of a `PurchaseReq` object. */ static builder(): PurchaseReqBuilder { - return new PurchaseReqBuilder(); + return new PurchaseReqBuilder(new PurchaseReq()); } /** @@ -32,15 +42,15 @@ export class PurchaseReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; /** * purchase amount */ - size?: string; + size: string; /** * purchase interest rate */ - interestRate?: string; + interestRate: string; }): PurchaseReq { let obj = new PurchaseReq(); obj.currency = data.currency; @@ -49,22 +59,23 @@ export class PurchaseReq implements Serializable { return obj; } - fromJson(input: string): PurchaseReq { - const jsonObject = JSON.parse(input); - return plainToInstance(PurchaseReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): PurchaseReq { - return plainToInstance(PurchaseReq, jsonObject); + static fromJson(input: string): PurchaseReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): PurchaseReq { + return plainToClassFromExist(new PurchaseReq(), jsonObject); } } export class PurchaseReqBuilder { - obj: PurchaseReq = new PurchaseReq(); + constructor(readonly obj: PurchaseReq) { + this.obj = obj; + } /** * Currency */ diff --git a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts index 9b24faf0..3cfb25b9 100644 --- a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class PurchaseResp implements Response { +export class PurchaseResp implements Response { /** * Purchase order id */ - orderNo?: string; + orderNo: string; + private constructor() { + // @ts-ignore + this.orderNo = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class PurchaseResp implements Response { this.commonResponse = response; } - fromJson(input: string): PurchaseResp { - const jsonObject = JSON.parse(input); - return plainToInstance(PurchaseResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): PurchaseResp { - return plainToInstance(PurchaseResp, jsonObject); + static fromJson(input: string): PurchaseResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): PurchaseResp { + return plainToClassFromExist(new PurchaseResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/credit/model_redeem_req.ts b/sdk/node/src/generate/margin/credit/model_redeem_req.ts index 682813b6..245a645c 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_req.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_req.ts @@ -1,28 +1,38 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class RedeemReq implements Serializable { +export class RedeemReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; + /** * Redemption amount */ - size?: string; + size: string; + /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.purchaseOrderNo = null; + } /** * Creates a new instance of the `RedeemReq` class. * The builder pattern allows step-by-step construction of a `RedeemReq` object. */ static builder(): RedeemReqBuilder { - return new RedeemReqBuilder(); + return new RedeemReqBuilder(new RedeemReq()); } /** @@ -32,15 +42,15 @@ export class RedeemReq implements Serializable { /** * Currency */ - currency?: string; + currency: string; /** * Redemption amount */ - size?: string; + size: string; /** * Purchase order id */ - purchaseOrderNo?: string; + purchaseOrderNo: string; }): RedeemReq { let obj = new RedeemReq(); obj.currency = data.currency; @@ -49,22 +59,23 @@ export class RedeemReq implements Serializable { return obj; } - fromJson(input: string): RedeemReq { - const jsonObject = JSON.parse(input); - return plainToInstance(RedeemReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RedeemReq { - return plainToInstance(RedeemReq, jsonObject); + static fromJson(input: string): RedeemReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RedeemReq { + return plainToClassFromExist(new RedeemReq(), jsonObject); } } export class RedeemReqBuilder { - obj: RedeemReq = new RedeemReq(); + constructor(readonly obj: RedeemReq) { + this.obj = obj; + } /** * Currency */ diff --git a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts index ddb5758f..b7045efa 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class RedeemResp implements Response { +export class RedeemResp implements Response { /** * Redeem order id */ - orderNo?: string; + orderNo: string; + private constructor() { + // @ts-ignore + this.orderNo = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class RedeemResp implements Response { this.commonResponse = response; } - fromJson(input: string): RedeemResp { - const jsonObject = JSON.parse(input); - return plainToInstance(RedeemResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RedeemResp { - return plainToInstance(RedeemResp, jsonObject); + static fromJson(input: string): RedeemResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RedeemResp { + return plainToClassFromExist(new RedeemResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/debit/api_debit.ts b/sdk/node/src/generate/margin/debit/api_debit.ts index 29a09834..dfd364ce 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.ts +++ b/sdk/node/src/generate/margin/debit/api_debit.ts @@ -122,7 +122,7 @@ export class DebitAPIImpl implements DebitAPI { 'POST', '/api/v3/margin/borrow', req, - new BorrowResp(), + BorrowResp, false, ); } @@ -134,7 +134,7 @@ export class DebitAPIImpl implements DebitAPI { 'GET', '/api/v3/margin/borrow', req, - new GetBorrowHistoryResp(), + GetBorrowHistoryResp, false, ); } @@ -146,7 +146,7 @@ export class DebitAPIImpl implements DebitAPI { 'POST', '/api/v3/margin/repay', req, - new RepayResp(), + RepayResp, false, ); } @@ -158,7 +158,7 @@ export class DebitAPIImpl implements DebitAPI { 'GET', '/api/v3/margin/repay', req, - new GetRepayHistoryResp(), + GetRepayHistoryResp, false, ); } @@ -170,7 +170,7 @@ export class DebitAPIImpl implements DebitAPI { 'GET', '/api/v3/margin/interest', req, - new GetInterestHistoryResp(), + GetInterestHistoryResp, false, ); } @@ -182,7 +182,7 @@ export class DebitAPIImpl implements DebitAPI { 'POST', '/api/v3/position/update-user-leverage', req, - new ModifyLeverageResp(), + ModifyLeverageResp, false, ); } diff --git a/sdk/node/src/generate/margin/debit/model_borrow_req.ts b/sdk/node/src/generate/margin/debit/model_borrow_req.ts index 7683fee8..f69a2d83 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_req.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_req.ts @@ -1,40 +1,53 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BorrowReq implements Serializable { +export class BorrowReq implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Borrow amount */ - size?: number; + size: number; + /** * timeInForce: IOC, FOK */ - timeInForce?: BorrowReq.TimeInForceEnum; + timeInForce: BorrowReq.TimeInForceEnum; + /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * true: high frequency borrowing, false: low frequency borrowing; default false */ isHf?: boolean = false; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.timeInForce = null; + } /** * Creates a new instance of the `BorrowReq` class. * The builder pattern allows step-by-step construction of a `BorrowReq` object. */ static builder(): BorrowReqBuilder { - return new BorrowReqBuilder(); + return new BorrowReqBuilder(new BorrowReq()); } /** @@ -44,15 +57,15 @@ export class BorrowReq implements Serializable { /** * currency */ - currency?: string; + currency: string; /** * Borrow amount */ - size?: number; + size: number; /** * timeInForce: IOC, FOK */ - timeInForce?: BorrowReq.TimeInForceEnum; + timeInForce: BorrowReq.TimeInForceEnum; /** * symbol, mandatory for isolated margin account */ @@ -71,22 +84,29 @@ export class BorrowReq implements Serializable { obj.size = data.size; obj.timeInForce = data.timeInForce; obj.symbol = data.symbol; - obj.isIsolated = data.isIsolated; - obj.isHf = data.isHf; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } + if (data.isHf) { + obj.isHf = data.isHf; + } else { + obj.isHf = false; + } return obj; } - fromJson(input: string): BorrowReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BorrowReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BorrowReq { - return plainToInstance(BorrowReq, jsonObject); + static fromJson(input: string): BorrowReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BorrowReq { + return plainToClassFromExist(new BorrowReq(), jsonObject); } } @@ -104,7 +124,9 @@ export namespace BorrowReq { } export class BorrowReqBuilder { - obj: BorrowReq = new BorrowReq(); + constructor(readonly obj: BorrowReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts index 4ac95607..266fbf79 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BorrowResp implements Response { +export class BorrowResp implements Response { /** * Borrow Order Id */ - orderNo?: string; + orderNo: string; + /** * Actual borrowed amount */ - actualSize?: string; + actualSize: string; + private constructor() { + // @ts-ignore + this.orderNo = null; + // @ts-ignore + this.actualSize = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class BorrowResp implements Response { this.commonResponse = response; } - fromJson(input: string): BorrowResp { - const jsonObject = JSON.parse(input); - return plainToInstance(BorrowResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BorrowResp { - return plainToInstance(BorrowResp, jsonObject); + static fromJson(input: string): BorrowResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BorrowResp { + return plainToClassFromExist(new BorrowResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts index 1e8cb5be..f33dc0cb 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts @@ -1,49 +1,70 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetBorrowHistoryItems implements Serializable { +export class GetBorrowHistoryItems implements Serializable { /** * Borrow Order Id */ - orderNo?: string; + orderNo: string; + /** * Isolated Margin symbol; empty for cross margin */ - symbol?: string; + symbol: string; + /** * currency */ - currency?: string; + currency: string; + /** * Initiated borrow amount */ - size?: string; + size: string; + /** * Actual borrow amount */ - actualSize?: string; + actualSize: string; + /** * PENDING: Processing, SUCCESS: Successful, FAILED: Failed */ - status?: GetBorrowHistoryItems.StatusEnum; + status: GetBorrowHistoryItems.StatusEnum; + /** * borrow time */ - createdTime?: number; + createdTime: number; - fromJson(input: string): GetBorrowHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetBorrowHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.orderNo = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.actualSize = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.createdTime = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetBorrowHistoryItems { - return plainToInstance(GetBorrowHistoryItems, jsonObject); + static fromJson(input: string): GetBorrowHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetBorrowHistoryItems { + return plainToClassFromExist(new GetBorrowHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts index f902fbcd..d96fd816 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts @@ -1,48 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetBorrowHistoryReq implements Serializable { +export class GetBorrowHistoryReq implements Serializable { /** * currency */ currency?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * Borrow Order Id */ orderNo?: string; + /** * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) */ startTime?: number; + /** * End time */ endTime?: number; + /** * Current query page, with a starting value of 1. Default:1 */ currentPage?: number = 1; + /** * Number of results per page. Default is 50, minimum is 10, maximum is 500 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetBorrowHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetBorrowHistoryReq` object. */ static builder(): GetBorrowHistoryReqBuilder { - return new GetBorrowHistoryReqBuilder(); + return new GetBorrowHistoryReqBuilder(new GetBorrowHistoryReq()); } /** @@ -84,32 +92,45 @@ export class GetBorrowHistoryReq implements Serializable { }): GetBorrowHistoryReq { let obj = new GetBorrowHistoryReq(); obj.currency = data.currency; - obj.isIsolated = data.isIsolated; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } obj.symbol = data.symbol; obj.orderNo = data.orderNo; obj.startTime = data.startTime; obj.endTime = data.endTime; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetBorrowHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetBorrowHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetBorrowHistoryReq { - return plainToInstance(GetBorrowHistoryReq, jsonObject); + static fromJson(input: string): GetBorrowHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetBorrowHistoryReq { + return plainToClassFromExist(new GetBorrowHistoryReq(), jsonObject); } } export class GetBorrowHistoryReqBuilder { - obj: GetBorrowHistoryReq = new GetBorrowHistoryReq(); + constructor(readonly obj: GetBorrowHistoryReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts index 7811de66..fef3a9c0 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts @@ -1,37 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetBorrowHistoryItems } from './model_get_borrow_history_items'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetBorrowHistoryResp implements Response { +export class GetBorrowHistoryResp implements Response { /** * */ - timestamp?: number; + timestamp: number; + /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetBorrowHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -42,16 +61,15 @@ export class GetBorrowHistoryResp implements Response { +export class GetInterestHistoryItems implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Daily interest rate */ - dayRatio?: string; + dayRatio: string; + /** * Interest amount */ - interestAmount?: string; + interestAmount: string; + /** * Interest Timestamp */ - createdTime?: number; + createdTime: number; - fromJson(input: string): GetInterestHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetInterestHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.dayRatio = null; + // @ts-ignore + this.interestAmount = null; + // @ts-ignore + this.createdTime = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetInterestHistoryItems { - return plainToInstance(GetInterestHistoryItems, jsonObject); + static fromJson(input: string): GetInterestHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetInterestHistoryItems { + return plainToClassFromExist(new GetInterestHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts index 325dd493..950a0609 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetInterestHistoryReq implements Serializable { +export class GetInterestHistoryReq implements Serializable { /** * currency */ currency?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) */ startTime?: number; + /** * End time */ endTime?: number; + /** * Current query page, with a starting value of 1. Default:1 */ currentPage?: number = 1; + /** * Number of results per page. Default is 50, minimum is 10, maximum is 500 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetInterestHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetInterestHistoryReq` object. */ static builder(): GetInterestHistoryReqBuilder { - return new GetInterestHistoryReqBuilder(); + return new GetInterestHistoryReqBuilder(new GetInterestHistoryReq()); } /** @@ -76,31 +83,44 @@ export class GetInterestHistoryReq implements Serializable { +export class GetInterestHistoryResp implements Response { /** * */ - timestamp?: number; + timestamp: number; + /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetInterestHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -42,16 +61,15 @@ export class GetInterestHistoryResp implements Response { +export class GetRepayHistoryItems implements Serializable { /** * Repay Order Id */ - orderNo?: string; + orderNo: string; + /** * Isolated Margin symbol; empty for cross margin */ - symbol?: string; + symbol: string; + /** * currency */ - currency?: string; + currency: string; + /** * Amount of initiated repay */ - size?: string; + size: string; + /** * Amount of principal paid */ - principal?: string; + principal: string; + /** * Amount of interest paid */ - interest?: string; + interest: string; + /** * PENDING: Processing, SUCCESS: Successful, FAILED: Failed */ - status?: GetRepayHistoryItems.StatusEnum; + status: GetRepayHistoryItems.StatusEnum; + /** * Repayment time */ - createdTime?: number; + createdTime: number; - fromJson(input: string): GetRepayHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRepayHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.orderNo = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.principal = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.createdTime = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRepayHistoryItems { - return plainToInstance(GetRepayHistoryItems, jsonObject); + static fromJson(input: string): GetRepayHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRepayHistoryItems { + return plainToClassFromExist(new GetRepayHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts index 1786f77f..ca2992fd 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts @@ -1,48 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRepayHistoryReq implements Serializable { +export class GetRepayHistoryReq implements Serializable { /** * currency */ currency?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * Repay Order Id */ orderNo?: string; + /** * The start and end times are not restricted. If the start time is empty or less than 1680278400000, the default value is set to 1680278400000 (April 1, 2023, 00:00:00) */ startTime?: number; + /** * End time */ endTime?: number; + /** * Current query page, with a starting value of 1. Default:1 */ currentPage?: number = 1; + /** * Number of results per page. Default is 50, minimum is 10, maximum is 500 */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetRepayHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetRepayHistoryReq` object. */ static builder(): GetRepayHistoryReqBuilder { - return new GetRepayHistoryReqBuilder(); + return new GetRepayHistoryReqBuilder(new GetRepayHistoryReq()); } /** @@ -84,32 +92,45 @@ export class GetRepayHistoryReq implements Serializable { }): GetRepayHistoryReq { let obj = new GetRepayHistoryReq(); obj.currency = data.currency; - obj.isIsolated = data.isIsolated; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } obj.symbol = data.symbol; obj.orderNo = data.orderNo; obj.startTime = data.startTime; obj.endTime = data.endTime; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetRepayHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRepayHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRepayHistoryReq { - return plainToInstance(GetRepayHistoryReq, jsonObject); + static fromJson(input: string): GetRepayHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRepayHistoryReq { + return plainToClassFromExist(new GetRepayHistoryReq(), jsonObject); } } export class GetRepayHistoryReqBuilder { - obj: GetRepayHistoryReq = new GetRepayHistoryReq(); + constructor(readonly obj: GetRepayHistoryReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts index 26de1e19..26c471f3 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts @@ -1,37 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetRepayHistoryItems } from './model_get_repay_history_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetRepayHistoryResp implements Response { +export class GetRepayHistoryResp implements Response { /** * */ - timestamp?: number; + timestamp: number; + /** * current page */ - currentPage?: number; + currentPage: number; + /** * page size */ - pageSize?: number; + pageSize: number; + /** * total number */ - totalNum?: number; + totalNum: number; + /** * total page */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetRepayHistoryItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -42,16 +61,15 @@ export class GetRepayHistoryResp implements Response { +export class ModifyLeverageReq implements Serializable { /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user\'s current debt leverage or greater than the system\'s maximum leverage */ - leverage?: string; + leverage: string; + private constructor() { + // @ts-ignore + this.leverage = null; + } /** * Creates a new instance of the `ModifyLeverageReq` class. * The builder pattern allows step-by-step construction of a `ModifyLeverageReq` object. */ static builder(): ModifyLeverageReqBuilder { - return new ModifyLeverageReqBuilder(); + return new ModifyLeverageReqBuilder(new ModifyLeverageReq()); } /** @@ -40,31 +46,36 @@ export class ModifyLeverageReq implements Serializable { /** * New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user\'s current debt leverage or greater than the system\'s maximum leverage */ - leverage?: string; + leverage: string; }): ModifyLeverageReq { let obj = new ModifyLeverageReq(); obj.symbol = data.symbol; - obj.isIsolated = data.isIsolated; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } obj.leverage = data.leverage; return obj; } - fromJson(input: string): ModifyLeverageReq { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyLeverageReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyLeverageReq { - return plainToInstance(ModifyLeverageReq, jsonObject); + static fromJson(input: string): ModifyLeverageReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyLeverageReq { + return plainToClassFromExist(new ModifyLeverageReq(), jsonObject); } } export class ModifyLeverageReqBuilder { - obj: ModifyLeverageReq = new ModifyLeverageReq(); + constructor(readonly obj: ModifyLeverageReq) { + this.obj = obj; + } /** * symbol, mandatory for isolated margin account */ diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts index 978bb674..09679abc 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ModifyLeverageResp implements Response { +export class ModifyLeverageResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class ModifyLeverageResp implements Response { +export class RepayReq implements Serializable { /** * currency */ - currency?: string; + currency: string; + /** * Borrow amount */ - size?: number; + size: number; + /** * symbol, mandatory for isolated margin account */ symbol?: string; + /** * true-isolated, false-cross; default is false */ isIsolated?: boolean = false; + /** * true: high frequency borrowing, false: low frequency borrowing; default false */ isHf?: boolean = false; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.size = null; + } /** * Creates a new instance of the `RepayReq` class. * The builder pattern allows step-by-step construction of a `RepayReq` object. */ static builder(): RepayReqBuilder { - return new RepayReqBuilder(); + return new RepayReqBuilder(new RepayReq()); } /** @@ -40,11 +50,11 @@ export class RepayReq implements Serializable { /** * currency */ - currency?: string; + currency: string; /** * Borrow amount */ - size?: number; + size: number; /** * symbol, mandatory for isolated margin account */ @@ -62,27 +72,36 @@ export class RepayReq implements Serializable { obj.currency = data.currency; obj.size = data.size; obj.symbol = data.symbol; - obj.isIsolated = data.isIsolated; - obj.isHf = data.isHf; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } + if (data.isHf) { + obj.isHf = data.isHf; + } else { + obj.isHf = false; + } return obj; } - fromJson(input: string): RepayReq { - const jsonObject = JSON.parse(input); - return plainToInstance(RepayReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RepayReq { - return plainToInstance(RepayReq, jsonObject); + static fromJson(input: string): RepayReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RepayReq { + return plainToClassFromExist(new RepayReq(), jsonObject); } } export class RepayReqBuilder { - obj: RepayReq = new RepayReq(); + constructor(readonly obj: RepayReq) { + this.obj = obj; + } /** * currency */ diff --git a/sdk/node/src/generate/margin/debit/model_repay_resp.ts b/sdk/node/src/generate/margin/debit/model_repay_resp.ts index 5cf6fc83..40496fed 100644 --- a/sdk/node/src/generate/margin/debit/model_repay_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_repay_resp.ts @@ -1,23 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class RepayResp implements Response { +export class RepayResp implements Response { /** * */ - timestamp?: number; + timestamp: number; + /** * Repay Order Id */ - orderNo?: string; + orderNo: string; + /** * Actual repay amount */ - actualSize?: string; + actualSize: string; + private constructor() { + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.orderNo = null; + // @ts-ignore + this.actualSize = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class RepayResp implements Response { this.commonResponse = response; } - fromJson(input: string): RepayResp { - const jsonObject = JSON.parse(input); - return plainToInstance(RepayResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): RepayResp { - return plainToInstance(RepayResp, jsonObject); + static fromJson(input: string): RepayResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): RepayResp { + return plainToClassFromExist(new RepayResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts index 4af50a1c..d94d11dd 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class CrossMarginPositionAssetListValue - implements Serializable -{ +export class CrossMarginPositionAssetListValue implements Serializable { /** * */ @@ -19,16 +17,15 @@ export class CrossMarginPositionAssetListValue */ hold?: string; - fromJson(input: string): CrossMarginPositionAssetListValue { - const jsonObject = JSON.parse(input); - return plainToInstance(CrossMarginPositionAssetListValue, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CrossMarginPositionAssetListValue { - return plainToInstance(CrossMarginPositionAssetListValue, jsonObject); + static fromJson(input: string): CrossMarginPositionAssetListValue { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CrossMarginPositionAssetListValue { + return plainToClassFromExist(new CrossMarginPositionAssetListValue(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index 95d4e8b0..b3a93322 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { CrossMarginPositionAssetListValue } from './model_cross_margin_position_asset_list_value'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CrossMarginPositionEvent implements Response { +export class CrossMarginPositionEvent implements Response { /** * Debt ratio */ @@ -50,17 +50,16 @@ export class CrossMarginPositionEvent implements Response -{ +export class IsolatedMarginPositionChangeAssetsValue implements Serializable { /** * */ @@ -23,16 +21,15 @@ export class IsolatedMarginPositionChangeAssetsValue */ liabilityInterest?: string; - fromJson(input: string): IsolatedMarginPositionChangeAssetsValue { - const jsonObject = JSON.parse(input); - return plainToInstance(IsolatedMarginPositionChangeAssetsValue, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): IsolatedMarginPositionChangeAssetsValue { - return plainToInstance(IsolatedMarginPositionChangeAssetsValue, jsonObject); + static fromJson(input: string): IsolatedMarginPositionChangeAssetsValue { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): IsolatedMarginPositionChangeAssetsValue { + return plainToClassFromExist(new IsolatedMarginPositionChangeAssetsValue(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index 520cfced..743c6198 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -1,14 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { IsolatedMarginPositionChangeAssetsValue } from './model_isolated_margin_position_change_assets_value'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class IsolatedMarginPositionEvent - implements Response -{ +export class IsolatedMarginPositionEvent implements Response { /** * Isolated margin symbol */ @@ -44,17 +42,16 @@ export class IsolatedMarginPositionEvent this.commonResponse = response; } - fromJson(input: string): IsolatedMarginPositionEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(IsolatedMarginPositionEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): IsolatedMarginPositionEvent { - return plainToInstance(IsolatedMarginPositionEvent, jsonObject); + static fromJson(input: string): IsolatedMarginPositionEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): IsolatedMarginPositionEvent { + return plainToClassFromExist(new IsolatedMarginPositionEvent(), jsonObject); } } @@ -141,7 +138,7 @@ export class IsolatedMarginPositionEventCallbackWrapper implements WebSocketMess } onMessage(msg: WsMessage): void { - let event = new IsolatedMarginPositionEvent().fromObject(msg.data); + let event = IsolatedMarginPositionEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index 362b80e6..73593975 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class IndexPriceEvent implements Response { +export class IndexPriceEvent implements Response { /** * */ @@ -33,17 +33,16 @@ export class IndexPriceEvent implements Response { this.commonResponse = response; } - fromJson(input: string): IndexPriceEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(IndexPriceEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): IndexPriceEvent { - return plainToInstance(IndexPriceEvent, jsonObject); + static fromJson(input: string): IndexPriceEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): IndexPriceEvent { + return plainToClassFromExist(new IndexPriceEvent(), jsonObject); } } @@ -59,7 +58,7 @@ export class IndexPriceEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new IndexPriceEvent().fromObject(msg.data); + let event = IndexPriceEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index 9817570c..8bd875b4 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class MarkPriceEvent implements Response { +export class MarkPriceEvent implements Response { /** * */ @@ -33,17 +33,16 @@ export class MarkPriceEvent implements Response { this.commonResponse = response; } - fromJson(input: string): MarkPriceEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(MarkPriceEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarkPriceEvent { - return plainToInstance(MarkPriceEvent, jsonObject); + static fromJson(input: string): MarkPriceEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarkPriceEvent { + return plainToClassFromExist(new MarkPriceEvent(), jsonObject); } } @@ -55,7 +54,7 @@ export class MarkPriceEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new MarkPriceEvent().fromObject(msg.data); + let event = MarkPriceEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/margin/market/api_market.ts b/sdk/node/src/generate/margin/market/api_market.ts index 0351edd3..3ef20655 100644 --- a/sdk/node/src/generate/margin/market/api_market.ts +++ b/sdk/node/src/generate/margin/market/api_market.ts @@ -119,7 +119,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v3/margin/symbols', req, - new GetCrossMarginSymbolsResp(), + GetCrossMarginSymbolsResp, false, ); } @@ -131,7 +131,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/margin/config', null, - new GetMarginConfigResp(), + GetMarginConfigResp, false, ); } @@ -143,7 +143,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v3/etf/info', req, - new GetETFInfoResp(), + GetETFInfoResp, false, ); } @@ -155,7 +155,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v3/mark-price/all-symbols', null, - new GetMarkPriceListResp(), + GetMarkPriceListResp, false, ); } @@ -167,7 +167,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/mark-price/{symbol}/current', req, - new GetMarkPriceDetailResp(), + GetMarkPriceDetailResp, false, ); } @@ -179,7 +179,7 @@ export class MarketAPIImpl implements MarketAPI { 'GET', '/api/v1/isolated/symbols', null, - new GetIsolatedMarginSymbolsResp(), + GetIsolatedMarginSymbolsResp, false, ); } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts index 385b0f8a..3a9fb198 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts @@ -1,84 +1,132 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetCrossMarginSymbolsItems implements Serializable { +export class GetCrossMarginSymbolsItems implements Serializable { /** * symbol */ - symbol?: string; + symbol: string; + /** * symbol name */ - name?: string; + name: string; + /** * Whether trading is enabled: true for enabled, false for disabled */ - enableTrading?: boolean; + enableTrading: boolean; + /** * Trading market */ - market?: string; + market: string; + /** * Base currency,e.g. BTC. */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency,e.g. USDT. */ - quoteCurrency?: string; + quoteCurrency: string; + /** * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. */ - baseIncrement?: string; + baseIncrement: string; + /** * The minimum order quantity requried to place an order. */ - baseMinSize?: string; + baseMinSize: string; + /** * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. */ - quoteIncrement?: string; + quoteIncrement: string; + /** * The minimum order funds required to place a market order. */ - quoteMinSize?: string; + quoteMinSize: string; + /** * The maximum order size required to place an order. */ - baseMaxSize?: string; + baseMaxSize: string; + /** * The maximum order funds required to place a market order. */ - quoteMaxSize?: string; + quoteMaxSize: string; + /** * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. specifies the min order price as well as the price increment.This also applies to quote currency. */ - priceIncrement?: string; + priceIncrement: string; + /** * The currency of charged fees. */ - feeCurrency?: string; + feeCurrency: string; + /** * Threshold for price portection */ - priceLimitRate?: string; + priceLimitRate: string; + /** * the minimum trading amounts */ - minFunds?: string; + minFunds: string; - fromJson(input: string): GetCrossMarginSymbolsItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCrossMarginSymbolsItems, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.name = null; + // @ts-ignore + this.enableTrading = null; + // @ts-ignore + this.market = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.baseIncrement = null; + // @ts-ignore + this.baseMinSize = null; + // @ts-ignore + this.quoteIncrement = null; + // @ts-ignore + this.quoteMinSize = null; + // @ts-ignore + this.baseMaxSize = null; + // @ts-ignore + this.quoteMaxSize = null; + // @ts-ignore + this.priceIncrement = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.priceLimitRate = null; + // @ts-ignore + this.minFunds = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCrossMarginSymbolsItems { - return plainToInstance(GetCrossMarginSymbolsItems, jsonObject); + static fromJson(input: string): GetCrossMarginSymbolsItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCrossMarginSymbolsItems { + return plainToClassFromExist(new GetCrossMarginSymbolsItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts index b4968921..1f0aef24 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetCrossMarginSymbolsReq implements Serializable { +export class GetCrossMarginSymbolsReq implements Serializable { /** * If not provided, all cross margin symbol will be queried. If provided, only the specified symbol will be queried. */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetCrossMarginSymbolsReq` class. * The builder pattern allows step-by-step construction of a `GetCrossMarginSymbolsReq` object. */ static builder(): GetCrossMarginSymbolsReqBuilder { - return new GetCrossMarginSymbolsReqBuilder(); + return new GetCrossMarginSymbolsReqBuilder(new GetCrossMarginSymbolsReq()); } /** @@ -31,22 +32,23 @@ export class GetCrossMarginSymbolsReq implements Serializable -{ +export class GetCrossMarginSymbolsResp implements Response { /** * */ - timestamp?: number; + timestamp: number; + /** * */ @Type(() => GetCrossMarginSymbolsItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -28,16 +33,15 @@ export class GetCrossMarginSymbolsResp this.commonResponse = response; } - fromJson(input: string): GetCrossMarginSymbolsResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCrossMarginSymbolsResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCrossMarginSymbolsResp { - return plainToInstance(GetCrossMarginSymbolsResp, jsonObject); + static fromJson(input: string): GetCrossMarginSymbolsResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCrossMarginSymbolsResp { + return plainToClassFromExist(new GetCrossMarginSymbolsResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts index 5609697f..c40a094b 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts @@ -1,44 +1,62 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetETFInfoData implements Serializable { +export class GetETFInfoData implements Serializable { /** * ETF Currency */ - currency?: string; + currency: string; + /** * Net worth */ - netAsset?: string; + netAsset: string; + /** * Target leverage */ - targetLeverage?: string; + targetLeverage: string; + /** * Actual leverage */ - actualLeverage?: string; + actualLeverage: string; + /** * The amount of currency issued */ - issuedSize?: string; + issuedSize: string; + /** * Basket information */ - basket?: string; + basket: string; - fromJson(input: string): GetETFInfoData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetETFInfoData, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.netAsset = null; + // @ts-ignore + this.targetLeverage = null; + // @ts-ignore + this.actualLeverage = null; + // @ts-ignore + this.issuedSize = null; + // @ts-ignore + this.basket = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetETFInfoData { - return plainToInstance(GetETFInfoData, jsonObject); + static fromJson(input: string): GetETFInfoData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetETFInfoData { + return plainToClassFromExist(new GetETFInfoData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts index f530b7bc..c104f7e8 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetETFInfoReq implements Serializable { +export class GetETFInfoReq implements Serializable { /** * ETF Currency, if empty query all currencies */ currency?: string; + private constructor() {} /** * Creates a new instance of the `GetETFInfoReq` class. * The builder pattern allows step-by-step construction of a `GetETFInfoReq` object. */ static builder(): GetETFInfoReqBuilder { - return new GetETFInfoReqBuilder(); + return new GetETFInfoReqBuilder(new GetETFInfoReq()); } /** @@ -31,22 +32,23 @@ export class GetETFInfoReq implements Serializable { return obj; } - fromJson(input: string): GetETFInfoReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetETFInfoReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetETFInfoReq { - return plainToInstance(GetETFInfoReq, jsonObject); + static fromJson(input: string): GetETFInfoReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetETFInfoReq { + return plainToClassFromExist(new GetETFInfoReq(), jsonObject); } } export class GetETFInfoReqBuilder { - obj: GetETFInfoReq = new GetETFInfoReq(); + constructor(readonly obj: GetETFInfoReq) { + this.obj = obj; + } /** * ETF Currency, if empty query all currencies */ diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts index e619e9b2..1a4ff3a5 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetETFInfoData } from './model_get_etf_info_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetETFInfoResp implements Response { +export class GetETFInfoResp implements Response { /** * */ @Type(() => GetETFInfoData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetETFInfoResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetETFInfoResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetETFInfoResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetETFInfoResp { - return plainToInstance(GetETFInfoResp, { data: jsonObject }); + static fromJson(input: string): GetETFInfoResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetETFInfoResp { + return plainToClassFromExist(new GetETFInfoResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts index f8e6969e..61f1ff0c 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts @@ -1,76 +1,118 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginSymbolsData implements Serializable { +export class GetIsolatedMarginSymbolsData implements Serializable { /** * symbol */ - symbol?: string; + symbol: string; + /** * symbol name */ - symbolName?: string; + symbolName: string; + /** * Base currency,e.g. BTC. */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency,e.g. USDT. */ - quoteCurrency?: string; + quoteCurrency: string; + /** * Max leverage of this symbol */ - maxLeverage?: number; + maxLeverage: number; + /** * */ - flDebtRatio?: string; + flDebtRatio: string; + /** * */ - tradeEnable?: boolean; + tradeEnable: boolean; + /** * */ - autoRenewMaxDebtRatio?: string; + autoRenewMaxDebtRatio: string; + /** * */ - baseBorrowEnable?: boolean; + baseBorrowEnable: boolean; + /** * */ - quoteBorrowEnable?: boolean; + quoteBorrowEnable: boolean; + /** * */ - baseTransferInEnable?: boolean; + baseTransferInEnable: boolean; + /** * */ - quoteTransferInEnable?: boolean; + quoteTransferInEnable: boolean; + /** * */ - baseBorrowCoefficient?: string; + baseBorrowCoefficient: string; + /** * */ - quoteBorrowCoefficient?: string; + quoteBorrowCoefficient: string; - fromJson(input: string): GetIsolatedMarginSymbolsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginSymbolsData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.symbolName = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.maxLeverage = null; + // @ts-ignore + this.flDebtRatio = null; + // @ts-ignore + this.tradeEnable = null; + // @ts-ignore + this.autoRenewMaxDebtRatio = null; + // @ts-ignore + this.baseBorrowEnable = null; + // @ts-ignore + this.quoteBorrowEnable = null; + // @ts-ignore + this.baseTransferInEnable = null; + // @ts-ignore + this.quoteTransferInEnable = null; + // @ts-ignore + this.baseBorrowCoefficient = null; + // @ts-ignore + this.quoteBorrowCoefficient = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetIsolatedMarginSymbolsData { - return plainToInstance(GetIsolatedMarginSymbolsData, jsonObject); + static fromJson(input: string): GetIsolatedMarginSymbolsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginSymbolsData { + return plainToClassFromExist(new GetIsolatedMarginSymbolsData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts index 0521010a..8988fb0e 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts @@ -1,19 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetIsolatedMarginSymbolsData } from './model_get_isolated_margin_symbols_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetIsolatedMarginSymbolsResp - implements Response -{ +export class GetIsolatedMarginSymbolsResp implements Response { /** * */ @Type(() => GetIsolatedMarginSymbolsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetIsolatedMarginSymbolsResp this.commonResponse = response; } - fromJson(input: string): GetIsolatedMarginSymbolsResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetIsolatedMarginSymbolsResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetIsolatedMarginSymbolsResp { - return plainToInstance(GetIsolatedMarginSymbolsResp, { data: jsonObject }); + static fromJson(input: string): GetIsolatedMarginSymbolsResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetIsolatedMarginSymbolsResp { + return plainToClassFromExist(new GetIsolatedMarginSymbolsResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts index e9fbde9a..84fc2f27 100644 --- a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarginConfigResp implements Response { +export class GetMarginConfigResp implements Response { /** * Available currencies for margin trade */ - currencyList?: Array; + currencyList: Array; + /** * Max leverage available */ - maxLeverage?: number; + maxLeverage: number; + /** * The warning debt ratio of the forced liquidation */ - warningDebtRatio?: string; + warningDebtRatio: string; + /** * The debt ratio of the forced liquidation */ - liqDebtRatio?: string; + liqDebtRatio: string; + private constructor() { + // @ts-ignore + this.currencyList = null; + // @ts-ignore + this.maxLeverage = null; + // @ts-ignore + this.warningDebtRatio = null; + // @ts-ignore + this.liqDebtRatio = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class GetMarginConfigResp implements Response { +export class GetMarkPriceDetailReq implements Serializable { /** * symbol */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMarkPriceDetailReq` class. * The builder pattern allows step-by-step construction of a `GetMarkPriceDetailReq` object. */ static builder(): GetMarkPriceDetailReqBuilder { - return new GetMarkPriceDetailReqBuilder(); + return new GetMarkPriceDetailReqBuilder(new GetMarkPriceDetailReq()); } /** @@ -33,22 +34,23 @@ export class GetMarkPriceDetailReq implements Serializable { +export class GetMarkPriceDetailResp implements Response { /** * symbol */ - symbol?: string; + symbol: string; + /** * Timestamp (milliseconds) */ - timePoint?: number; + timePoint: number; + /** * Mark price */ - value?: number; + value: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; + } /** * common response */ @@ -28,16 +38,15 @@ export class GetMarkPriceDetailResp implements Response { +export class GetMarkPriceListData implements Serializable { /** * symbol */ - symbol?: string; + symbol: string; + /** * Timestamp (milliseconds) */ - timePoint?: number; + timePoint: number; + /** * Mark price */ - value?: number; + value: number; - fromJson(input: string): GetMarkPriceListData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarkPriceListData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.timePoint = null; + // @ts-ignore + this.value = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarkPriceListData { - return plainToInstance(GetMarkPriceListData, jsonObject); + static fromJson(input: string): GetMarkPriceListData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarkPriceListData { + return plainToClassFromExist(new GetMarkPriceListData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts index 06f258b8..b6a45680 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetMarkPriceListData } from './model_get_mark_price_list_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarkPriceListResp implements Response { +export class GetMarkPriceListResp implements Response { /** * */ @Type(() => GetMarkPriceListData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetMarkPriceListResp implements Response { +export class AddOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderReq.TypeEnum = AddOrderReq.TypeEnum.LIMIT; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: AddOrderReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading */ timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * true - isolated margin ,false - cross margin. defult as false */ isIsolated?: boolean = false; + /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ autoBorrow?: boolean = false; + /** * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ autoRepay?: boolean = false; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderReq` class. * The builder pattern allows step-by-step construction of a `AddOrderReq` object. */ static builder(): AddOrderReqBuilder { - return new AddOrderReqBuilder(); + return new AddOrderReqBuilder(new AddOrderReq()); } /** @@ -88,15 +112,15 @@ export class AddOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -158,34 +182,65 @@ export class AddOrderReq implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderReq.TypeEnum.LIMIT; + } obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.isIsolated = data.isIsolated; - obj.autoBorrow = data.autoBorrow; - obj.autoRepay = data.autoRepay; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } + if (data.autoBorrow) { + obj.autoBorrow = data.autoBorrow; + } else { + obj.autoBorrow = false; + } + if (data.autoRepay) { + obj.autoRepay = data.autoRepay; + } else { + obj.autoRepay = false; + } return obj; } - fromJson(input: string): AddOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderReq { - return plainToInstance(AddOrderReq, jsonObject); + static fromJson(input: string): AddOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderReq { + return plainToClassFromExist(new AddOrderReq(), jsonObject); } } @@ -249,7 +304,9 @@ export namespace AddOrderReq { } export class AddOrderReqBuilder { - obj: AddOrderReq = new AddOrderReq(); + constructor(readonly obj: AddOrderReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_resp.ts index 12eb4916..94fac442 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderResp implements Response { +export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. */ - loanApplyId?: string; + loanApplyId: string; + /** * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. */ - borrowSize?: string; + borrowSize: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.loanApplyId = null; + // @ts-ignore + this.borrowSize = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddOrderResp implements Response { this.commonResponse = response; } - fromJson(input: string): AddOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderResp { - return plainToInstance(AddOrderResp, jsonObject); + static fromJson(input: string): AddOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderResp { + return plainToClassFromExist(new AddOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts index 028fa68e..57006b90 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts @@ -1,84 +1,108 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderTestReq implements Serializable { +export class AddOrderTestReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderTestReq.TypeEnum = AddOrderTestReq.TypeEnum.LIMIT; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: AddOrderTestReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading */ timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * true - isolated margin ,false - cross margin. defult as false */ isIsolated?: boolean = false; + /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ autoBorrow?: boolean = false; + /** * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ autoRepay?: boolean = false; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderTestReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. */ static builder(): AddOrderTestReqBuilder { - return new AddOrderTestReqBuilder(); + return new AddOrderTestReqBuilder(new AddOrderTestReq()); } /** @@ -88,15 +112,15 @@ export class AddOrderTestReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -158,34 +182,65 @@ export class AddOrderTestReq implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderTestReq.TypeEnum.LIMIT; + } obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.isIsolated = data.isIsolated; - obj.autoBorrow = data.autoBorrow; - obj.autoRepay = data.autoRepay; + if (data.isIsolated) { + obj.isIsolated = data.isIsolated; + } else { + obj.isIsolated = false; + } + if (data.autoBorrow) { + obj.autoBorrow = data.autoBorrow; + } else { + obj.autoBorrow = false; + } + if (data.autoRepay) { + obj.autoRepay = data.autoRepay; + } else { + obj.autoRepay = false; + } return obj; } - fromJson(input: string): AddOrderTestReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestReq { - return plainToInstance(AddOrderTestReq, jsonObject); + static fromJson(input: string): AddOrderTestReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestReq { + return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } } @@ -249,7 +304,9 @@ export namespace AddOrderTestReq { } export class AddOrderTestReqBuilder { - obj: AddOrderTestReq = new AddOrderTestReq(); + constructor(readonly obj: AddOrderTestReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts index bd4372be..38f6b58b 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestResp implements Response { +export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. */ - loanApplyId?: string; + loanApplyId: string; + /** * ID of the borrowing response. The field is returned only after placing the order under the mode of Auto-Borrow. */ - borrowSize?: number; + borrowSize: number; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.loanApplyId = null; + // @ts-ignore + this.borrowSize = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddOrderTestResp implements Response { +export class AddOrderTestV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestV1Req.SideEnum; + side: AddOrderTestV1Req.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderTestV1Req.TypeEnum = AddOrderTestV1Req.TypeEnum.LIMIT; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderTestV1Req.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/api-5176570) is a special strategy used during trading */ timeInForce?: AddOrderTestV1Req.TimeInForceEnum = AddOrderTestV1Req.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * Hidden or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in iceberg orders */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ autoBorrow?: boolean = false; + /** * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ autoRepay?: boolean = false; + /** * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. */ marginModel?: AddOrderTestV1Req.MarginModelEnum = AddOrderTestV1Req.MarginModelEnum.CROSS; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderTestV1Req` class. * The builder pattern allows step-by-step construction of a `AddOrderTestV1Req` object. */ static builder(): AddOrderTestV1ReqBuilder { - return new AddOrderTestV1ReqBuilder(); + return new AddOrderTestV1ReqBuilder(new AddOrderTestV1Req()); } /** @@ -88,15 +112,15 @@ export class AddOrderTestV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestV1Req.SideEnum; + side: AddOrderTestV1Req.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -158,34 +182,65 @@ export class AddOrderTestV1Req implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderTestV1Req.TypeEnum.LIMIT; + } obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestV1Req.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.autoBorrow = data.autoBorrow; - obj.autoRepay = data.autoRepay; - obj.marginModel = data.marginModel; + if (data.autoBorrow) { + obj.autoBorrow = data.autoBorrow; + } else { + obj.autoBorrow = false; + } + if (data.autoRepay) { + obj.autoRepay = data.autoRepay; + } else { + obj.autoRepay = false; + } + if (data.marginModel) { + obj.marginModel = data.marginModel; + } else { + obj.marginModel = AddOrderTestV1Req.MarginModelEnum.CROSS; + } return obj; } - fromJson(input: string): AddOrderTestV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestV1Req { - return plainToInstance(AddOrderTestV1Req, jsonObject); + static fromJson(input: string): AddOrderTestV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestV1Req { + return plainToClassFromExist(new AddOrderTestV1Req(), jsonObject); } } @@ -259,7 +314,9 @@ export namespace AddOrderTestV1Req { } export class AddOrderTestV1ReqBuilder { - obj: AddOrderTestV1Req = new AddOrderTestV1Req(); + constructor(readonly obj: AddOrderTestV1Req) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts index 0c1801ff..47554a27 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestV1Resp implements Response { +export class AddOrderTestV1Resp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. */ - loanApplyId?: string; + loanApplyId: string; + /** * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. */ - borrowSize?: string; + borrowSize: string; + /** * This return value is invalid */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.loanApplyId = null; + // @ts-ignore + this.borrowSize = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddOrderTestV1Resp implements Response { +export class AddOrderV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderV1Req.SideEnum; + side: AddOrderV1Req.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderV1Req.TypeEnum = AddOrderV1Req.TypeEnum.LIMIT; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderV1Req.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderV1Req.TimeInForceEnum = AddOrderV1Req.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * Hidden or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in iceberg orders */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * When Margin Account has inefficient balance, our system autoborrows inefficient assets and opens positions according to the lowest market interest rate. */ autoBorrow?: boolean = false; + /** * AutoPay allows returning borrowed assets when you close a position. Our system automatically triggers the repayment and the maximum repayment amount equals to the filled-order amount. */ autoRepay?: boolean = false; + /** * The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default. */ marginModel?: AddOrderV1Req.MarginModelEnum = AddOrderV1Req.MarginModelEnum.CROSS; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderV1Req` class. * The builder pattern allows step-by-step construction of a `AddOrderV1Req` object. */ static builder(): AddOrderV1ReqBuilder { - return new AddOrderV1ReqBuilder(); + return new AddOrderV1ReqBuilder(new AddOrderV1Req()); } /** @@ -88,15 +112,15 @@ export class AddOrderV1Req implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderV1Req.SideEnum; + side: AddOrderV1Req.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -158,34 +182,65 @@ export class AddOrderV1Req implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderV1Req.TypeEnum.LIMIT; + } obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderV1Req.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.autoBorrow = data.autoBorrow; - obj.autoRepay = data.autoRepay; - obj.marginModel = data.marginModel; + if (data.autoBorrow) { + obj.autoBorrow = data.autoBorrow; + } else { + obj.autoBorrow = false; + } + if (data.autoRepay) { + obj.autoRepay = data.autoRepay; + } else { + obj.autoRepay = false; + } + if (data.marginModel) { + obj.marginModel = data.marginModel; + } else { + obj.marginModel = AddOrderV1Req.MarginModelEnum.CROSS; + } return obj; } - fromJson(input: string): AddOrderV1Req { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderV1Req, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderV1Req { - return plainToInstance(AddOrderV1Req, jsonObject); + static fromJson(input: string): AddOrderV1Req { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderV1Req { + return plainToClassFromExist(new AddOrderV1Req(), jsonObject); } } @@ -259,7 +314,9 @@ export namespace AddOrderV1Req { } export class AddOrderV1ReqBuilder { - obj: AddOrderV1Req = new AddOrderV1Req(); + constructor(readonly obj: AddOrderV1Req) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts index b6834356..ceecdde6 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderV1Resp implements Response { +export class AddOrderV1Resp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Borrow order id. The field is returned only after placing the order under the mode of Auto-Borrow. */ - loanApplyId?: string; + loanApplyId: string; + /** * Borrowed amount. The field is returned only after placing the order under the mode of Auto-Borrow. */ - borrowSize?: string; + borrowSize: string; + /** * This return value is invalid */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.loanApplyId = null; + // @ts-ignore + this.borrowSize = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class AddOrderV1Resp implements Response { this.commonResponse = response; } - fromJson(input: string): AddOrderV1Resp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderV1Resp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderV1Resp { - return plainToInstance(AddOrderV1Resp, jsonObject); + static fromJson(input: string): AddOrderV1Resp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderV1Resp { + return plainToClassFromExist(new AddOrderV1Resp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts index 5a2fad3f..c5a48c3d 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelAllOrdersBySymbolReq implements Serializable { +export class CancelAllOrdersBySymbolReq implements Serializable { /** * symbol */ symbol?: string; + /** * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade */ tradeType?: CancelAllOrdersBySymbolReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. * The builder pattern allows step-by-step construction of a `CancelAllOrdersBySymbolReq` object. */ static builder(): CancelAllOrdersBySymbolReqBuilder { - return new CancelAllOrdersBySymbolReqBuilder(); + return new CancelAllOrdersBySymbolReqBuilder(new CancelAllOrdersBySymbolReq()); } /** @@ -40,17 +42,16 @@ export class CancelAllOrdersBySymbolReq implements Serializable -{ +export class CancelAllOrdersBySymbolResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelAllOrdersBySymbolResp this.commonResponse = response; } - fromJson(input: string): CancelAllOrdersBySymbolResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { - return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + static fromJson(input: string): CancelAllOrdersBySymbolResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { + return plainToClassFromExist(new CancelAllOrdersBySymbolResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts index 0e56abe1..93adba79 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByClientOidReq implements Serializable { +export class CancelOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. */ static builder(): CancelOrderByClientOidReqBuilder { - return new CancelOrderByClientOidReqBuilder(); + return new CancelOrderByClientOidReqBuilder(new CancelOrderByClientOidReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByClientOidReq implements Serializable -{ +export class CancelOrderByClientOidResp implements Response { /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidResp { - return plainToInstance(CancelOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts index 626aa327..50e79618 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByOrderIdReq implements Serializable { +export class CancelOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdReq` object. */ static builder(): CancelOrderByOrderIdReqBuilder { - return new CancelOrderByOrderIdReqBuilder(); + return new CancelOrderByOrderIdReqBuilder(new CancelOrderByOrderIdReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByOrderIdReq implements Serializable { +export class CancelOrderByOrderIdResp implements Response { /** * order id */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelOrderByOrderIdResp implements Response { +export class GetClosedOrdersItems implements Serializable { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetClosedOrdersItems.TypeEnum; + type: GetClosedOrdersItems.TypeEnum; + /** * Buy or sell */ - side?: string; + side: string; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: GetClosedOrdersItems.StpEnum; + /** * */ stop?: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * Time in force */ - timeInForce?: GetClosedOrdersItems.TimeInForceEnum; + timeInForce: GetClosedOrdersItems.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; - fromJson(input: string): GetClosedOrdersItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetClosedOrdersItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetClosedOrdersItems { - return plainToInstance(GetClosedOrdersItems, jsonObject); + static fromJson(input: string): GetClosedOrdersItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetClosedOrdersItems { + return plainToClassFromExist(new GetClosedOrdersItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts index c05e9b59..612ed623 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts @@ -1,48 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetClosedOrdersReq implements Serializable { +export class GetClosedOrdersReq implements Serializable { /** * symbol */ symbol?: string; + /** * Transaction type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade */ tradeType?: GetClosedOrdersReq.TradeTypeEnum; + /** * specify if the order is to \'buy\' or \'sell\' */ side?: GetClosedOrdersReq.SideEnum; + /** * specify if the order is an \'limit\' order or \'market\' order. */ type?: GetClosedOrdersReq.TypeEnum; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ lastId?: number; + /** * Default20,Max100 */ limit?: number = 20; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetClosedOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetClosedOrdersReq` object. */ static builder(): GetClosedOrdersReqBuilder { - return new GetClosedOrdersReqBuilder(); + return new GetClosedOrdersReqBuilder(new GetClosedOrdersReq()); } /** @@ -88,23 +96,26 @@ export class GetClosedOrdersReq implements Serializable { obj.side = data.side; obj.type = data.type; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 20; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetClosedOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetClosedOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetClosedOrdersReq { - return plainToInstance(GetClosedOrdersReq, jsonObject); + static fromJson(input: string): GetClosedOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetClosedOrdersReq { + return plainToClassFromExist(new GetClosedOrdersReq(), jsonObject); } } @@ -142,7 +153,9 @@ export namespace GetClosedOrdersReq { } export class GetClosedOrdersReqBuilder { - obj: GetClosedOrdersReq = new GetClosedOrdersReq(); + constructor(readonly obj: GetClosedOrdersReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts index dce47df4..87acd142 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetClosedOrdersItems } from './model_get_closed_orders_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetClosedOrdersResp implements Response { +export class GetClosedOrdersResp implements Response { /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ - lastId?: number; + lastId: number; + /** * */ @Type(() => GetClosedOrdersItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.lastId = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetClosedOrdersResp implements Response { +export class GetOpenOrdersData implements Serializable { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOpenOrdersData.TypeEnum; + type: GetOpenOrdersData.TypeEnum; + /** * Buy or sell */ - side?: GetOpenOrdersData.SideEnum; + side: GetOpenOrdersData.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * trading fee */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: GetOpenOrdersData.StpEnum; + /** * */ stop?: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * Time in force */ - timeInForce?: GetOpenOrdersData.TimeInForceEnum; + timeInForce: GetOpenOrdersData.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; - fromJson(input: string): GetOpenOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOpenOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOpenOrdersData { - return plainToInstance(GetOpenOrdersData, jsonObject); + static fromJson(input: string): GetOpenOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOpenOrdersData { + return plainToClassFromExist(new GetOpenOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts index 485d2b48..74fe2e7f 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOpenOrdersReq implements Serializable { +export class GetOpenOrdersReq implements Serializable { /** * symbol */ symbol?: string; + /** * Order type: MARGIN_TRADE - cross margin trading order, MARGIN_ISOLATED_TRADE - isolated margin trading order */ tradeType?: GetOpenOrdersReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetOpenOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetOpenOrdersReq` object. */ static builder(): GetOpenOrdersReqBuilder { - return new GetOpenOrdersReqBuilder(); + return new GetOpenOrdersReqBuilder(new GetOpenOrdersReq()); } /** @@ -40,17 +42,16 @@ export class GetOpenOrdersReq implements Serializable { return obj; } - fromJson(input: string): GetOpenOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOpenOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOpenOrdersReq { - return plainToInstance(GetOpenOrdersReq, jsonObject); + static fromJson(input: string): GetOpenOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOpenOrdersReq { + return plainToClassFromExist(new GetOpenOrdersReq(), jsonObject); } } @@ -68,7 +69,9 @@ export namespace GetOpenOrdersReq { } export class GetOpenOrdersReqBuilder { - obj: GetOpenOrdersReq = new GetOpenOrdersReq(); + constructor(readonly obj: GetOpenOrdersReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts index fda90ac5..4c955bed 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetOpenOrdersData } from './model_get_open_orders_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOpenOrdersResp implements Response { +export class GetOpenOrdersResp implements Response { /** * */ @Type(() => GetOpenOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetOpenOrdersResp implements Response { +export class GetOrderByClientOidReq implements Serializable { /** * symbol */ symbol?: string; + /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. */ static builder(): GetOrderByClientOidReqBuilder { - return new GetOrderByClientOidReqBuilder(); + return new GetOrderByClientOidReqBuilder(new GetOrderByClientOidReq()); } /** @@ -42,22 +44,23 @@ export class GetOrderByClientOidReq implements Serializable { +export class GetOrderByClientOidResp implements Response { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOrderByClientOidResp.TypeEnum; + type: GetOrderByClientOidResp.TypeEnum; + /** * Buy or sell */ - side?: GetOrderByClientOidResp.SideEnum; + side: GetOrderByClientOidResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: GetOrderByClientOidResp.StpEnum; + /** * */ stop?: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * Time in force */ - timeInForce?: GetOrderByClientOidResp.TimeInForceEnum; + timeInForce: GetOrderByClientOidResp.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; + } /** * common response */ @@ -164,17 +268,16 @@ export class GetOrderByClientOidResp implements Response { +export class GetOrderByOrderIdReq implements Serializable { /** * symbol */ symbol?: string; + /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. */ static builder(): GetOrderByOrderIdReqBuilder { - return new GetOrderByOrderIdReqBuilder(); + return new GetOrderByOrderIdReqBuilder(new GetOrderByOrderIdReq()); } /** @@ -42,22 +44,23 @@ export class GetOrderByOrderIdReq implements Serializable return obj; } - fromJson(input: string): GetOrderByOrderIdReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderByOrderIdReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderByOrderIdReq { - return plainToInstance(GetOrderByOrderIdReq, jsonObject); + static fromJson(input: string): GetOrderByOrderIdReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } } export class GetOrderByOrderIdReqBuilder { - obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + constructor(readonly obj: GetOrderByOrderIdReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts index 315e04b2..aef6d50f 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts @@ -1,159 +1,265 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOrderByOrderIdResp implements Response { +export class GetOrderByOrderIdResp implements Response { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOrderByOrderIdResp.TypeEnum; + type: GetOrderByOrderIdResp.TypeEnum; + /** * Buy or sell */ - side?: GetOrderByOrderIdResp.SideEnum; + side: GetOrderByOrderIdResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into these strategies: CN, CO, CB , and DC */ stp?: GetOrderByOrderIdResp.StpEnum; + /** * */ stop?: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * Time in force */ - timeInForce?: GetOrderByOrderIdResp.TimeInForceEnum; + timeInForce: GetOrderByOrderIdResp.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ - remark?: string; + remark: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; + } /** * common response */ @@ -164,17 +270,16 @@ export class GetOrderByOrderIdResp implements Response { +export class GetSymbolsWithOpenOrderReq implements Serializable { /** * Cross Margin: MARGIN_TRADE, Isolated Margin: MARGIN_ISOLATED_TRADE */ tradeType?: GetSymbolsWithOpenOrderReq.TradeTypeEnum; + private constructor() {} /** * Creates a new instance of the `GetSymbolsWithOpenOrderReq` class. * The builder pattern allows step-by-step construction of a `GetSymbolsWithOpenOrderReq` object. */ static builder(): GetSymbolsWithOpenOrderReqBuilder { - return new GetSymbolsWithOpenOrderReqBuilder(); + return new GetSymbolsWithOpenOrderReqBuilder(new GetSymbolsWithOpenOrderReq()); } /** @@ -31,17 +32,16 @@ export class GetSymbolsWithOpenOrderReq implements Serializable -{ +export class GetSymbolsWithOpenOrderResp implements Response { /** * Symbol Size */ - symbolSize?: number; + symbolSize: number; + /** * The symbol that has active orders */ - symbols?: Array; + symbols: Array; + private constructor() { + // @ts-ignore + this.symbolSize = null; + // @ts-ignore + this.symbols = null; + } /** * common response */ @@ -26,16 +31,15 @@ export class GetSymbolsWithOpenOrderResp this.commonResponse = response; } - fromJson(input: string): GetSymbolsWithOpenOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { - return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + static fromJson(input: string): GetSymbolsWithOpenOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { + return plainToClassFromExist(new GetSymbolsWithOpenOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts index ef06cab8..6c7832ec 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts @@ -1,101 +1,161 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryItems implements Serializable { +export class GetTradeHistoryItems implements Serializable { /** * Id of transaction detail */ - id?: number; + id: number; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Trade Id, symbol latitude increment */ - tradeId?: number; + tradeId: number; + /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; + /** * Counterparty order Id */ - counterOrderId?: string; + counterOrderId: string; + /** * Buy or sell */ - side?: GetTradeHistoryItems.SideEnum; + side: GetTradeHistoryItems.SideEnum; + /** * Liquidity type: taker or maker */ - liquidity?: GetTradeHistoryItems.LiquidityEnum; + liquidity: GetTradeHistoryItems.LiquidityEnum; + /** * */ - forceTaker?: boolean; + forceTaker: boolean; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * Fee rate */ - feeRate?: string; + feeRate: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty */ - stop?: string; + stop: string; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Tax Rate, Users in some regions need query this field */ - taxRate?: string; + taxRate: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetTradeHistoryItems.TypeEnum; + type: GetTradeHistoryItems.TypeEnum; + /** * */ - createdAt?: number; + createdAt: number; - fromJson(input: string): GetTradeHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.counterOrderId = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.liquidity = null; + // @ts-ignore + this.forceTaker = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeRate = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.taxRate = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.createdAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryItems { - return plainToInstance(GetTradeHistoryItems, jsonObject); + static fromJson(input: string): GetTradeHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts index 345f370a..de217296 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts @@ -1,52 +1,61 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryReq implements Serializable { +export class GetTradeHistoryReq implements Serializable { /** * symbol */ symbol?: string; + /** * Trade type: MARGIN_TRADE - cross margin trade, MARGIN_ISOLATED_TRADE - isolated margin trade */ tradeType?: GetTradeHistoryReq.TradeTypeEnum; + /** * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) */ orderId?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ side?: GetTradeHistoryReq.SideEnum; + /** * specify if the order is an \'limit\' order or \'market\' order. */ type?: GetTradeHistoryReq.TypeEnum; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ lastId?: number; + /** * Default100,Max200 */ limit?: number = 20; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. */ static builder(): GetTradeHistoryReqBuilder { - return new GetTradeHistoryReqBuilder(); + return new GetTradeHistoryReqBuilder(new GetTradeHistoryReq()); } /** @@ -97,23 +106,26 @@ export class GetTradeHistoryReq implements Serializable { obj.side = data.side; obj.type = data.type; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 20; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetTradeHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryReq { - return plainToInstance(GetTradeHistoryReq, jsonObject); + static fromJson(input: string): GetTradeHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } } @@ -151,7 +163,9 @@ export namespace GetTradeHistoryReq { } export class GetTradeHistoryReqBuilder { - obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + constructor(readonly obj: GetTradeHistoryReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts index f970c961..641f94ab 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetTradeHistoryItems } from './model_get_trade_history_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTradeHistoryResp implements Response { +export class GetTradeHistoryResp implements Response { /** * */ @Type(() => GetTradeHistoryItems) - items?: Array; + items: Array; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ - lastId?: number; + lastId: number; + private constructor() { + // @ts-ignore + this.items = null; + // @ts-ignore + this.lastId = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetTradeHistoryResp implements Response { +export class GetMarginRiskLimitData implements Serializable { /** * Time stamp */ timestamp?: number; + /** * CROSS MARGIN RESPONSES, Currency */ currency?: string; + /** * CROSS MARGIN RESPONSES, Maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. */ borrowMaxAmount?: string; + /** * CROSS MARGIN RESPONSES, Maximum buy amount */ buyMaxAmount?: string; + /** * CROSS MARGIN RESPONSES, Maximum holding amount */ holdMaxAmount?: string; + /** * CROSS MARGIN RESPONSES, [Borrow Coefficient](https://www.kucoin.com/land/price-protect) */ borrowCoefficient?: string; + /** * CROSS MARGIN RESPONSES, [Margin Coefficient](https://www.kucoin.com/land/price-protect) */ marginCoefficient?: string; + /** * CROSS MARGIN RESPONSES, Currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 */ precision?: number; + /** * CROSS MARGIN RESPONSES, Minimum personal borrow amount */ borrowMinAmount?: string; + /** * CROSS MARGIN RESPONSES, Minimum unit for borrowing, the borrowed amount must be an integer multiple of this value */ borrowMinUnit?: string; + /** * CROSS MARGIN RESPONSES, Whether to support borrowing */ borrowEnabled?: boolean; + /** * ISOLATED MARGIN RESPONSES, Symbol */ symbol?: string; + /** * ISOLATED MARGIN RESPONSES, Base maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. */ baseMaxBorrowAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Quote maximum personal borrow amount. If the platform has no borrowing amount, this value will still be displayed. */ quoteMaxBorrowAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Base maximum buy amount */ baseMaxBuyAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Quote maximum buy amount */ quoteMaxBuyAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Base maximum holding amount */ baseMaxHoldAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Quote maximum holding amount */ quoteMaxHoldAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Base currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 */ basePrecision?: number; + /** * ISOLATED MARGIN RESPONSES, Quote currency precision. the minimum repayment amount of a single transaction should be >= currency precision, for example, the precision of ETH is 8, and the minimum repayment amount is 0.00000001 */ quotePrecision?: number; + /** * ISOLATED MARGIN RESPONSES, Base minimum personal borrow amount */ baseBorrowMinAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Quote minimum personal borrow amount */ quoteBorrowMinAmount?: string; + /** * ISOLATED MARGIN RESPONSES, Base minimum unit for borrowing, the borrowed amount must be an integer multiple of this value */ baseBorrowMinUnit?: string; + /** * ISOLATED MARGIN RESPONSES, Quote minimum unit for borrowing, the borrowed amount must be an integer multiple of this value */ quoteBorrowMinUnit?: string; + /** * ISOLATED MARGIN RESPONSES, Base whether to support borrowing */ baseBorrowEnabled?: boolean; + /** * ISOLATED MARGIN RESPONSES, Quote whether to support borrowing */ quoteBorrowEnabled?: boolean; + /** * ISOLATED MARGIN RESPONSES, [Base Borrow Coefficient](https://www.kucoin.com/land/price-protect) */ baseBorrowCoefficient?: string; + /** * ISOLATED MARGIN RESPONSES, [Quote Borrow Coefficient](https://www.kucoin.com/land/price-protect) */ quoteBorrowCoefficient?: string; + /** * ISOLATED MARGIN RESPONSES, [Base Margin Coefficient](https://www.kucoin.com/land/price-protect) */ baseMarginCoefficient?: string; + /** * ISOLATED MARGIN RESPONSES, [Quote Margin Coefficient](https://www.kucoin.com/land/price-protect) */ quoteMarginCoefficient?: string; - fromJson(input: string): GetMarginRiskLimitData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetMarginRiskLimitData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetMarginRiskLimitData { - return plainToInstance(GetMarginRiskLimitData, jsonObject); + static fromJson(input: string): GetMarginRiskLimitData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetMarginRiskLimitData { + return plainToClassFromExist(new GetMarginRiskLimitData(), jsonObject); } } diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts index a41d1178..994056a4 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts @@ -1,28 +1,31 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetMarginRiskLimitReq implements Serializable { +export class GetMarginRiskLimitReq implements Serializable { /** * true-isolated, false-cross */ isIsolated?: boolean; + /** * currency, This field is only required for cross margin */ currency?: string; + /** * symbol, This field is only required for isolated margin */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetMarginRiskLimitReq` class. * The builder pattern allows step-by-step construction of a `GetMarginRiskLimitReq` object. */ static builder(): GetMarginRiskLimitReqBuilder { - return new GetMarginRiskLimitReqBuilder(); + return new GetMarginRiskLimitReqBuilder(new GetMarginRiskLimitReq()); } /** @@ -49,22 +52,23 @@ export class GetMarginRiskLimitReq implements Serializable { +export class GetMarginRiskLimitResp implements Response { /** * */ @Type(() => GetMarginRiskLimitData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetMarginRiskLimitResp implements Response { +export class Get24hrStatsReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `Get24hrStatsReq` class. * The builder pattern allows step-by-step construction of a `Get24hrStatsReq` object. */ static builder(): Get24hrStatsReqBuilder { - return new Get24hrStatsReqBuilder(); + return new Get24hrStatsReqBuilder(new Get24hrStatsReq()); } /** @@ -31,22 +32,23 @@ export class Get24hrStatsReq implements Serializable { return obj; } - fromJson(input: string): Get24hrStatsReq { - const jsonObject = JSON.parse(input); - return plainToInstance(Get24hrStatsReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): Get24hrStatsReq { - return plainToInstance(Get24hrStatsReq, jsonObject); + static fromJson(input: string): Get24hrStatsReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): Get24hrStatsReq { + return plainToClassFromExist(new Get24hrStatsReq(), jsonObject); } } export class Get24hrStatsReqBuilder { - obj: Get24hrStatsReq = new Get24hrStatsReq(); + constructor(readonly obj: Get24hrStatsReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts index 411fa7e8..46649e62 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts @@ -1,75 +1,124 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class Get24hrStatsResp implements Response { +export class Get24hrStatsResp implements Response { /** * timestamp */ - time?: number; + time: number; + /** * Symbol */ - symbol?: string; + symbol: string; + /** * Best bid price */ - buy?: string; + buy: string; + /** * Best ask price */ - sell?: string; + sell: string; + /** * 24h change rate */ - changeRate?: string; + changeRate: string; + /** * 24h change price */ - changePrice?: string; + changePrice: string; + /** * Highest price in 24h */ - high?: string; + high: string; + /** * Lowest price in 24h */ - low?: string; + low: string; + /** * 24h volume, executed based on base currency */ - vol?: string; + vol: string; + /** * 24h traded amount */ - volValue?: string; + volValue: string; + /** * Last traded price */ - last?: string; + last: string; + /** * Average trading price in the last 24 hours */ - averagePrice?: string; + averagePrice: string; + /** * Basic Taker Fee */ - takerFeeRate?: string; + takerFeeRate: string; + /** * Basic Maker Fee */ - makerFeeRate?: string; + makerFeeRate: string; + /** * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - takerCoefficient?: string; + takerCoefficient: string; + /** * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - makerCoefficient?: string; + makerCoefficient: string; + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.buy = null; + // @ts-ignore + this.sell = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + // @ts-ignore + this.last = null; + // @ts-ignore + this.averagePrice = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.takerCoefficient = null; + // @ts-ignore + this.makerCoefficient = null; + } /** * common response */ @@ -80,16 +129,15 @@ export class Get24hrStatsResp implements Response { +export class GetAllCurrenciesData implements Serializable { /** * A unique currency code that will never change */ - currency?: string; + currency: string; + /** * Currency name, will change after renaming */ - name?: string; + name: string; + /** * Full name of a currency, will change after renaming */ - fullName?: string; + fullName: string; + /** * Currency precision */ - precision?: number; + precision: number; + /** * Number of block confirmations */ - confirms?: number; + confirms: number; + /** * Contract address */ - contractAddress?: string; + contractAddress: string; + /** * Support margin or not */ - isMarginEnabled?: boolean; + isMarginEnabled: boolean; + /** * Support debit or not */ - isDebitEnabled?: boolean; + isDebitEnabled: boolean; + /** * chain list */ @Type(() => GetAllCurrenciesDataChains) - chains?: Array; + chains: Array; - fromJson(input: string): GetAllCurrenciesData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllCurrenciesData, jsonObject); + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.name = null; + // @ts-ignore + this.fullName = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.confirms = null; + // @ts-ignore + this.contractAddress = null; + // @ts-ignore + this.isMarginEnabled = null; + // @ts-ignore + this.isDebitEnabled = null; + // @ts-ignore + this.chains = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllCurrenciesData { - return plainToInstance(GetAllCurrenciesData, jsonObject); + static fromJson(input: string): GetAllCurrenciesData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllCurrenciesData { + return plainToClassFromExist(new GetAllCurrenciesData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts index 0b36fa7b..368f55d7 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts @@ -1,92 +1,140 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAllCurrenciesDataChains implements Serializable { +export class GetAllCurrenciesDataChains implements Serializable { /** * chain name of currency */ - chainName?: string; + chainName: string; + /** * Minimum withdrawal amount */ - withdrawalMinSize?: string; + withdrawalMinSize: string; + /** * Minimum deposit amount */ - depositMinSize?: string; + depositMinSize: string; + /** * withdraw fee rate */ - withdrawFeeRate?: string; + withdrawFeeRate: string; + /** * Minimum fees charged for withdrawal */ - withdrawalMinFee?: string; + withdrawalMinFee: string; + /** * Support withdrawal or not */ - isWithdrawEnabled?: boolean; + isWithdrawEnabled: boolean; + /** * Support deposit or not */ - isDepositEnabled?: boolean; + isDepositEnabled: boolean; + /** * Number of block confirmations */ - confirms?: number; + confirms: number; + /** * The number of blocks (confirmations) for advance on-chain verification */ - preConfirms?: number; + preConfirms: number; + /** * Contract address */ - contractAddress?: string; + contractAddress: string; + /** * Withdrawal precision bit, indicating the maximum supported length after the decimal point of the withdrawal amount */ - withdrawPrecision?: number; + withdrawPrecision: number; + /** * Maximum amount of single withdrawal */ - maxWithdraw?: string; + maxWithdraw: string; + /** * Maximum amount of single deposit (only applicable to Lightning Network) */ - maxDeposit?: string; + maxDeposit: string; + /** * whether memo/tag is needed */ - needTag?: boolean; + needTag: boolean; + /** * chain id of currency */ - chainId?: string; + chainId: string; + /** * deposit fee rate (some currencies have this param, the default is empty) */ depositFeeRate?: string; + /** * withdraw max fee(some currencies have this param, the default is empty) */ withdrawMaxFee?: string; + /** * */ depositTierFee?: string; - fromJson(input: string): GetAllCurrenciesDataChains { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllCurrenciesDataChains, jsonObject); + private constructor() { + // @ts-ignore + this.chainName = null; + // @ts-ignore + this.withdrawalMinSize = null; + // @ts-ignore + this.depositMinSize = null; + // @ts-ignore + this.withdrawFeeRate = null; + // @ts-ignore + this.withdrawalMinFee = null; + // @ts-ignore + this.isWithdrawEnabled = null; + // @ts-ignore + this.isDepositEnabled = null; + // @ts-ignore + this.confirms = null; + // @ts-ignore + this.preConfirms = null; + // @ts-ignore + this.contractAddress = null; + // @ts-ignore + this.withdrawPrecision = null; + // @ts-ignore + this.maxWithdraw = null; + // @ts-ignore + this.maxDeposit = null; + // @ts-ignore + this.needTag = null; + // @ts-ignore + this.chainId = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllCurrenciesDataChains { - return plainToInstance(GetAllCurrenciesDataChains, jsonObject); + static fromJson(input: string): GetAllCurrenciesDataChains { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllCurrenciesDataChains { + return plainToClassFromExist(new GetAllCurrenciesDataChains(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts index 83ad6e80..e5e99f90 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAllCurrenciesData } from './model_get_all_currencies_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAllCurrenciesResp implements Response { +export class GetAllCurrenciesResp implements Response { /** * */ @Type(() => GetAllCurrenciesData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetAllCurrenciesResp implements Response { +export class GetAllSymbolsData implements Serializable { /** * unique code of a symbol, it would not change after renaming */ - symbol?: string; + symbol: string; + /** * Name of trading pairs, it would change after renaming */ - name?: string; + name: string; + /** * Base currency,e.g. BTC. */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency,e.g. USDT. */ - quoteCurrency?: string; + quoteCurrency: string; + /** * The currency of charged fees. */ - feeCurrency?: string; + feeCurrency: string; + /** * The trading market. */ - market?: string; + market: string; + /** * The minimum order quantity requried to place an order. */ - baseMinSize?: string; + baseMinSize: string; + /** * The minimum order funds required to place a market order. */ - quoteMinSize?: string; + quoteMinSize: string; + /** * The maximum order size required to place an order. */ - baseMaxSize?: string; + baseMaxSize: string; + /** * The maximum order funds required to place a market order. */ - quoteMaxSize?: string; + quoteMaxSize: string; + /** * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. */ - baseIncrement?: string; + baseIncrement: string; + /** * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. */ - quoteIncrement?: string; + quoteIncrement: string; + /** * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. specifies the min order price as well as the price increment.This also applies to quote currency. */ - priceIncrement?: string; + priceIncrement: string; + /** * Threshold for price portection */ - priceLimitRate?: string; + priceLimitRate: string; + /** * the minimum trading amounts */ - minFunds?: string; + minFunds: string; + /** * Available for margin or not. */ - isMarginEnabled?: boolean; + isMarginEnabled: boolean; + /** * Available for transaction or not. */ - enableTrading?: boolean; + enableTrading: boolean; + /** * [Fee Type](https://www.kucoin.com/vip/privilege) */ - feeCategory?: GetAllSymbolsData.FeeCategoryEnum; + feeCategory: GetAllSymbolsData.FeeCategoryEnum; + /** * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - makerFeeCoefficient?: string; + makerFeeCoefficient: string; + /** * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - takerFeeCoefficient?: string; + takerFeeCoefficient: string; + /** * Whether it is an [Special Treatment](https://www.kucoin.com/legal/special-treatment) symbol */ - st?: boolean; + st: boolean; - fromJson(input: string): GetAllSymbolsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllSymbolsData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.name = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.market = null; + // @ts-ignore + this.baseMinSize = null; + // @ts-ignore + this.quoteMinSize = null; + // @ts-ignore + this.baseMaxSize = null; + // @ts-ignore + this.quoteMaxSize = null; + // @ts-ignore + this.baseIncrement = null; + // @ts-ignore + this.quoteIncrement = null; + // @ts-ignore + this.priceIncrement = null; + // @ts-ignore + this.priceLimitRate = null; + // @ts-ignore + this.minFunds = null; + // @ts-ignore + this.isMarginEnabled = null; + // @ts-ignore + this.enableTrading = null; + // @ts-ignore + this.feeCategory = null; + // @ts-ignore + this.makerFeeCoefficient = null; + // @ts-ignore + this.takerFeeCoefficient = null; + // @ts-ignore + this.st = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllSymbolsData { - return plainToInstance(GetAllSymbolsData, jsonObject); + static fromJson(input: string): GetAllSymbolsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllSymbolsData { + return plainToClassFromExist(new GetAllSymbolsData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts index 98149e74..258a86ff 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAllSymbolsReq implements Serializable { +export class GetAllSymbolsReq implements Serializable { /** * [The trading market](https://www.kucoin.com/docs-new/api-222921786) */ market?: string; + private constructor() {} /** * Creates a new instance of the `GetAllSymbolsReq` class. * The builder pattern allows step-by-step construction of a `GetAllSymbolsReq` object. */ static builder(): GetAllSymbolsReqBuilder { - return new GetAllSymbolsReqBuilder(); + return new GetAllSymbolsReqBuilder(new GetAllSymbolsReq()); } /** @@ -31,22 +32,23 @@ export class GetAllSymbolsReq implements Serializable { return obj; } - fromJson(input: string): GetAllSymbolsReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllSymbolsReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllSymbolsReq { - return plainToInstance(GetAllSymbolsReq, jsonObject); + static fromJson(input: string): GetAllSymbolsReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllSymbolsReq { + return plainToClassFromExist(new GetAllSymbolsReq(), jsonObject); } } export class GetAllSymbolsReqBuilder { - obj: GetAllSymbolsReq = new GetAllSymbolsReq(); + constructor(readonly obj: GetAllSymbolsReq) { + this.obj = obj; + } /** * [The trading market](https://www.kucoin.com/docs-new/api-222921786) */ diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts index ebcad026..9c443b60 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetAllSymbolsData } from './model_get_all_symbols_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAllSymbolsResp implements Response { +export class GetAllSymbolsResp implements Response { /** * */ @Type(() => GetAllSymbolsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetAllSymbolsResp implements Response { +export class GetAllTickersResp implements Response { /** * timestamp */ - time?: number; + time: number; + /** * */ @Type(() => GetAllTickersTicker) - ticker?: Array; + ticker: Array; + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.ticker = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetAllTickersResp implements Response { +export class GetAllTickersTicker implements Serializable { /** * Symbol */ - symbol?: string; + symbol: string; + /** * Name of trading pairs, it would change after renaming */ - symbolName?: string; + symbolName: string; + /** * Best bid price */ - buy?: string; + buy: string; + /** * Best bid size */ - bestBidSize?: string; + bestBidSize: string; + /** * Best ask price */ - sell?: string; + sell: string; + /** * Best ask size */ - bestAskSize?: string; + bestAskSize: string; + /** * 24h change rate */ - changeRate?: string; + changeRate: string; + /** * 24h change price */ - changePrice?: string; + changePrice: string; + /** * Highest price in 24h */ - high?: string; + high: string; + /** * Lowest price in 24h */ - low?: string; + low: string; + /** * 24h volume, executed based on base currency */ - vol?: string; + vol: string; + /** * 24h traded amount */ - volValue?: string; + volValue: string; + /** * Last traded price */ - last?: string; + last: string; + /** * Average trading price in the last 24 hours */ - averagePrice?: string; + averagePrice: string; + /** * Basic Taker Fee */ - takerFeeRate?: string; + takerFeeRate: string; + /** * Basic Maker Fee */ - makerFeeRate?: string; + makerFeeRate: string; + /** * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - takerCoefficient?: GetAllTickersTicker.TakerCoefficientEnum; + takerCoefficient: GetAllTickersTicker.TakerCoefficientEnum; + /** * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - makerCoefficient?: GetAllTickersTicker.MakerCoefficientEnum; + makerCoefficient: GetAllTickersTicker.MakerCoefficientEnum; - fromJson(input: string): GetAllTickersTicker { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAllTickersTicker, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.symbolName = null; + // @ts-ignore + this.buy = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.sell = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + // @ts-ignore + this.last = null; + // @ts-ignore + this.averagePrice = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.takerCoefficient = null; + // @ts-ignore + this.makerCoefficient = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAllTickersTicker { - return plainToInstance(GetAllTickersTicker, jsonObject); + static fromJson(input: string): GetAllTickersTicker { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAllTickersTicker { + return plainToClassFromExist(new GetAllTickersTicker(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts index 47feb856..71284de2 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts @@ -1,48 +1,69 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAnnouncementsItems implements Serializable { +export class GetAnnouncementsItems implements Serializable { /** * Announcement ID */ - annId?: number; + annId: number; + /** * Announcement title */ - annTitle?: string; + annTitle: string; + /** * Announcement type */ - annType?: Array; + annType: Array; + /** * Announcement description */ - annDesc?: string; + annDesc: string; + /** * Announcement release time, Unix millisecond timestamp format */ - cTime?: number; + cTime: number; + /** * language type */ - language?: string; + language: string; + /** * Announcement link */ - annUrl?: string; + annUrl: string; - fromJson(input: string): GetAnnouncementsItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAnnouncementsItems, jsonObject); + private constructor() { + // @ts-ignore + this.annId = null; + // @ts-ignore + this.annTitle = null; + // @ts-ignore + this.annType = null; + // @ts-ignore + this.annDesc = null; + // @ts-ignore + this.cTime = null; + // @ts-ignore + this.language = null; + // @ts-ignore + this.annUrl = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAnnouncementsItems { - return plainToInstance(GetAnnouncementsItems, jsonObject); + static fromJson(input: string): GetAnnouncementsItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAnnouncementsItems { + return plainToClassFromExist(new GetAnnouncementsItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts index 790910b3..09e50886 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts @@ -1,41 +1,47 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAnnouncementsReq implements Serializable { +export class GetAnnouncementsReq implements Serializable { /** * page number */ currentPage?: number; + /** * page Size */ pageSize?: number; + /** * Announcement types: latest-announcements , activities (latest activities), new-listings (new currency online), product-updates (product updates), vip (institutions and VIPs), maintenance-updates (system maintenance), product -updates (product news), delistings (currency offline), others, api-campaigns (API user activities), default : latest-announcements */ annType?: GetAnnouncementsReq.AnnTypeEnum = GetAnnouncementsReq.AnnTypeEnum.LATEST_ANNOUNCEMENTS; + /** * Language type, the default is en_US, the specific value parameters are as follows */ lang?: GetAnnouncementsReq.LangEnum = GetAnnouncementsReq.LangEnum.EN_US; + /** * Announcement online start time (milliseconds) */ startTime?: number; + /** * Announcement online end time (milliseconds) */ endTime?: number; + private constructor() {} /** * Creates a new instance of the `GetAnnouncementsReq` class. * The builder pattern allows step-by-step construction of a `GetAnnouncementsReq` object. */ static builder(): GetAnnouncementsReqBuilder { - return new GetAnnouncementsReqBuilder(); + return new GetAnnouncementsReqBuilder(new GetAnnouncementsReq()); } /** @@ -70,24 +76,31 @@ export class GetAnnouncementsReq implements Serializable { let obj = new GetAnnouncementsReq(); obj.currentPage = data.currentPage; obj.pageSize = data.pageSize; - obj.annType = data.annType; - obj.lang = data.lang; + if (data.annType) { + obj.annType = data.annType; + } else { + obj.annType = GetAnnouncementsReq.AnnTypeEnum.LATEST_ANNOUNCEMENTS; + } + if (data.lang) { + obj.lang = data.lang; + } else { + obj.lang = GetAnnouncementsReq.LangEnum.EN_US; + } obj.startTime = data.startTime; obj.endTime = data.endTime; return obj; } - fromJson(input: string): GetAnnouncementsReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAnnouncementsReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAnnouncementsReq { - return plainToInstance(GetAnnouncementsReq, jsonObject); + static fromJson(input: string): GetAnnouncementsReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAnnouncementsReq { + return plainToClassFromExist(new GetAnnouncementsReq(), jsonObject); } } @@ -223,7 +236,9 @@ export namespace GetAnnouncementsReq { } export class GetAnnouncementsReqBuilder { - obj: GetAnnouncementsReq = new GetAnnouncementsReq(); + constructor(readonly obj: GetAnnouncementsReq) { + this.obj = obj; + } /** * page number */ diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts index a27e58b6..a4a3e944 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAnnouncementsItems } from './model_get_announcements_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAnnouncementsResp implements Response { +export class GetAnnouncementsResp implements Response { /** * Total Number */ - totalNum?: number; + totalNum: number; + /** * */ @Type(() => GetAnnouncementsItems) - items?: Array; + items: Array; + /** * Current page */ - currentPage?: number; + currentPage: number; + /** * Page size */ - pageSize?: number; + pageSize: number; + /** * Total Page */ - totalPage?: number; + totalPage: number; + private constructor() { + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.items = null; + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalPage = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetAnnouncementsResp implements Response { +export class GetCurrencyChains implements Serializable { /** * chain name of currency */ - chainName?: string; + chainName: string; + /** * Minimum withdrawal amount */ - withdrawalMinSize?: string; + withdrawalMinSize: string; + /** * Minimum deposit amount */ - depositMinSize?: string; + depositMinSize: string; + /** * withdraw fee rate */ - withdrawFeeRate?: string; + withdrawFeeRate: string; + /** * Minimum fees charged for withdrawal */ - withdrawalMinFee?: string; + withdrawalMinFee: string; + /** * Support withdrawal or not */ - isWithdrawEnabled?: boolean; + isWithdrawEnabled: boolean; + /** * Support deposit or not */ - isDepositEnabled?: boolean; + isDepositEnabled: boolean; + /** * Number of block confirmations */ - confirms?: number; + confirms: number; + /** * The number of blocks (confirmations) for advance on-chain verification */ - preConfirms?: number; + preConfirms: number; + /** * Contract address */ - contractAddress?: string; + contractAddress: string; + /** * Withdrawal precision bit, indicating the maximum supported length after the decimal point of the withdrawal amount */ - withdrawPrecision?: number; + withdrawPrecision: number; + /** * Maximum amount of single withdrawal */ - maxWithdraw?: number; + maxWithdraw: number; + /** * Maximum amount of single deposit (only applicable to Lightning Network) */ - maxDeposit?: string; + maxDeposit: string; + /** * whether memo/tag is needed */ - needTag?: boolean; + needTag: boolean; + /** * chain id of currency */ - chainId?: string; + chainId: string; - fromJson(input: string): GetCurrencyChains { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCurrencyChains, jsonObject); + private constructor() { + // @ts-ignore + this.chainName = null; + // @ts-ignore + this.withdrawalMinSize = null; + // @ts-ignore + this.depositMinSize = null; + // @ts-ignore + this.withdrawFeeRate = null; + // @ts-ignore + this.withdrawalMinFee = null; + // @ts-ignore + this.isWithdrawEnabled = null; + // @ts-ignore + this.isDepositEnabled = null; + // @ts-ignore + this.confirms = null; + // @ts-ignore + this.preConfirms = null; + // @ts-ignore + this.contractAddress = null; + // @ts-ignore + this.withdrawPrecision = null; + // @ts-ignore + this.maxWithdraw = null; + // @ts-ignore + this.maxDeposit = null; + // @ts-ignore + this.needTag = null; + // @ts-ignore + this.chainId = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCurrencyChains { - return plainToInstance(GetCurrencyChains, jsonObject); + static fromJson(input: string): GetCurrencyChains { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCurrencyChains { + return plainToClassFromExist(new GetCurrencyChains(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_currency_req.ts b/sdk/node/src/generate/spot/market/model_get_currency_req.ts index fd79c952..02b761e8 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetCurrencyReq implements Serializable { +export class GetCurrencyReq implements Serializable { /** * Path parameter, Currency */ @Reflect.metadata('path', 'currency') currency?: string; + /** * Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. */ chain?: string; + private constructor() {} /** * Creates a new instance of the `GetCurrencyReq` class. * The builder pattern allows step-by-step construction of a `GetCurrencyReq` object. */ static builder(): GetCurrencyReqBuilder { - return new GetCurrencyReqBuilder(); + return new GetCurrencyReqBuilder(new GetCurrencyReq()); } /** @@ -42,22 +44,23 @@ export class GetCurrencyReq implements Serializable { return obj; } - fromJson(input: string): GetCurrencyReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCurrencyReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCurrencyReq { - return plainToInstance(GetCurrencyReq, jsonObject); + static fromJson(input: string): GetCurrencyReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCurrencyReq { + return plainToClassFromExist(new GetCurrencyReq(), jsonObject); } } export class GetCurrencyReqBuilder { - obj: GetCurrencyReq = new GetCurrencyReq(); + constructor(readonly obj: GetCurrencyReq) { + this.obj = obj; + } /** * Path parameter, Currency */ diff --git a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts index 025defd7..489dff2b 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts @@ -1,49 +1,77 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetCurrencyChains } from './model_get_currency_chains'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetCurrencyResp implements Response { +export class GetCurrencyResp implements Response { /** * A unique currency code that will never change */ - currency?: string; + currency: string; + /** * Currency name, will change after renaming */ - name?: string; + name: string; + /** * Full name of a currency, will change after renaming */ - fullName?: string; + fullName: string; + /** * Currency precision */ - precision?: number; + precision: number; + /** * Number of block confirmations */ - confirms?: number; + confirms: number; + /** * Contract address */ - contractAddress?: string; + contractAddress: string; + /** * Support margin or not */ - isMarginEnabled?: boolean; + isMarginEnabled: boolean; + /** * Support debit or not */ - isDebitEnabled?: boolean; + isDebitEnabled: boolean; + /** * chain list */ @Type(() => GetCurrencyChains) - chains?: Array; + chains: Array; + private constructor() { + // @ts-ignore + this.currency = null; + // @ts-ignore + this.name = null; + // @ts-ignore + this.fullName = null; + // @ts-ignore + this.precision = null; + // @ts-ignore + this.confirms = null; + // @ts-ignore + this.contractAddress = null; + // @ts-ignore + this.isMarginEnabled = null; + // @ts-ignore + this.isDebitEnabled = null; + // @ts-ignore + this.chains = null; + } /** * common response */ @@ -54,16 +82,15 @@ export class GetCurrencyResp implements Response this.commonResponse = response; } - fromJson(input: string): GetCurrencyResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetCurrencyResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetCurrencyResp { - return plainToInstance(GetCurrencyResp, jsonObject); + static fromJson(input: string): GetCurrencyResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetCurrencyResp { + return plainToClassFromExist(new GetCurrencyResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts index 6ff28c0a..f96fe967 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetFiatPriceReq implements Serializable { +export class GetFiatPriceReq implements Serializable { /** * Ticker symbol of a base currency,eg.USD,EUR. Default is USD */ base?: string = 'USD'; + /** * Comma-separated cryptocurrencies to be converted into fiat, e.g.: BTC,ETH, etc. Default to return the fiat price of all currencies. */ currencies?: string; + private constructor() {} /** * Creates a new instance of the `GetFiatPriceReq` class. * The builder pattern allows step-by-step construction of a `GetFiatPriceReq` object. */ static builder(): GetFiatPriceReqBuilder { - return new GetFiatPriceReqBuilder(); + return new GetFiatPriceReqBuilder(new GetFiatPriceReq()); } /** @@ -35,27 +37,32 @@ export class GetFiatPriceReq implements Serializable { currencies?: string; }): GetFiatPriceReq { let obj = new GetFiatPriceReq(); - obj.base = data.base; + if (data.base) { + obj.base = data.base; + } else { + obj.base = 'USD'; + } obj.currencies = data.currencies; return obj; } - fromJson(input: string): GetFiatPriceReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFiatPriceReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFiatPriceReq { - return plainToInstance(GetFiatPriceReq, jsonObject); + static fromJson(input: string): GetFiatPriceReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFiatPriceReq { + return plainToClassFromExist(new GetFiatPriceReq(), jsonObject); } } export class GetFiatPriceReqBuilder { - obj: GetFiatPriceReq = new GetFiatPriceReq(); + constructor(readonly obj: GetFiatPriceReq) { + this.obj = obj; + } /** * Ticker symbol of a base currency,eg.USD,EUR. Default is USD */ diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts index 635acdf7..eb606c79 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts @@ -1,3597 +1,6286 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance, Expose } from 'class-transformer'; +import { instanceToPlain, Exclude, Expose, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFiatPriceResp implements Response { +export class GetFiatPriceResp implements Response { /** * */ - AGLD?: string; + AGLD: string; + /** * */ - DFI?: string; + DFI: string; + /** * */ - PYTHUP?: string; + PYTHUP: string; + /** * */ - ISLM?: string; + ISLM: string; + /** * */ - NEAR?: string; + NEAR: string; + /** * */ - AIOZ?: string; + AIOZ: string; + /** * */ - AUDIO?: string; + AUDIO: string; + /** * */ - BBL?: string; + BBL: string; + /** * */ - WLD?: string; + WLD: string; + /** * */ - HNT?: string; + HNT: string; + /** * */ - ETHFI?: string; + ETHFI: string; + /** * */ - DMAIL?: string; + DMAIL: string; + /** * */ - OPUP?: string; + OPUP: string; + /** * */ - VET3S?: string; + VET3S: string; + /** * */ - MANA3S?: string; + MANA3S: string; + /** * */ - TIDAL?: string; + TIDAL: string; + /** * */ - HALO?: string; + HALO: string; + /** * */ - OPUL?: string; + OPUL: string; + /** * */ - MANA3L?: string; + MANA3L: string; + /** * */ - DGB?: string; + DGB: string; + /** * */ - AA?: string; + AA: string; + /** * */ - BCH?: string; + BCH: string; + /** * */ - GMEE?: string; + GMEE: string; + /** * */ - JST?: string; + JST: string; + /** * */ - PBUX?: string; + PBUX: string; + /** * */ - AR?: string; + AR: string; + /** * */ - SEI?: string; + SEI: string; + /** * */ - PSTAKE?: string; + PSTAKE: string; + /** * */ - LMWR?: string; + LMWR: string; + /** * */ - UNFIDOWN?: string; + UNFIDOWN: string; + /** * */ - BB?: string; + BB: string; + /** * */ - JTO?: string; + JTO: string; + /** * */ - WEMIX?: string; + WEMIX: string; + /** * */ - G?: string; + G: string; + /** * */ - MARSH?: string; + MARSH: string; + /** * */ - BN?: string; + BN: string; + /** * */ - FLIP?: string; + FLIP: string; + /** * */ - FLR?: string; + FLR: string; + /** * */ - BIGTIME?: string; + BIGTIME: string; + /** * */ - FLY?: string; + FLY: string; + /** * */ - T?: string; + T: string; + /** * */ - W?: string; + W: string; + /** * */ - BDX?: string; + BDX: string; + /** * */ - BABYDOGE?: string; + BABYDOGE: string; + /** * */ - SFP?: string; + SFP: string; + /** * */ - DIA?: string; + DIA: string; + /** * */ - ISME?: string; + ISME: string; + /** * */ - LYM?: string; + LYM: string; + /** * */ - VET3L?: string; + VET3L: string; + /** * */ - JUP?: string; + JUP: string; + /** * */ - LYX?: string; + LYX: string; + /** * */ - AIEPK?: string; + AIEPK: string; + /** * */ - SILLY?: string; + SILLY: string; + /** * */ - SCPT?: string; + SCPT: string; + /** * */ - WOO?: string; + WOO: string; + /** * */ - BLUR?: string; + BLUR: string; + /** * */ - STRK?: string; + STRK: string; + /** * */ - BFC?: string; + BFC: string; + /** * */ - DC?: string; + DC: string; + /** * */ - KARATE?: string; + KARATE: string; + /** * */ - SUSHI3L?: string; + SUSHI3L: string; + /** * */ - NETVR?: string; + NETVR: string; + /** * */ - WAVES?: string; + WAVES: string; + /** * */ - LITH?: string; + LITH: string; + /** * */ - HAPI?: string; + HAPI: string; + /** * */ - SUSHI3S?: string; + SUSHI3S: string; + /** * */ - CEEK?: string; + CEEK: string; + /** * */ - FLOKI?: string; + FLOKI: string; + /** * */ - SHR?: string; + SHR: string; + /** * */ - SAND?: string; + SAND: string; + /** * */ - TURT?: string; + TURT: string; + /** * */ - UMA?: string; + UMA: string; + /** * */ - BEPRO?: string; + BEPRO: string; + /** * */ - SCRT?: string; + SCRT: string; + /** * */ - TUSD?: string; + TUSD: string; + /** * */ - COOKIE?: string; + COOKIE: string; + /** * */ - LRDS?: string; + LRDS: string; + /** * */ - SIN?: string; + SIN: string; + /** * */ - OAS?: string; + OAS: string; + /** * */ - ROOT?: string; + ROOT: string; + /** * */ - ADA3L?: string; + ADA3L: string; + /** * */ - TIAUP?: string; + TIAUP: string; + /** * */ - HTR?: string; + HTR: string; + /** * */ - UNB?: string; + UNB: string; + /** * */ - UNA?: string; + UNA: string; + /** * */ - HARD?: string; + HARD: string; + /** * */ - G3?: string; + G3: string; + /** * */ - ADA3S?: string; + ADA3S: string; + /** * */ - MYRO?: string; + MYRO: string; + /** * */ - HTX?: string; + HTX: string; + /** * */ - FT?: string; + FT: string; + /** * */ - BTCDOWN?: string; + BTCDOWN: string; + /** * */ - UNI?: string; + UNI: string; + /** * */ - FX?: string; + FX: string; + /** * */ - OBI?: string; + OBI: string; + /** * */ - UNO?: string; + UNO: string; + /** * */ - WRX?: string; + WRX: string; + /** * */ - TIADOWN?: string; + TIADOWN: string; + /** * */ - ETHDOWN?: string; + ETHDOWN: string; + /** * */ - WELL?: string; + WELL: string; + /** * */ - SWFTC?: string; + SWFTC: string; + /** * */ - SKL?: string; + SKL: string; + /** * */ - UOS?: string; + UOS: string; + /** * */ - AIPAD?: string; + AIPAD: string; + /** * */ - BRETT?: string; + BRETT: string; + /** * */ - SKY?: string; + SKY: string; + /** * */ - FRM?: string; + FRM: string; + /** * */ - VISION?: string; + VISION: string; + /** * */ - LENDS?: string; + LENDS: string; + /** * */ - SLF?: string; + SLF: string; + /** * */ - BULL?: string; + BULL: string; + /** * */ - FLOW?: string; + FLOW: string; + /** * */ - ODDZ?: string; + ODDZ: string; + /** * */ - SLN?: string; + SLN: string; + /** * */ - UPO?: string; + UPO: string; + /** * */ - SLP?: string; + SLP: string; + /** * */ - ID?: string; + ID: string; + /** * */ - SLIM?: string; + SLIM: string; + /** * */ - SPOT?: string; + SPOT: string; + /** * */ - DOP?: string; + DOP: string; + /** * */ - ISSP?: string; + ISSP: string; + /** * */ - UQC?: string; + UQC: string; + /** * */ - IO?: string; + IO: string; + /** * */ - DOT?: string; + DOT: string; + /** * */ @Expose({ name: '1INCH' }) - _1INCH?: string; + _1INCH: string; + /** * */ - SMH?: string; + SMH: string; + /** * */ - MAK?: string; + MAK: string; + /** * */ - TOKO?: string; + TOKO: string; + /** * */ - TURBO?: string; + TURBO: string; + /** * */ - UNFI?: string; + UNFI: string; + /** * */ - MAN?: string; + MAN: string; + /** * */ - EVER?: string; + EVER: string; + /** * */ - FTM?: string; + FTM: string; + /** * */ - SHRAP?: string; + SHRAP: string; + /** * */ - MAV?: string; + MAV: string; + /** * */ - MAX?: string; + MAX: string; + /** * */ - DPR?: string; + DPR: string; + /** * */ - FTT?: string; + FTT: string; + /** * */ - ARKM?: string; + ARKM: string; + /** * */ - ATOM?: string; + ATOM: string; + /** * */ - PENDLE?: string; + PENDLE: string; + /** * */ - QUICK?: string; + QUICK: string; + /** * */ - BLZ?: string; + BLZ: string; + /** * */ - BOBA?: string; + BOBA: string; + /** * */ - MBL?: string; + MBL: string; + /** * */ - OFN?: string; + OFN: string; + /** * */ - UNIO?: string; + UNIO: string; + /** * */ - SNS?: string; + SNS: string; + /** * */ - SNX?: string; + SNX: string; + /** * */ - NXRA?: string; + NXRA: string; + /** * */ - TAIKO?: string; + TAIKO: string; + /** * */ - AVAX3L?: string; + AVAX3L: string; + /** * */ - L3?: string; + L3: string; + /** * */ - API3?: string; + API3: string; + /** * */ - XRP3S?: string; + XRP3S: string; + /** * */ - QKC?: string; + QKC: string; + /** * */ - AVAX3S?: string; + AVAX3S: string; + /** * */ - ROSE?: string; + ROSE: string; + /** * */ - SATS?: string; + SATS: string; + /** * */ - BMX?: string; + BMX: string; + /** * */ - PORTAL?: string; + PORTAL: string; + /** * */ - TOMI?: string; + TOMI: string; + /** * */ - XRP3L?: string; + XRP3L: string; + /** * */ - SOL?: string; + SOL: string; + /** * */ - SON?: string; + SON: string; + /** * */ - BNC?: string; + BNC: string; + /** * */ - SOCIAL?: string; + SOCIAL: string; + /** * */ - CGPT?: string; + CGPT: string; + /** * */ - CELR?: string; + CELR: string; + /** * */ - BNB?: string; + BNB: string; + /** * */ - OGN?: string; + OGN: string; + /** * */ - CELO?: string; + CELO: string; + /** * */ - AUCTION?: string; + AUCTION: string; + /** * */ - MANTA?: string; + MANTA: string; + /** * */ - LAYER?: string; + LAYER: string; + /** * */ - AERO?: string; + AERO: string; + /** * */ - CETUS?: string; + CETUS: string; + /** * */ - LL?: string; + LL: string; + /** * */ - SPA?: string; + SPA: string; + /** * */ - PYTHDOWN?: string; + PYTHDOWN: string; + /** * */ - NEIROCTO?: string; + NEIROCTO: string; + /** * */ - UTK?: string; + UTK: string; + /** * */ - GMRX?: string; + GMRX: string; + /** * */ - BOB?: string; + BOB: string; + /** * */ - HOTCROSS?: string; + HOTCROSS: string; + /** * */ - AERGO?: string; + AERGO: string; + /** * */ - MOCA?: string; + MOCA: string; + /** * */ - SQD?: string; + SQD: string; + /** * */ - MV?: string; + MV: string; + /** * */ - BNB3L?: string; + BNB3L: string; + /** * */ - BNB3S?: string; + BNB3S: string; + /** * */ - GALAX3L?: string; + GALAX3L: string; + /** * */ - KAI?: string; + KAI: string; + /** * */ - SQR?: string; + SQR: string; + /** * */ - GALAX3S?: string; + GALAX3S: string; + /** * */ - EGLD?: string; + EGLD: string; + /** * */ - ZBCN?: string; + ZBCN: string; + /** * */ - KAS?: string; + KAS: string; + /** * */ - MEW?: string; + MEW: string; + /** * */ - PUNDIX?: string; + PUNDIX: string; + /** * */ - LOOKS?: string; + LOOKS: string; + /** * */ - FXS?: string; + FXS: string; + /** * */ - BOSON?: string; + BOSON: string; + /** * */ - BRISE?: string; + BRISE: string; + /** * */ - AEVO?: string; + AEVO: string; + /** * */ - FLUX?: string; + FLUX: string; + /** * */ - PRCL?: string; + PRCL: string; + /** * */ - UNFIUP?: string; + UNFIUP: string; + /** * */ - SEIDOWN?: string; + SEIDOWN: string; + /** * */ - DOAI?: string; + DOAI: string; + /** * */ - QNT?: string; + QNT: string; + /** * */ - REDO?: string; + REDO: string; + /** * */ - STRIKE?: string; + STRIKE: string; + /** * */ - ETHW?: string; + ETHW: string; + /** * */ - OM?: string; + OM: string; + /** * */ - OP?: string; + OP: string; + /** * */ - WHALE?: string; + WHALE: string; + /** * */ @Expose({ name: '1CAT' }) - _1CAT?: string; + _1CAT: string; + /** * */ - NEON?: string; + NEON: string; + /** * */ - GTAI?: string; + GTAI: string; + /** * */ - SSV?: string; + SSV: string; + /** * */ - ETH2?: string; + ETH2: string; + /** * */ - KCS?: string; + KCS: string; + /** * */ - ARPA?: string; + ARPA: string; + /** * */ - ARTFI?: string; + ARTFI: string; + /** * */ - BRL?: string; + BRL: string; + /** * */ - ALEX?: string; + ALEX: string; + /** * */ - STG?: string; + STG: string; + /** * */ - SHIB?: string; + SHIB: string; + /** * */ - IOTX?: string; + IOTX: string; + /** * */ - OLE?: string; + OLE: string; + /** * */ - KDA?: string; + KDA: string; + /** * */ - CERE?: string; + CERE: string; + /** * */ - DOCK?: string; + DOCK: string; + /** * */ - STX?: string; + STX: string; + /** * */ - OLT?: string; + OLT: string; + /** * */ - QI?: string; + QI: string; + /** * */ - SDAO?: string; + SDAO: string; + /** * */ - BLAST?: string; + BLAST: string; + /** * */ - LINK3S?: string; + LINK3S: string; + /** * */ - IOST?: string; + IOST: string; + /** * */ - SUI?: string; + SUI: string; + /** * */ - CAKE?: string; + CAKE: string; + /** * */ - BSW?: string; + BSW: string; + /** * */ - OMG?: string; + OMG: string; + /** * */ - VOLT?: string; + VOLT: string; + /** * */ - LINK3L?: string; + LINK3L: string; + /** * */ - GEEQ?: string; + GEEQ: string; + /** * */ - PYUSD?: string; + PYUSD: string; + /** * */ - SUN?: string; + SUN: string; + /** * */ - TOWER?: string; + TOWER: string; + /** * */ - BTC?: string; + BTC: string; + /** * */ - IOTA?: string; + IOTA: string; + /** * */ - REEF?: string; + REEF: string; + /** * */ - TRIAS?: string; + TRIAS: string; + /** * */ - KEY?: string; + KEY: string; + /** * */ - ETH3L?: string; + ETH3L: string; + /** * */ - BTT?: string; + BTT: string; + /** * */ - ONE?: string; + ONE: string; + /** * */ - RENDER?: string; + RENDER: string; + /** * */ - ETH3S?: string; + ETH3S: string; + /** * */ - ANKR?: string; + ANKR: string; + /** * */ - ALGO?: string; + ALGO: string; + /** * */ - SYLO?: string; + SYLO: string; + /** * */ - ZCX?: string; + ZCX: string; + /** * */ - SD?: string; + SD: string; + /** * */ - ONT?: string; + ONT: string; + /** * */ - MJT?: string; + MJT: string; + /** * */ - DYM?: string; + DYM: string; + /** * */ - DYP?: string; + DYP: string; + /** * */ - BAKEUP?: string; + BAKEUP: string; + /** * */ - OOE?: string; + OOE: string; + /** * */ - ZELIX?: string; + ZELIX: string; + /** * */ - DOGE3L?: string; + DOGE3L: string; + /** * */ - ARTY?: string; + ARTY: string; + /** * */ - QORPO?: string; + QORPO: string; + /** * */ - ICE?: string; + ICE: string; + /** * */ - NOTAI?: string; + NOTAI: string; + /** * */ - DOGE3S?: string; + DOGE3S: string; + /** * */ - NAKA?: string; + NAKA: string; + /** * */ - GALAX?: string; + GALAX: string; + /** * */ - MKR?: string; + MKR: string; + /** * */ - DODO?: string; + DODO: string; + /** * */ - ICP?: string; + ICP: string; + /** * */ - ZEC?: string; + ZEC: string; + /** * */ - ZEE?: string; + ZEE: string; + /** * */ - ICX?: string; + ICX: string; + /** * */ - KMNO?: string; + KMNO: string; + /** * */ - TT?: string; + TT: string; + /** * */ - DOT3L?: string; + DOT3L: string; + /** * */ - XAI?: string; + XAI: string; + /** * */ - ZEN?: string; + ZEN: string; + /** * */ - DOGE?: string; + DOGE: string; + /** * */ - ALPHA?: string; + ALPHA: string; + /** * */ - DUSK?: string; + DUSK: string; + /** * */ - DOT3S?: string; + DOT3S: string; + /** * */ - SXP?: string; + SXP: string; + /** * */ - HBAR?: string; + HBAR: string; + /** * */ - SYNT?: string; + SYNT: string; + /** * */ - ZEX?: string; + ZEX: string; + /** * */ - BONDLY?: string; + BONDLY: string; + /** * */ - MLK?: string; + MLK: string; + /** * */ - KICKS?: string; + KICKS: string; + /** * */ - PEPE?: string; + PEPE: string; + /** * */ - OUSD?: string; + OUSD: string; + /** * */ - LUNCDOWN?: string; + LUNCDOWN: string; + /** * */ - DOGS?: string; + DOGS: string; + /** * */ - REV3L?: string; + REV3L: string; + /** * */ - CTSI?: string; + CTSI: string; + /** * */ - C98?: string; + C98: string; + /** * */ - OSMO?: string; + OSMO: string; + /** * */ - NTRN?: string; + NTRN: string; + /** * */ - CFX2S?: string; + CFX2S: string; + /** * */ - SYN?: string; + SYN: string; + /** * */ - VIDT?: string; + VIDT: string; + /** * */ - SYS?: string; + SYS: string; + /** * */ - GAS?: string; + GAS: string; + /** * */ - BOME?: string; + BOME: string; + /** * */ - COMBO?: string; + COMBO: string; + /** * */ - XCH?: string; + XCH: string; + /** * */ - VR?: string; + VR: string; + /** * */ - CFX2L?: string; + CFX2L: string; + /** * */ - VSYS?: string; + VSYS: string; + /** * */ - PANDORA?: string; + PANDORA: string; + /** * */ - THETA?: string; + THETA: string; + /** * */ - XCN?: string; + XCN: string; + /** * */ - NEXG?: string; + NEXG: string; + /** * */ - MELOS?: string; + MELOS: string; + /** * */ - XCV?: string; + XCV: string; + /** * */ - ORN?: string; + ORN: string; + /** * */ - WLKN?: string; + WLKN: string; + /** * */ - AAVE?: string; + AAVE: string; + /** * */ - MNT?: string; + MNT: string; + /** * */ - BONK?: string; + BONK: string; + /** * */ - PERP?: string; + PERP: string; + /** * */ - XDC?: string; + XDC: string; + /** * */ - MNW?: string; + MNW: string; + /** * */ - XDB?: string; + XDB: string; + /** * */ - BOND?: string; + BOND: string; + /** * */ - SUIA?: string; + SUIA: string; + /** * */ - MOG?: string; + MOG: string; + /** * */ - SUTER?: string; + SUTER: string; + /** * */ - TIME?: string; + TIME: string; + /** * */ - RACA?: string; + RACA: string; + /** * */ - BICO?: string; + BICO: string; + /** * */ - MON?: string; + MON: string; + /** * */ - SWEAT?: string; + SWEAT: string; + /** * */ - MOXIE?: string; + MOXIE: string; + /** * */ - BABYBNB?: string; + BABYBNB: string; + /** * */ - IGU?: string; + IGU: string; + /** * */ - HMSTR?: string; + HMSTR: string; + /** * */ - XEC?: string; + XEC: string; + /** * */ - MONI?: string; + MONI: string; + /** * */ - XR?: string; + XR: string; + /** * */ - PEOPLE?: string; + PEOPLE: string; + /** * */ - PUMLX?: string; + PUMLX: string; + /** * */ - ZIL?: string; + ZIL: string; + /** * */ - WLDDOWN?: string; + WLDDOWN: string; + /** * */ - VAI?: string; + VAI: string; + /** * */ - XEN?: string; + XEN: string; + /** * */ - MPC?: string; + MPC: string; + /** * */ - XEM?: string; + XEM: string; + /** * */ - JASMY3S?: string; + JASMY3S: string; + /** * */ - OTK?: string; + OTK: string; + /** * */ - TRAC?: string; + TRAC: string; + /** * */ - DFYN?: string; + DFYN: string; + /** * */ - BIDP?: string; + BIDP: string; + /** * */ - JASMY3L?: string; + JASMY3L: string; + /** * */ - INJDOWN?: string; + INJDOWN: string; + /** * */ - KLV?: string; + KLV: string; + /** * */ - WAXL?: string; + WAXL: string; + /** * */ - TRBDOWN?: string; + TRBDOWN: string; + /** * */ - BCH3L?: string; + BCH3L: string; + /** * */ - GMT3S?: string; + GMT3S: string; + /** * */ - KMD?: string; + KMD: string; + /** * */ - BCH3S?: string; + BCH3S: string; + /** * */ - ECOX?: string; + ECOX: string; + /** * */ - AAVE3S?: string; + AAVE3S: string; + /** * */ - GMT3L?: string; + GMT3L: string; + /** * */ - EPIK?: string; + EPIK: string; + /** * */ - SUIP?: string; + SUIP: string; + /** * */ - AAVE3L?: string; + AAVE3L: string; + /** * */ - ZK?: string; + ZK: string; + /** * */ - ZKF?: string; + ZKF: string; + /** * */ - OMNIA?: string; + OMNIA: string; + /** * */ - ZKJ?: string; + ZKJ: string; + /** * */ - ZKL?: string; + ZKL: string; + /** * */ - GAFI?: string; + GAFI: string; + /** * */ - CARV?: string; + CARV: string; + /** * */ - KNC?: string; + KNC: string; + /** * */ - CATS?: string; + CATS: string; + /** * */ - PROM?: string; + PROM: string; + /** * */ - ALEPH?: string; + ALEPH: string; + /** * */ - PONKE?: string; + PONKE: string; + /** * */ - OVR?: string; + OVR: string; + /** * */ - CATI?: string; + CATI: string; + /** * */ - ORDER?: string; + ORDER: string; + /** * */ - GFT?: string; + GFT: string; + /** * */ - BIFI?: string; + BIFI: string; + /** * */ - GGC?: string; + GGC: string; + /** * */ - GGG?: string; + GGG: string; + /** * */ - DAPPX?: string; + DAPPX: string; + /** * */ - SUKU?: string; + SUKU: string; + /** * */ - ULTI?: string; + ULTI: string; + /** * */ - CREDI?: string; + CREDI: string; + /** * */ - ERTHA?: string; + ERTHA: string; + /** * */ - FURY?: string; + FURY: string; + /** * */ - KARRAT?: string; + KARRAT: string; + /** * */ - MOBILE?: string; + MOBILE: string; + /** * */ - SIDUS?: string; + SIDUS: string; + /** * */ - NAVI?: string; + NAVI: string; + /** * */ - TAO?: string; + TAO: string; + /** * */ - USDJ?: string; + USDJ: string; + /** * */ - MTL?: string; + MTL: string; + /** * */ - VET?: string; + VET: string; + /** * */ - FITFI?: string; + FITFI: string; + /** * */ - USDT?: string; + USDT: string; + /** * */ - OXT?: string; + OXT: string; + /** * */ - CANDY?: string; + CANDY: string; + /** * */ - USDP?: string; + USDP: string; + /** * */ - MTS?: string; + MTS: string; + /** * */ - TADA?: string; + TADA: string; + /** * */ - MTV?: string; + MTV: string; + /** * */ - NAVX?: string; + NAVX: string; + /** * */ - ILV?: string; + ILV: string; + /** * */ - VINU?: string; + VINU: string; + /** * */ - GHX?: string; + GHX: string; + /** * */ - EDU?: string; + EDU: string; + /** * */ - HYVE?: string; + HYVE: string; + /** * */ - BTC3L?: string; + BTC3L: string; + /** * */ - ANYONE?: string; + ANYONE: string; + /** * */ - BEAT?: string; + BEAT: string; + /** * */ - KING?: string; + KING: string; + /** * */ - CREAM?: string; + CREAM: string; + /** * */ - CAS?: string; + CAS: string; + /** * */ - IMX?: string; + IMX: string; + /** * */ - CAT?: string; + CAT: string; + /** * */ - BTC3S?: string; + BTC3S: string; + /** * */ - USDE?: string; + USDE: string; + /** * */ - USDD?: string; + USDD: string; + /** * */ - CWAR?: string; + CWAR: string; + /** * */ - USDC?: string; + USDC: string; + /** * */ - KRL?: string; + KRL: string; + /** * */ - INJ?: string; + INJ: string; + /** * */ - GAME?: string; + GAME: string; + /** * */ - TRIBL?: string; + TRIBL: string; + /** * */ - XLM?: string; + XLM: string; + /** * */ - TRBUP?: string; + TRBUP: string; + /** * */ - VRADOWN?: string; + VRADOWN: string; + /** * */ - SUPER?: string; + SUPER: string; + /** * */ - EIGEN?: string; + EIGEN: string; + /** * */ - IOI?: string; + IOI: string; + /** * */ - KSM?: string; + KSM: string; + /** * */ - CCD?: string; + CCD: string; + /** * */ - EGO?: string; + EGO: string; + /** * */ - EGP?: string; + EGP: string; + /** * */ - MXC?: string; + MXC: string; + /** * */ - TEL?: string; + TEL: string; + /** * */ - MOVR?: string; + MOVR: string; + /** * */ - XMR?: string; + XMR: string; + /** * */ - MXM?: string; + MXM: string; + /** * */ - OORT?: string; + OORT: string; + /** * */ - GLM?: string; + GLM: string; + /** * */ - RAY?: string; + RAY: string; + /** * */ - XTAG?: string; + XTAG: string; + /** * */ - GLQ?: string; + GLQ: string; + /** * */ - CWEB?: string; + CWEB: string; + /** * */ - REVU?: string; + REVU: string; + /** * */ - REVV?: string; + REVV: string; + /** * */ - ZRO?: string; + ZRO: string; + /** * */ - XNL?: string; + XNL: string; + /** * */ - XNO?: string; + XNO: string; + /** * */ - SAROS?: string; + SAROS: string; + /** * */ - KACE?: string; + KACE: string; + /** * */ - ZRX?: string; + ZRX: string; + /** * */ - WLTH?: string; + WLTH: string; + /** * */ - ATOM3L?: string; + ATOM3L: string; + /** * */ - GMM?: string; + GMM: string; + /** * */ - BEER?: string; + BEER: string; + /** * */ - GMT?: string; + GMT: string; + /** * */ - HEART?: string; + HEART: string; + /** * */ - GMX?: string; + GMX: string; + /** * */ - ABBC?: string; + ABBC: string; + /** * */ - OMNI?: string; + OMNI: string; + /** * */ - ATOM3S?: string; + ATOM3S: string; + /** * */ - IRL?: string; + IRL: string; + /** * */ - CFG?: string; + CFG: string; + /** * */ - WSDM?: string; + WSDM: string; + /** * */ - GNS?: string; + GNS: string; + /** * */ - VANRY?: string; + VANRY: string; + /** * */ - CFX?: string; + CFX: string; + /** * */ - GRAIL?: string; + GRAIL: string; + /** * */ - BEFI?: string; + BEFI: string; + /** * */ - VELO?: string; + VELO: string; + /** * */ - XPR?: string; + XPR: string; + /** * */ - DOVI?: string; + DOVI: string; + /** * */ - ACE?: string; + ACE: string; + /** * */ - ACH?: string; + ACH: string; + /** * */ - ISP?: string; + ISP: string; + /** * */ - XCAD?: string; + XCAD: string; + /** * */ - MINA?: string; + MINA: string; + /** * */ - TIA?: string; + TIA: string; + /** * */ - DRIFT?: string; + DRIFT: string; + /** * */ - ACQ?: string; + ACQ: string; + /** * */ - ACS?: string; + ACS: string; + /** * */ - MIND?: string; + MIND: string; + /** * */ - STORE?: string; + STORE: string; + /** * */ - REN?: string; + REN: string; + /** * */ - ELA?: string; + ELA: string; + /** * */ - DREAMS?: string; + DREAMS: string; + /** * */ - ADA?: string; + ADA: string; + /** * */ - ELF?: string; + ELF: string; + /** * */ - REQ?: string; + REQ: string; + /** * */ - STORJ?: string; + STORJ: string; + /** * */ - LADYS?: string; + LADYS: string; + /** * */ - PAXG?: string; + PAXG: string; + /** * */ - REZ?: string; + REZ: string; + /** * */ - XRD?: string; + XRD: string; + /** * */ - CHO?: string; + CHO: string; + /** * */ - CHR?: string; + CHR: string; + /** * */ - ADS?: string; + ADS: string; + /** * */ - CHZ?: string; + CHZ: string; + /** * */ - ADX?: string; + ADX: string; + /** * */ - XRP?: string; + XRP: string; + /** * */ - JASMY?: string; + JASMY: string; + /** * */ - KAGI?: string; + KAGI: string; + /** * */ - FIDA?: string; + FIDA: string; + /** * */ - PBR?: string; + PBR: string; + /** * */ - AEG?: string; + AEG: string; + /** * */ - H2O?: string; + H2O: string; + /** * */ - CHMB?: string; + CHMB: string; + /** * */ - SAND3L?: string; + SAND3L: string; + /** * */ - PBX?: string; + PBX: string; + /** * */ - SOLVE?: string; + SOLVE: string; + /** * */ - DECHAT?: string; + DECHAT: string; + /** * */ - GARI?: string; + GARI: string; + /** * */ - SHIB2L?: string; + SHIB2L: string; + /** * */ - SHIB2S?: string; + SHIB2S: string; + /** * */ - ENA?: string; + ENA: string; + /** * */ - VEMP?: string; + VEMP: string; + /** * */ - ENJ?: string; + ENJ: string; + /** * */ - AFG?: string; + AFG: string; + /** * */ - RATS?: string; + RATS: string; + /** * */ - GRT?: string; + GRT: string; + /** * */ - FORWARD?: string; + FORWARD: string; + /** * */ - TFUEL?: string; + TFUEL: string; + /** * */ - ENS?: string; + ENS: string; + /** * */ - KASDOWN?: string; + KASDOWN: string; + /** * */ - XTM?: string; + XTM: string; + /** * */ - DEGEN?: string; + DEGEN: string; + /** * */ - TLM?: string; + TLM: string; + /** * */ - DYDXDOWN?: string; + DYDXDOWN: string; + /** * */ - CKB?: string; + CKB: string; + /** * */ - LUNC?: string; + LUNC: string; + /** * */ - AURORA?: string; + AURORA: string; + /** * */ - LUNA?: string; + LUNA: string; + /** * */ - XTZ?: string; + XTZ: string; + /** * */ - ELON?: string; + ELON: string; + /** * */ - DMTR?: string; + DMTR: string; + /** * */ - EOS?: string; + EOS: string; + /** * */ - GST?: string; + GST: string; + /** * */ - FORT?: string; + FORT: string; + /** * */ - FLAME?: string; + FLAME: string; + /** * */ - PATEX?: string; + PATEX: string; + /** * */ - DEEP?: string; + DEEP: string; + /** * */ - ID3L?: string; + ID3L: string; + /** * */ - GTC?: string; + GTC: string; + /** * */ - ID3S?: string; + ID3S: string; + /** * */ - RIO?: string; + RIO: string; + /** * */ - CLH?: string; + CLH: string; + /** * */ - BURGER?: string; + BURGER: string; + /** * */ - VRA?: string; + VRA: string; + /** * */ - SUNDOG?: string; + SUNDOG: string; + /** * */ - GTT?: string; + GTT: string; + /** * */ - INJUP?: string; + INJUP: string; + /** * */ - CPOOL?: string; + CPOOL: string; + /** * */ - EPX?: string; + EPX: string; + /** * */ - CLV?: string; + CLV: string; + /** * */ - FEAR?: string; + FEAR: string; + /** * */ - MEME?: string; + MEME: string; + /** * */ - ROOBEE?: string; + ROOBEE: string; + /** * */ - DEFI?: string; + DEFI: string; + /** * */ - TOKEN?: string; + TOKEN: string; + /** * */ - GRAPE?: string; + GRAPE: string; + /** * */ - KASUP?: string; + KASUP: string; + /** * */ - XWG?: string; + XWG: string; + /** * */ - SKEY?: string; + SKEY: string; + /** * */ - SFUND?: string; + SFUND: string; + /** * */ - EQX?: string; + EQX: string; + /** * */ - ORDIUP?: string; + ORDIUP: string; + /** * */ - TON?: string; + TON: string; + /** * */ - DEGO?: string; + DEGO: string; + /** * */ - IZI?: string; + IZI: string; + /** * */ - ERG?: string; + ERG: string; + /** * */ - ERN?: string; + ERN: string; + /** * */ - VENOM?: string; + VENOM: string; + /** * */ - VOXEL?: string; + VOXEL: string; + /** * */ - RLC?: string; + RLC: string; + /** * */ - PHA?: string; + PHA: string; + /** * */ - DYDXUP?: string; + DYDXUP: string; + /** * */ - APE3S?: string; + APE3S: string; + /** * */ - ORBS?: string; + ORBS: string; + /** * */ - OPDOWN?: string; + OPDOWN: string; + /** * */ - ESE?: string; + ESE: string; + /** * */ - APE3L?: string; + APE3L: string; + /** * */ - HMND?: string; + HMND: string; + /** * */ - COQ?: string; + COQ: string; + /** * */ - AURY?: string; + AURY: string; + /** * */ - CULT?: string; + CULT: string; + /** * */ - AKT?: string; + AKT: string; + /** * */ - GLMR?: string; + GLMR: string; + /** * */ - XYM?: string; + XYM: string; + /** * */ - ORAI?: string; + ORAI: string; + /** * */ - XYO?: string; + XYO: string; + /** * */ - ETC?: string; + ETC: string; + /** * */ - LAI?: string; + LAI: string; + /** * */ - PIP?: string; + PIP: string; + /** * */ - ETH?: string; + ETH: string; + /** * */ - NEO?: string; + NEO: string; + /** * */ - RMV?: string; + RMV: string; + /** * */ - KLAY?: string; + KLAY: string; + /** * */ - PIT?: string; + PIT: string; + /** * */ - TARA?: string; + TARA: string; + /** * */ - KALT?: string; + KALT: string; + /** * */ - PIX?: string; + PIX: string; + /** * */ - ETN?: string; + ETN: string; + /** * */ - CSIX?: string; + CSIX: string; + /** * */ - TRADE?: string; + TRADE: string; + /** * */ - MAVIA?: string; + MAVIA: string; + /** * */ - HIGH?: string; + HIGH: string; + /** * */ - TRB?: string; + TRB: string; + /** * */ - ORDI?: string; + ORDI: string; + /** * */ - TRVL?: string; + TRVL: string; + /** * */ - AMB?: string; + AMB: string; + /** * */ - TRU?: string; + TRU: string; + /** * */ - LOGX?: string; + LOGX: string; + /** * */ - FINC?: string; + FINC: string; + /** * */ - INFRA?: string; + INFRA: string; + /** * */ - NATIX?: string; + NATIX: string; + /** * */ - NFP?: string; + NFP: string; + /** * */ - TRY?: string; + TRY: string; + /** * */ - TRX?: string; + TRX: string; + /** * */ - LBP?: string; + LBP: string; + /** * */ - LBR?: string; + LBR: string; + /** * */ - EUL?: string; + EUL: string; + /** * */ - NFT?: string; + NFT: string; + /** * */ - SEIUP?: string; + SEIUP: string; + /** * */ - PUFFER?: string; + PUFFER: string; + /** * */ - EUR?: string; + EUR: string; + /** * */ - ORCA?: string; + ORCA: string; + /** * */ - NEAR3L?: string; + NEAR3L: string; + /** * */ - AMP?: string; + AMP: string; + /** * */ - XDEFI?: string; + XDEFI: string; + /** * */ - HIFI?: string; + HIFI: string; + /** * */ - TRUF?: string; + TRUF: string; + /** * */ - AITECH?: string; + AITECH: string; + /** * */ - AMU?: string; + AMU: string; + /** * */ - USTC?: string; + USTC: string; + /** * */ - KNGL?: string; + KNGL: string; + /** * */ - FOXY?: string; + FOXY: string; + /** * */ - NGC?: string; + NGC: string; + /** * */ - TENET?: string; + TENET: string; + /** * */ - NEAR3S?: string; + NEAR3S: string; + /** * */ - MAHA?: string; + MAHA: string; + /** * */ - NGL?: string; + NGL: string; + /** * */ - TST?: string; + TST: string; + /** * */ - HIPPO?: string; + HIPPO: string; + /** * */ - AXS3S?: string; + AXS3S: string; + /** * */ - CRO?: string; + CRO: string; + /** * */ - ZPAY?: string; + ZPAY: string; + /** * */ - MNDE?: string; + MNDE: string; + /** * */ - CRV?: string; + CRV: string; + /** * */ - SWASH?: string; + SWASH: string; + /** * */ - AXS3L?: string; + AXS3L: string; + /** * */ - VERSE?: string; + VERSE: string; + /** * */ - RPK?: string; + RPK: string; + /** * */ - RPL?: string; + RPL: string; + /** * */ - AZERO?: string; + AZERO: string; + /** * */ - SOUL?: string; + SOUL: string; + /** * */ - VXV?: string; + VXV: string; + /** * */ - LDO?: string; + LDO: string; + /** * */ - MAGIC?: string; + MAGIC: string; + /** * */ - ALICE?: string; + ALICE: string; + /** * */ - SEAM?: string; + SEAM: string; + /** * */ - PLU?: string; + PLU: string; + /** * */ - AOG?: string; + AOG: string; + /** * */ - SMOLE?: string; + SMOLE: string; + /** * */ - EWT?: string; + EWT: string; + /** * */ - TSUGT?: string; + TSUGT: string; + /** * */ - PMG?: string; + PMG: string; + /** * */ - OPAI?: string; + OPAI: string; + /** * */ - LOCUS?: string; + LOCUS: string; + /** * */ - CTA?: string; + CTA: string; + /** * */ - NIM?: string; + NIM: string; + /** * */ - CTC?: string; + CTC: string; + /** * */ - APE?: string; + APE: string; + /** * */ - MERL?: string; + MERL: string; + /** * */ - JAM?: string; + JAM: string; + /** * */ - CTI?: string; + CTI: string; + /** * */ - APP?: string; + APP: string; + /** * */ - APT?: string; + APT: string; + /** * */ - WLDUP?: string; + WLDUP: string; + /** * */ - ZEND?: string; + ZEND: string; + /** * */ - FIRE?: string; + FIRE: string; + /** * */ - DENT?: string; + DENT: string; + /** * */ - PYTH?: string; + PYTH: string; + /** * */ - LFT?: string; + LFT: string; + /** * */ - DPET?: string; + DPET: string; + /** * */ - ORDIDOWN?: string; + ORDIDOWN: string; + /** * */ - KPOL?: string; + KPOL: string; + /** * */ - ETHUP?: string; + ETHUP: string; + /** * */ - BAND?: string; + BAND: string; + /** * */ - POL?: string; + POL: string; + /** * */ - ASTR?: string; + ASTR: string; + /** * */ - NKN?: string; + NKN: string; + /** * */ - RSR?: string; + RSR: string; + /** * */ - DVPN?: string; + DVPN: string; + /** * */ - TWT?: string; + TWT: string; + /** * */ - ARB?: string; + ARB: string; + /** * */ - CVC?: string; + CVC: string; + /** * */ - ARC?: string; + ARC: string; + /** * */ - XETA?: string; + XETA: string; + /** * */ - MTRG?: string; + MTRG: string; + /** * */ - LOKA?: string; + LOKA: string; + /** * */ - LPOOL?: string; + LPOOL: string; + /** * */ - TURBOS?: string; + TURBOS: string; + /** * */ - CVX?: string; + CVX: string; + /** * */ - ARX?: string; + ARX: string; + /** * */ - MPLX?: string; + MPLX: string; + /** * */ - SUSHI?: string; + SUSHI: string; + /** * */ - NLK?: string; + NLK: string; + /** * */ - PEPE2?: string; + PEPE2: string; + /** * */ - WBTC?: string; + WBTC: string; + /** * */ - SUI3L?: string; + SUI3L: string; + /** * */ - CWS?: string; + CWS: string; + /** * */ - SUI3S?: string; + SUI3S: string; + /** * */ - INSP?: string; + INSP: string; + /** * */ - MANA?: string; + MANA: string; + /** * */ - VRTX?: string; + VRTX: string; + /** * */ - CSPR?: string; + CSPR: string; + /** * */ - ATA?: string; + ATA: string; + /** * */ - OPEN?: string; + OPEN: string; + /** * */ - HAI?: string; + HAI: string; + /** * */ - NMR?: string; + NMR: string; + /** * */ - ATH?: string; + ATH: string; + /** * */ - LIT?: string; + LIT: string; + /** * */ - TLOS?: string; + TLOS: string; + /** * */ - TNSR?: string; + TNSR: string; + /** * */ - CXT?: string; + CXT: string; + /** * */ - POLYX?: string; + POLYX: string; + /** * */ - ZERO?: string; + ZERO: string; + /** * */ - ROUTE?: string; + ROUTE: string; + /** * */ - LOOM?: string; + LOOM: string; + /** * */ - PRE?: string; + PRE: string; + /** * */ - VRAUP?: string; + VRAUP: string; + /** * */ - HBB?: string; + HBB: string; + /** * */ - RVN?: string; + RVN: string; + /** * */ - PRQ?: string; + PRQ: string; + /** * */ - ONDO?: string; + ONDO: string; + /** * */ - PEPEDOWN?: string; + PEPEDOWN: string; + /** * */ - WOOP?: string; + WOOP: string; + /** * */ - LUNCUP?: string; + LUNCUP: string; + /** * */ - KAVA?: string; + KAVA: string; + /** * */ - LKI?: string; + LKI: string; + /** * */ - AVA?: string; + AVA: string; + /** * */ - NOM?: string; + NOM: string; + /** * */ - MAPO?: string; + MAPO: string; + /** * */ - PEPEUP?: string; + PEPEUP: string; + /** * */ - STRAX?: string; + STRAX: string; + /** * */ - NOT?: string; + NOT: string; + /** * */ - ZERC?: string; + ZERC: string; + /** * */ - BCUT?: string; + BCUT: string; + /** * */ - MASA?: string; + MASA: string; + /** * */ - WAN?: string; + WAN: string; + /** * */ - WAT?: string; + WAT: string; + /** * */ - WAX?: string; + WAX: string; + /** * */ - MASK?: string; + MASK: string; + /** * */ - EOS3L?: string; + EOS3L: string; + /** * */ - IDEA?: string; + IDEA: string; + /** * */ - EOS3S?: string; + EOS3S: string; + /** * */ - YFI?: string; + YFI: string; + /** * */ - MOODENG?: string; + MOODENG: string; + /** * */ - XCUR?: string; + XCUR: string; + /** * */ - HYDRA?: string; + HYDRA: string; + /** * */ - POPCAT?: string; + POPCAT: string; + /** * */ - LQTY?: string; + LQTY: string; + /** * */ - PIXEL?: string; + PIXEL: string; + /** * */ - LMR?: string; + LMR: string; + /** * */ - ZETA?: string; + ZETA: string; + /** * */ - YGG?: string; + YGG: string; + /** * */ - AXS?: string; + AXS: string; + /** * */ - BCHSV?: string; + BCHSV: string; + /** * */ - NRN?: string; + NRN: string; + /** * */ - FTON?: string; + FTON: string; + /** * */ - COMP?: string; + COMP: string; + /** * */ - XPRT?: string; + XPRT: string; + /** * */ - HFT?: string; + HFT: string; + /** * */ - UXLINK?: string; + UXLINK: string; + /** * */ - STAMP?: string; + STAMP: string; + /** * */ - RUNE?: string; + RUNE: string; + /** * */ - ZEUS?: string; + ZEUS: string; + /** * */ - LTC3L?: string; + LTC3L: string; + /** * */ - DAPP?: string; + DAPP: string; + /** * */ - FORTH?: string; + FORTH: string; + /** * */ - ALPINE?: string; + ALPINE: string; + /** * */ - SENSO?: string; + SENSO: string; + /** * */ - LTC3S?: string; + LTC3S: string; + /** * */ - DEXE?: string; + DEXE: string; + /** * */ - GOAL?: string; + GOAL: string; + /** * */ - AVAX?: string; + AVAX: string; + /** * */ - LISTA?: string; + LISTA: string; + /** * */ - AMPL?: string; + AMPL: string; + /** * */ - WORK?: string; + WORK: string; + /** * */ - BRWL?: string; + BRWL: string; + /** * */ - BANANA?: string; + BANANA: string; + /** * */ - PUSH?: string; + PUSH: string; + /** * */ - WEN?: string; + WEN: string; + /** * */ - NEIRO?: string; + NEIRO: string; + /** * */ - BTCUP?: string; + BTCUP: string; + /** * */ - SOL3S?: string; + SOL3S: string; + /** * */ - BRAWL?: string; + BRAWL: string; + /** * */ - LAY3R?: string; + LAY3R: string; + /** * */ - LPT?: string; + LPT: string; + /** * */ - GODS?: string; + GODS: string; + /** * */ - SAND3S?: string; + SAND3S: string; + /** * */ - RDNT?: string; + RDNT: string; + /** * */ - SOL3L?: string; + SOL3L: string; + /** * */ - NIBI?: string; + NIBI: string; + /** * */ - NUM?: string; + NUM: string; + /** * */ - PYR?: string; + PYR: string; + /** * */ - DAG?: string; + DAG: string; + /** * */ - DAI?: string; + DAI: string; + /** * */ - HIP?: string; + HIP: string; + /** * */ - DAO?: string; + DAO: string; + /** * */ - AVAIL?: string; + AVAIL: string; + /** * */ - DAR?: string; + DAR: string; + /** * */ - FET?: string; + FET: string; + /** * */ - FCON?: string; + FCON: string; + /** * */ - XAVA?: string; + XAVA: string; + /** * */ - LRC?: string; + LRC: string; + /** * */ - UNI3S?: string; + UNI3S: string; + /** * */ - POKT?: string; + POKT: string; + /** * */ - DASH?: string; + DASH: string; + /** * */ - BAKEDOWN?: string; + BAKEDOWN: string; + /** * */ - POLC?: string; + POLC: string; + /** * */ - CIRUS?: string; + CIRUS: string; + /** * */ - UNI3L?: string; + UNI3L: string; + /** * */ - NWC?: string; + NWC: string; + /** * */ - POLK?: string; + POLK: string; + /** * */ - LSD?: string; + LSD: string; + /** * */ - MARS4?: string; + MARS4: string; + /** * */ - LSK?: string; + LSK: string; + /** * */ - BLOCK?: string; + BLOCK: string; + /** * */ - ANALOS?: string; + ANALOS: string; + /** * */ - SAFE?: string; + SAFE: string; + /** * */ - DCK?: string; + DCK: string; + /** * */ - LSS?: string; + LSS: string; + /** * */ - DCR?: string; + DCR: string; + /** * */ - LIKE?: string; + LIKE: string; + /** * */ - DATA?: string; + DATA: string; + /** * */ - WIF?: string; + WIF: string; + /** * */ - BLOK?: string; + BLOK: string; + /** * */ - LTC?: string; + LTC: string; + /** * */ - METIS?: string; + METIS: string; + /** * */ - WIN?: string; + WIN: string; + /** * */ - HLG?: string; + HLG: string; + /** * */ - LTO?: string; + LTO: string; + /** * */ - DYDX?: string; + DYDX: string; + /** * */ - ARB3S?: string; + ARB3S: string; + /** * */ - MUBI?: string; + MUBI: string; + /** * */ - ARB3L?: string; + ARB3L: string; + /** * */ - RBTC1?: string; + RBTC1: string; + /** * */ - POND?: string; + POND: string; + /** * */ - LINA?: string; + LINA: string; + /** * */ - MYRIA?: string; + MYRIA: string; + /** * */ - LINK?: string; + LINK: string; + /** * */ - QTUM?: string; + QTUM: string; + /** * */ - TUNE?: string; + TUNE: string; + /** * */ - UFO?: string; + UFO: string; + /** * */ - CYBER?: string; + CYBER: string; + /** * */ - WILD?: string; + WILD: string; + /** * */ - POLS?: string; + POLS: string; + /** * */ - NYM?: string; + NYM: string; + /** * */ - FIL?: string; + FIL: string; + /** * */ - BAL?: string; + BAL: string; + /** * */ - SCA?: string; + SCA: string; + /** * */ - STND?: string; + STND: string; + /** * */ - WMTX?: string; + WMTX: string; + /** * */ - SCLP?: string; + SCLP: string; + /** * */ - MANEKI?: string; + MANEKI: string; + /** * */ - BAT?: string; + BAT: string; + /** * */ - AKRO?: string; + AKRO: string; + /** * */ - FTM3L?: string; + FTM3L: string; + /** * */ - BAX?: string; + BAX: string; + /** * */ - FTM3S?: string; + FTM3S: string; + /** * */ - COTI?: string; + COTI: string; + private constructor() { + // @ts-ignore + this.AGLD = null; + // @ts-ignore + this.DFI = null; + // @ts-ignore + this.PYTHUP = null; + // @ts-ignore + this.ISLM = null; + // @ts-ignore + this.NEAR = null; + // @ts-ignore + this.AIOZ = null; + // @ts-ignore + this.AUDIO = null; + // @ts-ignore + this.BBL = null; + // @ts-ignore + this.WLD = null; + // @ts-ignore + this.HNT = null; + // @ts-ignore + this.ETHFI = null; + // @ts-ignore + this.DMAIL = null; + // @ts-ignore + this.OPUP = null; + // @ts-ignore + this.VET3S = null; + // @ts-ignore + this.MANA3S = null; + // @ts-ignore + this.TIDAL = null; + // @ts-ignore + this.HALO = null; + // @ts-ignore + this.OPUL = null; + // @ts-ignore + this.MANA3L = null; + // @ts-ignore + this.DGB = null; + // @ts-ignore + this.AA = null; + // @ts-ignore + this.BCH = null; + // @ts-ignore + this.GMEE = null; + // @ts-ignore + this.JST = null; + // @ts-ignore + this.PBUX = null; + // @ts-ignore + this.AR = null; + // @ts-ignore + this.SEI = null; + // @ts-ignore + this.PSTAKE = null; + // @ts-ignore + this.LMWR = null; + // @ts-ignore + this.UNFIDOWN = null; + // @ts-ignore + this.BB = null; + // @ts-ignore + this.JTO = null; + // @ts-ignore + this.WEMIX = null; + // @ts-ignore + this.G = null; + // @ts-ignore + this.MARSH = null; + // @ts-ignore + this.BN = null; + // @ts-ignore + this.FLIP = null; + // @ts-ignore + this.FLR = null; + // @ts-ignore + this.BIGTIME = null; + // @ts-ignore + this.FLY = null; + // @ts-ignore + this.T = null; + // @ts-ignore + this.W = null; + // @ts-ignore + this.BDX = null; + // @ts-ignore + this.BABYDOGE = null; + // @ts-ignore + this.SFP = null; + // @ts-ignore + this.DIA = null; + // @ts-ignore + this.ISME = null; + // @ts-ignore + this.LYM = null; + // @ts-ignore + this.VET3L = null; + // @ts-ignore + this.JUP = null; + // @ts-ignore + this.LYX = null; + // @ts-ignore + this.AIEPK = null; + // @ts-ignore + this.SILLY = null; + // @ts-ignore + this.SCPT = null; + // @ts-ignore + this.WOO = null; + // @ts-ignore + this.BLUR = null; + // @ts-ignore + this.STRK = null; + // @ts-ignore + this.BFC = null; + // @ts-ignore + this.DC = null; + // @ts-ignore + this.KARATE = null; + // @ts-ignore + this.SUSHI3L = null; + // @ts-ignore + this.NETVR = null; + // @ts-ignore + this.WAVES = null; + // @ts-ignore + this.LITH = null; + // @ts-ignore + this.HAPI = null; + // @ts-ignore + this.SUSHI3S = null; + // @ts-ignore + this.CEEK = null; + // @ts-ignore + this.FLOKI = null; + // @ts-ignore + this.SHR = null; + // @ts-ignore + this.SAND = null; + // @ts-ignore + this.TURT = null; + // @ts-ignore + this.UMA = null; + // @ts-ignore + this.BEPRO = null; + // @ts-ignore + this.SCRT = null; + // @ts-ignore + this.TUSD = null; + // @ts-ignore + this.COOKIE = null; + // @ts-ignore + this.LRDS = null; + // @ts-ignore + this.SIN = null; + // @ts-ignore + this.OAS = null; + // @ts-ignore + this.ROOT = null; + // @ts-ignore + this.ADA3L = null; + // @ts-ignore + this.TIAUP = null; + // @ts-ignore + this.HTR = null; + // @ts-ignore + this.UNB = null; + // @ts-ignore + this.UNA = null; + // @ts-ignore + this.HARD = null; + // @ts-ignore + this.G3 = null; + // @ts-ignore + this.ADA3S = null; + // @ts-ignore + this.MYRO = null; + // @ts-ignore + this.HTX = null; + // @ts-ignore + this.FT = null; + // @ts-ignore + this.BTCDOWN = null; + // @ts-ignore + this.UNI = null; + // @ts-ignore + this.FX = null; + // @ts-ignore + this.OBI = null; + // @ts-ignore + this.UNO = null; + // @ts-ignore + this.WRX = null; + // @ts-ignore + this.TIADOWN = null; + // @ts-ignore + this.ETHDOWN = null; + // @ts-ignore + this.WELL = null; + // @ts-ignore + this.SWFTC = null; + // @ts-ignore + this.SKL = null; + // @ts-ignore + this.UOS = null; + // @ts-ignore + this.AIPAD = null; + // @ts-ignore + this.BRETT = null; + // @ts-ignore + this.SKY = null; + // @ts-ignore + this.FRM = null; + // @ts-ignore + this.VISION = null; + // @ts-ignore + this.LENDS = null; + // @ts-ignore + this.SLF = null; + // @ts-ignore + this.BULL = null; + // @ts-ignore + this.FLOW = null; + // @ts-ignore + this.ODDZ = null; + // @ts-ignore + this.SLN = null; + // @ts-ignore + this.UPO = null; + // @ts-ignore + this.SLP = null; + // @ts-ignore + this.ID = null; + // @ts-ignore + this.SLIM = null; + // @ts-ignore + this.SPOT = null; + // @ts-ignore + this.DOP = null; + // @ts-ignore + this.ISSP = null; + // @ts-ignore + this.UQC = null; + // @ts-ignore + this.IO = null; + // @ts-ignore + this.DOT = null; + // @ts-ignore + this._1INCH = null; + // @ts-ignore + this.SMH = null; + // @ts-ignore + this.MAK = null; + // @ts-ignore + this.TOKO = null; + // @ts-ignore + this.TURBO = null; + // @ts-ignore + this.UNFI = null; + // @ts-ignore + this.MAN = null; + // @ts-ignore + this.EVER = null; + // @ts-ignore + this.FTM = null; + // @ts-ignore + this.SHRAP = null; + // @ts-ignore + this.MAV = null; + // @ts-ignore + this.MAX = null; + // @ts-ignore + this.DPR = null; + // @ts-ignore + this.FTT = null; + // @ts-ignore + this.ARKM = null; + // @ts-ignore + this.ATOM = null; + // @ts-ignore + this.PENDLE = null; + // @ts-ignore + this.QUICK = null; + // @ts-ignore + this.BLZ = null; + // @ts-ignore + this.BOBA = null; + // @ts-ignore + this.MBL = null; + // @ts-ignore + this.OFN = null; + // @ts-ignore + this.UNIO = null; + // @ts-ignore + this.SNS = null; + // @ts-ignore + this.SNX = null; + // @ts-ignore + this.NXRA = null; + // @ts-ignore + this.TAIKO = null; + // @ts-ignore + this.AVAX3L = null; + // @ts-ignore + this.L3 = null; + // @ts-ignore + this.API3 = null; + // @ts-ignore + this.XRP3S = null; + // @ts-ignore + this.QKC = null; + // @ts-ignore + this.AVAX3S = null; + // @ts-ignore + this.ROSE = null; + // @ts-ignore + this.SATS = null; + // @ts-ignore + this.BMX = null; + // @ts-ignore + this.PORTAL = null; + // @ts-ignore + this.TOMI = null; + // @ts-ignore + this.XRP3L = null; + // @ts-ignore + this.SOL = null; + // @ts-ignore + this.SON = null; + // @ts-ignore + this.BNC = null; + // @ts-ignore + this.SOCIAL = null; + // @ts-ignore + this.CGPT = null; + // @ts-ignore + this.CELR = null; + // @ts-ignore + this.BNB = null; + // @ts-ignore + this.OGN = null; + // @ts-ignore + this.CELO = null; + // @ts-ignore + this.AUCTION = null; + // @ts-ignore + this.MANTA = null; + // @ts-ignore + this.LAYER = null; + // @ts-ignore + this.AERO = null; + // @ts-ignore + this.CETUS = null; + // @ts-ignore + this.LL = null; + // @ts-ignore + this.SPA = null; + // @ts-ignore + this.PYTHDOWN = null; + // @ts-ignore + this.NEIROCTO = null; + // @ts-ignore + this.UTK = null; + // @ts-ignore + this.GMRX = null; + // @ts-ignore + this.BOB = null; + // @ts-ignore + this.HOTCROSS = null; + // @ts-ignore + this.AERGO = null; + // @ts-ignore + this.MOCA = null; + // @ts-ignore + this.SQD = null; + // @ts-ignore + this.MV = null; + // @ts-ignore + this.BNB3L = null; + // @ts-ignore + this.BNB3S = null; + // @ts-ignore + this.GALAX3L = null; + // @ts-ignore + this.KAI = null; + // @ts-ignore + this.SQR = null; + // @ts-ignore + this.GALAX3S = null; + // @ts-ignore + this.EGLD = null; + // @ts-ignore + this.ZBCN = null; + // @ts-ignore + this.KAS = null; + // @ts-ignore + this.MEW = null; + // @ts-ignore + this.PUNDIX = null; + // @ts-ignore + this.LOOKS = null; + // @ts-ignore + this.FXS = null; + // @ts-ignore + this.BOSON = null; + // @ts-ignore + this.BRISE = null; + // @ts-ignore + this.AEVO = null; + // @ts-ignore + this.FLUX = null; + // @ts-ignore + this.PRCL = null; + // @ts-ignore + this.UNFIUP = null; + // @ts-ignore + this.SEIDOWN = null; + // @ts-ignore + this.DOAI = null; + // @ts-ignore + this.QNT = null; + // @ts-ignore + this.REDO = null; + // @ts-ignore + this.STRIKE = null; + // @ts-ignore + this.ETHW = null; + // @ts-ignore + this.OM = null; + // @ts-ignore + this.OP = null; + // @ts-ignore + this.WHALE = null; + // @ts-ignore + this._1CAT = null; + // @ts-ignore + this.NEON = null; + // @ts-ignore + this.GTAI = null; + // @ts-ignore + this.SSV = null; + // @ts-ignore + this.ETH2 = null; + // @ts-ignore + this.KCS = null; + // @ts-ignore + this.ARPA = null; + // @ts-ignore + this.ARTFI = null; + // @ts-ignore + this.BRL = null; + // @ts-ignore + this.ALEX = null; + // @ts-ignore + this.STG = null; + // @ts-ignore + this.SHIB = null; + // @ts-ignore + this.IOTX = null; + // @ts-ignore + this.OLE = null; + // @ts-ignore + this.KDA = null; + // @ts-ignore + this.CERE = null; + // @ts-ignore + this.DOCK = null; + // @ts-ignore + this.STX = null; + // @ts-ignore + this.OLT = null; + // @ts-ignore + this.QI = null; + // @ts-ignore + this.SDAO = null; + // @ts-ignore + this.BLAST = null; + // @ts-ignore + this.LINK3S = null; + // @ts-ignore + this.IOST = null; + // @ts-ignore + this.SUI = null; + // @ts-ignore + this.CAKE = null; + // @ts-ignore + this.BSW = null; + // @ts-ignore + this.OMG = null; + // @ts-ignore + this.VOLT = null; + // @ts-ignore + this.LINK3L = null; + // @ts-ignore + this.GEEQ = null; + // @ts-ignore + this.PYUSD = null; + // @ts-ignore + this.SUN = null; + // @ts-ignore + this.TOWER = null; + // @ts-ignore + this.BTC = null; + // @ts-ignore + this.IOTA = null; + // @ts-ignore + this.REEF = null; + // @ts-ignore + this.TRIAS = null; + // @ts-ignore + this.KEY = null; + // @ts-ignore + this.ETH3L = null; + // @ts-ignore + this.BTT = null; + // @ts-ignore + this.ONE = null; + // @ts-ignore + this.RENDER = null; + // @ts-ignore + this.ETH3S = null; + // @ts-ignore + this.ANKR = null; + // @ts-ignore + this.ALGO = null; + // @ts-ignore + this.SYLO = null; + // @ts-ignore + this.ZCX = null; + // @ts-ignore + this.SD = null; + // @ts-ignore + this.ONT = null; + // @ts-ignore + this.MJT = null; + // @ts-ignore + this.DYM = null; + // @ts-ignore + this.DYP = null; + // @ts-ignore + this.BAKEUP = null; + // @ts-ignore + this.OOE = null; + // @ts-ignore + this.ZELIX = null; + // @ts-ignore + this.DOGE3L = null; + // @ts-ignore + this.ARTY = null; + // @ts-ignore + this.QORPO = null; + // @ts-ignore + this.ICE = null; + // @ts-ignore + this.NOTAI = null; + // @ts-ignore + this.DOGE3S = null; + // @ts-ignore + this.NAKA = null; + // @ts-ignore + this.GALAX = null; + // @ts-ignore + this.MKR = null; + // @ts-ignore + this.DODO = null; + // @ts-ignore + this.ICP = null; + // @ts-ignore + this.ZEC = null; + // @ts-ignore + this.ZEE = null; + // @ts-ignore + this.ICX = null; + // @ts-ignore + this.KMNO = null; + // @ts-ignore + this.TT = null; + // @ts-ignore + this.DOT3L = null; + // @ts-ignore + this.XAI = null; + // @ts-ignore + this.ZEN = null; + // @ts-ignore + this.DOGE = null; + // @ts-ignore + this.ALPHA = null; + // @ts-ignore + this.DUSK = null; + // @ts-ignore + this.DOT3S = null; + // @ts-ignore + this.SXP = null; + // @ts-ignore + this.HBAR = null; + // @ts-ignore + this.SYNT = null; + // @ts-ignore + this.ZEX = null; + // @ts-ignore + this.BONDLY = null; + // @ts-ignore + this.MLK = null; + // @ts-ignore + this.KICKS = null; + // @ts-ignore + this.PEPE = null; + // @ts-ignore + this.OUSD = null; + // @ts-ignore + this.LUNCDOWN = null; + // @ts-ignore + this.DOGS = null; + // @ts-ignore + this.REV3L = null; + // @ts-ignore + this.CTSI = null; + // @ts-ignore + this.C98 = null; + // @ts-ignore + this.OSMO = null; + // @ts-ignore + this.NTRN = null; + // @ts-ignore + this.CFX2S = null; + // @ts-ignore + this.SYN = null; + // @ts-ignore + this.VIDT = null; + // @ts-ignore + this.SYS = null; + // @ts-ignore + this.GAS = null; + // @ts-ignore + this.BOME = null; + // @ts-ignore + this.COMBO = null; + // @ts-ignore + this.XCH = null; + // @ts-ignore + this.VR = null; + // @ts-ignore + this.CFX2L = null; + // @ts-ignore + this.VSYS = null; + // @ts-ignore + this.PANDORA = null; + // @ts-ignore + this.THETA = null; + // @ts-ignore + this.XCN = null; + // @ts-ignore + this.NEXG = null; + // @ts-ignore + this.MELOS = null; + // @ts-ignore + this.XCV = null; + // @ts-ignore + this.ORN = null; + // @ts-ignore + this.WLKN = null; + // @ts-ignore + this.AAVE = null; + // @ts-ignore + this.MNT = null; + // @ts-ignore + this.BONK = null; + // @ts-ignore + this.PERP = null; + // @ts-ignore + this.XDC = null; + // @ts-ignore + this.MNW = null; + // @ts-ignore + this.XDB = null; + // @ts-ignore + this.BOND = null; + // @ts-ignore + this.SUIA = null; + // @ts-ignore + this.MOG = null; + // @ts-ignore + this.SUTER = null; + // @ts-ignore + this.TIME = null; + // @ts-ignore + this.RACA = null; + // @ts-ignore + this.BICO = null; + // @ts-ignore + this.MON = null; + // @ts-ignore + this.SWEAT = null; + // @ts-ignore + this.MOXIE = null; + // @ts-ignore + this.BABYBNB = null; + // @ts-ignore + this.IGU = null; + // @ts-ignore + this.HMSTR = null; + // @ts-ignore + this.XEC = null; + // @ts-ignore + this.MONI = null; + // @ts-ignore + this.XR = null; + // @ts-ignore + this.PEOPLE = null; + // @ts-ignore + this.PUMLX = null; + // @ts-ignore + this.ZIL = null; + // @ts-ignore + this.WLDDOWN = null; + // @ts-ignore + this.VAI = null; + // @ts-ignore + this.XEN = null; + // @ts-ignore + this.MPC = null; + // @ts-ignore + this.XEM = null; + // @ts-ignore + this.JASMY3S = null; + // @ts-ignore + this.OTK = null; + // @ts-ignore + this.TRAC = null; + // @ts-ignore + this.DFYN = null; + // @ts-ignore + this.BIDP = null; + // @ts-ignore + this.JASMY3L = null; + // @ts-ignore + this.INJDOWN = null; + // @ts-ignore + this.KLV = null; + // @ts-ignore + this.WAXL = null; + // @ts-ignore + this.TRBDOWN = null; + // @ts-ignore + this.BCH3L = null; + // @ts-ignore + this.GMT3S = null; + // @ts-ignore + this.KMD = null; + // @ts-ignore + this.BCH3S = null; + // @ts-ignore + this.ECOX = null; + // @ts-ignore + this.AAVE3S = null; + // @ts-ignore + this.GMT3L = null; + // @ts-ignore + this.EPIK = null; + // @ts-ignore + this.SUIP = null; + // @ts-ignore + this.AAVE3L = null; + // @ts-ignore + this.ZK = null; + // @ts-ignore + this.ZKF = null; + // @ts-ignore + this.OMNIA = null; + // @ts-ignore + this.ZKJ = null; + // @ts-ignore + this.ZKL = null; + // @ts-ignore + this.GAFI = null; + // @ts-ignore + this.CARV = null; + // @ts-ignore + this.KNC = null; + // @ts-ignore + this.CATS = null; + // @ts-ignore + this.PROM = null; + // @ts-ignore + this.ALEPH = null; + // @ts-ignore + this.PONKE = null; + // @ts-ignore + this.OVR = null; + // @ts-ignore + this.CATI = null; + // @ts-ignore + this.ORDER = null; + // @ts-ignore + this.GFT = null; + // @ts-ignore + this.BIFI = null; + // @ts-ignore + this.GGC = null; + // @ts-ignore + this.GGG = null; + // @ts-ignore + this.DAPPX = null; + // @ts-ignore + this.SUKU = null; + // @ts-ignore + this.ULTI = null; + // @ts-ignore + this.CREDI = null; + // @ts-ignore + this.ERTHA = null; + // @ts-ignore + this.FURY = null; + // @ts-ignore + this.KARRAT = null; + // @ts-ignore + this.MOBILE = null; + // @ts-ignore + this.SIDUS = null; + // @ts-ignore + this.NAVI = null; + // @ts-ignore + this.TAO = null; + // @ts-ignore + this.USDJ = null; + // @ts-ignore + this.MTL = null; + // @ts-ignore + this.VET = null; + // @ts-ignore + this.FITFI = null; + // @ts-ignore + this.USDT = null; + // @ts-ignore + this.OXT = null; + // @ts-ignore + this.CANDY = null; + // @ts-ignore + this.USDP = null; + // @ts-ignore + this.MTS = null; + // @ts-ignore + this.TADA = null; + // @ts-ignore + this.MTV = null; + // @ts-ignore + this.NAVX = null; + // @ts-ignore + this.ILV = null; + // @ts-ignore + this.VINU = null; + // @ts-ignore + this.GHX = null; + // @ts-ignore + this.EDU = null; + // @ts-ignore + this.HYVE = null; + // @ts-ignore + this.BTC3L = null; + // @ts-ignore + this.ANYONE = null; + // @ts-ignore + this.BEAT = null; + // @ts-ignore + this.KING = null; + // @ts-ignore + this.CREAM = null; + // @ts-ignore + this.CAS = null; + // @ts-ignore + this.IMX = null; + // @ts-ignore + this.CAT = null; + // @ts-ignore + this.BTC3S = null; + // @ts-ignore + this.USDE = null; + // @ts-ignore + this.USDD = null; + // @ts-ignore + this.CWAR = null; + // @ts-ignore + this.USDC = null; + // @ts-ignore + this.KRL = null; + // @ts-ignore + this.INJ = null; + // @ts-ignore + this.GAME = null; + // @ts-ignore + this.TRIBL = null; + // @ts-ignore + this.XLM = null; + // @ts-ignore + this.TRBUP = null; + // @ts-ignore + this.VRADOWN = null; + // @ts-ignore + this.SUPER = null; + // @ts-ignore + this.EIGEN = null; + // @ts-ignore + this.IOI = null; + // @ts-ignore + this.KSM = null; + // @ts-ignore + this.CCD = null; + // @ts-ignore + this.EGO = null; + // @ts-ignore + this.EGP = null; + // @ts-ignore + this.MXC = null; + // @ts-ignore + this.TEL = null; + // @ts-ignore + this.MOVR = null; + // @ts-ignore + this.XMR = null; + // @ts-ignore + this.MXM = null; + // @ts-ignore + this.OORT = null; + // @ts-ignore + this.GLM = null; + // @ts-ignore + this.RAY = null; + // @ts-ignore + this.XTAG = null; + // @ts-ignore + this.GLQ = null; + // @ts-ignore + this.CWEB = null; + // @ts-ignore + this.REVU = null; + // @ts-ignore + this.REVV = null; + // @ts-ignore + this.ZRO = null; + // @ts-ignore + this.XNL = null; + // @ts-ignore + this.XNO = null; + // @ts-ignore + this.SAROS = null; + // @ts-ignore + this.KACE = null; + // @ts-ignore + this.ZRX = null; + // @ts-ignore + this.WLTH = null; + // @ts-ignore + this.ATOM3L = null; + // @ts-ignore + this.GMM = null; + // @ts-ignore + this.BEER = null; + // @ts-ignore + this.GMT = null; + // @ts-ignore + this.HEART = null; + // @ts-ignore + this.GMX = null; + // @ts-ignore + this.ABBC = null; + // @ts-ignore + this.OMNI = null; + // @ts-ignore + this.ATOM3S = null; + // @ts-ignore + this.IRL = null; + // @ts-ignore + this.CFG = null; + // @ts-ignore + this.WSDM = null; + // @ts-ignore + this.GNS = null; + // @ts-ignore + this.VANRY = null; + // @ts-ignore + this.CFX = null; + // @ts-ignore + this.GRAIL = null; + // @ts-ignore + this.BEFI = null; + // @ts-ignore + this.VELO = null; + // @ts-ignore + this.XPR = null; + // @ts-ignore + this.DOVI = null; + // @ts-ignore + this.ACE = null; + // @ts-ignore + this.ACH = null; + // @ts-ignore + this.ISP = null; + // @ts-ignore + this.XCAD = null; + // @ts-ignore + this.MINA = null; + // @ts-ignore + this.TIA = null; + // @ts-ignore + this.DRIFT = null; + // @ts-ignore + this.ACQ = null; + // @ts-ignore + this.ACS = null; + // @ts-ignore + this.MIND = null; + // @ts-ignore + this.STORE = null; + // @ts-ignore + this.REN = null; + // @ts-ignore + this.ELA = null; + // @ts-ignore + this.DREAMS = null; + // @ts-ignore + this.ADA = null; + // @ts-ignore + this.ELF = null; + // @ts-ignore + this.REQ = null; + // @ts-ignore + this.STORJ = null; + // @ts-ignore + this.LADYS = null; + // @ts-ignore + this.PAXG = null; + // @ts-ignore + this.REZ = null; + // @ts-ignore + this.XRD = null; + // @ts-ignore + this.CHO = null; + // @ts-ignore + this.CHR = null; + // @ts-ignore + this.ADS = null; + // @ts-ignore + this.CHZ = null; + // @ts-ignore + this.ADX = null; + // @ts-ignore + this.XRP = null; + // @ts-ignore + this.JASMY = null; + // @ts-ignore + this.KAGI = null; + // @ts-ignore + this.FIDA = null; + // @ts-ignore + this.PBR = null; + // @ts-ignore + this.AEG = null; + // @ts-ignore + this.H2O = null; + // @ts-ignore + this.CHMB = null; + // @ts-ignore + this.SAND3L = null; + // @ts-ignore + this.PBX = null; + // @ts-ignore + this.SOLVE = null; + // @ts-ignore + this.DECHAT = null; + // @ts-ignore + this.GARI = null; + // @ts-ignore + this.SHIB2L = null; + // @ts-ignore + this.SHIB2S = null; + // @ts-ignore + this.ENA = null; + // @ts-ignore + this.VEMP = null; + // @ts-ignore + this.ENJ = null; + // @ts-ignore + this.AFG = null; + // @ts-ignore + this.RATS = null; + // @ts-ignore + this.GRT = null; + // @ts-ignore + this.FORWARD = null; + // @ts-ignore + this.TFUEL = null; + // @ts-ignore + this.ENS = null; + // @ts-ignore + this.KASDOWN = null; + // @ts-ignore + this.XTM = null; + // @ts-ignore + this.DEGEN = null; + // @ts-ignore + this.TLM = null; + // @ts-ignore + this.DYDXDOWN = null; + // @ts-ignore + this.CKB = null; + // @ts-ignore + this.LUNC = null; + // @ts-ignore + this.AURORA = null; + // @ts-ignore + this.LUNA = null; + // @ts-ignore + this.XTZ = null; + // @ts-ignore + this.ELON = null; + // @ts-ignore + this.DMTR = null; + // @ts-ignore + this.EOS = null; + // @ts-ignore + this.GST = null; + // @ts-ignore + this.FORT = null; + // @ts-ignore + this.FLAME = null; + // @ts-ignore + this.PATEX = null; + // @ts-ignore + this.DEEP = null; + // @ts-ignore + this.ID3L = null; + // @ts-ignore + this.GTC = null; + // @ts-ignore + this.ID3S = null; + // @ts-ignore + this.RIO = null; + // @ts-ignore + this.CLH = null; + // @ts-ignore + this.BURGER = null; + // @ts-ignore + this.VRA = null; + // @ts-ignore + this.SUNDOG = null; + // @ts-ignore + this.GTT = null; + // @ts-ignore + this.INJUP = null; + // @ts-ignore + this.CPOOL = null; + // @ts-ignore + this.EPX = null; + // @ts-ignore + this.CLV = null; + // @ts-ignore + this.FEAR = null; + // @ts-ignore + this.MEME = null; + // @ts-ignore + this.ROOBEE = null; + // @ts-ignore + this.DEFI = null; + // @ts-ignore + this.TOKEN = null; + // @ts-ignore + this.GRAPE = null; + // @ts-ignore + this.KASUP = null; + // @ts-ignore + this.XWG = null; + // @ts-ignore + this.SKEY = null; + // @ts-ignore + this.SFUND = null; + // @ts-ignore + this.EQX = null; + // @ts-ignore + this.ORDIUP = null; + // @ts-ignore + this.TON = null; + // @ts-ignore + this.DEGO = null; + // @ts-ignore + this.IZI = null; + // @ts-ignore + this.ERG = null; + // @ts-ignore + this.ERN = null; + // @ts-ignore + this.VENOM = null; + // @ts-ignore + this.VOXEL = null; + // @ts-ignore + this.RLC = null; + // @ts-ignore + this.PHA = null; + // @ts-ignore + this.DYDXUP = null; + // @ts-ignore + this.APE3S = null; + // @ts-ignore + this.ORBS = null; + // @ts-ignore + this.OPDOWN = null; + // @ts-ignore + this.ESE = null; + // @ts-ignore + this.APE3L = null; + // @ts-ignore + this.HMND = null; + // @ts-ignore + this.COQ = null; + // @ts-ignore + this.AURY = null; + // @ts-ignore + this.CULT = null; + // @ts-ignore + this.AKT = null; + // @ts-ignore + this.GLMR = null; + // @ts-ignore + this.XYM = null; + // @ts-ignore + this.ORAI = null; + // @ts-ignore + this.XYO = null; + // @ts-ignore + this.ETC = null; + // @ts-ignore + this.LAI = null; + // @ts-ignore + this.PIP = null; + // @ts-ignore + this.ETH = null; + // @ts-ignore + this.NEO = null; + // @ts-ignore + this.RMV = null; + // @ts-ignore + this.KLAY = null; + // @ts-ignore + this.PIT = null; + // @ts-ignore + this.TARA = null; + // @ts-ignore + this.KALT = null; + // @ts-ignore + this.PIX = null; + // @ts-ignore + this.ETN = null; + // @ts-ignore + this.CSIX = null; + // @ts-ignore + this.TRADE = null; + // @ts-ignore + this.MAVIA = null; + // @ts-ignore + this.HIGH = null; + // @ts-ignore + this.TRB = null; + // @ts-ignore + this.ORDI = null; + // @ts-ignore + this.TRVL = null; + // @ts-ignore + this.AMB = null; + // @ts-ignore + this.TRU = null; + // @ts-ignore + this.LOGX = null; + // @ts-ignore + this.FINC = null; + // @ts-ignore + this.INFRA = null; + // @ts-ignore + this.NATIX = null; + // @ts-ignore + this.NFP = null; + // @ts-ignore + this.TRY = null; + // @ts-ignore + this.TRX = null; + // @ts-ignore + this.LBP = null; + // @ts-ignore + this.LBR = null; + // @ts-ignore + this.EUL = null; + // @ts-ignore + this.NFT = null; + // @ts-ignore + this.SEIUP = null; + // @ts-ignore + this.PUFFER = null; + // @ts-ignore + this.EUR = null; + // @ts-ignore + this.ORCA = null; + // @ts-ignore + this.NEAR3L = null; + // @ts-ignore + this.AMP = null; + // @ts-ignore + this.XDEFI = null; + // @ts-ignore + this.HIFI = null; + // @ts-ignore + this.TRUF = null; + // @ts-ignore + this.AITECH = null; + // @ts-ignore + this.AMU = null; + // @ts-ignore + this.USTC = null; + // @ts-ignore + this.KNGL = null; + // @ts-ignore + this.FOXY = null; + // @ts-ignore + this.NGC = null; + // @ts-ignore + this.TENET = null; + // @ts-ignore + this.NEAR3S = null; + // @ts-ignore + this.MAHA = null; + // @ts-ignore + this.NGL = null; + // @ts-ignore + this.TST = null; + // @ts-ignore + this.HIPPO = null; + // @ts-ignore + this.AXS3S = null; + // @ts-ignore + this.CRO = null; + // @ts-ignore + this.ZPAY = null; + // @ts-ignore + this.MNDE = null; + // @ts-ignore + this.CRV = null; + // @ts-ignore + this.SWASH = null; + // @ts-ignore + this.AXS3L = null; + // @ts-ignore + this.VERSE = null; + // @ts-ignore + this.RPK = null; + // @ts-ignore + this.RPL = null; + // @ts-ignore + this.AZERO = null; + // @ts-ignore + this.SOUL = null; + // @ts-ignore + this.VXV = null; + // @ts-ignore + this.LDO = null; + // @ts-ignore + this.MAGIC = null; + // @ts-ignore + this.ALICE = null; + // @ts-ignore + this.SEAM = null; + // @ts-ignore + this.PLU = null; + // @ts-ignore + this.AOG = null; + // @ts-ignore + this.SMOLE = null; + // @ts-ignore + this.EWT = null; + // @ts-ignore + this.TSUGT = null; + // @ts-ignore + this.PMG = null; + // @ts-ignore + this.OPAI = null; + // @ts-ignore + this.LOCUS = null; + // @ts-ignore + this.CTA = null; + // @ts-ignore + this.NIM = null; + // @ts-ignore + this.CTC = null; + // @ts-ignore + this.APE = null; + // @ts-ignore + this.MERL = null; + // @ts-ignore + this.JAM = null; + // @ts-ignore + this.CTI = null; + // @ts-ignore + this.APP = null; + // @ts-ignore + this.APT = null; + // @ts-ignore + this.WLDUP = null; + // @ts-ignore + this.ZEND = null; + // @ts-ignore + this.FIRE = null; + // @ts-ignore + this.DENT = null; + // @ts-ignore + this.PYTH = null; + // @ts-ignore + this.LFT = null; + // @ts-ignore + this.DPET = null; + // @ts-ignore + this.ORDIDOWN = null; + // @ts-ignore + this.KPOL = null; + // @ts-ignore + this.ETHUP = null; + // @ts-ignore + this.BAND = null; + // @ts-ignore + this.POL = null; + // @ts-ignore + this.ASTR = null; + // @ts-ignore + this.NKN = null; + // @ts-ignore + this.RSR = null; + // @ts-ignore + this.DVPN = null; + // @ts-ignore + this.TWT = null; + // @ts-ignore + this.ARB = null; + // @ts-ignore + this.CVC = null; + // @ts-ignore + this.ARC = null; + // @ts-ignore + this.XETA = null; + // @ts-ignore + this.MTRG = null; + // @ts-ignore + this.LOKA = null; + // @ts-ignore + this.LPOOL = null; + // @ts-ignore + this.TURBOS = null; + // @ts-ignore + this.CVX = null; + // @ts-ignore + this.ARX = null; + // @ts-ignore + this.MPLX = null; + // @ts-ignore + this.SUSHI = null; + // @ts-ignore + this.NLK = null; + // @ts-ignore + this.PEPE2 = null; + // @ts-ignore + this.WBTC = null; + // @ts-ignore + this.SUI3L = null; + // @ts-ignore + this.CWS = null; + // @ts-ignore + this.SUI3S = null; + // @ts-ignore + this.INSP = null; + // @ts-ignore + this.MANA = null; + // @ts-ignore + this.VRTX = null; + // @ts-ignore + this.CSPR = null; + // @ts-ignore + this.ATA = null; + // @ts-ignore + this.OPEN = null; + // @ts-ignore + this.HAI = null; + // @ts-ignore + this.NMR = null; + // @ts-ignore + this.ATH = null; + // @ts-ignore + this.LIT = null; + // @ts-ignore + this.TLOS = null; + // @ts-ignore + this.TNSR = null; + // @ts-ignore + this.CXT = null; + // @ts-ignore + this.POLYX = null; + // @ts-ignore + this.ZERO = null; + // @ts-ignore + this.ROUTE = null; + // @ts-ignore + this.LOOM = null; + // @ts-ignore + this.PRE = null; + // @ts-ignore + this.VRAUP = null; + // @ts-ignore + this.HBB = null; + // @ts-ignore + this.RVN = null; + // @ts-ignore + this.PRQ = null; + // @ts-ignore + this.ONDO = null; + // @ts-ignore + this.PEPEDOWN = null; + // @ts-ignore + this.WOOP = null; + // @ts-ignore + this.LUNCUP = null; + // @ts-ignore + this.KAVA = null; + // @ts-ignore + this.LKI = null; + // @ts-ignore + this.AVA = null; + // @ts-ignore + this.NOM = null; + // @ts-ignore + this.MAPO = null; + // @ts-ignore + this.PEPEUP = null; + // @ts-ignore + this.STRAX = null; + // @ts-ignore + this.NOT = null; + // @ts-ignore + this.ZERC = null; + // @ts-ignore + this.BCUT = null; + // @ts-ignore + this.MASA = null; + // @ts-ignore + this.WAN = null; + // @ts-ignore + this.WAT = null; + // @ts-ignore + this.WAX = null; + // @ts-ignore + this.MASK = null; + // @ts-ignore + this.EOS3L = null; + // @ts-ignore + this.IDEA = null; + // @ts-ignore + this.EOS3S = null; + // @ts-ignore + this.YFI = null; + // @ts-ignore + this.MOODENG = null; + // @ts-ignore + this.XCUR = null; + // @ts-ignore + this.HYDRA = null; + // @ts-ignore + this.POPCAT = null; + // @ts-ignore + this.LQTY = null; + // @ts-ignore + this.PIXEL = null; + // @ts-ignore + this.LMR = null; + // @ts-ignore + this.ZETA = null; + // @ts-ignore + this.YGG = null; + // @ts-ignore + this.AXS = null; + // @ts-ignore + this.BCHSV = null; + // @ts-ignore + this.NRN = null; + // @ts-ignore + this.FTON = null; + // @ts-ignore + this.COMP = null; + // @ts-ignore + this.XPRT = null; + // @ts-ignore + this.HFT = null; + // @ts-ignore + this.UXLINK = null; + // @ts-ignore + this.STAMP = null; + // @ts-ignore + this.RUNE = null; + // @ts-ignore + this.ZEUS = null; + // @ts-ignore + this.LTC3L = null; + // @ts-ignore + this.DAPP = null; + // @ts-ignore + this.FORTH = null; + // @ts-ignore + this.ALPINE = null; + // @ts-ignore + this.SENSO = null; + // @ts-ignore + this.LTC3S = null; + // @ts-ignore + this.DEXE = null; + // @ts-ignore + this.GOAL = null; + // @ts-ignore + this.AVAX = null; + // @ts-ignore + this.LISTA = null; + // @ts-ignore + this.AMPL = null; + // @ts-ignore + this.WORK = null; + // @ts-ignore + this.BRWL = null; + // @ts-ignore + this.BANANA = null; + // @ts-ignore + this.PUSH = null; + // @ts-ignore + this.WEN = null; + // @ts-ignore + this.NEIRO = null; + // @ts-ignore + this.BTCUP = null; + // @ts-ignore + this.SOL3S = null; + // @ts-ignore + this.BRAWL = null; + // @ts-ignore + this.LAY3R = null; + // @ts-ignore + this.LPT = null; + // @ts-ignore + this.GODS = null; + // @ts-ignore + this.SAND3S = null; + // @ts-ignore + this.RDNT = null; + // @ts-ignore + this.SOL3L = null; + // @ts-ignore + this.NIBI = null; + // @ts-ignore + this.NUM = null; + // @ts-ignore + this.PYR = null; + // @ts-ignore + this.DAG = null; + // @ts-ignore + this.DAI = null; + // @ts-ignore + this.HIP = null; + // @ts-ignore + this.DAO = null; + // @ts-ignore + this.AVAIL = null; + // @ts-ignore + this.DAR = null; + // @ts-ignore + this.FET = null; + // @ts-ignore + this.FCON = null; + // @ts-ignore + this.XAVA = null; + // @ts-ignore + this.LRC = null; + // @ts-ignore + this.UNI3S = null; + // @ts-ignore + this.POKT = null; + // @ts-ignore + this.DASH = null; + // @ts-ignore + this.BAKEDOWN = null; + // @ts-ignore + this.POLC = null; + // @ts-ignore + this.CIRUS = null; + // @ts-ignore + this.UNI3L = null; + // @ts-ignore + this.NWC = null; + // @ts-ignore + this.POLK = null; + // @ts-ignore + this.LSD = null; + // @ts-ignore + this.MARS4 = null; + // @ts-ignore + this.LSK = null; + // @ts-ignore + this.BLOCK = null; + // @ts-ignore + this.ANALOS = null; + // @ts-ignore + this.SAFE = null; + // @ts-ignore + this.DCK = null; + // @ts-ignore + this.LSS = null; + // @ts-ignore + this.DCR = null; + // @ts-ignore + this.LIKE = null; + // @ts-ignore + this.DATA = null; + // @ts-ignore + this.WIF = null; + // @ts-ignore + this.BLOK = null; + // @ts-ignore + this.LTC = null; + // @ts-ignore + this.METIS = null; + // @ts-ignore + this.WIN = null; + // @ts-ignore + this.HLG = null; + // @ts-ignore + this.LTO = null; + // @ts-ignore + this.DYDX = null; + // @ts-ignore + this.ARB3S = null; + // @ts-ignore + this.MUBI = null; + // @ts-ignore + this.ARB3L = null; + // @ts-ignore + this.RBTC1 = null; + // @ts-ignore + this.POND = null; + // @ts-ignore + this.LINA = null; + // @ts-ignore + this.MYRIA = null; + // @ts-ignore + this.LINK = null; + // @ts-ignore + this.QTUM = null; + // @ts-ignore + this.TUNE = null; + // @ts-ignore + this.UFO = null; + // @ts-ignore + this.CYBER = null; + // @ts-ignore + this.WILD = null; + // @ts-ignore + this.POLS = null; + // @ts-ignore + this.NYM = null; + // @ts-ignore + this.FIL = null; + // @ts-ignore + this.BAL = null; + // @ts-ignore + this.SCA = null; + // @ts-ignore + this.STND = null; + // @ts-ignore + this.WMTX = null; + // @ts-ignore + this.SCLP = null; + // @ts-ignore + this.MANEKI = null; + // @ts-ignore + this.BAT = null; + // @ts-ignore + this.AKRO = null; + // @ts-ignore + this.FTM3L = null; + // @ts-ignore + this.BAX = null; + // @ts-ignore + this.FTM3S = null; + // @ts-ignore + this.COTI = null; + } /** * common response */ @@ -3602,16 +6291,15 @@ export class GetFiatPriceResp implements Response { +export class GetFullOrderBookReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetFullOrderBookReq` class. * The builder pattern allows step-by-step construction of a `GetFullOrderBookReq` object. */ static builder(): GetFullOrderBookReqBuilder { - return new GetFullOrderBookReqBuilder(); + return new GetFullOrderBookReqBuilder(new GetFullOrderBookReq()); } /** @@ -31,22 +32,23 @@ export class GetFullOrderBookReq implements Serializable { return obj; } - fromJson(input: string): GetFullOrderBookReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetFullOrderBookReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetFullOrderBookReq { - return plainToInstance(GetFullOrderBookReq, jsonObject); + static fromJson(input: string): GetFullOrderBookReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetFullOrderBookReq { + return plainToClassFromExist(new GetFullOrderBookReq(), jsonObject); } } export class GetFullOrderBookReqBuilder { - obj: GetFullOrderBookReq = new GetFullOrderBookReq(); + constructor(readonly obj: GetFullOrderBookReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts index f4d94e77..52fd8755 100644 --- a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetFullOrderBookResp implements Response { +export class GetFullOrderBookResp implements Response { /** * Timestamp(millisecond) */ - time?: number; + time: number; + /** * Sequence number */ - sequence?: string; + sequence: string; + /** * bids, from high to low */ - bids?: Array>; + bids: Array>; + /** * asks, from low to high */ - asks?: Array>; + asks: Array>; + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.asks = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class GetFullOrderBookResp implements Response { +export class GetKlinesReq implements Serializable { /** * symbol */ symbol?: string; + /** * Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week, 1month */ type?: GetKlinesReq.TypeEnum; + /** * Start time (second), default is 0 */ startAt?: number = 0; + /** * End time (second), default is 0 */ endAt?: number = 0; + private constructor() {} /** * Creates a new instance of the `GetKlinesReq` class. * The builder pattern allows step-by-step construction of a `GetKlinesReq` object. */ static builder(): GetKlinesReqBuilder { - return new GetKlinesReqBuilder(); + return new GetKlinesReqBuilder(new GetKlinesReq()); } /** @@ -53,22 +57,29 @@ export class GetKlinesReq implements Serializable { let obj = new GetKlinesReq(); obj.symbol = data.symbol; obj.type = data.type; - obj.startAt = data.startAt; - obj.endAt = data.endAt; + if (data.startAt) { + obj.startAt = data.startAt; + } else { + obj.startAt = 0; + } + if (data.endAt) { + obj.endAt = data.endAt; + } else { + obj.endAt = 0; + } return obj; } - fromJson(input: string): GetKlinesReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKlinesReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetKlinesReq { - return plainToInstance(GetKlinesReq, jsonObject); + static fromJson(input: string): GetKlinesReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKlinesReq { + return plainToClassFromExist(new GetKlinesReq(), jsonObject); } } @@ -134,7 +145,9 @@ export namespace GetKlinesReq { } export class GetKlinesReqBuilder { - obj: GetKlinesReq = new GetKlinesReq(); + constructor(readonly obj: GetKlinesReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts index 546b19e1..3013967d 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetKlinesResp implements Response { +export class GetKlinesResp implements Response { /** * */ - data?: Array>; + data: Array>; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetKlinesResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetKlinesResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetKlinesResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetKlinesResp { - return plainToInstance(GetKlinesResp, { data: jsonObject }); + static fromJson(input: string): GetKlinesResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetKlinesResp { + return plainToClassFromExist(new GetKlinesResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts index 0292fb6f..94f83a4b 100644 --- a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetMarketListResp implements Response { +export class GetMarketListResp implements Response { /** * */ - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetMarketListResp implements Response { +export class GetPartOrderBookReq implements Serializable { /** * symbol */ symbol?: string; + /** * Get the depth layer, optional value: 20, 100 */ @Reflect.metadata('path', 'size') size?: string; + private constructor() {} /** * Creates a new instance of the `GetPartOrderBookReq` class. * The builder pattern allows step-by-step construction of a `GetPartOrderBookReq` object. */ static builder(): GetPartOrderBookReqBuilder { - return new GetPartOrderBookReqBuilder(); + return new GetPartOrderBookReqBuilder(new GetPartOrderBookReq()); } /** @@ -42,22 +44,23 @@ export class GetPartOrderBookReq implements Serializable { return obj; } - fromJson(input: string): GetPartOrderBookReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPartOrderBookReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPartOrderBookReq { - return plainToInstance(GetPartOrderBookReq, jsonObject); + static fromJson(input: string): GetPartOrderBookReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPartOrderBookReq { + return plainToClassFromExist(new GetPartOrderBookReq(), jsonObject); } } export class GetPartOrderBookReqBuilder { - obj: GetPartOrderBookReq = new GetPartOrderBookReq(); + constructor(readonly obj: GetPartOrderBookReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts index 39226a19..bb3df7da 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts @@ -1,27 +1,40 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPartOrderBookResp implements Response { +export class GetPartOrderBookResp implements Response { /** * Timestamp(millisecond) */ - time?: number; + time: number; + /** * Sequence number */ - sequence?: string; + sequence: string; + /** * bids, from high to low */ - bids?: Array>; + bids: Array>; + /** * asks, from low to high */ - asks?: Array>; + asks: Array>; + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.asks = null; + } /** * common response */ @@ -32,16 +45,15 @@ export class GetPartOrderBookResp implements Response -{ +export class GetPrivateTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change */ - endpoint?: string; + endpoint: string; + /** * Whether to encrypt. Currently only supports wss, not ws */ - encrypt?: boolean; + encrypt: boolean; + /** * Network Protocol */ - protocol?: GetPrivateTokenInstanceServers.ProtocolEnum; + protocol: GetPrivateTokenInstanceServers.ProtocolEnum; + /** * Recommended ping interval(millisecond) */ - pingInterval?: number; + pingInterval: number; + /** * Heartbeat timeout(millisecond) */ - pingTimeout?: number; + pingTimeout: number; - fromJson(input: string): GetPrivateTokenInstanceServers { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + private constructor() { + // @ts-ignore + this.endpoint = null; + // @ts-ignore + this.encrypt = null; + // @ts-ignore + this.protocol = null; + // @ts-ignore + this.pingInterval = null; + // @ts-ignore + this.pingTimeout = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { - return plainToInstance(GetPrivateTokenInstanceServers, jsonObject); + static fromJson(input: string): GetPrivateTokenInstanceServers { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { + return plainToClassFromExist(new GetPrivateTokenInstanceServers(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts index c63fb8eb..30d35009 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetPrivateTokenInstanceServers } from './model_get_private_token_instance_servers'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPrivateTokenResp implements Response { +export class GetPrivateTokenResp implements Response { /** * The token required to establish a websocket connection */ - token?: string; + token: string; + /** * */ @Type(() => GetPrivateTokenInstanceServers) - instanceServers?: Array; + instanceServers: Array; + private constructor() { + // @ts-ignore + this.token = null; + // @ts-ignore + this.instanceServers = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetPrivateTokenResp implements Response { +export class GetPublicTokenInstanceServers implements Serializable { /** * Websocket domain URL, It is recommended to use a dynamic URL as the URL may change */ - endpoint?: string; + endpoint: string; + /** * Whether to encrypt. Currently only supports wss, not ws */ - encrypt?: boolean; + encrypt: boolean; + /** * Network Protocol */ - protocol?: GetPublicTokenInstanceServers.ProtocolEnum; + protocol: GetPublicTokenInstanceServers.ProtocolEnum; + /** * Recommended ping interval(millisecond) */ - pingInterval?: number; + pingInterval: number; + /** * Heartbeat timeout(millisecond) */ - pingTimeout?: number; + pingTimeout: number; - fromJson(input: string): GetPublicTokenInstanceServers { - const jsonObject = JSON.parse(input); - return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + private constructor() { + // @ts-ignore + this.endpoint = null; + // @ts-ignore + this.encrypt = null; + // @ts-ignore + this.protocol = null; + // @ts-ignore + this.pingInterval = null; + // @ts-ignore + this.pingTimeout = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetPublicTokenInstanceServers { - return plainToInstance(GetPublicTokenInstanceServers, jsonObject); + static fromJson(input: string): GetPublicTokenInstanceServers { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetPublicTokenInstanceServers { + return plainToClassFromExist(new GetPublicTokenInstanceServers(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts index 032b4362..c6c5da8b 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetPublicTokenInstanceServers } from './model_get_public_token_instance_servers'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetPublicTokenResp implements Response { +export class GetPublicTokenResp implements Response { /** * The token required to establish a websocket connection */ - token?: string; + token: string; + /** * */ @Type(() => GetPublicTokenInstanceServers) - instanceServers?: Array; + instanceServers: Array; + private constructor() { + // @ts-ignore + this.token = null; + // @ts-ignore + this.instanceServers = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetPublicTokenResp implements Response { +export class GetServerTimeResp implements Response { /** * ServerTime(millisecond) */ - data?: number; + data: number; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class GetServerTimeResp implements Response { +export class GetServiceStatusResp implements Response { /** * Status of service: open:normal transaction, close:Stop Trading/Maintenance, cancelonly:can only cancel the order but not place order */ - status?: GetServiceStatusResp.StatusEnum; + status: GetServiceStatusResp.StatusEnum; + /** * Remark for operation */ - msg?: string; + msg: string; + private constructor() { + // @ts-ignore + this.status = null; + // @ts-ignore + this.msg = null; + } /** * common response */ @@ -24,17 +31,16 @@ export class GetServiceStatusResp implements Response { +export class GetSymbolReq implements Serializable { /** * Path parameter, Symbol */ @Reflect.metadata('path', 'symbol') symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetSymbolReq` class. * The builder pattern allows step-by-step construction of a `GetSymbolReq` object. */ static builder(): GetSymbolReqBuilder { - return new GetSymbolReqBuilder(); + return new GetSymbolReqBuilder(new GetSymbolReq()); } /** @@ -33,22 +34,23 @@ export class GetSymbolReq implements Serializable { return obj; } - fromJson(input: string): GetSymbolReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolReq { - return plainToInstance(GetSymbolReq, jsonObject); + static fromJson(input: string): GetSymbolReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolReq { + return plainToClassFromExist(new GetSymbolReq(), jsonObject); } } export class GetSymbolReqBuilder { - obj: GetSymbolReq = new GetSymbolReq(); + constructor(readonly obj: GetSymbolReq) { + this.obj = obj; + } /** * Path parameter, Symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts index c2d6c7c0..11823c20 100644 --- a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts @@ -1,95 +1,159 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetSymbolResp implements Response { +export class GetSymbolResp implements Response { /** * unique code of a symbol, it would not change after renaming */ - symbol?: string; + symbol: string; + /** * Name of trading pairs, it would change after renaming */ - name?: string; + name: string; + /** * Base currency,e.g. BTC. */ - baseCurrency?: string; + baseCurrency: string; + /** * Quote currency,e.g. USDT. */ - quoteCurrency?: string; + quoteCurrency: string; + /** * The currency of charged fees. */ - feeCurrency?: string; + feeCurrency: string; + /** * The trading market. */ - market?: string; + market: string; + /** * The minimum order quantity requried to place an order. */ - baseMinSize?: string; + baseMinSize: string; + /** * The minimum order funds required to place a market order. */ - quoteMinSize?: string; + quoteMinSize: string; + /** * The maximum order size required to place an order. */ - baseMaxSize?: string; + baseMaxSize: string; + /** * The maximum order funds required to place a market order. */ - quoteMaxSize?: string; + quoteMaxSize: string; + /** * Quantity increment: The quantity for an order must be a positive integer multiple of this increment. Here, the size refers to the quantity of the base currency for the order. For example, for the ETH-USDT trading pair, if the baseIncrement is 0.0000001, the order quantity can be 1.0000001 but not 1.00000001. */ - baseIncrement?: string; + baseIncrement: string; + /** * Quote increment: The funds for a market order must be a positive integer multiple of this increment. The funds refer to the quote currency amount. For example, for the ETH-USDT trading pair, if the quoteIncrement is 0.000001, the amount of USDT for the order can be 3000.000001 but not 3000.0000001. */ - quoteIncrement?: string; + quoteIncrement: string; + /** * Price increment: The price of an order must be a positive integer multiple of this increment. For example, for the ETH-USDT trading pair, if the priceIncrement is 0.01, the order price can be 3000.01 but not 3000.001. */ - priceIncrement?: string; + priceIncrement: string; + /** * Threshold for price portection */ - priceLimitRate?: string; + priceLimitRate: string; + /** * the minimum trading amounts */ - minFunds?: string; + minFunds: string; + /** * Available for margin or not. */ - isMarginEnabled?: boolean; + isMarginEnabled: boolean; + /** * Available for transaction or not. */ - enableTrading?: boolean; + enableTrading: boolean; + /** * [Fee Type](https://www.kucoin.com/vip/privilege) */ - feeCategory?: GetSymbolResp.FeeCategoryEnum; + feeCategory: GetSymbolResp.FeeCategoryEnum; + /** * The maker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - makerFeeCoefficient?: string; + makerFeeCoefficient: string; + /** * The taker fee coefficient. The actual fee needs to be multiplied by this coefficient to get the final fee. Most currencies have a coefficient of 1. If set to 0, it means no fee */ - takerFeeCoefficient?: string; + takerFeeCoefficient: string; + /** * */ - st?: boolean; + st: boolean; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.name = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.market = null; + // @ts-ignore + this.baseMinSize = null; + // @ts-ignore + this.quoteMinSize = null; + // @ts-ignore + this.baseMaxSize = null; + // @ts-ignore + this.quoteMaxSize = null; + // @ts-ignore + this.baseIncrement = null; + // @ts-ignore + this.quoteIncrement = null; + // @ts-ignore + this.priceIncrement = null; + // @ts-ignore + this.priceLimitRate = null; + // @ts-ignore + this.minFunds = null; + // @ts-ignore + this.isMarginEnabled = null; + // @ts-ignore + this.enableTrading = null; + // @ts-ignore + this.feeCategory = null; + // @ts-ignore + this.makerFeeCoefficient = null; + // @ts-ignore + this.takerFeeCoefficient = null; + // @ts-ignore + this.st = null; + } /** * common response */ @@ -100,17 +164,16 @@ export class GetSymbolResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetSymbolResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolResp { - return plainToInstance(GetSymbolResp, jsonObject); + static fromJson(input: string): GetSymbolResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolResp { + return plainToClassFromExist(new GetSymbolResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts index 6220fedc..dc88ebc4 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTickerReq implements Serializable { +export class GetTickerReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetTickerReq` class. * The builder pattern allows step-by-step construction of a `GetTickerReq` object. */ static builder(): GetTickerReqBuilder { - return new GetTickerReqBuilder(); + return new GetTickerReqBuilder(new GetTickerReq()); } /** @@ -31,22 +32,23 @@ export class GetTickerReq implements Serializable { return obj; } - fromJson(input: string): GetTickerReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTickerReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTickerReq { - return plainToInstance(GetTickerReq, jsonObject); + static fromJson(input: string): GetTickerReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTickerReq { + return plainToClassFromExist(new GetTickerReq(), jsonObject); } } export class GetTickerReqBuilder { - obj: GetTickerReq = new GetTickerReq(); + constructor(readonly obj: GetTickerReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts index ff818da2..66211745 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts @@ -1,43 +1,68 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTickerResp implements Response { +export class GetTickerResp implements Response { /** * timestamp */ - time?: number; + time: number; + /** * Sequence */ - sequence?: string; + sequence: string; + /** * Last traded price */ - price?: string; + price: string; + /** * Last traded size */ - size?: string; + size: string; + /** * Best bid price */ - bestBid?: string; + bestBid: string; + /** * Best bid size */ - bestBidSize?: string; + bestBidSize: string; + /** * Best ask price */ - bestAsk?: string; + bestAsk: string; + /** * Best ask size */ - bestAskSize?: string; + bestAskSize: string; + private constructor() { + // @ts-ignore + this.time = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.bestBid = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.bestAsk = null; + // @ts-ignore + this.bestAskSize = null; + } /** * common response */ @@ -48,16 +73,15 @@ export class GetTickerResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetTickerResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTickerResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTickerResp { - return plainToInstance(GetTickerResp, jsonObject); + static fromJson(input: string): GetTickerResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTickerResp { + return plainToClassFromExist(new GetTickerResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts index d49b4904..0106e185 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts @@ -1,41 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryData implements Serializable { +export class GetTradeHistoryData implements Serializable { /** * Sequence number */ - sequence?: string; + sequence: string; + /** * Filled price */ - price?: string; + price: string; + /** * Filled amount */ - size?: string; + size: string; + /** * Filled side, The trade side indicates the taker order side. A taker order is the order that was matched with orders opened on the order book. */ - side?: GetTradeHistoryData.SideEnum; + side: GetTradeHistoryData.SideEnum; + /** * Filled timestamp(nanosecond) */ - time?: number; + time: number; - fromJson(input: string): GetTradeHistoryData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryData, jsonObject); + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.time = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryData { - return plainToInstance(GetTradeHistoryData, jsonObject); + static fromJson(input: string): GetTradeHistoryData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryData { + return plainToClassFromExist(new GetTradeHistoryData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts index c4db12eb..f138ff35 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryReq implements Serializable { +export class GetTradeHistoryReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. */ static builder(): GetTradeHistoryReqBuilder { - return new GetTradeHistoryReqBuilder(); + return new GetTradeHistoryReqBuilder(new GetTradeHistoryReq()); } /** @@ -31,22 +32,23 @@ export class GetTradeHistoryReq implements Serializable { return obj; } - fromJson(input: string): GetTradeHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryReq { - return plainToInstance(GetTradeHistoryReq, jsonObject); + static fromJson(input: string): GetTradeHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } } export class GetTradeHistoryReqBuilder { - obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + constructor(readonly obj: GetTradeHistoryReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts index be1b821e..198f4e8e 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; import { GetTradeHistoryData } from './model_get_trade_history_data'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTradeHistoryResp implements Response { +export class GetTradeHistoryResp implements Response { /** * */ @Type(() => GetTradeHistoryData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetTradeHistoryResp implements Response { +export class AddOcoOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOcoOrderReq.SideEnum; + side: AddOcoOrderReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * Specify price for order */ - price?: string; + price: string; + /** * Specify quantity for order */ - size?: string; + size: string; + /** * trigger price. */ - stopPrice?: string; + stopPrice: string; + /** * The limit order price after take-profit and stop-loss are triggered. */ - limitPrice?: string; + limitPrice: string; + /** * Transaction Type, currently only supports TRADE (spot transactions), the default is TRADE */ tradeType?: AddOcoOrderReq.TradeTypeEnum; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.limitPrice = null; + } /** * Creates a new instance of the `AddOcoOrderReq` class. * The builder pattern allows step-by-step construction of a `AddOcoOrderReq` object. */ static builder(): AddOcoOrderReqBuilder { - return new AddOcoOrderReqBuilder(); + return new AddOcoOrderReqBuilder(new AddOcoOrderReq()); } /** @@ -56,15 +80,15 @@ export class AddOcoOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOcoOrderReq.SideEnum; + side: AddOcoOrderReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ @@ -72,19 +96,19 @@ export class AddOcoOrderReq implements Serializable { /** * Specify price for order */ - price?: string; + price: string; /** * Specify quantity for order */ - size?: string; + size: string; /** * trigger price. */ - stopPrice?: string; + stopPrice: string; /** * The limit order price after take-profit and stop-loss are triggered. */ - limitPrice?: string; + limitPrice: string; /** * Transaction Type, currently only supports TRADE (spot transactions), the default is TRADE */ @@ -103,17 +127,16 @@ export class AddOcoOrderReq implements Serializable { return obj; } - fromJson(input: string): AddOcoOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOcoOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOcoOrderReq { - return plainToInstance(AddOcoOrderReq, jsonObject); + static fromJson(input: string): AddOcoOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOcoOrderReq { + return plainToClassFromExist(new AddOcoOrderReq(), jsonObject); } } @@ -137,7 +160,9 @@ export namespace AddOcoOrderReq { } export class AddOcoOrderReqBuilder { - obj: AddOcoOrderReq = new AddOcoOrderReq(); + constructor(readonly obj: AddOcoOrderReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts index 64679f8b..6754fc12 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOcoOrderResp implements Response { +export class AddOcoOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class AddOcoOrderResp implements Response this.commonResponse = response; } - fromJson(input: string): AddOcoOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOcoOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOcoOrderResp { - return plainToInstance(AddOcoOrderResp, jsonObject); + static fromJson(input: string): AddOcoOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOcoOrderResp { + return plainToClassFromExist(new AddOcoOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts index ef9d8568..cb07f954 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts @@ -1,80 +1,103 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderOldReq implements Serializable { +export class AddOrderOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderOldReq.SideEnum; + side: AddOrderOldReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderOldReq.TypeEnum = AddOrderOldReq.TypeEnum.LIMIT; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderOldReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderOldReq.TimeInForceEnum = AddOrderOldReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * Hidden or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in iceberg orders */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** */ tradeType?: AddOrderOldReq.TradeTypeEnum = AddOrderOldReq.TradeTypeEnum.TRADE; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderOldReq` class. * The builder pattern allows step-by-step construction of a `AddOrderOldReq` object. */ static builder(): AddOrderOldReqBuilder { - return new AddOrderOldReqBuilder(); + return new AddOrderOldReqBuilder(new AddOrderOldReq()); } /** @@ -84,15 +107,15 @@ export class AddOrderOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderOldReq.SideEnum; + side: AddOrderOldReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -150,33 +173,56 @@ export class AddOrderOldReq implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderOldReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderOldReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.tradeType = data.tradeType; + if (data.tradeType) { + obj.tradeType = data.tradeType; + } else { + obj.tradeType = AddOrderOldReq.TradeTypeEnum.TRADE; + } return obj; } - fromJson(input: string): AddOrderOldReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderOldReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderOldReq { - return plainToInstance(AddOrderOldReq, jsonObject); + static fromJson(input: string): AddOrderOldReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderOldReq { + return plainToClassFromExist(new AddOrderOldReq(), jsonObject); } } @@ -250,7 +296,9 @@ export namespace AddOrderOldReq { } export class AddOrderOldReqBuilder { - obj: AddOrderOldReq = new AddOrderOldReq(); + constructor(readonly obj: AddOrderOldReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts index d9fbb7de..3b9e53f7 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderOldResp implements Response { +export class AddOrderOldResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class AddOrderOldResp implements Response this.commonResponse = response; } - fromJson(input: string): AddOrderOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderOldResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderOldResp { - return plainToInstance(AddOrderOldResp, jsonObject); + static fromJson(input: string): AddOrderOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderOldResp { + return plainToClassFromExist(new AddOrderOldResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_add_order_req.ts b/sdk/node/src/generate/spot/order/model_add_order_req.ts index 8fda5173..fa597588 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_req.ts @@ -1,80 +1,103 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderReq implements Serializable { +export class AddOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderReq.TypeEnum; + type: AddOrderReq.TypeEnum; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderReq.TimeInForceEnum = AddOrderReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + private constructor() { + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `AddOrderReq` class. * The builder pattern allows step-by-step construction of a `AddOrderReq` object. */ static builder(): AddOrderReqBuilder { - return new AddOrderReqBuilder(); + return new AddOrderReqBuilder(new AddOrderReq()); } /** @@ -88,15 +111,15 @@ export class AddOrderReq implements Serializable { /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderReq.SideEnum; + side: AddOrderReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderReq.TypeEnum; + type: AddOrderReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ @@ -155,10 +178,26 @@ export class AddOrderReq implements Serializable { obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.tags = data.tags; obj.cancelAfter = data.cancelAfter; @@ -166,17 +205,16 @@ export class AddOrderReq implements Serializable { return obj; } - fromJson(input: string): AddOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderReq { - return plainToInstance(AddOrderReq, jsonObject); + static fromJson(input: string): AddOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderReq { + return plainToClassFromExist(new AddOrderReq(), jsonObject); } } @@ -240,7 +278,9 @@ export namespace AddOrderReq { } export class AddOrderReqBuilder { - obj: AddOrderReq = new AddOrderReq(); + constructor(readonly obj: AddOrderReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_resp.ts index b221e43d..7545d9d8 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderResp implements Response { +export class AddOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderResp implements Response { this.commonResponse = response; } - fromJson(input: string): AddOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderResp { - return plainToInstance(AddOrderResp, jsonObject); + static fromJson(input: string): AddOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderResp { + return plainToClassFromExist(new AddOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts index ea65a040..c0abaa25 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts @@ -1,80 +1,103 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AddOrderSyncReq implements Serializable { +export class AddOrderSyncReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderSyncReq.SideEnum; + side: AddOrderSyncReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderSyncReq.TypeEnum; + type: AddOrderSyncReq.TypeEnum; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderSyncReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderSyncReq.TimeInForceEnum = AddOrderSyncReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + private constructor() { + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `AddOrderSyncReq` class. * The builder pattern allows step-by-step construction of a `AddOrderSyncReq` object. */ static builder(): AddOrderSyncReqBuilder { - return new AddOrderSyncReqBuilder(); + return new AddOrderSyncReqBuilder(new AddOrderSyncReq()); } /** @@ -88,15 +111,15 @@ export class AddOrderSyncReq implements Serializable { /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderSyncReq.SideEnum; + side: AddOrderSyncReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderSyncReq.TypeEnum; + type: AddOrderSyncReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ @@ -155,10 +178,26 @@ export class AddOrderSyncReq implements Serializable { obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderSyncReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.tags = data.tags; obj.cancelAfter = data.cancelAfter; @@ -166,17 +205,16 @@ export class AddOrderSyncReq implements Serializable { return obj; } - fromJson(input: string): AddOrderSyncReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderSyncReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderSyncReq { - return plainToInstance(AddOrderSyncReq, jsonObject); + static fromJson(input: string): AddOrderSyncReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderSyncReq { + return plainToClassFromExist(new AddOrderSyncReq(), jsonObject); } } @@ -240,7 +278,9 @@ export namespace AddOrderSyncReq { } export class AddOrderSyncReqBuilder { - obj: AddOrderSyncReq = new AddOrderSyncReq(); + constructor(readonly obj: AddOrderSyncReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts index 424ac2df..60f9e167 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts @@ -1,47 +1,75 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderSyncResp implements Response { +export class AddOrderSyncResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + /** * */ - orderTime?: number; + orderTime: number; + /** * original order size */ - originSize?: string; + originSize: string; + /** * deal size */ - dealSize?: string; + dealSize: string; + /** * remain size */ - remainSize?: string; + remainSize: string; + /** * Cumulative canceled size */ - canceledSize?: string; + canceledSize: string; + /** * Order Status. open:order is active; done:order has been completed */ - status?: AddOrderSyncResp.StatusEnum; + status: AddOrderSyncResp.StatusEnum; + /** * */ - matchTime?: number; + matchTime: number; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.originSize = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.canceledSize = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.matchTime = null; + } /** * common response */ @@ -52,17 +80,16 @@ export class AddOrderSyncResp implements Response { +export class AddOrderTestOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestOldReq.SideEnum; + side: AddOrderTestOldReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ type?: AddOrderTestOldReq.TypeEnum = AddOrderTestOldReq.TypeEnum.LIMIT; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderTestOldReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderTestOldReq.TimeInForceEnum = AddOrderTestOldReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * Hidden or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in iceberg orders */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * The type of trading : **TRADE**(Spot Trade), **MARGIN_TRADE** (Margin Trade). Default is **TRADE**. **Note: To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for order placing of margin. For traders still using the current interface, please move to the new one as soon as possible. The current one will no longer accept margin orders by May 1st, 2021 (UTC). At the time, KuCoin will notify users via the announcement, please pay attention to it.** */ tradeType?: AddOrderTestOldReq.TradeTypeEnum = AddOrderTestOldReq.TradeTypeEnum.TRADE; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `AddOrderTestOldReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestOldReq` object. */ static builder(): AddOrderTestOldReqBuilder { - return new AddOrderTestOldReqBuilder(); + return new AddOrderTestOldReqBuilder(new AddOrderTestOldReq()); } /** @@ -84,15 +107,15 @@ export class AddOrderTestOldReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestOldReq.SideEnum; + side: AddOrderTestOldReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ @@ -150,33 +173,56 @@ export class AddOrderTestOldReq implements Serializable { obj.clientOid = data.clientOid; obj.side = data.side; obj.symbol = data.symbol; - obj.type = data.type; + if (data.type) { + obj.type = data.type; + } else { + obj.type = AddOrderTestOldReq.TypeEnum.LIMIT; + } obj.remark = data.remark; obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestOldReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; - obj.tradeType = data.tradeType; + if (data.tradeType) { + obj.tradeType = data.tradeType; + } else { + obj.tradeType = AddOrderTestOldReq.TradeTypeEnum.TRADE; + } return obj; } - fromJson(input: string): AddOrderTestOldReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestOldReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestOldReq { - return plainToInstance(AddOrderTestOldReq, jsonObject); + static fromJson(input: string): AddOrderTestOldReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestOldReq { + return plainToClassFromExist(new AddOrderTestOldReq(), jsonObject); } } @@ -250,7 +296,9 @@ export namespace AddOrderTestOldReq { } export class AddOrderTestOldReqBuilder { - obj: AddOrderTestOldReq = new AddOrderTestOldReq(); + constructor(readonly obj: AddOrderTestOldReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts index 729df3e6..3f3ecbc1 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts @@ -1,15 +1,19 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestOldResp implements Response { +export class AddOrderTestOldResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class AddOrderTestOldResp implements Response { +export class AddOrderTestReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderTestReq.TypeEnum; + type: AddOrderTestReq.TypeEnum; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddOrderTestReq.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: AddOrderTestReq.TimeInForceEnum = AddOrderTestReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + private constructor() { + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + } /** * Creates a new instance of the `AddOrderTestReq` class. * The builder pattern allows step-by-step construction of a `AddOrderTestReq` object. */ static builder(): AddOrderTestReqBuilder { - return new AddOrderTestReqBuilder(); + return new AddOrderTestReqBuilder(new AddOrderTestReq()); } /** @@ -88,15 +111,15 @@ export class AddOrderTestReq implements Serializable { /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddOrderTestReq.SideEnum; + side: AddOrderTestReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddOrderTestReq.TypeEnum; + type: AddOrderTestReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ @@ -155,10 +178,26 @@ export class AddOrderTestReq implements Serializable { obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddOrderTestReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.tags = data.tags; obj.cancelAfter = data.cancelAfter; @@ -166,17 +205,16 @@ export class AddOrderTestReq implements Serializable { return obj; } - fromJson(input: string): AddOrderTestReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddOrderTestReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddOrderTestReq { - return plainToInstance(AddOrderTestReq, jsonObject); + static fromJson(input: string): AddOrderTestReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddOrderTestReq { + return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } } @@ -240,7 +278,9 @@ export namespace AddOrderTestReq { } export class AddOrderTestReqBuilder { - obj: AddOrderTestReq = new AddOrderTestReq(); + constructor(readonly obj: AddOrderTestReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts index 9eae886c..20e19e9d 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddOrderTestResp implements Response { +export class AddOrderTestResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddOrderTestResp implements Response { +export class AddStopOrderReq implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ clientOid?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddStopOrderReq.SideEnum; + side: AddStopOrderReq.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddStopOrderReq.TypeEnum; + type: AddStopOrderReq.TypeEnum; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: AddStopOrderReq.StpEnum; + /** * Specify price for order, not need for market order. When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ price?: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading. Required for limit orders. */ timeInForce?: AddStopOrderReq.TimeInForceEnum = AddStopOrderReq.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK if **type** is limit. */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * When **type** is limit, this is Maximum visible quantity in iceberg orders. */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT when **type** is limit. */ cancelAfter?: number; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + /** * The trigger price. */ - stopPrice?: string; + stopPrice: string; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE */ tradeType?: string; + private constructor() { + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.stopPrice = null; + } /** * Creates a new instance of the `AddStopOrderReq` class. * The builder pattern allows step-by-step construction of a `AddStopOrderReq` object. */ static builder(): AddStopOrderReqBuilder { - return new AddStopOrderReqBuilder(); + return new AddStopOrderReqBuilder(new AddStopOrderReq()); } /** @@ -92,15 +118,15 @@ export class AddStopOrderReq implements Serializable { /** * specify if the order is to \'buy\' or \'sell\' */ - side?: AddStopOrderReq.SideEnum; + side: AddStopOrderReq.SideEnum; /** * symbol */ - symbol?: string; + symbol: string; /** * specify if the order is an \'limit\' order or \'market\' order. The type of order you specify when you place your order determines whether or not you need to request other parameters and also affects the execution of the matching engine. When placing a limit order, you must specify a price and size. The system will try to match the order according to market price or a price better than market price. If the order cannot be immediately matched, it will stay in the order book until it is matched or the user cancels. Unlike limit orders, the price for market orders fluctuates with market prices. When placing a market order, you do not need to specify a price, you only need to specify a quantity. Market orders are filled immediately and will not enter the order book. All market orders are takers and a taker fee will be charged. */ - type?: AddStopOrderReq.TypeEnum; + type: AddStopOrderReq.TypeEnum; /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ @@ -148,7 +174,7 @@ export class AddStopOrderReq implements Serializable { /** * The trigger price. */ - stopPrice?: string; + stopPrice: string; /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE */ @@ -163,10 +189,26 @@ export class AddStopOrderReq implements Serializable { obj.stp = data.stp; obj.price = data.price; obj.size = data.size; - obj.timeInForce = data.timeInForce; - obj.postOnly = data.postOnly; - obj.hidden = data.hidden; - obj.iceberg = data.iceberg; + if (data.timeInForce) { + obj.timeInForce = data.timeInForce; + } else { + obj.timeInForce = AddStopOrderReq.TimeInForceEnum.GTC; + } + if (data.postOnly) { + obj.postOnly = data.postOnly; + } else { + obj.postOnly = false; + } + if (data.hidden) { + obj.hidden = data.hidden; + } else { + obj.hidden = false; + } + if (data.iceberg) { + obj.iceberg = data.iceberg; + } else { + obj.iceberg = false; + } obj.visibleSize = data.visibleSize; obj.cancelAfter = data.cancelAfter; obj.funds = data.funds; @@ -175,17 +217,16 @@ export class AddStopOrderReq implements Serializable { return obj; } - fromJson(input: string): AddStopOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(AddStopOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AddStopOrderReq { - return plainToInstance(AddStopOrderReq, jsonObject); + static fromJson(input: string): AddStopOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AddStopOrderReq { + return plainToClassFromExist(new AddStopOrderReq(), jsonObject); } } @@ -249,7 +290,9 @@ export namespace AddStopOrderReq { } export class AddStopOrderReqBuilder { - obj: AddStopOrderReq = new AddStopOrderReq(); + constructor(readonly obj: AddStopOrderReq) { + this.obj = obj; + } /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts index 054887e6..d3db6ea0 100644 --- a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AddStopOrderResp implements Response { +export class AddStopOrderResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * The user self-defined order id. */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class AddStopOrderResp implements Response { +export class BatchAddOrdersData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ orderId?: string; + /** * The user self-defined order id. */ clientOid?: string; + /** * Add order success/failure */ - success?: boolean; + success: boolean; + /** * error message */ failMsg?: string; - fromJson(input: string): BatchAddOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.success = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersData { - return plainToInstance(BatchAddOrdersData, jsonObject); + static fromJson(input: string): BatchAddOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersData { + return plainToClassFromExist(new BatchAddOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts index 4a4b63a6..fc0b4e7a 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts @@ -1,104 +1,167 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchAddOrdersOldData implements Serializable { +export class BatchAddOrdersOldData implements Serializable { /** * */ - symbol?: string; + symbol: string; + /** * */ - type?: string; + type: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - size?: string; + size: string; + /** * */ - funds?: string; + funds: string; + /** * */ - stp?: string; + stp: string; + /** * */ - stop?: string; + stop: string; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - timeInForce?: string; + timeInForce: string; + /** * */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - postOnly?: boolean; + postOnly: boolean; + /** * */ - hidden?: boolean; + hidden: boolean; + /** * */ - iceberge?: boolean; + iceberge: boolean; + /** * */ - iceberg?: boolean; + iceberg: boolean; + /** * */ - visibleSize?: string; + visibleSize: string; + /** * */ - channel?: string; + channel: string; + /** * */ - id?: string; + id: string; + /** * */ - status?: string; + status: string; + /** * */ - failMsg?: string; + failMsg: string; + /** * */ - clientOid?: string; + clientOid: string; - fromJson(input: string): BatchAddOrdersOldData { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersOldData, jsonObject); + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberge = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.id = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.failMsg = null; + // @ts-ignore + this.clientOid = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersOldData { - return plainToInstance(BatchAddOrdersOldData, jsonObject); + static fromJson(input: string): BatchAddOrdersOldData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersOldData { + return plainToClassFromExist(new BatchAddOrdersOldData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts index 3c5a6afb..9502fbfa 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts @@ -1,86 +1,114 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchAddOrdersOldOrderList implements Serializable { +export class BatchAddOrdersOldOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. Please remember the orderId created by the service provider, it used to check for updates in order status. */ - clientOid?: string; + clientOid: string; + /** * specify if the order is to \'buy\' or \'sell\' */ - side?: BatchAddOrdersOldOrderList.SideEnum; + side: BatchAddOrdersOldOrderList.SideEnum; + /** * symbol */ - symbol?: string; + symbol: string; + /** * only limit (default is limit) */ type?: BatchAddOrdersOldOrderList.TypeEnum = BatchAddOrdersOldOrderList.TypeEnum.LIMIT; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: BatchAddOrdersOldOrderList.StpEnum; + /** * Specify price for order When placing a limit order, the price must be based on priceIncrement for the trading pair. The price increment (priceIncrement) is the price precision for the trading pair. For example, for the BTC-USDT trading pair, the priceIncrement is 0.00001000. So the price for your orders cannot be less than 0.00001000 and must be a multiple of priceIncrement. Otherwise, the order will return an invalid priceIncrement error. */ - price?: string; + price: string; + /** * Specify quantity for order When **type** is limit, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ - size?: string; + size: string; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: BatchAddOrdersOldOrderList.TimeInForceEnum = BatchAddOrdersOldOrderList.TimeInForceEnum.GTC; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * Hidden or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in iceberg orders */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * The type of trading : **TRADE**(Spot Trade) */ tradeType?: BatchAddOrdersOldOrderList.TradeTypeEnum = BatchAddOrdersOldOrderList.TradeTypeEnum.TRADE; + /** * Either loss or entry. Requires stopPrice to be defined */ stop?: BatchAddOrdersOldOrderList.StopEnum; + /** * Stop price, Need to be defined if stop is specified. */ stopPrice?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + } /** * Creates a new instance of the `BatchAddOrdersOldOrderList` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersOldOrderList` object. */ static builder(): BatchAddOrdersOldOrderListBuilder { - return new BatchAddOrdersOldOrderListBuilder(); + return new BatchAddOrdersOldOrderListBuilder(new BatchAddOrdersOldOrderList()); } /** @@ -90,15 +118,15 @@ export class BatchAddOrdersOldOrderList implements Serializable { +export class BatchAddOrdersOldReq implements Serializable { /** * */ @Type(() => BatchAddOrdersOldOrderList) orderList?: Array; + /** * */ - symbol?: string; + symbol: string; + private constructor() { + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `BatchAddOrdersOldReq` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersOldReq` object. */ static builder(): BatchAddOrdersOldReqBuilder { - return new BatchAddOrdersOldReqBuilder(); + return new BatchAddOrdersOldReqBuilder(new BatchAddOrdersOldReq()); } /** @@ -34,7 +39,7 @@ export class BatchAddOrdersOldReq implements Serializable /** * */ - symbol?: string; + symbol: string; }): BatchAddOrdersOldReq { let obj = new BatchAddOrdersOldReq(); obj.orderList = data.orderList; @@ -42,22 +47,23 @@ export class BatchAddOrdersOldReq implements Serializable return obj; } - fromJson(input: string): BatchAddOrdersOldReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersOldReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersOldReq { - return plainToInstance(BatchAddOrdersOldReq, jsonObject); + static fromJson(input: string): BatchAddOrdersOldReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersOldReq { + return plainToClassFromExist(new BatchAddOrdersOldReq(), jsonObject); } } export class BatchAddOrdersOldReqBuilder { - obj: BatchAddOrdersOldReq = new BatchAddOrdersOldReq(); + constructor(readonly obj: BatchAddOrdersOldReq) { + this.obj = obj; + } /** * */ diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts index fd3961e7..3004ee97 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { BatchAddOrdersOldData } from './model_batch_add_orders_old_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BatchAddOrdersOldResp implements Response { +export class BatchAddOrdersOldResp implements Response { /** * */ @Type(() => BatchAddOrdersOldData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class BatchAddOrdersOldResp implements Response { +export class BatchAddOrdersOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. */ clientOid?: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: BatchAddOrdersOrderList.TypeEnum; + type: BatchAddOrdersOrderList.TypeEnum; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: BatchAddOrdersOrderList.TimeInForceEnum = BatchAddOrdersOrderList.TimeInForceEnum.GTC; + /** * Specify if the order is to \'buy\' or \'sell\' */ - side?: BatchAddOrdersOrderList.SideEnum; + side: BatchAddOrdersOrderList.SideEnum; + /** * Specify price for order */ - price?: string; + price: string; + /** * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: BatchAddOrdersOrderList.StpEnum; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + } /** * Creates a new instance of the `BatchAddOrdersOrderList` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersOrderList` object. */ static builder(): BatchAddOrdersOrderListBuilder { - return new BatchAddOrdersOrderListBuilder(); + return new BatchAddOrdersOrderListBuilder(new BatchAddOrdersOrderList()); } /** @@ -89,11 +114,11 @@ export class BatchAddOrdersOrderList implements Serializable { +export class BatchAddOrdersReq implements Serializable { /** * Order List */ @Type(() => BatchAddOrdersOrderList) - orderList?: Array; + orderList: Array; + private constructor() { + // @ts-ignore + this.orderList = null; + } /** * Creates a new instance of the `BatchAddOrdersReq` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersReq` object. */ static builder(): BatchAddOrdersReqBuilder { - return new BatchAddOrdersReqBuilder(); + return new BatchAddOrdersReqBuilder(new BatchAddOrdersReq()); } /** @@ -26,29 +30,30 @@ export class BatchAddOrdersReq implements Serializable { /** * Order List */ - orderList?: Array; + orderList: Array; }): BatchAddOrdersReq { let obj = new BatchAddOrdersReq(); obj.orderList = data.orderList; return obj; } - fromJson(input: string): BatchAddOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersReq { - return plainToInstance(BatchAddOrdersReq, jsonObject); + static fromJson(input: string): BatchAddOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersReq { + return plainToClassFromExist(new BatchAddOrdersReq(), jsonObject); } } export class BatchAddOrdersReqBuilder { - obj: BatchAddOrdersReq = new BatchAddOrdersReq(); + constructor(readonly obj: BatchAddOrdersReq) { + this.obj = obj; + } /** * Order List */ diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts index a9a3d8e5..41e0771d 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { BatchAddOrdersData } from './model_batch_add_orders_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BatchAddOrdersResp implements Response { +export class BatchAddOrdersResp implements Response { /** * */ @Type(() => BatchAddOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class BatchAddOrdersResp implements Response { +export class BatchAddOrdersSyncData implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ orderId?: string; + /** * The user self-defined order id. */ clientOid?: string; + /** * */ orderTime?: number; + /** * original order size */ originSize?: string; + /** * deal size */ dealSize?: string; + /** * remain size */ remainSize?: string; + /** * Cumulative canceled size */ canceledSize?: string; + /** * Order Status. open:order is active; done:order has been completed */ status?: BatchAddOrdersSyncData.StatusEnum; + /** * */ matchTime?: number; + /** * Add order success/failure */ - success?: boolean; + success: boolean; + /** * error message */ failMsg?: string; - fromJson(input: string): BatchAddOrdersSyncData { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersSyncData, jsonObject); + private constructor() { + // @ts-ignore + this.success = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersSyncData { - return plainToInstance(BatchAddOrdersSyncData, jsonObject); + static fromJson(input: string): BatchAddOrdersSyncData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersSyncData { + return plainToClassFromExist(new BatchAddOrdersSyncData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts index 51564b3e..5f714e5f 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts @@ -1,81 +1,106 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class BatchAddOrdersSyncOrderList implements Serializable { +export class BatchAddOrdersSyncOrderList implements Serializable { /** * Client Order Id,The ClientOid field is a unique ID created by the user(we recommend using a UUID), and can only contain numbers, letters, underscores (_), and hyphens (-). This field is returned when order information is obtained. You can use clientOid to tag your orders. ClientOid is different from the order ID created by the service provider. Please do not initiate requests using the same clientOid. The maximum length for the ClientOid is 40 characters. */ clientOid?: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: BatchAddOrdersSyncOrderList.TypeEnum; + type: BatchAddOrdersSyncOrderList.TypeEnum; + /** * [Time in force](https://www.kucoin.com/docs-new/doc-338146) is a special strategy used during trading */ timeInForce?: BatchAddOrdersSyncOrderList.TimeInForceEnum = BatchAddOrdersSyncOrderList.TimeInForceEnum.GTC; + /** * Specify if the order is to \'buy\' or \'sell\' */ - side?: BatchAddOrdersSyncOrderList.SideEnum; + side: BatchAddOrdersSyncOrderList.SideEnum; + /** * Specify price for order */ - price?: string; + price: string; + /** * Specify quantity for order When **type** is limit, select one out of two: size or funds, size refers to the amount of trading targets (the asset name written in front) for the trading pair. Teh Size must be based on the baseIncrement of the trading pair. The baseIncrement represents the precision for the trading pair. The size of an order must be a positive-integer multiple of baseIncrement and must be between baseMinSize and baseMaxSize. When **type** is market, select one out of two: size or funds */ size?: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/doc-338146) is divided into four strategies: CN, CO, CB , and DC */ stp?: BatchAddOrdersSyncOrderList.StpEnum; + /** * Cancel after n seconds,the order timing strategy is GTT */ cancelAfter?: number; + /** * passive order labels, this is disabled when the order timing strategy is IOC or FOK */ postOnly?: boolean = false; + /** * [Hidden order](https://www.kucoin.com/docs-new/doc-338146) or not (not shown in order book) */ hidden?: boolean = false; + /** * Whether or not only visible portions of orders are shown in [Iceberg orders](https://www.kucoin.com/docs-new/doc-338146) */ iceberg?: boolean = false; + /** * Maximum visible quantity in iceberg orders */ visibleSize?: string; + /** * Order tag, length cannot exceed 20 characters (ASCII) */ tags?: string; + /** * Order placement remarks, length cannot exceed 20 characters (ASCII) */ remark?: string; + /** * When **type** is market, select one out of two: size or funds */ funds?: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + } /** * Creates a new instance of the `BatchAddOrdersSyncOrderList` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersSyncOrderList` object. */ static builder(): BatchAddOrdersSyncOrderListBuilder { - return new BatchAddOrdersSyncOrderListBuilder(); + return new BatchAddOrdersSyncOrderListBuilder(new BatchAddOrdersSyncOrderList()); } /** @@ -89,11 +114,11 @@ export class BatchAddOrdersSyncOrderList implements Serializable { +export class BatchAddOrdersSyncReq implements Serializable { /** * Order List */ @Type(() => BatchAddOrdersSyncOrderList) - orderList?: Array; + orderList: Array; + private constructor() { + // @ts-ignore + this.orderList = null; + } /** * Creates a new instance of the `BatchAddOrdersSyncReq` class. * The builder pattern allows step-by-step construction of a `BatchAddOrdersSyncReq` object. */ static builder(): BatchAddOrdersSyncReqBuilder { - return new BatchAddOrdersSyncReqBuilder(); + return new BatchAddOrdersSyncReqBuilder(new BatchAddOrdersSyncReq()); } /** @@ -26,29 +30,30 @@ export class BatchAddOrdersSyncReq implements Serializable; + orderList: Array; }): BatchAddOrdersSyncReq { let obj = new BatchAddOrdersSyncReq(); obj.orderList = data.orderList; return obj; } - fromJson(input: string): BatchAddOrdersSyncReq { - const jsonObject = JSON.parse(input); - return plainToInstance(BatchAddOrdersSyncReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): BatchAddOrdersSyncReq { - return plainToInstance(BatchAddOrdersSyncReq, jsonObject); + static fromJson(input: string): BatchAddOrdersSyncReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): BatchAddOrdersSyncReq { + return plainToClassFromExist(new BatchAddOrdersSyncReq(), jsonObject); } } export class BatchAddOrdersSyncReqBuilder { - obj: BatchAddOrdersSyncReq = new BatchAddOrdersSyncReq(); + constructor(readonly obj: BatchAddOrdersSyncReq) { + this.obj = obj; + } /** * Order List */ diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts index fc4c37d4..b58c942d 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { BatchAddOrdersSyncData } from './model_batch_add_orders_sync_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class BatchAddOrdersSyncResp implements Response { +export class BatchAddOrdersSyncResp implements Response { /** * */ @Type(() => BatchAddOrdersSyncData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class BatchAddOrdersSyncResp implements Response { +export class BatchCancelOcoOrdersReq implements Serializable { /** * Specify the order id, there can be multiple orders, separated by commas. If not passed, all oco orders will be canceled by default. */ orderIds?: string; + /** * trading pair. If not passed, the oco orders of all symbols will be canceled by default. */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `BatchCancelOcoOrdersReq` class. * The builder pattern allows step-by-step construction of a `BatchCancelOcoOrdersReq` object. */ static builder(): BatchCancelOcoOrdersReqBuilder { - return new BatchCancelOcoOrdersReqBuilder(); + return new BatchCancelOcoOrdersReqBuilder(new BatchCancelOcoOrdersReq()); } /** @@ -40,22 +42,23 @@ export class BatchCancelOcoOrdersReq implements Serializable { +export class BatchCancelOcoOrdersResp implements Response { /** * List of two order IDs related to the canceled OCO order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class BatchCancelOcoOrdersResp implements Response { +export class BatchCancelOrderOldReq implements Serializable { /** * symbol */ symbol?: string; + /** * The type of trading :TRADE(Spot Trading), MARGIN_TRADE(Cross Margin Trading), MARGIN_ISOLATED_TRADE(Isolated Margin Trading), and the default is TRADE to cancel the spot trading orders. */ tradeType?: BatchCancelOrderOldReq.TradeTypeEnum = BatchCancelOrderOldReq.TradeTypeEnum.TRADE; + private constructor() {} /** * Creates a new instance of the `BatchCancelOrderOldReq` class. * The builder pattern allows step-by-step construction of a `BatchCancelOrderOldReq` object. */ static builder(): BatchCancelOrderOldReqBuilder { - return new BatchCancelOrderOldReqBuilder(); + return new BatchCancelOrderOldReqBuilder(new BatchCancelOrderOldReq()); } /** @@ -36,21 +38,24 @@ export class BatchCancelOrderOldReq implements Serializable { +export class BatchCancelOrderOldResp implements Response { /** * */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class BatchCancelOrderOldResp implements Response { +export class BatchCancelStopOrderReq implements Serializable { /** * Cancel the open order for the specified symbol */ symbol?: string; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE */ tradeType?: string; + /** * Comma seperated order IDs. */ orderIds?: string; + private constructor() {} /** * Creates a new instance of the `BatchCancelStopOrderReq` class. * The builder pattern allows step-by-step construction of a `BatchCancelStopOrderReq` object. */ static builder(): BatchCancelStopOrderReqBuilder { - return new BatchCancelStopOrderReqBuilder(); + return new BatchCancelStopOrderReqBuilder(new BatchCancelStopOrderReq()); } /** @@ -49,22 +52,23 @@ export class BatchCancelStopOrderReq implements Serializable { +export class BatchCancelStopOrderResp implements Response { /** * order id array */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class BatchCancelStopOrderResp implements Response { +export class CancelAllOrdersBySymbolReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. * The builder pattern allows step-by-step construction of a `CancelAllOrdersBySymbolReq` object. */ static builder(): CancelAllOrdersBySymbolReqBuilder { - return new CancelAllOrdersBySymbolReqBuilder(); + return new CancelAllOrdersBySymbolReqBuilder(new CancelAllOrdersBySymbolReq()); } /** @@ -31,22 +32,23 @@ export class CancelAllOrdersBySymbolReq implements Serializable -{ +export class CancelAllOrdersBySymbolResp implements Response { /** * */ - data?: string; + data: string; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelAllOrdersBySymbolResp this.commonResponse = response; } - fromJson(input: string): CancelAllOrdersBySymbolResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { - return plainToInstance(CancelAllOrdersBySymbolResp, { data: jsonObject }); + static fromJson(input: string): CancelAllOrdersBySymbolResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { + return plainToClassFromExist(new CancelAllOrdersBySymbolResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts index 3ec1cde6..1e9d7a63 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts @@ -1,28 +1,29 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelAllOrdersFailedSymbols implements Serializable { +export class CancelAllOrdersFailedSymbols implements Serializable { /** * symbol */ symbol?: string; + /** * error message */ error?: string; - fromJson(input: string): CancelAllOrdersFailedSymbols { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelAllOrdersFailedSymbols, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelAllOrdersFailedSymbols { - return plainToInstance(CancelAllOrdersFailedSymbols, jsonObject); + static fromJson(input: string): CancelAllOrdersFailedSymbols { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelAllOrdersFailedSymbols { + return plainToClassFromExist(new CancelAllOrdersFailedSymbols(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts index 7af7028e..c7cde64b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { CancelAllOrdersFailedSymbols } from './model_cancel_all_orders_failed_symbols'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class CancelAllOrdersResp implements Response { +export class CancelAllOrdersResp implements Response { /** * The Symbols Successfully cancelled */ - succeedSymbols?: Array; + succeedSymbols: Array; + /** * The Symbols Failed to cancel */ @Type(() => CancelAllOrdersFailedSymbols) - failedSymbols?: Array; + failedSymbols: Array; + private constructor() { + // @ts-ignore + this.succeedSymbols = null; + // @ts-ignore + this.failedSymbols = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class CancelAllOrdersResp implements Response { +export class CancelOcoOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `CancelOcoOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelOcoOrderByClientOidReq` object. */ static builder(): CancelOcoOrderByClientOidReqBuilder { - return new CancelOcoOrderByClientOidReqBuilder(); + return new CancelOcoOrderByClientOidReqBuilder(new CancelOcoOrderByClientOidReq()); } /** @@ -33,22 +34,23 @@ export class CancelOcoOrderByClientOidReq implements Serializable -{ +export class CancelOcoOrderByClientOidResp implements Response { /** * List of two order IDs related to the canceled OCO order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOcoOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelOcoOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOcoOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOcoOrderByClientOidResp { - return plainToInstance(CancelOcoOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelOcoOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOcoOrderByClientOidResp { + return plainToClassFromExist(new CancelOcoOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts index 4003b981..35c5c34c 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOcoOrderByOrderIdReq implements Serializable { +export class CancelOcoOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `CancelOcoOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `CancelOcoOrderByOrderIdReq` object. */ static builder(): CancelOcoOrderByOrderIdReqBuilder { - return new CancelOcoOrderByOrderIdReqBuilder(); + return new CancelOcoOrderByOrderIdReqBuilder(new CancelOcoOrderByOrderIdReq()); } /** @@ -33,22 +34,23 @@ export class CancelOcoOrderByOrderIdReq implements Serializable -{ +export class CancelOcoOrderByOrderIdResp implements Response { /** * List of two order IDs related to the canceled OCO order */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOcoOrderByOrderIdResp this.commonResponse = response; } - fromJson(input: string): CancelOcoOrderByOrderIdResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOcoOrderByOrderIdResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOcoOrderByOrderIdResp { - return plainToInstance(CancelOcoOrderByOrderIdResp, jsonObject); + static fromJson(input: string): CancelOcoOrderByOrderIdResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOcoOrderByOrderIdResp { + return plainToClassFromExist(new CancelOcoOrderByOrderIdResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts index 9fbca2fe..799b5b37 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByClientOidOldReq implements Serializable { +export class CancelOrderByClientOidOldReq implements Serializable { /** * symbol */ symbol?: string; + /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidOldReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidOldReq` object. */ static builder(): CancelOrderByClientOidOldReqBuilder { - return new CancelOrderByClientOidOldReqBuilder(); + return new CancelOrderByClientOidOldReqBuilder(new CancelOrderByClientOidOldReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByClientOidOldReq implements Serializable -{ +export class CancelOrderByClientOidOldResp implements Response { /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * */ - cancelledOrderId?: string; + cancelledOrderId: string; + /** * */ - cancelledOcoOrderIds?: string; + cancelledOcoOrderIds: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelledOrderId = null; + // @ts-ignore + this.cancelledOcoOrderIds = null; + } /** * common response */ @@ -30,16 +38,15 @@ export class CancelOrderByClientOidOldResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidOldResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidOldResp { - return plainToInstance(CancelOrderByClientOidOldResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidOldResp { + return plainToClassFromExist(new CancelOrderByClientOidOldResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts index 0e56abe1..93adba79 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByClientOidReq implements Serializable { +export class CancelOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidReq` object. */ static builder(): CancelOrderByClientOidReqBuilder { - return new CancelOrderByClientOidReqBuilder(); + return new CancelOrderByClientOidReqBuilder(new CancelOrderByClientOidReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByClientOidReq implements Serializable -{ +export class CancelOrderByClientOidResp implements Response { /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidResp { - return plainToInstance(CancelOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidResp { + return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts index 2bf66673..ec2ad208 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByClientOidSyncReq implements Serializable { +export class CancelOrderByClientOidSyncReq implements Serializable { /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidSyncReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByClientOidSyncReq` object. */ static builder(): CancelOrderByClientOidSyncReqBuilder { - return new CancelOrderByClientOidSyncReqBuilder(); + return new CancelOrderByClientOidSyncReqBuilder(new CancelOrderByClientOidSyncReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByClientOidSyncReq implements Serializable -{ +export class CancelOrderByClientOidSyncResp implements Response { /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * original order size */ - originSize?: string; + originSize: string; + /** * deal size */ - dealSize?: string; + dealSize: string; + /** * remain size */ - remainSize?: string; + remainSize: string; + /** * Cumulative canceled size */ - canceledSize?: string; + canceledSize: string; + /** * Order Status. open:order is active; done:order has been completed */ - status?: CancelOrderByClientOidSyncResp.StatusEnum; + status: CancelOrderByClientOidSyncResp.StatusEnum; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.originSize = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.canceledSize = null; + // @ts-ignore + this.status = null; + } /** * common response */ @@ -42,17 +59,16 @@ export class CancelOrderByClientOidSyncResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByClientOidSyncResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByClientOidSyncResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByClientOidSyncResp { - return plainToInstance(CancelOrderByClientOidSyncResp, jsonObject); + static fromJson(input: string): CancelOrderByClientOidSyncResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByClientOidSyncResp { + return plainToClassFromExist(new CancelOrderByClientOidSyncResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts index 013f93ce..9f898589 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByOrderIdOldReq implements Serializable { +export class CancelOrderByOrderIdOldReq implements Serializable { /** * symbol */ symbol?: string; + /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdOldReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdOldReq` object. */ static builder(): CancelOrderByOrderIdOldReqBuilder { - return new CancelOrderByOrderIdOldReqBuilder(); + return new CancelOrderByOrderIdOldReqBuilder(new CancelOrderByOrderIdOldReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByOrderIdOldReq implements Serializable -{ +export class CancelOrderByOrderIdOldResp implements Response { /** * */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelOrderByOrderIdOldResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByOrderIdOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByOrderIdOldResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByOrderIdOldResp { - return plainToInstance(CancelOrderByOrderIdOldResp, jsonObject); + static fromJson(input: string): CancelOrderByOrderIdOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByOrderIdOldResp { + return plainToClassFromExist(new CancelOrderByOrderIdOldResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts index 626aa327..50e79618 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelOrderByOrderIdReq implements Serializable { +export class CancelOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdReq` object. */ static builder(): CancelOrderByOrderIdReqBuilder { - return new CancelOrderByOrderIdReqBuilder(); + return new CancelOrderByOrderIdReqBuilder(new CancelOrderByOrderIdReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByOrderIdReq implements Serializable { +export class CancelOrderByOrderIdResp implements Response { /** * order id */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.orderId = null; + } /** * common response */ @@ -20,16 +24,15 @@ export class CancelOrderByOrderIdResp implements Response { +export class CancelOrderByOrderIdSyncReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdSyncReq` class. * The builder pattern allows step-by-step construction of a `CancelOrderByOrderIdSyncReq` object. */ static builder(): CancelOrderByOrderIdSyncReqBuilder { - return new CancelOrderByOrderIdSyncReqBuilder(); + return new CancelOrderByOrderIdSyncReqBuilder(new CancelOrderByOrderIdSyncReq()); } /** @@ -42,22 +44,23 @@ export class CancelOrderByOrderIdSyncReq implements Serializable -{ +export class CancelOrderByOrderIdSyncResp implements Response { /** * order id */ - orderId?: string; + orderId: string; + /** * original order size */ - originSize?: string; + originSize: string; + /** * deal size */ - dealSize?: string; + dealSize: string; + /** * remain size */ - remainSize?: string; + remainSize: string; + /** * Cumulative canceled size */ - canceledSize?: string; + canceledSize: string; + /** * Order Status. open:order is active; done:order has been completed */ - status?: CancelOrderByOrderIdSyncResp.StatusEnum; + status: CancelOrderByOrderIdSyncResp.StatusEnum; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.originSize = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.canceledSize = null; + // @ts-ignore + this.status = null; + } /** * common response */ @@ -42,17 +59,16 @@ export class CancelOrderByOrderIdSyncResp this.commonResponse = response; } - fromJson(input: string): CancelOrderByOrderIdSyncResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelOrderByOrderIdSyncResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelOrderByOrderIdSyncResp { - return plainToInstance(CancelOrderByOrderIdSyncResp, jsonObject); + static fromJson(input: string): CancelOrderByOrderIdSyncResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelOrderByOrderIdSyncResp { + return plainToClassFromExist(new CancelOrderByOrderIdSyncResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts index c5c7a6c5..80074a6a 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts @@ -1,30 +1,33 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelPartialOrderReq implements Serializable { +export class CancelPartialOrderReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + /** * symbol */ symbol?: string; + /** * The size you want cancel */ cancelSize?: string; + private constructor() {} /** * Creates a new instance of the `CancelPartialOrderReq` class. * The builder pattern allows step-by-step construction of a `CancelPartialOrderReq` object. */ static builder(): CancelPartialOrderReqBuilder { - return new CancelPartialOrderReqBuilder(); + return new CancelPartialOrderReqBuilder(new CancelPartialOrderReq()); } /** @@ -51,22 +54,23 @@ export class CancelPartialOrderReq implements Serializable { +export class CancelPartialOrderResp implements Response { /** * order id */ - orderId?: string; + orderId: string; + /** * The size you canceled */ - cancelSize?: string; + cancelSize: string; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.cancelSize = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class CancelPartialOrderResp implements Response { +export class CancelStopOrderByClientOidReq implements Serializable { /** * symbol */ symbol?: string; + /** * Unique order id created by users to identify their orders */ clientOid?: string; + private constructor() {} /** * Creates a new instance of the `CancelStopOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `CancelStopOrderByClientOidReq` object. */ static builder(): CancelStopOrderByClientOidReqBuilder { - return new CancelStopOrderByClientOidReqBuilder(); + return new CancelStopOrderByClientOidReqBuilder(new CancelStopOrderByClientOidReq()); } /** @@ -40,22 +42,23 @@ export class CancelStopOrderByClientOidReq implements Serializable -{ +export class CancelStopOrderByClientOidResp implements Response { /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Unique ID of the cancelled order */ - cancelledOrderId?: string; + cancelledOrderId: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelledOrderId = null; + } /** * common response */ @@ -26,16 +31,15 @@ export class CancelStopOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): CancelStopOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelStopOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelStopOrderByClientOidResp { - return plainToInstance(CancelStopOrderByClientOidResp, jsonObject); + static fromJson(input: string): CancelStopOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelStopOrderByClientOidResp { + return plainToClassFromExist(new CancelStopOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts index 262f63cf..52ff5f7b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class CancelStopOrderByOrderIdReq implements Serializable { +export class CancelStopOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `CancelStopOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `CancelStopOrderByOrderIdReq` object. */ static builder(): CancelStopOrderByOrderIdReqBuilder { - return new CancelStopOrderByOrderIdReqBuilder(); + return new CancelStopOrderByOrderIdReqBuilder(new CancelStopOrderByOrderIdReq()); } /** @@ -33,22 +34,23 @@ export class CancelStopOrderByOrderIdReq implements Serializable -{ +export class CancelStopOrderByOrderIdResp implements Response { /** * order id array */ - cancelledOrderIds?: Array; + cancelledOrderIds: Array; + private constructor() { + // @ts-ignore + this.cancelledOrderIds = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class CancelStopOrderByOrderIdResp this.commonResponse = response; } - fromJson(input: string): CancelStopOrderByOrderIdResp { - const jsonObject = JSON.parse(input); - return plainToInstance(CancelStopOrderByOrderIdResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): CancelStopOrderByOrderIdResp { - return plainToInstance(CancelStopOrderByOrderIdResp, jsonObject); + static fromJson(input: string): CancelStopOrderByOrderIdResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): CancelStopOrderByOrderIdResp { + return plainToClassFromExist(new CancelStopOrderByOrderIdResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts index 6cce9a2f..8be86830 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts @@ -1,157 +1,253 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetClosedOrdersItems implements Serializable { +export class GetClosedOrdersItems implements Serializable { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetClosedOrdersItems.TypeEnum; + type: GetClosedOrdersItems.TypeEnum; + /** * Buy or sell */ - side?: GetClosedOrdersItems.SideEnum; + side: GetClosedOrdersItems.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) */ stp?: GetClosedOrdersItems.StpEnum; + /** * Time in force */ - timeInForce?: GetClosedOrdersItems.TimeInForceEnum; + timeInForce: GetClosedOrdersItems.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; - fromJson(input: string): GetClosedOrdersItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetClosedOrdersItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetClosedOrdersItems { - return plainToInstance(GetClosedOrdersItems, jsonObject); + static fromJson(input: string): GetClosedOrdersItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetClosedOrdersItems { + return plainToClassFromExist(new GetClosedOrdersItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts index e40d2ca1..9f8cfadd 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts @@ -1,44 +1,51 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetClosedOrdersReq implements Serializable { +export class GetClosedOrdersReq implements Serializable { /** * symbol */ symbol?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ side?: GetClosedOrdersReq.SideEnum; + /** * specify if the order is an \'limit\' order or \'market\' order. */ type?: GetClosedOrdersReq.TypeEnum; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ lastId?: number; + /** * Default20,Max100 */ limit?: number = 20; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetClosedOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetClosedOrdersReq` object. */ static builder(): GetClosedOrdersReqBuilder { - return new GetClosedOrdersReqBuilder(); + return new GetClosedOrdersReqBuilder(new GetClosedOrdersReq()); } /** @@ -79,23 +86,26 @@ export class GetClosedOrdersReq implements Serializable { obj.side = data.side; obj.type = data.type; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 20; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetClosedOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetClosedOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetClosedOrdersReq { - return plainToInstance(GetClosedOrdersReq, jsonObject); + static fromJson(input: string): GetClosedOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetClosedOrdersReq { + return plainToClassFromExist(new GetClosedOrdersReq(), jsonObject); } } @@ -123,7 +133,9 @@ export namespace GetClosedOrdersReq { } export class GetClosedOrdersReqBuilder { - obj: GetClosedOrdersReq = new GetClosedOrdersReq(); + constructor(readonly obj: GetClosedOrdersReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts index dce47df4..87acd142 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetClosedOrdersItems } from './model_get_closed_orders_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetClosedOrdersResp implements Response { +export class GetClosedOrdersResp implements Response { /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ - lastId?: number; + lastId: number; + /** * */ @Type(() => GetClosedOrdersItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.lastId = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetClosedOrdersResp implements Response { +export class GetDCPResp implements Response { /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400 */ timeout?: number; + /** * List of trading pairs. Separated by commas, empty means all trading pairs */ symbols?: string; + /** * System current time (in seconds) */ currentTime?: number; + /** * Trigger cancellation time (in seconds) */ triggerTime?: number; + private constructor() {} /** * common response */ @@ -32,16 +36,15 @@ export class GetDCPResp implements Response { this.commonResponse = response; } - fromJson(input: string): GetDCPResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetDCPResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetDCPResp { - return plainToInstance(GetDCPResp, jsonObject); + static fromJson(input: string): GetDCPResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetDCPResp { + return plainToClassFromExist(new GetDCPResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts index f04db087..f146ee4b 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOcoOrderByClientOidReq implements Serializable { +export class GetOcoOrderByClientOidReq implements Serializable { /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `GetOcoOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `GetOcoOrderByClientOidReq` object. */ static builder(): GetOcoOrderByClientOidReqBuilder { - return new GetOcoOrderByClientOidReqBuilder(); + return new GetOcoOrderByClientOidReqBuilder(new GetOcoOrderByClientOidReq()); } /** @@ -33,22 +34,23 @@ export class GetOcoOrderByClientOidReq implements Serializable -{ +export class GetOcoOrderByClientOidResp implements Response { /** * symbol */ - symbol?: string; + symbol: string; + /** * Client Order Id */ - clientOid?: string; + clientOid: string; + /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Order placement time, milliseconds */ - orderTime?: number; + orderTime: number; + /** * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ - status?: string; + status: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.status = null; + } /** * common response */ @@ -38,16 +52,15 @@ export class GetOcoOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): GetOcoOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOcoOrderByClientOidResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOcoOrderByClientOidResp { - return plainToInstance(GetOcoOrderByClientOidResp, jsonObject); + static fromJson(input: string): GetOcoOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOcoOrderByClientOidResp { + return plainToClassFromExist(new GetOcoOrderByClientOidResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts index 16e1aab4..edae8848 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOcoOrderByOrderIdReq implements Serializable { +export class GetOcoOrderByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetOcoOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetOcoOrderByOrderIdReq` object. */ static builder(): GetOcoOrderByOrderIdReqBuilder { - return new GetOcoOrderByOrderIdReqBuilder(); + return new GetOcoOrderByOrderIdReqBuilder(new GetOcoOrderByOrderIdReq()); } /** @@ -33,22 +34,23 @@ export class GetOcoOrderByOrderIdReq implements Serializable { +export class GetOcoOrderByOrderIdResp implements Response { /** * symbol */ - symbol?: string; + symbol: string; + /** * Client Order Id */ - clientOid?: string; + clientOid: string; + /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * Order placement time, milliseconds */ - orderTime?: number; + orderTime: number; + /** * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ - status?: GetOcoOrderByOrderIdResp.StatusEnum; + status: GetOcoOrderByOrderIdResp.StatusEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.status = null; + } /** * common response */ @@ -36,17 +52,16 @@ export class GetOcoOrderByOrderIdResp implements Response -{ +export class GetOcoOrderDetailByOrderIdOrders implements Serializable { /** * */ - id?: string; + id: string; + /** * */ - symbol?: string; + symbol: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - size?: string; + size: string; + /** * */ - status?: string; + status: string; - fromJson(input: string): GetOcoOrderDetailByOrderIdOrders { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOcoOrderDetailByOrderIdOrders, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.status = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdOrders { - return plainToInstance(GetOcoOrderDetailByOrderIdOrders, jsonObject); + static fromJson(input: string): GetOcoOrderDetailByOrderIdOrders { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdOrders { + return plainToClassFromExist(new GetOcoOrderDetailByOrderIdOrders(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts index 41663732..92a6504a 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOcoOrderDetailByOrderIdReq implements Serializable { +export class GetOcoOrderDetailByOrderIdReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetOcoOrderDetailByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetOcoOrderDetailByOrderIdReq` object. */ static builder(): GetOcoOrderDetailByOrderIdReqBuilder { - return new GetOcoOrderDetailByOrderIdReqBuilder(); + return new GetOcoOrderDetailByOrderIdReqBuilder(new GetOcoOrderDetailByOrderIdReq()); } /** @@ -33,22 +34,23 @@ export class GetOcoOrderDetailByOrderIdReq implements Serializable -{ +export class GetOcoOrderDetailByOrderIdResp implements Response { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Client Order Id */ - clientOid?: string; + clientOid: string; + /** * Order placement time, milliseconds */ - orderTime?: number; + orderTime: number; + /** * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ - status?: string; + status: string; + /** * */ @Type(() => GetOcoOrderDetailByOrderIdOrders) - orders?: Array; + orders: Array; + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.orders = null; + } /** * common response */ @@ -44,16 +61,15 @@ export class GetOcoOrderDetailByOrderIdResp this.commonResponse = response; } - fromJson(input: string): GetOcoOrderDetailByOrderIdResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOcoOrderDetailByOrderIdResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdResp { - return plainToInstance(GetOcoOrderDetailByOrderIdResp, jsonObject); + static fromJson(input: string): GetOcoOrderDetailByOrderIdResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdResp { + return plainToClassFromExist(new GetOcoOrderDetailByOrderIdResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts index 7335c6c1..31ce5736 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts @@ -1,41 +1,56 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOcoOrderListItems implements Serializable { +export class GetOcoOrderListItems implements Serializable { /** * The unique order id generated by the trading system,which can be used later for further actions such as canceling the order. */ - orderId?: string; + orderId: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Client Order Id */ - clientOid?: string; + clientOid: string; + /** * Order placement time, milliseconds */ - orderTime?: number; + orderTime: number; + /** * Order status: NEW: New, DONE: Completed, TRIGGERED: Triggered, CANCELLED: Cancelled */ - status?: GetOcoOrderListItems.StatusEnum; + status: GetOcoOrderListItems.StatusEnum; - fromJson(input: string): GetOcoOrderListItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOcoOrderListItems, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.status = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOcoOrderListItems { - return plainToInstance(GetOcoOrderListItems, jsonObject); + static fromJson(input: string): GetOcoOrderListItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOcoOrderListItems { + return plainToClassFromExist(new GetOcoOrderListItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts index 3fb35f15..1dfb0fba 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts @@ -1,40 +1,46 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOcoOrderListReq implements Serializable { +export class GetOcoOrderListReq implements Serializable { /** * symbol */ symbol?: string; + /** * Start time (milliseconds) */ startAt?: number; + /** * End time (milliseconds) */ endAt?: number; + /** * Specify orderId collection, up to 500 orders */ orderIds?: string; + /** * Size per page, minimum value 10, maximum value 500 */ pageSize?: number = 50; + /** * Page number, minimum value 1 */ currentPage?: number = 1; + private constructor() {} /** * Creates a new instance of the `GetOcoOrderListReq` class. * The builder pattern allows step-by-step construction of a `GetOcoOrderListReq` object. */ static builder(): GetOcoOrderListReqBuilder { - return new GetOcoOrderListReqBuilder(); + return new GetOcoOrderListReqBuilder(new GetOcoOrderListReq()); } /** @@ -71,27 +77,36 @@ export class GetOcoOrderListReq implements Serializable { obj.startAt = data.startAt; obj.endAt = data.endAt; obj.orderIds = data.orderIds; - obj.pageSize = data.pageSize; - obj.currentPage = data.currentPage; + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } return obj; } - fromJson(input: string): GetOcoOrderListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOcoOrderListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOcoOrderListReq { - return plainToInstance(GetOcoOrderListReq, jsonObject); + static fromJson(input: string): GetOcoOrderListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOcoOrderListReq { + return plainToClassFromExist(new GetOcoOrderListReq(), jsonObject); } } export class GetOcoOrderListReqBuilder { - obj: GetOcoOrderListReq = new GetOcoOrderListReq(); + constructor(readonly obj: GetOcoOrderListReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts index f5179f75..6d015b09 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetOcoOrderListItems } from './model_get_oco_order_list_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOcoOrderListResp implements Response { +export class GetOcoOrderListResp implements Response { /** * */ - currentPage?: number; + currentPage: number; + /** * */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetOcoOrderListItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetOcoOrderListResp implements Response { +export class GetOpenOrdersData implements Serializable { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOpenOrdersData.TypeEnum; + type: GetOpenOrdersData.TypeEnum; + /** * Buy or sell */ - side?: GetOpenOrdersData.SideEnum; + side: GetOpenOrdersData.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) */ stp?: GetOpenOrdersData.StpEnum; + /** * Time in force */ - timeInForce?: GetOpenOrdersData.TimeInForceEnum; + timeInForce: GetOpenOrdersData.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; - fromJson(input: string): GetOpenOrdersData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOpenOrdersData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOpenOrdersData { - return plainToInstance(GetOpenOrdersData, jsonObject); + static fromJson(input: string): GetOpenOrdersData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOpenOrdersData { + return plainToClassFromExist(new GetOpenOrdersData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts index 3adf9aad..1bd237da 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts @@ -1,20 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOpenOrdersReq implements Serializable { +export class GetOpenOrdersReq implements Serializable { /** * symbol */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetOpenOrdersReq` class. * The builder pattern allows step-by-step construction of a `GetOpenOrdersReq` object. */ static builder(): GetOpenOrdersReqBuilder { - return new GetOpenOrdersReqBuilder(); + return new GetOpenOrdersReqBuilder(new GetOpenOrdersReq()); } /** @@ -31,22 +32,23 @@ export class GetOpenOrdersReq implements Serializable { return obj; } - fromJson(input: string): GetOpenOrdersReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOpenOrdersReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOpenOrdersReq { - return plainToInstance(GetOpenOrdersReq, jsonObject); + static fromJson(input: string): GetOpenOrdersReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOpenOrdersReq { + return plainToClassFromExist(new GetOpenOrdersReq(), jsonObject); } } export class GetOpenOrdersReqBuilder { - obj: GetOpenOrdersReq = new GetOpenOrdersReq(); + constructor(readonly obj: GetOpenOrdersReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts index fda90ac5..4c955bed 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetOpenOrdersData } from './model_get_open_orders_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOpenOrdersResp implements Response { +export class GetOpenOrdersResp implements Response { /** * */ @Type(() => GetOpenOrdersData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetOpenOrdersResp implements Response { +export class GetOrderByClientOidOldReq implements Serializable { /** * Unique order id created by users to identify their orders */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidOldReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByClientOidOldReq` object. */ static builder(): GetOrderByClientOidOldReqBuilder { - return new GetOrderByClientOidOldReqBuilder(); + return new GetOrderByClientOidOldReqBuilder(new GetOrderByClientOidOldReq()); } /** @@ -33,22 +34,23 @@ export class GetOrderByClientOidOldReq implements Serializable -{ +export class GetOrderByClientOidOldResp implements Response { /** * */ - id?: string; + id: string; + /** * */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * */ - type?: string; + type: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - size?: string; + size: string; + /** * */ - funds?: string; + funds: string; + /** * */ - dealFunds?: string; + dealFunds: string; + /** * */ - dealSize?: string; + dealSize: string; + /** * */ - fee?: string; + fee: string; + /** * */ - feeCurrency?: string; + feeCurrency: string; + /** * */ - stp?: string; + stp: string; + /** * */ - stop?: string; + stop: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - timeInForce?: string; + timeInForce: string; + /** * */ - postOnly?: boolean; + postOnly: boolean; + /** * */ - hidden?: boolean; + hidden: boolean; + /** * */ - iceberg?: boolean; + iceberg: boolean; + /** * */ - visibleSize?: string; + visibleSize: string; + /** * */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * */ - clientOid?: string; + clientOid: string; + /** * */ - remark?: string; + remark: string; + /** * */ - tags?: string; + tags: string; + /** * */ - isActive?: boolean; + isActive: boolean; + /** * */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - tradeType?: string; + tradeType: string; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.tradeType = null; + } /** * common response */ @@ -138,16 +227,15 @@ export class GetOrderByClientOidOldResp this.commonResponse = response; } - fromJson(input: string): GetOrderByClientOidOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderByClientOidOldResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderByClientOidOldResp { - return plainToInstance(GetOrderByClientOidOldResp, jsonObject); + static fromJson(input: string): GetOrderByClientOidOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderByClientOidOldResp { + return plainToClassFromExist(new GetOrderByClientOidOldResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts index 50921149..db2e27e3 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts @@ -1,26 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOrderByClientOidReq implements Serializable { +export class GetOrderByClientOidReq implements Serializable { /** * symbol */ symbol?: string; + /** * Client Order Id,unique identifier created by the user */ @Reflect.metadata('path', 'clientOid') clientOid?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByClientOidReq` object. */ static builder(): GetOrderByClientOidReqBuilder { - return new GetOrderByClientOidReqBuilder(); + return new GetOrderByClientOidReqBuilder(new GetOrderByClientOidReq()); } /** @@ -42,22 +44,23 @@ export class GetOrderByClientOidReq implements Serializable { +export class GetOrderByClientOidResp implements Response { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOrderByClientOidResp.TypeEnum; + type: GetOrderByClientOidResp.TypeEnum; + /** * Buy or sell */ - side?: GetOrderByClientOidResp.SideEnum; + side: GetOrderByClientOidResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) */ stp?: GetOrderByClientOidResp.StpEnum; + /** * Time in force */ - timeInForce?: GetOrderByClientOidResp.TimeInForceEnum; + timeInForce: GetOrderByClientOidResp.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; + } /** * common response */ @@ -152,17 +249,16 @@ export class GetOrderByClientOidResp implements Response { +export class GetOrderByOrderIdOldReq implements Serializable { /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdOldReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdOldReq` object. */ static builder(): GetOrderByOrderIdOldReqBuilder { - return new GetOrderByOrderIdOldReqBuilder(); + return new GetOrderByOrderIdOldReqBuilder(new GetOrderByOrderIdOldReq()); } /** @@ -33,22 +34,23 @@ export class GetOrderByOrderIdOldReq implements Serializable { +export class GetOrderByOrderIdOldResp implements Response { /** * */ - id?: string; + id: string; + /** * */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * */ - type?: string; + type: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - size?: string; + size: string; + /** * */ - funds?: string; + funds: string; + /** * */ - dealFunds?: string; + dealFunds: string; + /** * */ - dealSize?: string; + dealSize: string; + /** * */ - fee?: string; + fee: string; + /** * */ - feeCurrency?: string; + feeCurrency: string; + /** * */ - stp?: string; + stp: string; + /** * */ - stop?: string; + stop: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - timeInForce?: string; + timeInForce: string; + /** * */ - postOnly?: boolean; + postOnly: boolean; + /** * */ - hidden?: boolean; + hidden: boolean; + /** * */ - iceberg?: boolean; + iceberg: boolean; + /** * */ - visibleSize?: string; + visibleSize: string; + /** * */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * */ - clientOid?: string; + clientOid: string; + /** * */ - remark?: string; + remark: string; + /** * */ - tags?: string; + tags: string; + /** * */ - isActive?: boolean; + isActive: boolean; + /** * */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - tradeType?: string; + tradeType: string; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.tradeType = null; + } /** * common response */ @@ -136,16 +227,15 @@ export class GetOrderByOrderIdOldResp implements Response { +export class GetOrderByOrderIdReq implements Serializable { /** * symbol */ symbol?: string; + /** * The unique order id generated by the trading system */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetOrderByOrderIdReq` object. */ static builder(): GetOrderByOrderIdReqBuilder { - return new GetOrderByOrderIdReqBuilder(); + return new GetOrderByOrderIdReqBuilder(new GetOrderByOrderIdReq()); } /** @@ -42,22 +44,23 @@ export class GetOrderByOrderIdReq implements Serializable return obj; } - fromJson(input: string): GetOrderByOrderIdReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrderByOrderIdReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrderByOrderIdReq { - return plainToInstance(GetOrderByOrderIdReq, jsonObject); + static fromJson(input: string): GetOrderByOrderIdReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrderByOrderIdReq { + return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } } export class GetOrderByOrderIdReqBuilder { - obj: GetOrderByOrderIdReq = new GetOrderByOrderIdReq(); + constructor(readonly obj: GetOrderByOrderIdReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts index c18d0e84..9a66291b 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts @@ -1,147 +1,244 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOrderByOrderIdResp implements Response { +export class GetOrderByOrderIdResp implements Response { /** * The unique order id generated by the trading system */ - id?: string; + id: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetOrderByOrderIdResp.TypeEnum; + type: GetOrderByOrderIdResp.TypeEnum; + /** * Buy or sell */ - side?: GetOrderByOrderIdResp.SideEnum; + side: GetOrderByOrderIdResp.SideEnum; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * Number of filled transactions */ - dealSize?: string; + dealSize: string; + /** * Funds of filled transactions */ - dealFunds?: string; + dealFunds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * [Self Trade Prevention](https://www.kucoin.com/docs-new/api-5176570) */ stp?: GetOrderByOrderIdResp.StpEnum; + /** * Time in force */ - timeInForce?: GetOrderByOrderIdResp.TimeInForceEnum; + timeInForce: GetOrderByOrderIdResp.TimeInForceEnum; + /** * Whether its a postOnly order. */ - postOnly?: boolean; + postOnly: boolean; + /** * Whether its a hidden order. */ - hidden?: boolean; + hidden: boolean; + /** * Whether its a iceberg order. */ - iceberg?: boolean; + iceberg: boolean; + /** * Visible size of iceberg order in order book. */ - visibleSize?: string; + visibleSize: string; + /** * A GTT timeInForce that expires in n seconds */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * Client Order Id,unique identifier created by the user */ - clientOid?: string; + clientOid: string; + /** * Order placement remarks */ remark?: string; + /** * Order tag */ tags?: string; + /** * Whether there is a cancellation record for the order. */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - lastUpdatedAt?: number; + lastUpdatedAt: number; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Whether to enter the orderbook: true: enter the orderbook; false: not enter the orderbook */ - inOrderBook?: boolean; + inOrderBook: boolean; + /** * Number of canceled transactions */ - cancelledSize?: string; + cancelledSize: string; + /** * Funds of canceled transactions */ - cancelledFunds?: string; + cancelledFunds: string; + /** * Number of remain transactions */ - remainSize?: string; + remainSize: string; + /** * Funds of remain transactions */ - remainFunds?: string; + remainFunds: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Order status: true-The status of the order isactive; false-The status of the order is done */ - active?: boolean; + active: boolean; + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.lastUpdatedAt = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.inOrderBook = null; + // @ts-ignore + this.cancelledSize = null; + // @ts-ignore + this.cancelledFunds = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.remainFunds = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.active = null; + } /** * common response */ @@ -152,17 +249,16 @@ export class GetOrderByOrderIdResp implements Response { +export class GetOrdersListOldItems implements Serializable { /** * */ - id?: string; + id: string; + /** * */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * */ - type?: string; + type: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - size?: string; + size: string; + /** * */ - funds?: string; + funds: string; + /** * */ - dealFunds?: string; + dealFunds: string; + /** * */ - dealSize?: string; + dealSize: string; + /** * */ - fee?: string; + fee: string; + /** * */ - feeCurrency?: string; + feeCurrency: string; + /** * */ - stp?: string; + stp: string; + /** * */ - stop?: string; + stop: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - timeInForce?: string; + timeInForce: string; + /** * */ - postOnly?: boolean; + postOnly: boolean; + /** * */ - hidden?: boolean; + hidden: boolean; + /** * */ - iceberg?: boolean; + iceberg: boolean; + /** * */ - visibleSize?: string; + visibleSize: string; + /** * */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * */ - clientOid?: string; + clientOid: string; + /** * */ - remark?: string; + remark: string; + /** * */ - tags?: string; + tags: string; + /** * */ - isActive?: boolean; + isActive: boolean; + /** * */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - tradeType?: string; + tradeType: string; - fromJson(input: string): GetOrdersListOldItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrdersListOldItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.tradeType = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrdersListOldItems { - return plainToInstance(GetOrdersListOldItems, jsonObject); + static fromJson(input: string): GetOrdersListOldItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrdersListOldItems { + return plainToClassFromExist(new GetOrdersListOldItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts index d63e0ea2..f45e814b 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts @@ -1,52 +1,61 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetOrdersListOldReq implements Serializable { +export class GetOrdersListOldReq implements Serializable { /** * symbol */ symbol?: string; + /** * active or done(done as default), Only list orders with a specific status . */ status?: GetOrdersListOldReq.StatusEnum = GetOrdersListOldReq.StatusEnum.DONE; + /** * buy or sell */ side?: GetOrdersListOldReq.SideEnum; + /** * limit, market, limit_stop or market_stop */ type?: GetOrdersListOldReq.TypeEnum; + /** * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. */ tradeType?: GetOrdersListOldReq.TradeTypeEnum = GetOrdersListOldReq.TradeTypeEnum.TRADE; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetOrdersListOldReq` class. * The builder pattern allows step-by-step construction of a `GetOrdersListOldReq` object. */ static builder(): GetOrdersListOldReqBuilder { - return new GetOrdersListOldReqBuilder(); + return new GetOrdersListOldReqBuilder(new GetOrdersListOldReq()); } /** @@ -92,28 +101,43 @@ export class GetOrdersListOldReq implements Serializable { }): GetOrdersListOldReq { let obj = new GetOrdersListOldReq(); obj.symbol = data.symbol; - obj.status = data.status; + if (data.status) { + obj.status = data.status; + } else { + obj.status = GetOrdersListOldReq.StatusEnum.DONE; + } obj.side = data.side; obj.type = data.type; - obj.tradeType = data.tradeType; + if (data.tradeType) { + obj.tradeType = data.tradeType; + } else { + obj.tradeType = GetOrdersListOldReq.TradeTypeEnum.TRADE; + } obj.startAt = data.startAt; obj.endAt = data.endAt; - obj.currentPage = data.currentPage; - obj.pageSize = data.pageSize; + if (data.currentPage) { + obj.currentPage = data.currentPage; + } else { + obj.currentPage = 1; + } + if (data.pageSize) { + obj.pageSize = data.pageSize; + } else { + obj.pageSize = 50; + } return obj; } - fromJson(input: string): GetOrdersListOldReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetOrdersListOldReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetOrdersListOldReq { - return plainToInstance(GetOrdersListOldReq, jsonObject); + static fromJson(input: string): GetOrdersListOldReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetOrdersListOldReq { + return plainToClassFromExist(new GetOrdersListOldReq(), jsonObject); } } @@ -173,7 +197,9 @@ export namespace GetOrdersListOldReq { } export class GetOrdersListOldReqBuilder { - obj: GetOrdersListOldReq = new GetOrdersListOldReq(); + constructor(readonly obj: GetOrdersListOldReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts index bb0d25bb..a8ad1d61 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts @@ -1,33 +1,49 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetOrdersListOldItems } from './model_get_orders_list_old_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetOrdersListOldResp implements Response { +export class GetOrdersListOldResp implements Response { /** * */ - currentPage?: number; + currentPage: number; + /** * */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetOrdersListOldItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetOrdersListOldResp implements Response { +export class GetRecentOrdersListOldData implements Serializable { /** * */ - id?: string; + id: string; + /** * */ - symbol?: string; + symbol: string; + /** * */ - opType?: string; + opType: string; + /** * */ - type?: string; + type: string; + /** * */ - side?: string; + side: string; + /** * */ - price?: string; + price: string; + /** * */ - size?: string; + size: string; + /** * */ - funds?: string; + funds: string; + /** * */ - dealFunds?: string; + dealFunds: string; + /** * */ - dealSize?: string; + dealSize: string; + /** * */ - fee?: string; + fee: string; + /** * */ - feeCurrency?: string; + feeCurrency: string; + /** * */ - stp?: string; + stp: string; + /** * */ - stop?: string; + stop: string; + /** * */ - stopTriggered?: boolean; + stopTriggered: boolean; + /** * */ - stopPrice?: string; + stopPrice: string; + /** * */ - timeInForce?: string; + timeInForce: string; + /** * */ - postOnly?: boolean; + postOnly: boolean; + /** * */ - hidden?: boolean; + hidden: boolean; + /** * */ - iceberg?: boolean; + iceberg: boolean; + /** * */ - visibleSize?: string; + visibleSize: string; + /** * */ - cancelAfter?: number; + cancelAfter: number; + /** * */ - channel?: string; + channel: string; + /** * */ - clientOid?: string; + clientOid: string; + /** * */ - remark?: string; + remark: string; + /** * */ - tags?: string; + tags: string; + /** * */ - isActive?: boolean; + isActive: boolean; + /** * */ - cancelExist?: boolean; + cancelExist: boolean; + /** * */ - createdAt?: number; + createdAt: number; + /** * */ - tradeType?: string; + tradeType: string; - fromJson(input: string): GetRecentOrdersListOldData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentOrdersListOldData, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.opType = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.dealFunds = null; + // @ts-ignore + this.dealSize = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stp = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopTriggered = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.timeInForce = null; + // @ts-ignore + this.postOnly = null; + // @ts-ignore + this.hidden = null; + // @ts-ignore + this.iceberg = null; + // @ts-ignore + this.visibleSize = null; + // @ts-ignore + this.cancelAfter = null; + // @ts-ignore + this.channel = null; + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.remark = null; + // @ts-ignore + this.tags = null; + // @ts-ignore + this.isActive = null; + // @ts-ignore + this.cancelExist = null; + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.tradeType = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRecentOrdersListOldData { - return plainToInstance(GetRecentOrdersListOldData, jsonObject); + static fromJson(input: string): GetRecentOrdersListOldData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentOrdersListOldData { + return plainToClassFromExist(new GetRecentOrdersListOldData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts index 192693bb..23b1b29f 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentOrdersListOldReq implements Serializable { +export class GetRecentOrdersListOldReq implements Serializable { /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number = 50; + private constructor() {} /** * Creates a new instance of the `GetRecentOrdersListOldReq` class. * The builder pattern allows step-by-step construction of a `GetRecentOrdersListOldReq` object. */ static builder(): GetRecentOrdersListOldReqBuilder { - return new GetRecentOrdersListOldReqBuilder(); + return new GetRecentOrdersListOldReqBuilder(new GetRecentOrdersListOldReq()); } /** @@ -35,27 +37,36 @@ export class GetRecentOrdersListOldReq implements Serializable -{ +export class GetRecentOrdersListOldResp implements Response { /** * */ @Type(() => GetRecentOrdersListOldData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetRecentOrdersListOldResp this.commonResponse = response; } - fromJson(input: string): GetRecentOrdersListOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentOrdersListOldResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetRecentOrdersListOldResp { - return plainToInstance(GetRecentOrdersListOldResp, { data: jsonObject }); + static fromJson(input: string): GetRecentOrdersListOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentOrdersListOldResp { + return plainToClassFromExist(new GetRecentOrdersListOldResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts index e612b4d9..b2303d47 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts @@ -1,88 +1,104 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentTradeHistoryOldData implements Serializable { +export class GetRecentTradeHistoryOldData implements Serializable { /** * */ symbol?: string; + /** * */ tradeId?: string; + /** * */ orderId?: string; + /** * */ counterOrderId?: string; + /** * */ side?: string; + /** * */ liquidity?: string; + /** * */ forceTaker?: boolean; + /** * */ price?: string; + /** * */ size?: string; + /** * */ funds?: string; + /** * */ fee?: string; + /** * */ feeRate?: string; + /** * */ feeCurrency?: string; + /** * */ stop?: string; + /** * */ tradeType?: string; + /** * */ type?: string; + /** * */ createdAt?: number; - fromJson(input: string): GetRecentTradeHistoryOldData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentTradeHistoryOldData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetRecentTradeHistoryOldData { - return plainToInstance(GetRecentTradeHistoryOldData, jsonObject); + static fromJson(input: string): GetRecentTradeHistoryOldData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentTradeHistoryOldData { + return plainToClassFromExist(new GetRecentTradeHistoryOldData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts index 267668fd..fc37c617 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetRecentTradeHistoryOldReq implements Serializable { +export class GetRecentTradeHistoryOldReq implements Serializable { /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number; + private constructor() {} /** * Creates a new instance of the `GetRecentTradeHistoryOldReq` class. * The builder pattern allows step-by-step construction of a `GetRecentTradeHistoryOldReq` object. */ static builder(): GetRecentTradeHistoryOldReqBuilder { - return new GetRecentTradeHistoryOldReqBuilder(); + return new GetRecentTradeHistoryOldReqBuilder(new GetRecentTradeHistoryOldReq()); } /** @@ -35,27 +37,32 @@ export class GetRecentTradeHistoryOldReq implements Serializable -{ +export class GetRecentTradeHistoryOldResp implements Response { /** * */ @Type(() => GetRecentTradeHistoryOldData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetRecentTradeHistoryOldResp this.commonResponse = response; } - fromJson(input: string): GetRecentTradeHistoryOldResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetRecentTradeHistoryOldResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetRecentTradeHistoryOldResp { - return plainToInstance(GetRecentTradeHistoryOldResp, { data: jsonObject }); + static fromJson(input: string): GetRecentTradeHistoryOldResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetRecentTradeHistoryOldResp { + return plainToClassFromExist(new GetRecentTradeHistoryOldResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts index 474c0f1f..1a0bc86f 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts @@ -1,144 +1,174 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrderByClientOidData implements Serializable { +export class GetStopOrderByClientOidData implements Serializable { /** * Order ID, the ID of an order. */ id?: string; + /** * Symbol name */ symbol?: string; + /** * User ID */ userId?: string; + /** * Order status, include NEW, TRIGGERED */ status?: string; + /** * Order type,limit, market, limit_stop or market_stop */ type?: string; + /** * transaction direction,include buy and sell */ side?: string; + /** * order price */ price?: string; + /** * order quantity */ size?: string; + /** * order funds */ funds?: string; + /** * */ stp?: string; + /** * time InForce,include GTC,GTT,IOC,FOK */ timeInForce?: string; + /** * cancel orders after n seconds,requires timeInForce to be GTT */ cancelAfter?: number; + /** * postOnly */ postOnly?: boolean; + /** * hidden order */ hidden?: boolean; + /** * Iceberg order */ iceberg?: boolean; + /** * displayed quantity for iceberg order */ visibleSize?: string; + /** * order source */ channel?: string; + /** * user-entered order unique mark */ clientOid?: string; + /** * Remarks at stop order creation */ remark?: string; + /** * tag order source */ tags?: string; + /** * domainId, e.g: kucoin */ domainId?: string; + /** * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) */ tradeSource?: string; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). */ tradeType?: string; + /** * The currency of the fee */ feeCurrency?: string; + /** * Fee Rate of taker */ takerFeeRate?: string; + /** * Fee Rate of maker */ makerFeeRate?: string; + /** * order creation time */ createdAt?: number; + /** * Stop order type, include loss and entry */ stop?: string; + /** * The trigger time of the stop order */ stopTriggerTime?: number; + /** * stop price */ stopPrice?: string; + /** * Time of place a stop order, accurate to nanoseconds */ orderTime?: number; - fromJson(input: string): GetStopOrderByClientOidData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrderByClientOidData, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrderByClientOidData { - return plainToInstance(GetStopOrderByClientOidData, jsonObject); + static fromJson(input: string): GetStopOrderByClientOidData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrderByClientOidData { + return plainToClassFromExist(new GetStopOrderByClientOidData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts index 99508937..5501f257 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts @@ -1,24 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrderByClientOidReq implements Serializable { +export class GetStopOrderByClientOidReq implements Serializable { /** * The client order id */ clientOid?: string; + /** * symbol name */ symbol?: string; + private constructor() {} /** * Creates a new instance of the `GetStopOrderByClientOidReq` class. * The builder pattern allows step-by-step construction of a `GetStopOrderByClientOidReq` object. */ static builder(): GetStopOrderByClientOidReqBuilder { - return new GetStopOrderByClientOidReqBuilder(); + return new GetStopOrderByClientOidReqBuilder(new GetStopOrderByClientOidReq()); } /** @@ -40,22 +42,23 @@ export class GetStopOrderByClientOidReq implements Serializable -{ +export class GetStopOrderByClientOidResp implements Response { /** * the return code */ @Type(() => GetStopOrderByClientOidData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -24,16 +26,15 @@ export class GetStopOrderByClientOidResp this.commonResponse = response; } - fromJson(input: string): GetStopOrderByClientOidResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrderByClientOidResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetStopOrderByClientOidResp { - return plainToInstance(GetStopOrderByClientOidResp, { data: jsonObject }); + static fromJson(input: string): GetStopOrderByClientOidResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrderByClientOidResp { + return plainToClassFromExist(new GetStopOrderByClientOidResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts index 00d90a72..98c31854 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts @@ -1,22 +1,23 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import 'reflect-metadata'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrderByOrderIdReq implements Serializable { +export class GetStopOrderByOrderIdReq implements Serializable { /** * The order id */ @Reflect.metadata('path', 'orderId') orderId?: string; + private constructor() {} /** * Creates a new instance of the `GetStopOrderByOrderIdReq` class. * The builder pattern allows step-by-step construction of a `GetStopOrderByOrderIdReq` object. */ static builder(): GetStopOrderByOrderIdReqBuilder { - return new GetStopOrderByOrderIdReqBuilder(); + return new GetStopOrderByOrderIdReqBuilder(new GetStopOrderByOrderIdReq()); } /** @@ -33,22 +34,23 @@ export class GetStopOrderByOrderIdReq implements Serializable -{ +export class GetStopOrderByOrderIdResp implements Response { /** * Order ID, the ID of an order. */ id?: string; + /** * Symbol name */ symbol?: string; + /** * User ID */ userId?: string; + /** * Order status, include NEW, TRIGGERED */ status?: string; + /** * Order type,limit, market, limit_stop or market_stop */ type?: string; + /** * transaction direction,include buy and sell */ side?: string; + /** * order price */ price?: string; + /** * order quantity */ size?: string; + /** * order funds */ funds?: string; + /** * */ stp?: string; + /** * time InForce,include GTC,GTT,IOC,FOK */ timeInForce?: string; + /** * cancel orders after n seconds,requires timeInForce to be GTT */ cancelAfter?: number; + /** * postOnly */ postOnly?: boolean; + /** * hidden order */ hidden?: boolean; + /** * Iceberg order */ iceberg?: boolean; + /** * displayed quantity for iceberg order */ visibleSize?: string; + /** * order source */ channel?: string; + /** * user-entered order unique mark */ clientOid?: string; + /** * Remarks at stop order creation */ remark?: string; + /** * tag order source */ tags?: string; + /** * domainId, e.g: kucoin */ domainId?: string; + /** * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) */ tradeSource?: string; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). */ tradeType?: string; + /** * The currency of the fee */ feeCurrency?: string; + /** * Fee Rate of taker */ takerFeeRate?: string; + /** * Fee Rate of maker */ makerFeeRate?: string; + /** * order creation time */ createdAt?: number; + /** * Stop order type, include loss and entry */ stop?: string; + /** * The trigger time of the stop order */ stopTriggerTime?: number; + /** * stop price */ stopPrice?: string; + /** * Time of place a stop order, accurate to nanoseconds */ orderTime?: number; + private constructor() {} /** * common response */ @@ -142,16 +171,15 @@ export class GetStopOrderByOrderIdResp this.commonResponse = response; } - fromJson(input: string): GetStopOrderByOrderIdResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrderByOrderIdResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrderByOrderIdResp { - return plainToInstance(GetStopOrderByOrderIdResp, jsonObject); + static fromJson(input: string): GetStopOrderByOrderIdResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrderByOrderIdResp { + return plainToClassFromExist(new GetStopOrderByOrderIdResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts index 38bbda0f..a246c11c 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts @@ -1,144 +1,174 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrdersListItems implements Serializable { +export class GetStopOrdersListItems implements Serializable { /** * Order ID, the ID of an order. */ id?: string; + /** * Symbol name */ symbol?: string; + /** * User ID */ userId?: string; + /** * Order status, include NEW, TRIGGERED */ status?: string; + /** * Order type,limit, market, limit_stop or market_stop */ type?: string; + /** * transaction direction,include buy and sell */ side?: string; + /** * order price */ price?: string; + /** * order quantity */ size?: string; + /** * order funds */ funds?: string; + /** * */ stp?: string; + /** * time InForce,include GTC,GTT,IOC,FOK */ timeInForce?: string; + /** * cancel orders after n seconds,requires timeInForce to be GTT */ cancelAfter?: number; + /** * postOnly */ postOnly?: boolean; + /** * hidden order */ hidden?: boolean; + /** * Iceberg order */ iceberg?: boolean; + /** * displayed quantity for iceberg order */ visibleSize?: string; + /** * order source */ channel?: string; + /** * user-entered order unique mark */ clientOid?: string; + /** * Remarks at stop order creation */ remark?: string; + /** * tag order source */ tags?: string; + /** * Time of place a stop order, accurate to nanoseconds */ orderTime?: number; + /** * domainId, e.g: kucoin */ domainId?: string; + /** * trade source: USER(Order by user), MARGIN_SYSTEM(Order by margin system) */ tradeSource?: string; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). */ tradeType?: string; + /** * The currency of the fee */ feeCurrency?: string; + /** * Fee Rate of taker */ takerFeeRate?: string; + /** * Fee Rate of maker */ makerFeeRate?: string; + /** * order creation time */ createdAt?: number; + /** * Stop order type, include loss and entry */ stop?: string; + /** * The trigger time of the stop order */ stopTriggerTime?: number; + /** * stop price */ stopPrice?: string; - fromJson(input: string): GetStopOrdersListItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrdersListItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrdersListItems { - return plainToInstance(GetStopOrdersListItems, jsonObject); + static fromJson(input: string): GetStopOrdersListItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrdersListItems { + return plainToClassFromExist(new GetStopOrdersListItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts index b9564558..a68d1b14 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts @@ -1,56 +1,66 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetStopOrdersListReq implements Serializable { +export class GetStopOrdersListReq implements Serializable { /** * Only list orders for a specific symbol */ symbol?: string; + /** * buy or sell */ side?: GetStopOrdersListReq.SideEnum; + /** * limit, market, limit_stop or market_stop */ type?: GetStopOrdersListReq.TypeEnum; + /** * The type of trading : TRADE(Spot), MARGIN_TRADE (Cross Margin), MARGIN_ISOLATED_TRADE (Isolated Margin). Default is TRADE */ tradeType?: GetStopOrdersListReq.TradeTypeEnum; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * current page */ currentPage?: number; + /** * comma seperated order ID list */ orderIds?: string; + /** * page size */ pageSize?: number; + /** * Order type: stop: stop loss order, oco: oco order */ stop?: string; + private constructor() {} /** * Creates a new instance of the `GetStopOrdersListReq` class. * The builder pattern allows step-by-step construction of a `GetStopOrdersListReq` object. */ static builder(): GetStopOrdersListReqBuilder { - return new GetStopOrdersListReqBuilder(); + return new GetStopOrdersListReqBuilder(new GetStopOrdersListReq()); } /** @@ -112,17 +122,16 @@ export class GetStopOrdersListReq implements Serializable return obj; } - fromJson(input: string): GetStopOrdersListReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetStopOrdersListReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetStopOrdersListReq { - return plainToInstance(GetStopOrdersListReq, jsonObject); + static fromJson(input: string): GetStopOrdersListReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetStopOrdersListReq { + return plainToClassFromExist(new GetStopOrdersListReq(), jsonObject); } } @@ -172,7 +181,9 @@ export namespace GetStopOrdersListReq { } export class GetStopOrdersListReqBuilder { - obj: GetStopOrdersListReq = new GetStopOrdersListReq(); + constructor(readonly obj: GetStopOrdersListReq) { + this.obj = obj; + } /** * Only list orders for a specific symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts index 21d34dc2..40025ee3 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts @@ -1,33 +1,38 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetStopOrdersListItems } from './model_get_stop_orders_list_items'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetStopOrdersListResp implements Response { +export class GetStopOrdersListResp implements Response { /** * current page id */ currentPage?: number; + /** * */ pageSize?: number; + /** * the stop order count */ totalNum?: number; + /** * total page count of the list */ totalPage?: number; + /** * the list of stop orders */ @Type(() => GetStopOrdersListItems) items?: Array; + private constructor() {} /** * common response */ @@ -38,16 +43,15 @@ export class GetStopOrdersListResp implements Response -{ +export class GetSymbolsWithOpenOrderResp implements Response { /** * The symbol that has active orders */ - symbols?: Array; + symbols: Array; + private constructor() { + // @ts-ignore + this.symbols = null; + } /** * common response */ @@ -22,16 +24,15 @@ export class GetSymbolsWithOpenOrderResp this.commonResponse = response; } - fromJson(input: string): GetSymbolsWithOpenOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { - return plainToInstance(GetSymbolsWithOpenOrderResp, jsonObject); + static fromJson(input: string): GetSymbolsWithOpenOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { + return plainToClassFromExist(new GetSymbolsWithOpenOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts index 40f21dbf..143bc32e 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts @@ -1,101 +1,161 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryItems implements Serializable { +export class GetTradeHistoryItems implements Serializable { /** * Id of transaction detail */ - id?: number; + id: number; + /** * symbol */ - symbol?: string; + symbol: string; + /** * Trade Id, symbol latitude increment */ - tradeId?: number; + tradeId: number; + /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; + /** * Counterparty order Id */ - counterOrderId?: string; + counterOrderId: string; + /** * Buy or sell */ - side?: GetTradeHistoryItems.SideEnum; + side: GetTradeHistoryItems.SideEnum; + /** * Liquidity type: taker or maker */ - liquidity?: GetTradeHistoryItems.LiquidityEnum; + liquidity: GetTradeHistoryItems.LiquidityEnum; + /** * */ - forceTaker?: boolean; + forceTaker: boolean; + /** * Order price */ - price?: string; + price: string; + /** * Order size */ - size?: string; + size: string; + /** * Order Funds */ - funds?: string; + funds: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ - fee?: string; + fee: string; + /** * Fee rate */ - feeRate?: string; + feeRate: string; + /** * currency used to calculate trading fee */ - feeCurrency?: string; + feeCurrency: string; + /** * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty */ - stop?: string; + stop: string; + /** * Trade type, redundancy param */ - tradeType?: string; + tradeType: string; + /** * Tax Rate, Users in some regions need query this field */ - taxRate?: string; + taxRate: string; + /** * Users in some regions need query this field */ - tax?: string; + tax: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ - type?: GetTradeHistoryItems.TypeEnum; + type: GetTradeHistoryItems.TypeEnum; + /** * */ - createdAt?: number; + createdAt: number; - fromJson(input: string): GetTradeHistoryItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryItems, jsonObject); + private constructor() { + // @ts-ignore + this.id = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.counterOrderId = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.liquidity = null; + // @ts-ignore + this.forceTaker = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.funds = null; + // @ts-ignore + this.fee = null; + // @ts-ignore + this.feeRate = null; + // @ts-ignore + this.feeCurrency = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.tradeType = null; + // @ts-ignore + this.taxRate = null; + // @ts-ignore + this.tax = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.createdAt = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryItems { - return plainToInstance(GetTradeHistoryItems, jsonObject); + static fromJson(input: string): GetTradeHistoryItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryItems { + return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts index 71786b00..6badea5d 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts @@ -1,88 +1,104 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryOldItems implements Serializable { +export class GetTradeHistoryOldItems implements Serializable { /** * symbol */ symbol?: string; + /** * */ tradeId?: string; + /** * The unique order id generated by the trading system */ orderId?: string; + /** * Counterparty order Id */ counterOrderId?: string; + /** * Buy or sell */ side?: string; + /** * Liquidity type: taker or maker */ liquidity?: string; + /** * */ forceTaker?: boolean; + /** * Order price */ price?: string; + /** * Order size */ size?: string; + /** * Order Funds */ funds?: string; + /** * [Handling fees](https://www.kucoin.com/docs-new/api-5327739) */ fee?: string; + /** * Fee rate */ feeRate?: string; + /** * currency used to calculate trading fee */ feeCurrency?: string; + /** * Take Profit and Stop Loss type, currently HFT does not support the Take Profit and Stop Loss type, so it is empty */ stop?: string; + /** * Trade type, redundancy param */ tradeType?: string; + /** * Specify if the order is an \'limit\' order or \'market\' order. */ type?: string; + /** * */ createdAt?: number; - fromJson(input: string): GetTradeHistoryOldItems { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryOldItems, jsonObject); - } - + private constructor() {} toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryOldItems { - return plainToInstance(GetTradeHistoryOldItems, jsonObject); + static fromJson(input: string): GetTradeHistoryOldItems { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryOldItems { + return plainToClassFromExist(new GetTradeHistoryOldItems(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts index 633f2985..e0383e3a 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts @@ -1,52 +1,61 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetTradeHistoryOldReq implements Serializable { +export class GetTradeHistoryOldReq implements Serializable { /** * symbol */ symbol?: string; + /** * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) */ orderId?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ side?: GetTradeHistoryOldReq.SideEnum; + /** * limit, market, limit_stop or market_stop */ type?: GetTradeHistoryOldReq.TypeEnum; + /** * The type of trading:TRADE - Spot Trading(TRADE as default), MARGIN_TRADE - Cross Margin Trading, MARGIN_ISOLATED_TRADE - Isolated Margin Trading. */ tradeType?: GetTradeHistoryOldReq.TradeTypeEnum = GetTradeHistoryOldReq.TradeTypeEnum.TRADE; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + /** * Current request page. */ currentPage?: number = 1; + /** * Number of results per request. Minimum is 10, maximum is 500. */ pageSize?: number; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryOldReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryOldReq` object. */ static builder(): GetTradeHistoryOldReqBuilder { - return new GetTradeHistoryOldReqBuilder(); + return new GetTradeHistoryOldReqBuilder(new GetTradeHistoryOldReq()); } /** @@ -95,25 +104,32 @@ export class GetTradeHistoryOldReq implements Serializable { +export class GetTradeHistoryOldResp implements Response { /** * */ - currentPage?: number; + currentPage: number; + /** * */ - pageSize?: number; + pageSize: number; + /** * */ - totalNum?: number; + totalNum: number; + /** * */ - totalPage?: number; + totalPage: number; + /** * */ @Type(() => GetTradeHistoryOldItems) - items?: Array; + items: Array; + private constructor() { + // @ts-ignore + this.currentPage = null; + // @ts-ignore + this.pageSize = null; + // @ts-ignore + this.totalNum = null; + // @ts-ignore + this.totalPage = null; + // @ts-ignore + this.items = null; + } /** * common response */ @@ -38,16 +54,15 @@ export class GetTradeHistoryOldResp implements Response { +export class GetTradeHistoryReq implements Serializable { /** * symbol */ symbol?: string; + /** * The unique order id generated by the trading system (If orderId is specified,please ignore the other query parameters) */ orderId?: string; + /** * specify if the order is to \'buy\' or \'sell\' */ side?: GetTradeHistoryReq.SideEnum; + /** * specify if the order is an \'limit\' order or \'market\' order. */ type?: GetTradeHistoryReq.TypeEnum; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ lastId?: number; + /** * Default20,Max100 */ limit?: number = 20; + /** * Start time (milisecond) */ startAt?: number; + /** * End time (milisecond) */ endAt?: number; + private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. * The builder pattern allows step-by-step construction of a `GetTradeHistoryReq` object. */ static builder(): GetTradeHistoryReqBuilder { - return new GetTradeHistoryReqBuilder(); + return new GetTradeHistoryReqBuilder(new GetTradeHistoryReq()); } /** @@ -88,23 +96,26 @@ export class GetTradeHistoryReq implements Serializable { obj.side = data.side; obj.type = data.type; obj.lastId = data.lastId; - obj.limit = data.limit; + if (data.limit) { + obj.limit = data.limit; + } else { + obj.limit = 20; + } obj.startAt = data.startAt; obj.endAt = data.endAt; return obj; } - fromJson(input: string): GetTradeHistoryReq { - const jsonObject = JSON.parse(input); - return plainToInstance(GetTradeHistoryReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetTradeHistoryReq { - return plainToInstance(GetTradeHistoryReq, jsonObject); + static fromJson(input: string): GetTradeHistoryReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetTradeHistoryReq { + return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } } @@ -132,7 +143,9 @@ export namespace GetTradeHistoryReq { } export class GetTradeHistoryReqBuilder { - obj: GetTradeHistoryReq = new GetTradeHistoryReq(); + constructor(readonly obj: GetTradeHistoryReq) { + this.obj = obj; + } /** * symbol */ diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts index f970c961..641f94ab 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts @@ -1,21 +1,28 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetTradeHistoryItems } from './model_get_trade_history_items'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetTradeHistoryResp implements Response { +export class GetTradeHistoryResp implements Response { /** * */ @Type(() => GetTradeHistoryItems) - items?: Array; + items: Array; + /** * The id of the last set of data from the previous batch of data. By default, the latest information is given. lastId is used to filter data and paginate. If lastId is not entered, the default is a maximum of 100 returned data items. The return results include lastId,which can be used as a query parameter to look up new data from the next page. */ - lastId?: number; + lastId: number; + private constructor() { + // @ts-ignore + this.items = null; + // @ts-ignore + this.lastId = null; + } /** * common response */ @@ -26,16 +33,15 @@ export class GetTradeHistoryResp implements Response { +export class ModifyOrderReq implements Serializable { /** * The old client order id,orderId and clientOid must choose one */ clientOid?: string; + /** * symbol */ - symbol?: string; + symbol: string; + /** * The old order id, orderId and clientOid must choose one */ orderId?: string; + /** * The modified price of the new order, newPrice and newSize must choose one */ newPrice?: string; + /** * The modified size of the new order, newPrice and newSize must choose one */ newSize?: string; + private constructor() { + // @ts-ignore + this.symbol = null; + } /** * Creates a new instance of the `ModifyOrderReq` class. * The builder pattern allows step-by-step construction of a `ModifyOrderReq` object. */ static builder(): ModifyOrderReqBuilder { - return new ModifyOrderReqBuilder(); + return new ModifyOrderReqBuilder(new ModifyOrderReq()); } /** @@ -44,7 +52,7 @@ export class ModifyOrderReq implements Serializable { /** * symbol */ - symbol?: string; + symbol: string; /** * The old order id, orderId and clientOid must choose one */ @@ -67,22 +75,23 @@ export class ModifyOrderReq implements Serializable { return obj; } - fromJson(input: string): ModifyOrderReq { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyOrderReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyOrderReq { - return plainToInstance(ModifyOrderReq, jsonObject); + static fromJson(input: string): ModifyOrderReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyOrderReq { + return plainToClassFromExist(new ModifyOrderReq(), jsonObject); } } export class ModifyOrderReqBuilder { - obj: ModifyOrderReq = new ModifyOrderReq(); + constructor(readonly obj: ModifyOrderReq) { + this.obj = obj; + } /** * The old client order id,orderId and clientOid must choose one */ diff --git a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts index d1ce4aea..55d658fb 100644 --- a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class ModifyOrderResp implements Response { +export class ModifyOrderResp implements Response { /** * The new order id */ - newOrderId?: string; + newOrderId: string; + /** * The original client order id */ - clientOid?: string; + clientOid: string; + private constructor() { + // @ts-ignore + this.newOrderId = null; + // @ts-ignore + this.clientOid = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class ModifyOrderResp implements Response this.commonResponse = response; } - fromJson(input: string): ModifyOrderResp { - const jsonObject = JSON.parse(input); - return plainToInstance(ModifyOrderResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): ModifyOrderResp { - return plainToInstance(ModifyOrderResp, jsonObject); + static fromJson(input: string): ModifyOrderResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ModifyOrderResp { + return plainToClassFromExist(new ModifyOrderResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts index 996950ea..5d125b7b 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts @@ -1,24 +1,29 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class SetDCPReq implements Serializable { +export class SetDCPReq implements Serializable { /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. */ - timeout?: number; + timeout: number; + /** * List of trading pairs. When this parameter is not empty, separate it with commas and support up to 50 trading pairs. Empty means all trading pairs. When this parameter is changed, the previous setting will be overwritten. */ symbols?: string; + private constructor() { + // @ts-ignore + this.timeout = null; + } /** * Creates a new instance of the `SetDCPReq` class. * The builder pattern allows step-by-step construction of a `SetDCPReq` object. */ static builder(): SetDCPReqBuilder { - return new SetDCPReqBuilder(); + return new SetDCPReqBuilder(new SetDCPReq()); } /** @@ -28,7 +33,7 @@ export class SetDCPReq implements Serializable { /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. */ - timeout?: number; + timeout: number; /** * List of trading pairs. When this parameter is not empty, separate it with commas and support up to 50 trading pairs. Empty means all trading pairs. When this parameter is changed, the previous setting will be overwritten. */ @@ -40,22 +45,23 @@ export class SetDCPReq implements Serializable { return obj; } - fromJson(input: string): SetDCPReq { - const jsonObject = JSON.parse(input); - return plainToInstance(SetDCPReq, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SetDCPReq { - return plainToInstance(SetDCPReq, jsonObject); + static fromJson(input: string): SetDCPReq { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SetDCPReq { + return plainToClassFromExist(new SetDCPReq(), jsonObject); } } export class SetDCPReqBuilder { - obj: SetDCPReq = new SetDCPReq(); + constructor(readonly obj: SetDCPReq) { + this.obj = obj; + } /** * Auto cancel order trigger setting time, the unit is second. range: timeout=-1 (meaning unset) or 5 <= timeout <= 86400. For example, timeout=5 means that the order will be automatically canceled if no user request is received for more than 5 seconds. When this parameter is changed, the previous setting will be overwritten. */ diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts index d2eab184..6af83f95 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts @@ -1,19 +1,26 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class SetDCPResp implements Response { +export class SetDCPResp implements Response { /** * System current time (in seconds) */ - currentTime?: number; + currentTime: number; + /** * Trigger cancellation time (in seconds) */ - triggerTime?: number; + triggerTime: number; + private constructor() { + // @ts-ignore + this.currentTime = null; + // @ts-ignore + this.triggerTime = null; + } /** * common response */ @@ -24,16 +31,15 @@ export class SetDCPResp implements Response { this.commonResponse = response; } - fromJson(input: string): SetDCPResp { - const jsonObject = JSON.parse(input); - return plainToInstance(SetDCPResp, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SetDCPResp { - return plainToInstance(SetDCPResp, jsonObject); + static fromJson(input: string): SetDCPResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SetDCPResp { + return plainToClassFromExist(new SetDCPResp(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index fb69594b..6bc2917a 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { AccountRelationContext } from './model_account_relation_context'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AccountEvent implements Response { +export class AccountEvent implements Response { /** * Account ID */ @@ -62,17 +62,16 @@ export class AccountEvent implements Response { this.commonResponse = response; } - fromJson(input: string): AccountEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(AccountEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AccountEvent { - return plainToInstance(AccountEvent, jsonObject); + static fromJson(input: string): AccountEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AccountEvent { + return plainToClassFromExist(new AccountEvent(), jsonObject); } } @@ -84,7 +83,7 @@ export class AccountEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new AccountEvent().fromObject(msg.data); + let event = AccountEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts index 312fa2e2..f0fd8c7d 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -1,9 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class AccountRelationContext implements Serializable { +export class AccountRelationContext implements Serializable { /** * */ @@ -13,16 +13,15 @@ export class AccountRelationContext implements Serializable { +export class OrderV1Event implements Response { /** * Cumulative number of cancellations */ @@ -105,17 +105,16 @@ export class OrderV1Event implements Response { this.commonResponse = response; } - fromJson(input: string): OrderV1Event { - const jsonObject = JSON.parse(input); - return plainToInstance(OrderV1Event, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): OrderV1Event { - return plainToInstance(OrderV1Event, jsonObject); + static fromJson(input: string): OrderV1Event { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): OrderV1Event { + return plainToClassFromExist(new OrderV1Event(), jsonObject); } } @@ -210,7 +209,7 @@ export class OrderV1EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderV1Event().fromObject(msg.data); + let event = OrderV1Event.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index be74e34d..d1e87fd3 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class OrderV2Event implements Response { +export class OrderV2Event implements Response { /** * Cumulative number of cancellations */ @@ -105,17 +105,16 @@ export class OrderV2Event implements Response { this.commonResponse = response; } - fromJson(input: string): OrderV2Event { - const jsonObject = JSON.parse(input); - return plainToInstance(OrderV2Event, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): OrderV2Event { - return plainToInstance(OrderV2Event, jsonObject); + static fromJson(input: string): OrderV2Event { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): OrderV2Event { + return plainToClassFromExist(new OrderV2Event(), jsonObject); } } @@ -214,7 +213,7 @@ export class OrderV2EventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new OrderV2Event().fromObject(msg.data); + let event = OrderV2Event.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index a3ecedf4..55c423ae 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class AllTickersEvent implements Response { +export class AllTickersEvent implements Response { /** * */ @@ -49,17 +49,16 @@ export class AllTickersEvent implements Response { this.commonResponse = response; } - fromJson(input: string): AllTickersEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(AllTickersEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): AllTickersEvent { - return plainToInstance(AllTickersEvent, jsonObject); + static fromJson(input: string): AllTickersEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): AllTickersEvent { + return plainToClassFromExist(new AllTickersEvent(), jsonObject); } } @@ -75,7 +74,7 @@ export class AllTickersEventCallbackWrapper implements WebSocketMessageCallback } onMessage(msg: WsMessage): void { - let event = new AllTickersEvent().fromObject(msg.data); + let event = AllTickersEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index 5ddc2fc9..f2a7846f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class KlinesEvent implements Response { +export class KlinesEvent implements Response { /** * symbol */ @@ -29,17 +29,16 @@ export class KlinesEvent implements Response { this.commonResponse = response; } - fromJson(input: string): KlinesEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(KlinesEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): KlinesEvent { - return plainToInstance(KlinesEvent, jsonObject); + static fromJson(input: string): KlinesEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): KlinesEvent { + return plainToClassFromExist(new KlinesEvent(), jsonObject); } } @@ -51,7 +50,7 @@ export class KlinesEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new KlinesEvent().fromObject(msg.data); + let event = KlinesEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts index a6b30754..7fe34fb7 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. +import { Type, instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { MarketSnapshotDataMarketChange4h } from './model_market_snapshot_data_market_change4h'; import { MarketSnapshotDataMarketChange24h } from './model_market_snapshot_data_market_change24h'; import { MarketSnapshotDataMarketChange1h } from './model_market_snapshot_data_market_change1h'; -import { Type, instanceToPlain, plainToInstance } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class MarketSnapshotData implements Serializable { +export class MarketSnapshotData implements Serializable { /** * */ @@ -144,17 +144,16 @@ export class MarketSnapshotData implements Serializable { */ volValue?: number; - fromJson(input: string): MarketSnapshotData { - const jsonObject = JSON.parse(input); - return plainToInstance(MarketSnapshotData, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarketSnapshotData { - return plainToInstance(MarketSnapshotData, jsonObject); + static fromJson(input: string): MarketSnapshotData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarketSnapshotData { + return plainToClassFromExist(new MarketSnapshotData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts index 884545e0..9ee98dfb 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class MarketSnapshotDataMarketChange1h - implements Serializable -{ +export class MarketSnapshotDataMarketChange1h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class MarketSnapshotDataMarketChange1h */ volValue?: number; - fromJson(input: string): MarketSnapshotDataMarketChange1h { - const jsonObject = JSON.parse(input); - return plainToInstance(MarketSnapshotDataMarketChange1h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarketSnapshotDataMarketChange1h { - return plainToInstance(MarketSnapshotDataMarketChange1h, jsonObject); + static fromJson(input: string): MarketSnapshotDataMarketChange1h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange1h { + return plainToClassFromExist(new MarketSnapshotDataMarketChange1h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts index ac602617..714d3950 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class MarketSnapshotDataMarketChange24h - implements Serializable -{ +export class MarketSnapshotDataMarketChange24h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class MarketSnapshotDataMarketChange24h */ volValue?: number; - fromJson(input: string): MarketSnapshotDataMarketChange24h { - const jsonObject = JSON.parse(input); - return plainToInstance(MarketSnapshotDataMarketChange24h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarketSnapshotDataMarketChange24h { - return plainToInstance(MarketSnapshotDataMarketChange24h, jsonObject); + static fromJson(input: string): MarketSnapshotDataMarketChange24h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange24h { + return plainToClassFromExist(new MarketSnapshotDataMarketChange24h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts index 823a39a1..879d9a79 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class MarketSnapshotDataMarketChange4h - implements Serializable -{ +export class MarketSnapshotDataMarketChange4h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class MarketSnapshotDataMarketChange4h */ volValue?: number; - fromJson(input: string): MarketSnapshotDataMarketChange4h { - const jsonObject = JSON.parse(input); - return plainToInstance(MarketSnapshotDataMarketChange4h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): MarketSnapshotDataMarketChange4h { - return plainToInstance(MarketSnapshotDataMarketChange4h, jsonObject); + static fromJson(input: string): MarketSnapshotDataMarketChange4h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange4h { + return plainToClassFromExist(new MarketSnapshotDataMarketChange4h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index f499d54f..09a8d732 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { MarketSnapshotData } from './model_market_snapshot_data'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class MarketSnapshotEvent implements Response { +export class MarketSnapshotEvent implements Response { /** * */ @@ -26,17 +26,16 @@ export class MarketSnapshotEvent implements Response { +export class OrderbookIncrementChanges implements Serializable { /** * price,size,sequence */ @@ -13,16 +13,15 @@ export class OrderbookIncrementChanges implements Serializable>; - fromJson(input: string): OrderbookIncrementChanges { - const jsonObject = JSON.parse(input); - return plainToInstance(OrderbookIncrementChanges, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): OrderbookIncrementChanges { - return plainToInstance(OrderbookIncrementChanges, jsonObject); + static fromJson(input: string): OrderbookIncrementChanges { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): OrderbookIncrementChanges { + return plainToClassFromExist(new OrderbookIncrementChanges(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index d145b9e7..99fd6c99 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { OrderbookIncrementChanges } from './model_orderbook_increment_changes'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class OrderbookIncrementEvent implements Response { +export class OrderbookIncrementEvent implements Response { /** * */ @@ -38,17 +38,16 @@ export class OrderbookIncrementEvent implements Response { +export class OrderbookLevel1Event implements Response { /** * price, size */ @@ -29,17 +29,16 @@ export class OrderbookLevel1Event implements Response { +export class OrderbookLevel50Changes implements Serializable { /** * */ @@ -13,16 +13,15 @@ export class OrderbookLevel50Changes implements Serializable>; - fromJson(input: string): OrderbookLevel50Changes { - const jsonObject = JSON.parse(input); - return plainToInstance(OrderbookLevel50Changes, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): OrderbookLevel50Changes { - return plainToInstance(OrderbookLevel50Changes, jsonObject); + static fromJson(input: string): OrderbookLevel50Changes { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): OrderbookLevel50Changes { + return plainToClassFromExist(new OrderbookLevel50Changes(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index af99b53d..063a4e4f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { OrderbookLevel50Changes } from './model_orderbook_level50_changes'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class OrderbookLevel50Event implements Response { +export class OrderbookLevel50Event implements Response { /** * */ @@ -38,17 +38,16 @@ export class OrderbookLevel50Event implements Response { +export class OrderbookLevel5Event implements Response { /** * price, size */ @@ -29,17 +29,16 @@ export class OrderbookLevel5Event implements Response { +export class SymbolSnapshotData implements Serializable { /** * */ @@ -144,17 +144,16 @@ export class SymbolSnapshotData implements Serializable { */ volValue?: number; - fromJson(input: string): SymbolSnapshotData { - const jsonObject = JSON.parse(input); - return plainToInstance(SymbolSnapshotData, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SymbolSnapshotData { - return plainToInstance(SymbolSnapshotData, jsonObject); + static fromJson(input: string): SymbolSnapshotData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SymbolSnapshotData { + return plainToClassFromExist(new SymbolSnapshotData(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts index 11ac384c..037a7515 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class SymbolSnapshotDataMarketChange1h - implements Serializable -{ +export class SymbolSnapshotDataMarketChange1h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class SymbolSnapshotDataMarketChange1h */ volValue?: number; - fromJson(input: string): SymbolSnapshotDataMarketChange1h { - const jsonObject = JSON.parse(input); - return plainToInstance(SymbolSnapshotDataMarketChange1h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange1h { - return plainToInstance(SymbolSnapshotDataMarketChange1h, jsonObject); + static fromJson(input: string): SymbolSnapshotDataMarketChange1h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange1h { + return plainToClassFromExist(new SymbolSnapshotDataMarketChange1h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts index bb47fcd8..e0291dce 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class SymbolSnapshotDataMarketChange24h - implements Serializable -{ +export class SymbolSnapshotDataMarketChange24h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class SymbolSnapshotDataMarketChange24h */ volValue?: number; - fromJson(input: string): SymbolSnapshotDataMarketChange24h { - const jsonObject = JSON.parse(input); - return plainToInstance(SymbolSnapshotDataMarketChange24h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange24h { - return plainToInstance(SymbolSnapshotDataMarketChange24h, jsonObject); + static fromJson(input: string): SymbolSnapshotDataMarketChange24h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange24h { + return plainToClassFromExist(new SymbolSnapshotDataMarketChange24h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts index ac2b6143..f375f8c2 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -1,11 +1,9 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class SymbolSnapshotDataMarketChange4h - implements Serializable -{ +export class SymbolSnapshotDataMarketChange4h implements Serializable { /** * */ @@ -35,16 +33,15 @@ export class SymbolSnapshotDataMarketChange4h */ volValue?: number; - fromJson(input: string): SymbolSnapshotDataMarketChange4h { - const jsonObject = JSON.parse(input); - return plainToInstance(SymbolSnapshotDataMarketChange4h, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange4h { - return plainToInstance(SymbolSnapshotDataMarketChange4h, jsonObject); + static fromJson(input: string): SymbolSnapshotDataMarketChange4h { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange4h { + return plainToClassFromExist(new SymbolSnapshotDataMarketChange4h(), jsonObject); } } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index 4d5bdb84..7b30d2b1 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -1,12 +1,12 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { SymbolSnapshotData } from './model_symbol_snapshot_data'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class SymbolSnapshotEvent implements Response { +export class SymbolSnapshotEvent implements Response { /** * */ @@ -26,17 +26,16 @@ export class SymbolSnapshotEvent implements Response { +export class TickerEvent implements Response { /** * Sequence number */ @@ -49,17 +49,16 @@ export class TickerEvent implements Response { this.commonResponse = response; } - fromJson(input: string): TickerEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(TickerEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TickerEvent { - return plainToInstance(TickerEvent, jsonObject); + static fromJson(input: string): TickerEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TickerEvent { + return plainToClassFromExist(new TickerEvent(), jsonObject); } } @@ -71,7 +70,7 @@ export class TickerEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TickerEvent().fromObject(msg.data); + let event = TickerEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index 58141e9e..90dd302d 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -1,11 +1,11 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { WsMessage } from '@model/common'; import { WebSocketMessageCallback } from '@internal/interfaces/websocket'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class TradeEvent implements Response { +export class TradeEvent implements Response { /** * */ @@ -57,17 +57,16 @@ export class TradeEvent implements Response { this.commonResponse = response; } - fromJson(input: string): TradeEvent { - const jsonObject = JSON.parse(input); - return plainToInstance(TradeEvent, jsonObject); - } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): TradeEvent { - return plainToInstance(TradeEvent, jsonObject); + static fromJson(input: string): TradeEvent { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): TradeEvent { + return plainToClassFromExist(new TradeEvent(), jsonObject); } } @@ -79,7 +78,7 @@ export class TradeEventCallbackWrapper implements WebSocketMessageCallback { } onMessage(msg: WsMessage): void { - let event = new TradeEvent().fromObject(msg.data); + let event = TradeEvent.fromObject(msg.data); event.setCommonResponse(msg); this.callback(msg.topic, msg.subject, event); } diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index c7749129..eedbcf00 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-17'; +export const SdkGenerateDate = '2025-01-20'; diff --git a/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts index b2b7cce4..b68cc7f6 100644 --- a/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts +++ b/sdk/node/src/generate/viplending/viplending/api_vip_lending.ts @@ -48,7 +48,7 @@ export class VIPLendingAPIImpl implements VIPLendingAPI { 'GET', '/api/v1/otc-loan/loan', null, - new GetAccountDetailResp(), + GetAccountDetailResp, false, ); } @@ -60,7 +60,7 @@ export class VIPLendingAPIImpl implements VIPLendingAPI { 'GET', '/api/v1/otc-loan/accounts', null, - new GetAccountsResp(), + GetAccountsResp, false, ); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts index 21acdbcf..4dad8609 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts @@ -1,40 +1,55 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountDetailLtv implements Serializable { +export class GetAccountDetailLtv implements Serializable { /** * LTV of Restricted Transfers to Funding Account */ - transferLtv?: string; + transferLtv: string; + /** * LTV of Reduce Only (Restricted Open Positions) */ - onlyClosePosLtv?: string; + onlyClosePosLtv: string; + /** * LTV of Delayed Liquidation */ - delayedLiquidationLtv?: string; + delayedLiquidationLtv: string; + /** * LTV of Instant Liquidation */ - instantLiquidationLtv?: string; + instantLiquidationLtv: string; + /** * Current LTV */ - currentLtv?: string; + currentLtv: string; - fromJson(input: string): GetAccountDetailLtv { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountDetailLtv, jsonObject); + private constructor() { + // @ts-ignore + this.transferLtv = null; + // @ts-ignore + this.onlyClosePosLtv = null; + // @ts-ignore + this.delayedLiquidationLtv = null; + // @ts-ignore + this.instantLiquidationLtv = null; + // @ts-ignore + this.currentLtv = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountDetailLtv { - return plainToInstance(GetAccountDetailLtv, jsonObject); + static fromJson(input: string): GetAccountDetailLtv { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountDetailLtv { + return plainToClassFromExist(new GetAccountDetailLtv(), jsonObject); } } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts index 035f0220..e9fa4287 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts @@ -1,32 +1,41 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountDetailMargins implements Serializable { +export class GetAccountDetailMargins implements Serializable { /** * Margin Currency */ - marginCcy?: string; + marginCcy: string; + /** * Maintenance Quantity (Calculated with Margin Coefficient) */ - marginQty?: string; + marginQty: string; + /** * Margin Coefficient return real time margin discount rate to USDT */ - marginFactor?: string; + marginFactor: string; - fromJson(input: string): GetAccountDetailMargins { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountDetailMargins, jsonObject); + private constructor() { + // @ts-ignore + this.marginCcy = null; + // @ts-ignore + this.marginQty = null; + // @ts-ignore + this.marginFactor = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountDetailMargins { - return plainToInstance(GetAccountDetailMargins, jsonObject); + static fromJson(input: string): GetAccountDetailMargins { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountDetailMargins { + return plainToClassFromExist(new GetAccountDetailMargins(), jsonObject); } } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts index 089017df..43d81577 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts @@ -1,36 +1,48 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { instanceToPlain, plainToInstance } from 'class-transformer'; +import { instanceToPlain, plainToClassFromExist } from 'class-transformer'; import { Serializable } from '@internal/interfaces/serializable'; -export class GetAccountDetailOrders implements Serializable { +export class GetAccountDetailOrders implements Serializable { /** * Loan Orders ID */ - orderId?: string; + orderId: string; + /** * Principal to Be Repaid */ - principal?: string; + principal: string; + /** * Interest to Be Repaid */ - interest?: string; + interest: string; + /** * Loan Currency */ - currency?: string; + currency: string; - fromJson(input: string): GetAccountDetailOrders { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountDetailOrders, jsonObject); + private constructor() { + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.principal = null; + // @ts-ignore + this.interest = null; + // @ts-ignore + this.currency = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountDetailOrders { - return plainToInstance(GetAccountDetailOrders, jsonObject); + static fromJson(input: string): GetAccountDetailOrders { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountDetailOrders { + return plainToClassFromExist(new GetAccountDetailOrders(), jsonObject); } } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts index 37f153bd..da48fa5f 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts @@ -1,41 +1,60 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. import { GetAccountDetailLtv } from './model_get_account_detail_ltv'; -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAccountDetailOrders } from './model_get_account_detail_orders'; import { GetAccountDetailMargins } from './model_get_account_detail_margins'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAccountDetailResp implements Response { +export class GetAccountDetailResp implements Response { /** * Master UID */ - parentUid?: string; + parentUid: string; + /** * Loan Orders */ @Type(() => GetAccountDetailOrders) - orders?: Array; + orders: Array; + /** * */ @Type(() => GetAccountDetailLtv) - ltv?: GetAccountDetailLtv; + ltv: GetAccountDetailLtv; + /** * Total Margin Amount (USDT) */ - totalMarginAmount?: string; + totalMarginAmount: string; + /** * Total Maintenance Margin for Restricted Transfers (USDT) */ - transferMarginAmount?: string; + transferMarginAmount: string; + /** * */ @Type(() => GetAccountDetailMargins) - margins?: Array; + margins: Array; + private constructor() { + // @ts-ignore + this.parentUid = null; + // @ts-ignore + this.orders = null; + // @ts-ignore + this.ltv = null; + // @ts-ignore + this.totalMarginAmount = null; + // @ts-ignore + this.transferMarginAmount = null; + // @ts-ignore + this.margins = null; + } /** * common response */ @@ -46,16 +65,15 @@ export class GetAccountDetailResp implements Response { +export class GetAccountsData implements Serializable { /** * UID */ - uid?: string; + uid: string; + /** * Margin Currency */ - marginCcy?: string; + marginCcy: string; + /** * Maintenance Quantity (Calculated with Margin Coefficient) */ - marginQty?: string; + marginQty: string; + /** * Margin Coefficient */ - marginFactor?: string; + marginFactor: string; + /** * Account Type: TRADE - Trading Account CONTRACT - Futures Account (for Total Futures Equity) */ - accountType?: string; + accountType: string; + /** * If It Is Master Account */ - isParent?: boolean; + isParent: boolean; - fromJson(input: string): GetAccountsData { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountsData, jsonObject); + private constructor() { + // @ts-ignore + this.uid = null; + // @ts-ignore + this.marginCcy = null; + // @ts-ignore + this.marginQty = null; + // @ts-ignore + this.marginFactor = null; + // @ts-ignore + this.accountType = null; + // @ts-ignore + this.isParent = null; } - toJson(): string { return JSON.stringify(instanceToPlain(this)); } - fromObject(jsonObject: Object): GetAccountsData { - return plainToInstance(GetAccountsData, jsonObject); + static fromJson(input: string): GetAccountsData { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountsData { + return plainToClassFromExist(new GetAccountsData(), jsonObject); } } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts index 88e94ab3..8a2ce550 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts @@ -1,17 +1,21 @@ // Code generated by Kucoin Universal SDK Generator; DO NOT EDIT. -import { Type, instanceToPlain, Exclude, plainToInstance } from 'class-transformer'; +import { Type, instanceToPlain, Exclude, plainToClassFromExist } from 'class-transformer'; import { GetAccountsData } from './model_get_accounts_data'; import { RestResponse } from '@model/common'; -import { Response } from '@internal/interfaces/response'; +import { Response } from '@internal/interfaces/serializable'; -export class GetAccountsResp implements Response { +export class GetAccountsResp implements Response { /** * */ @Type(() => GetAccountsData) - data?: Array; + data: Array; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ @@ -22,16 +26,15 @@ export class GetAccountsResp implements Response this.commonResponse = response; } - fromJson(input: string): GetAccountsResp { - const jsonObject = JSON.parse(input); - return plainToInstance(GetAccountsResp, { data: jsonObject }); - } - toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - fromObject(jsonObject: Object): GetAccountsResp { - return plainToInstance(GetAccountsResp, { data: jsonObject }); + static fromJson(input: string): GetAccountsResp { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): GetAccountsResp { + return plainToClassFromExist(new GetAccountsResp(), { data: jsonObject }); } } diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 47d9a9d9..a13d3a9e 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -1,13 +1,12 @@ import { Transport } from '@internal/interfaces/transport'; -import { Serializable } from '@internal/interfaces/serializable'; -import { Response } from '@internal/interfaces/response'; +import { Response, Serializable, StaticDeserializable } from '@internal/interfaces/serializable'; import { ClientOption } from '@model/client_option'; import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { DEFAULT_TRANSPORT_OPTION, TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from 'axios'; import axios from 'axios'; -import type { CreateAxiosDefaults, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; import 'reflect-metadata'; import axiosRetry from 'axios-retry'; import { Agent as HttpAgent } from 'http'; @@ -185,7 +184,7 @@ export class DefaultTransport implements Transport { } private processRequest( - requestObj: Serializable | null, + requestObj: Serializable | null, broker: boolean, path: string, rawpath: string, @@ -200,15 +199,15 @@ export class DefaultTransport implements Transport { let queryPath = path; if (requestAsJson) { - if (requestObj){ - reqBody = JSON.stringify(requestObj); + if (requestObj) { + reqBody = requestObj.toJson(); } - }else{ + } else { if (method === 'GET' || method === 'DELETE') { if (requestObj) { // create a new object for query parameters const queryObj = { ...requestObj }; - + // check path variables and remove from query const pathVarPattern = /{([^}]+)}/g; let match; @@ -216,17 +215,17 @@ export class DefaultTransport implements Transport { const pathVarName = match[1]; delete queryObj[pathVarName]; } - + const queryParams = this.rawQuery(queryObj); if (queryParams) { queryPath = `${path}?${queryParams}`; } } - } else if (method === "POST") { - if (requestObj){ - reqBody = JSON.stringify(requestObj); + } else if (method === 'POST') { + if (requestObj) { + reqBody = requestObj.toJson(); } - }else{ + } else { throw new Error(`Invalid method: ${method}`); } } @@ -267,10 +266,10 @@ export class DefaultTransport implements Transport { return rateLimit; } - private processResponse( + private processResponse>( response: AxiosResponse, - responseObj: Response, - ): Response { + responseCls: StaticDeserializable, + ): Response { // todo missing logic if (response.status >= 400) { console.error('[RESPONSE ERROR]', { @@ -282,25 +281,23 @@ export class DefaultTransport implements Transport { const commonResponse = RestResponse.fromJson(JSON.stringify(response.data)); commonResponse.rateLimit = this.processLimit(response.headers); - responseObj.setCommonResponse(commonResponse); - if (commonResponse.data) { - responseObj = responseObj.fromObject(commonResponse.data); - } + let responseObj = responseCls.fromObject(commonResponse.data); + responseObj.setCommonResponse(commonResponse); return responseObj; } - call( + call>( domain: string, isBroker: boolean, method: string, path: string, - requestObj: Serializable | null, - responseObj: Response, + requestObj: Serializable | null, + responseCls: StaticDeserializable, requestJson: boolean, args?: any, - ): Promise> { + ): Promise { return Promise.resolve() .then((): AxiosRequestConfig => { const endpoint = this.getEndpoint(domain); @@ -320,7 +317,7 @@ export class DefaultTransport implements Transport { return this.httpClient.request(config); }) .then((response: AxiosResponse) => { - return this.processResponse(response, responseObj); + return this.processResponse(response, responseCls); }) .catch((err: any) => { throw err; @@ -359,11 +356,11 @@ export class DefaultTransport implements Transport { if (this.httpClient.defaults.httpsAgent) { this.httpClient.defaults.httpsAgent.destroy(); } - + // Remove reference to the client (this.httpClient as any) = null; } - + return Promise.resolve(undefined); } } diff --git a/sdk/node/src/internal/interfaces/response.ts b/sdk/node/src/internal/interfaces/response.ts deleted file mode 100644 index c3d0b73a..00000000 --- a/sdk/node/src/internal/interfaces/response.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Serializable } from '@internal/interfaces/serializable'; - -/** - * Represents a response handler with a method to set common response data. - */ -export interface Response extends Serializable { - /** - * Set common response data. - */ - setCommonResponse(response: R): void; -} diff --git a/sdk/node/src/internal/interfaces/serializable.ts b/sdk/node/src/internal/interfaces/serializable.ts index 4610ff83..7f52222f 100644 --- a/sdk/node/src/internal/interfaces/serializable.ts +++ b/sdk/node/src/internal/interfaces/serializable.ts @@ -1,19 +1,34 @@ /** - * The interface for serializable objects. + * The interface for objects with static deserialization methods. */ -export interface Serializable { +export interface StaticDeserializable { /** - * Parses a JSON string and populates the object's properties. + * Parses a JSON string and returns an instance of the object. */ fromJson(input: string): T; + /** + * Populates an instance of the object based on a plain object. + */ + fromObject(jsonObject: Object): T; +} + +/** + * The interface for serializable objects. + */ +export interface Serializable { /** * Converts the current object into a JSON string. */ toJson(): string; +} +/** + * Represents a response handler with a method to set common response data. + */ +export interface Response extends Serializable { /** - * Populates the object's properties. + * Set common response data. */ - fromObject(jsonObject: Object): T; + setCommonResponse(response: R): void; } diff --git a/sdk/node/src/internal/interfaces/transport.ts b/sdk/node/src/internal/interfaces/transport.ts index e2606dab..f2cdd443 100644 --- a/sdk/node/src/internal/interfaces/transport.ts +++ b/sdk/node/src/internal/interfaces/transport.ts @@ -1,5 +1,5 @@ -import { Response } from './response'; -import { Serializable } from '@internal/interfaces/serializable'; +import { Response, Serializable, StaticDeserializable } from '@internal/interfaces/serializable'; +import { RestResponse } from '@src/model'; /** * Transport interface represents a generic transport layer. @@ -18,16 +18,16 @@ export interface Transport { * @returns A Promise that resolves to a `Response` object containing the result of the remote * call, or rejects with an error if the all fails. */ - call( + call>( domain: string, isBroker: boolean, method: string, path: string, - requestObj: Serializable | null, - responseObj: Response, + requestObj: Serializable | null, + responseObj: StaticDeserializable, requestJson: boolean, args?: any, - ): Promise>; + ): Promise; /** * Closes the transport and releases any resources. From 80fb3dc32ed2ffe84b0ce5bb561616f2d45945f2 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 20 Jan 2025 17:04:42 +0800 Subject: [PATCH 049/106] feat(nodejs): fix ws type --- .../main/resources/node-sdk/api_test.mustache | 6 +- .../resources/node-sdk/api_ws_test.mustache | 3 +- .../account/account/api_account.test.ts | 66 ++--- .../account/deposit/api_deposit.test.ts | 42 +-- .../src/generate/account/fee/api_fee.test.ts | 18 +- .../subaccount/api_sub_account.test.ts | 66 ++--- .../account/transfer/api_transfer.test.ts | 42 +-- .../account/withdrawal/api_withdrawal.test.ts | 36 +-- .../broker/apibroker/api_api_broker.test.ts | 6 +- .../broker/ndbroker/api_nd_broker.test.ts | 78 ++--- .../copytrading/futures/api_futures.test.ts | 66 ++--- .../src/generate/earn/earn/api_earn.test.ts | 54 ++-- .../fundingfees/api_funding_fees.test.ts | 18 +- .../futuresprivate/ws_futures_private.test.ts | 24 +- .../futurespublic/ws_futures_public.test.ts | 30 +- .../futures/market/api_market.test.ts | 60 ++-- .../generate/futures/order/api_order.test.ts | 108 +++---- .../futures/positions/api_positions.test.ts | 84 ++---- .../generate/margin/credit/api_credit.test.ts | 42 +-- .../generate/margin/debit/api_debit.test.ts | 36 +-- .../marginprivate/ws_margin_private.test.ts | 6 +- .../marginpublic/ws_margin_public.test.ts | 6 +- .../generate/margin/market/api_market.test.ts | 18 +- .../generate/margin/order/api_order.test.ts | 78 ++--- .../margin/risklimit/api_risk_limit.test.ts | 6 +- .../generate/spot/market/api_market.test.ts | 66 ++--- .../src/generate/spot/order/api_order.test.ts | 270 ++++++------------ .../spot/spotprivate/ws_spot_private.test.ts | 9 +- .../spot/spotpublic/ws_spot_public.test.ts | 30 +- 29 files changed, 458 insertions(+), 916 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/api_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_test.mustache index 03ec88ea..c1a00004 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_test.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_test.mustache @@ -14,8 +14,7 @@ describe('Auto Test', ()=> { */ {{#hasParams}} let data = "{{{vendorExtensions.x-request-example}}}"; - let req = new {{vendorExtensions.x-meta.methodServiceFmt}}Req(); - req = req.fromJson(data); + let req = {{vendorExtensions.x-meta.methodServiceFmt}}Req.fromJson(data); expect(Object.values(req).every(value => value === null || value === undefined)).toBe(false); console.log(req); {{/hasParams}} @@ -30,8 +29,7 @@ describe('Auto Test', ()=> { {{#hasParams}} let data = "{{{vendorExtensions.x-response-example}}}"; let commonResp = RestResponse.fromJson(data); - let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Resp(); - resp = resp.fromObject(commonResp.data) + let resp = {{vendorExtensions.x-meta.methodServiceFmt}}Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); console.log(resp); diff --git a/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache b/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache index b3d678f3..705f0b78 100644 --- a/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache +++ b/generator/plugin/src/main/resources/node-sdk/api_ws_test.mustache @@ -14,8 +14,7 @@ describe('Auto Test', ()=> { */ let data = "{{{vendorExtensions.x-response-example}}}"; let commonResp = WsMessage.fromJson(data); - let resp = new {{vendorExtensions.x-meta.methodServiceFmt}}Event(); - resp = resp.fromObject(commonResp.data); + let resp = {{vendorExtensions.x-meta.methodServiceFmt}}Event.fromObject(commonResp.data); expect(Object.values(resp).every(value => value === null || value === undefined)).toBe(false); console.log(resp); }) diff --git a/sdk/node/src/generate/account/account/api_account.test.ts b/sdk/node/src/generate/account/account/api_account.test.ts index 9e221f7e..4b2151de 100644 --- a/sdk/node/src/generate/account/account/api_account.test.ts +++ b/sdk/node/src/generate/account/account/api_account.test.ts @@ -79,8 +79,7 @@ describe('Auto Test', () => { * /api/v1/accounts */ let data = '{"currency": "USDT", "type": "main"}'; - let req = new GetSpotAccountListReq(); - req = req.fromJson(data); + let req = GetSpotAccountListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -96,8 +95,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "548674591753",\n "currency": "USDT",\n "type": "trade",\n "balance": "26.66759503",\n "available": "26.66759503",\n "holds": "0"\n },\n {\n "id": "63355cd156298d0001b66e61",\n "currency": "USDT",\n "type": "main",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotAccountListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotAccountListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -112,8 +110,7 @@ describe('Auto Test', () => { * /api/v1/accounts/{accountId} */ let data = '{"accountId": "548674591753"}'; - let req = new GetSpotAccountDetailReq(); - req = req.fromJson(data); + let req = GetSpotAccountDetailReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -129,8 +126,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"currency":"USDT","balance":"26.66759503","available":"26.66759503","holds":"0"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotAccountDetailResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotAccountDetailResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -145,8 +141,7 @@ describe('Auto Test', () => { * /api/v3/margin/accounts */ let data = '{"quoteCurrency": "USDT", "queryType": "MARGIN"}'; - let req = new GetCrossMarginAccountReq(); - req = req.fromJson(data); + let req = GetCrossMarginAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -162,8 +157,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.02",\n "totalLiabilityOfQuoteCurrency": "0",\n "debtRatio": "0",\n "status": "EFFECTIVE",\n "accounts": [\n {\n "currency": "USDT",\n "total": "0.02",\n "available": "0.02",\n "hold": "0",\n "liability": "0",\n "maxBorrowSize": "0",\n "borrowEnabled": true,\n "transferInEnabled": true\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetCrossMarginAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -179,8 +173,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "example_string_default_value", "quoteCurrency": "USDT", "queryType": "ISOLATED"}'; - let req = new GetIsolatedMarginAccountReq(); - req = req.fromJson(data); + let req = GetIsolatedMarginAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -196,8 +189,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "totalAssetOfQuoteCurrency": "0.01",\n "totalLiabilityOfQuoteCurrency": "0",\n "timestamp": 1728725465994,\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "EFFECTIVE",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0",\n "available": "0",\n "hold": "0",\n "maxBorrowSize": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "borrowEnabled": true,\n "transferInEnabled": true,\n "liability": "0",\n "total": "0.01",\n "available": "0.01",\n "hold": "0",\n "maxBorrowSize": "0"\n }\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetIsolatedMarginAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -212,8 +204,7 @@ describe('Auto Test', () => { * /api/v1/account-overview */ let data = '{"currency": "USDT"}'; - let req = new GetFuturesAccountReq(); - req = req.fromJson(data); + let req = GetFuturesAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -229,8 +220,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currency": "USDT",\n "accountEquity": 48.921913718,\n "unrealisedPNL": 1.59475,\n "marginBalance": 47.548728628,\n "positionMargin": 34.1577964733,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 14.7876172447,\n "riskRatio": 0.0090285199\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFuturesAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -246,8 +236,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetSpotLedgerReq(); - req = req.fromJson(data); + let req = GetSpotLedgerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -263,8 +252,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "265329987780896",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "balance": "0",\n "accountType": "TRADE",\n "bizType": "SUB_TRANSFER",\n "direction": "out",\n "createdAt": 1728658481484,\n "context": ""\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotLedgerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotLedgerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -280,8 +268,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetSpotHFLedgerReq(); - req = req.fromJson(data); + let req = GetSpotHFLedgerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -297,8 +284,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "254062248624417",\n "currency": "USDT",\n "amount": "1.59760080",\n "fee": "0.00159920",\n "tax": "0",\n "balance": "26.73759503",\n "accountType": "TRADE_HF",\n "bizType": "TRADE_EXCHANGE",\n "direction": "in",\n "createdAt": "1728443957539",\n "context": "{\\"symbol\\":\\"KCS-USDT\\",\\"orderId\\":\\"6705f6350dc7210007d6a36d\\",\\"tradeId\\":\\"10046097631627265\\"}"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotHFLedgerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotHFLedgerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -314,8 +300,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "direction": "in", "bizType": "TRANSFER", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetMarginHFLedgerReq(); - req = req.fromJson(data); + let req = GetMarginHFLedgerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -331,8 +316,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":[{"id":1949641706720,"currency":"USDT","amount":"0.01000000","fee":"0.00000000","balance":"0.01000000","accountType":"MARGIN_V2","bizType":"TRANSFER","direction":"in","createdAt":1728664091208,"context":"{}","tax":"0.00000000"}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarginHFLedgerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMarginHFLedgerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -348,8 +332,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "XBT", "type": "Transferin", "offset": 254062248624417, "forward": true, "maxCount": 50, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetFuturesLedgerReq(); - req = req.fromJson(data); + let req = GetFuturesLedgerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -365,8 +348,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "time": 1728665747000,\n "type": "TransferIn",\n "amount": 0.01,\n "fee": 0.0,\n "accountEquity": 14.02924938,\n "status": "Completed",\n "remark": "Transferred from High-Frequency Trading Account",\n "offset": 51360793,\n "currency": "USDT"\n },\n {\n "time": 1728648000000,\n "type": "RealisedPNL",\n "amount": 0.00630042,\n "fee": 0.0,\n "accountEquity": 20.0,\n "status": "Completed",\n "remark": "XBTUSDTM",\n "offset": 51352430,\n "currency": "USDT"\n }\n ],\n "hasMore": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesLedgerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFuturesLedgerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -396,8 +378,7 @@ describe('Auto Test', () => { * /api/v1/isolated/accounts */ let data = '{"balanceCurrency": "USDT"}'; - let req = new GetIsolatedMarginAccountListV1Req(); - req = req.fromJson(data); + let req = GetIsolatedMarginAccountListV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -413,8 +394,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "totalConversionBalance": "0.01",\n "liabilityConversionBalance": "0",\n "assets": [\n {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountListV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetIsolatedMarginAccountListV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -429,8 +409,7 @@ describe('Auto Test', () => { * /api/v1/isolated/account/{symbol} */ let data = '{"symbol": "example_string_default_value"}'; - let req = new GetIsolatedMarginAccountDetailV1Req(); - req = req.fromJson(data); + let req = GetIsolatedMarginAccountDetailV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -446,8 +425,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "BTC-USDT",\n "status": "CLEAR",\n "debtRatio": "0",\n "baseAsset": {\n "currency": "BTC",\n "totalBalance": "0",\n "holdBalance": "0",\n "availableBalance": "0",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n },\n "quoteAsset": {\n "currency": "USDT",\n "totalBalance": "0.01",\n "holdBalance": "0",\n "availableBalance": "0.01",\n "liability": "0",\n "interest": "0",\n "borrowableAmount": "0"\n }\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginAccountDetailV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetIsolatedMarginAccountDetailV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/account/deposit/api_deposit.test.ts b/sdk/node/src/generate/account/deposit/api_deposit.test.ts index 23c84bc7..718922a1 100644 --- a/sdk/node/src/generate/account/deposit/api_deposit.test.ts +++ b/sdk/node/src/generate/account/deposit/api_deposit.test.ts @@ -22,8 +22,7 @@ describe('Auto Test', () => { * /api/v3/deposit-address/create */ let data = '{"currency": "TON", "chain": "ton", "to": "trade"}'; - let req = new AddDepositAddressV3Req(); - req = req.fromJson(data); + let req = AddDepositAddressV3Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -39,8 +38,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2090821203","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"TON","chainName":"TON"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddDepositAddressV3Resp(); - resp = resp.fromObject(commonResp.data); + let resp = AddDepositAddressV3Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -56,8 +54,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "amount": "example_string_default_value", "chain": "example_string_default_value"}'; - let req = new GetDepositAddressV3Req(); - req = req.fromJson(data); + let req = GetDepositAddressV3Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -73,8 +70,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":[{"address":"TSv3L1fS7yA3SxzKD8c1qdX4nLP6rqNxYz","memo":"","chainId":"trx","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","chainName":"TRC20"},{"address":"0x551e823a3b36865e8c5dc6e6ac6cc0b00d98533e","memo":"","chainId":"kcc","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48","chainName":"KCC"},{"address":"EQCA1BI4QRZ8qYmskSRDzJmkucGodYRTZCf_b9hckjla6dZl","memo":"2085202643","chainId":"ton","to":"TRADE","expirationDate":0,"currency":"USDT","contractAddress":"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs","chainName":"TON"},{"address":"0x0a2586d5a901c8e7e68f6b0dc83bfd8bd8600ff5","memo":"","chainId":"eth","to":"MAIN","expirationDate":0,"currency":"USDT","contractAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7","chainName":"ERC20"}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV3Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositAddressV3Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -90,8 +86,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetDepositHistoryReq(); - req = req.fromJson(data); + let req = GetDepositHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -107,8 +102,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -123,8 +117,7 @@ describe('Auto Test', () => { * /api/v2/deposit-addresses */ let data = '{"currency": "BTC"}'; - let req = new GetDepositAddressV2Req(); - req = req.fromJson(data); + let req = GetDepositAddressV2Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -140,8 +133,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "address": "0x02028456*****87ede7a73d7c",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "ETH",\n "contractAddress": ""\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV2Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositAddressV2Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -156,8 +148,7 @@ describe('Auto Test', () => { * /api/v1/deposit-addresses */ let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetDepositAddressV1Req(); - req = req.fromJson(data); + let req = GetDepositAddressV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -173,8 +164,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "address": "0xea220bf61c3c2b0adc2cfa29fec3d2677745a379",\n "memo": "",\n "chain": "ERC20",\n "chainId": "eth",\n "to": "MAIN",\n "currency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositAddressV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositAddressV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -190,8 +180,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetDepositHistoryOldReq(); - req = req.fromJson(data); + let req = GetDepositHistoryOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -207,8 +196,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 0,\n "totalPage": 0,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1528536998,\n "amount": "0.03266638",\n "walletTxId": "55c643bc2c68d6f17266383ac1be9e454038864b929ae7cee0bc408cc5c869e8@12ffGWmMMD1zA1WbFm7Ho3JZ1w6NYXjpFk@234",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositHistoryOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositHistoryOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -223,8 +211,7 @@ describe('Auto Test', () => { * /api/v1/deposit-addresses */ let data = '{"currency": "ETH", "chain": "eth"}'; - let req = new AddDepositAddressV1Req(); - req = req.fromJson(data); + let req = AddDepositAddressV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -240,8 +227,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"address":"0x02028456f38e78609904e8a002c787ede7a73d7c","memo":null,"chain":"ERC20","chainId":"eth","to":"MAIN","currency":"ETH"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddDepositAddressV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = AddDepositAddressV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/account/fee/api_fee.test.ts b/sdk/node/src/generate/account/fee/api_fee.test.ts index a9e78cb1..8c7bf2e0 100644 --- a/sdk/node/src/generate/account/fee/api_fee.test.ts +++ b/sdk/node/src/generate/account/fee/api_fee.test.ts @@ -14,8 +14,7 @@ describe('Auto Test', () => { * /api/v1/base-fee */ let data = '{"currencyType": 1}'; - let req = new GetBasicFeeReq(); - req = req.fromJson(data); + let req = GetBasicFeeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -31,8 +30,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "takerFeeRate": "0.001",\n "makerFeeRate": "0.001"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetBasicFeeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetBasicFeeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -47,8 +45,7 @@ describe('Auto Test', () => { * /api/v1/trade-fees */ let data = '{"symbols": "BTC-USDT,ETH-USDT"}'; - let req = new GetSpotActualFeeReq(); - req = req.fromJson(data); + let req = GetSpotActualFeeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -64,8 +61,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":[{"symbol":"BTC-USDT","takerFeeRate":"0.001","makerFeeRate":"0.001"},{"symbol":"ETH-USDT","takerFeeRate":"0.001","makerFeeRate":"0.001"}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotActualFeeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotActualFeeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -80,8 +76,7 @@ describe('Auto Test', () => { * /api/v1/trade-fees */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetFuturesActualFeeReq(); - req = req.fromJson(data); + let req = GetFuturesActualFeeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -97,8 +92,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"symbol":"XBTUSDTM","takerFeeRate":"0.0006","makerFeeRate":"0.0002"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesActualFeeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFuturesActualFeeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts index c788490f..9fb73597 100644 --- a/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts +++ b/sdk/node/src/generate/account/subaccount/api_sub_account.test.ts @@ -33,8 +33,7 @@ describe('Auto Test', () => { */ let data = '{"password": "1234567", "remarks": "TheRemark", "subName": "Name1234567", "access": "Spot"}'; - let req = new AddSubAccountReq(); - req = req.fromJson(data); + let req = AddSubAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -50,8 +49,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -66,8 +64,7 @@ describe('Auto Test', () => { * /api/v3/sub/user/margin/enable */ let data = '{"uid": "169579801"}'; - let req = new AddSubAccountMarginPermissionReq(); - req = req.fromJson(data); + let req = AddSubAccountMarginPermissionReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -82,8 +79,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountMarginPermissionResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountMarginPermissionResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -98,8 +94,7 @@ describe('Auto Test', () => { * /api/v3/sub/user/futures/enable */ let data = '{"uid": "169579801"}'; - let req = new AddSubAccountFuturesPermissionReq(); - req = req.fromJson(data); + let req = AddSubAccountFuturesPermissionReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -114,8 +109,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountFuturesPermissionResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountFuturesPermissionResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -130,8 +124,7 @@ describe('Auto Test', () => { * /api/v2/sub/user */ let data = '{"currentPage": 1, "pageSize": 10}'; - let req = new GetSpotSubAccountsSummaryV2Req(); - req = req.fromJson(data); + let req = GetSpotSubAccountsSummaryV2Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -147,8 +140,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "userId": "63743f07e0c5230001761d08",\n "uid": 169579801,\n "subName": "testapi6",\n "status": 2,\n "type": 0,\n "access": "All",\n "createdAt": 1668562696000,\n "remarks": "remarks",\n "tradeTypes": [\n "Spot",\n "Futures",\n "Margin"\n ],\n "openedTradeTypes": [\n "Spot"\n ],\n "hostedStatus": null\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountsSummaryV2Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotSubAccountsSummaryV2Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -163,8 +155,7 @@ describe('Auto Test', () => { * /api/v1/sub-accounts/{subUserId} */ let data = '{"subUserId": "63743f07e0c5230001761d08", "includeBaseAmount": true}'; - let req = new GetSpotSubAccountDetailReq(); - req = req.fromJson(data); + let req = GetSpotSubAccountDetailReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -180,8 +171,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62384.3",\n "baseAmount": "0.00000016",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountDetailResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotSubAccountDetailResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -196,8 +186,7 @@ describe('Auto Test', () => { * /api/v2/sub-accounts */ let data = '{"currentPage": 1, "pageSize": 10}'; - let req = new GetSpotSubAccountListV2Req(); - req = req.fromJson(data); + let req = GetSpotSubAccountListV2Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -213,8 +202,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "subUserId": "63743f07e0c5230001761d08",\n "subName": "testapi6",\n "mainAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "marginAccounts": [\n {\n "currency": "USDT",\n "balance": "0.01",\n "available": "0.01",\n "holds": "0",\n "baseCurrency": "BTC",\n "baseCurrencyPrice": "62514.5",\n "baseAmount": "0.00000015",\n "tag": "DEFAULT"\n }\n ],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "670538a31037eb000115b076",\n "subName": "Name1234567",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n },\n {\n "subUserId": "66b0c0905fc1480001c14c36",\n "subName": "LTkucoin1491",\n "mainAccounts": [],\n "tradeAccounts": [],\n "marginAccounts": [],\n "tradeHFAccounts": []\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotSubAccountListV2Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotSubAccountListV2Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -229,8 +217,7 @@ describe('Auto Test', () => { * /api/v1/account-overview-all */ let data = '{"currency": "USDT"}'; - let req = new GetFuturesSubAccountListV2Req(); - req = req.fromJson(data); + let req = GetFuturesSubAccountListV2Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -246,8 +233,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "summary": {\n "accountEquityTotal": 103.899081508,\n "unrealisedPNLTotal": 38.81075,\n "marginBalanceTotal": 65.336985668,\n "positionMarginTotal": 68.9588320683,\n "orderMarginTotal": 0,\n "frozenFundsTotal": 0,\n "availableBalanceTotal": 67.2492494397,\n "currency": "USDT"\n },\n "accounts": [\n {\n "accountName": "Name1234567",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "LTkucoin1491",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "manage112233",\n "accountEquity": 0,\n "unrealisedPNL": 0,\n "marginBalance": 0,\n "positionMargin": 0,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 0,\n "currency": "USDT"\n },\n {\n "accountName": "testapi6",\n "accountEquity": 27.30545128,\n "unrealisedPNL": 22.549,\n "marginBalance": 4.75645128,\n "positionMargin": 24.1223749975,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 25.7320762825,\n "currency": "USDT"\n },\n {\n "accountName": "main",\n "accountEquity": 76.593630228,\n "unrealisedPNL": 16.26175,\n "marginBalance": 60.580534388,\n "positionMargin": 44.8364570708,\n "orderMargin": 0,\n "frozenFunds": 0,\n "availableBalance": 41.5171731572,\n "currency": "USDT"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesSubAccountListV2Resp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFuturesSubAccountListV2Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -263,8 +249,7 @@ describe('Auto Test', () => { */ let data = '{"subName": "testapi6", "passphrase": "11223344", "remark": "TheRemark", "permission": "General,Spot,Futures"}'; - let req = new AddSubAccountApiReq(); - req = req.fromJson(data); + let req = AddSubAccountApiReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -280,8 +265,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "remark": "TheRemark",\n "apiKey": "670621e3a25958000159c82f",\n "apiSecret": "46fd8974******896f005b2340",\n "apiVersion": 3,\n "passphrase": "11223344",\n "permission": "General,Futures",\n "createdAt": 1728455139000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountApiResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountApiResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -297,8 +281,7 @@ describe('Auto Test', () => { */ let data = '{"subName": "testapi6", "apiKey": "670621e3a25958000159c82f", "passphrase": "11223344", "permission": "General,Spot,Futures"}'; - let req = new ModifySubAccountApiReq(); - req = req.fromJson(data); + let req = ModifySubAccountApiReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -314,8 +297,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "subName": "testapi6",\n "apiKey": "670621e3a25958000159c82f",\n "permission": "General,Futures,Spot"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifySubAccountApiResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifySubAccountApiResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -330,8 +312,7 @@ describe('Auto Test', () => { * /api/v1/sub/api-key */ let data = '{"apiKey": "example_string_default_value", "subName": "testapi6"}'; - let req = new GetSubAccountApiListReq(); - req = req.fromJson(data); + let req = GetSubAccountApiListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -347,8 +328,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "subName": "apiSdkTest",\n "remark": "sdk_test_integration",\n "apiKey": "673eab2a955ebf000195d7e4",\n "apiVersion": 3,\n "permission": "General",\n "ipWhitelist": "10.**.1",\n "createdAt": 1732160298000,\n "uid": 215112467,\n "isMaster": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountApiListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSubAccountApiListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -364,8 +344,7 @@ describe('Auto Test', () => { */ let data = '{"apiKey": "670621e3a25958000159c82f", "subName": "testapi6", "passphrase": "11223344"}'; - let req = new DeleteSubAccountApiReq(); - req = req.fromJson(data); + let req = DeleteSubAccountApiReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -381,8 +360,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"subName":"testapi6","apiKey":"670621e3a25958000159c82f"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new DeleteSubAccountApiResp(); - resp = resp.fromObject(commonResp.data); + let resp = DeleteSubAccountApiResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/account/transfer/api_transfer.test.ts b/sdk/node/src/generate/account/transfer/api_transfer.test.ts index eb90c566..c6fa7411 100644 --- a/sdk/node/src/generate/account/transfer/api_transfer.test.ts +++ b/sdk/node/src/generate/account/transfer/api_transfer.test.ts @@ -22,8 +22,7 @@ describe('Auto Test', () => { * /api/v1/accounts/transferable */ let data = '{"currency": "BTC", "type": "MAIN", "tag": "ETH-USDT"}'; - let req = new GetTransferQuotasReq(); - req = req.fromJson(data); + let req = GetTransferQuotasReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -39,8 +38,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"currency":"USDT","balance":"10.5","available":"10.5","holds":"0","transferable":"10.5"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTransferQuotasResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTransferQuotasResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -56,8 +54,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "64ccc0f164781800010d8c09", "type": "PARENT_TO_SUB", "currency": "USDT", "amount": "0.01", "fromAccountType": "TRADE", "toUserId": "63743f07e0c5230001761d08", "toAccountType": "TRADE"}'; - let req = new FlexTransferReq(); - req = req.fromJson(data); + let req = FlexTransferReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -73,8 +70,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "6705f7248c6954000733ecac"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new FlexTransferResp(); - resp = resp.fromObject(commonResp.data); + let resp = FlexTransferResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -90,8 +86,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "direction": "OUT", "accountType": "MAIN", "subAccountType": "MAIN", "subUserId": "63743f07e0c5230001761d08"}'; - let req = new SubAccountTransferReq(); - req = req.fromJson(data); + let req = SubAccountTransferReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -106,8 +101,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"orderId":"670be6b0b1b9080007040a9b"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new SubAccountTransferResp(); - resp = resp.fromObject(commonResp.data); + let resp = SubAccountTransferResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -123,8 +117,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "64ccc0f164781800010d8c09", "currency": "USDT", "amount": "0.01", "from": "main", "to": "trade"}'; - let req = new InnerTransferReq(); - req = req.fromJson(data); + let req = InnerTransferReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -139,8 +132,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"orderId":"670beb3482a1bb0007dec644"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new InnerTransferResp(); - resp = resp.fromObject(commonResp.data); + let resp = InnerTransferResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -155,8 +147,7 @@ describe('Auto Test', () => { * /api/v3/transfer-out */ let data = '{"currency": "USDT", "amount": 0.01, "recAccountType": "MAIN"}'; - let req = new FuturesAccountTransferOutReq(); - req = req.fromJson(data); + let req = FuturesAccountTransferOutReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -172,8 +163,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "applyId": "670bf84c577f6c00017a1c48",\n "bizNo": "670bf84c577f6c00017a1c47",\n "payAccountType": "CONTRACT",\n "payTag": "DEFAULT",\n "remark": "",\n "recAccountType": "MAIN",\n "recTag": "DEFAULT",\n "recRemark": "",\n "recSystem": "KUCOIN",\n "status": "PROCESSING",\n "currency": "USDT",\n "amount": "0.01",\n "fee": "0",\n "sn": 1519769124134806,\n "reason": "",\n "createdAt": 1728837708000,\n "updatedAt": 1728837708000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new FuturesAccountTransferOutResp(); - resp = resp.fromObject(commonResp.data); + let resp = FuturesAccountTransferOutResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -188,8 +178,7 @@ describe('Auto Test', () => { * /api/v1/transfer-in */ let data = '{"currency": "USDT", "amount": 0.01, "payAccountType": "MAIN"}'; - let req = new FuturesAccountTransferInReq(); - req = req.fromJson(data); + let req = FuturesAccountTransferInReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -204,8 +193,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":null}'; let commonResp = RestResponse.fromJson(data); - let resp = new FuturesAccountTransferInResp(); - resp = resp.fromObject(commonResp.data); + let resp = FuturesAccountTransferInResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -221,8 +209,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "XBT", "type": "MAIN", "tag": ["mock_a", "mock_b"], "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetFuturesAccountTransferOutLedgerReq(); - req = req.fromJson(data); + let req = GetFuturesAccountTransferOutLedgerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -238,8 +225,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"applyId":"670bf84c577f6c00017a1c48","currency":"USDT","recRemark":"","recSystem":"KUCOIN","status":"SUCCESS","amount":"0.01","reason":"","offset":1519769124134806,"createdAt":1728837708000,"remark":""}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFuturesAccountTransferOutLedgerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFuturesAccountTransferOutLedgerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts index 6c62661e..5da114fa 100644 --- a/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts +++ b/sdk/node/src/generate/account/withdrawal/api_withdrawal.test.ts @@ -20,8 +20,7 @@ describe('Auto Test', () => { * /api/v1/withdrawals/quotas */ let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetWithdrawalQuotasReq(); - req = req.fromJson(data); + let req = GetWithdrawalQuotasReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -37,8 +36,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"currency":"BTC","limitBTCAmount":"15.79590095","usedBTCAmount":"0.00000000","quotaCurrency":"USDT","limitQuotaCurrencyAmount":"999999.00000000","usedQuotaCurrencyAmount":"0","remainAmount":"15.79590095","availableAmount":"0","withdrawMinFee":"0.0005","innerWithdrawMinFee":"0","withdrawMinSize":"0.001","isWithdrawEnabled":true,"precision":8,"chain":"BTC","reason":null,"lockedAmount":"0"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalQuotasResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetWithdrawalQuotasResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -54,8 +52,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "USDT", "toAddress": "TKFRQXSDcY****GmLrjJggwX8", "amount": 3, "withdrawType": "ADDRESS", "chain": "trx", "isInner": true, "remark": "this is Remark"}'; - let req = new WithdrawalV3Req(); - req = req.fromJson(data); + let req = WithdrawalV3Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -70,8 +67,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"withdrawalId":"670deec84d64da0007d7c946"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new WithdrawalV3Resp(); - resp = resp.fromObject(commonResp.data); + let resp = WithdrawalV3Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -86,8 +82,7 @@ describe('Auto Test', () => { * /api/v1/withdrawals/{withdrawalId} */ let data = '{"withdrawalId": "670b891f7e0f440007730692"}'; - let req = new CancelWithdrawalReq(); - req = req.fromJson(data); + let req = CancelWithdrawalReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -102,8 +97,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":null}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelWithdrawalResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelWithdrawalResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -119,8 +113,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetWithdrawalHistoryReq(); - req = req.fromJson(data); + let req = GetWithdrawalHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -136,8 +129,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 5,\n "totalPage": 1,\n "items": [\n {\n "currency": "USDT",\n "chain": "",\n "status": "SUCCESS",\n "address": "a435*****@gmail.com",\n "memo": "",\n "isInner": true,\n "amount": "1.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1728555875000,\n "updatedAt": 1728555875000,\n "remark": "",\n "arrears": false\n },\n {\n "currency": "USDT",\n "chain": "trx",\n "status": "SUCCESS",\n "address": "TSv3L1fS7******X4nLP6rqNxYz",\n "memo": "",\n "isInner": true,\n "amount": "6.00000000",\n "fee": "0.00000000",\n "walletTxId": null,\n "createdAt": 1721730920000,\n "updatedAt": 1721730920000,\n "remark": "",\n "arrears": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetWithdrawalHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -153,8 +145,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "SUCCESS", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetWithdrawalHistoryOldReq(); - req = req.fromJson(data); + let req = GetWithdrawalHistoryOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -170,8 +161,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "createAt": 1526723468,\n "amount": "0.534",\n "address": "33xW37ZSW4tQvg443Pc7NLCAs167Yc2XUV",\n "walletTxId": "aeacea864c020acf58e51606169240e96774838dcd4f7ce48acf38e3651323f4",\n "isInner": false,\n "status": "SUCCESS"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawalHistoryOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetWithdrawalHistoryOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -187,8 +177,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "USDT", "address": "TKFRQXSDc****16GmLrjJggwX8", "amount": 3, "chain": "trx", "isInner": true}'; - let req = new WithdrawalV1Req(); - req = req.fromJson(data); + let req = WithdrawalV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -203,8 +192,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"withdrawalId":"670a973cf07b3800070e216c"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new WithdrawalV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = WithdrawalV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts index c039de48..29a74144 100644 --- a/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts +++ b/sdk/node/src/generate/broker/apibroker/api_api_broker.test.ts @@ -10,8 +10,7 @@ describe('Auto Test', () => { * /api/v1/broker/api/rebase/download */ let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; - let req = new GetRebaseReq(); - req = req.fromJson(data); + let req = GetRebaseReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -27,8 +26,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRebaseResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRebaseResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts index 00d9bc00..1fe720de 100644 --- a/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts +++ b/sdk/node/src/generate/broker/ndbroker/api_nd_broker.test.ts @@ -34,8 +34,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/info */ let data = '{"begin": "20240510", "end": "20241010", "tradeType": "1"}'; - let req = new GetBrokerInfoReq(); - req = req.fromJson(data); + let req = GetBrokerInfoReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -51,8 +50,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "accountSize": 0,\n "maxAccountSize": null,\n "level": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetBrokerInfoResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetBrokerInfoResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -67,8 +65,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account */ let data = '{"accountName": "Account1"}'; - let req = new AddSubAccountReq(); - req = req.fromJson(data); + let req = AddSubAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -84,8 +81,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819381908,\n "level": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -100,8 +96,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account */ let data = '{"uid": "226383154", "currentPage": 1, "pageSize": 20}'; - let req = new GetSubAccountReq(); - req = req.fromJson(data); + let req = GetSubAccountReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -117,8 +112,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 20,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "accountName": "Account15",\n "uid": "226383154",\n "createdAt": 1729819382000,\n "level": 0\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSubAccountResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -134,8 +128,7 @@ describe('Auto Test', () => { */ let data = '{"uid": "226383154", "passphrase": "11223344", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; - let req = new AddSubAccountApiReq(); - req = req.fromJson(data); + let req = AddSubAccountApiReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -151,8 +144,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "secretKey": "d694df2******5bae05b96",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.0.0.1",\n "123.123.123.123"\n ],\n "createdAt": 1729821494000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddSubAccountApiResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddSubAccountApiResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -167,8 +159,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account/apikey */ let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; - let req = new GetSubAccountAPIReq(); - req = req.fromJson(data); + let req = GetSubAccountAPIReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -184,8 +175,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "203.**.154"\n ],\n "createdAt": 1729821494000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSubAccountAPIResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSubAccountAPIResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -201,8 +191,7 @@ describe('Auto Test', () => { */ let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1", "ipWhitelist": ["127.0.0.1", "123.123.123.123"], "permissions": ["general", "spot"], "label": "This is remarks"}'; - let req = new ModifySubAccountApiReq(); - req = req.fromJson(data); + let req = ModifySubAccountApiReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -218,8 +207,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "uid": "226383154",\n "label": "This is remarks",\n "apiKey": "671afb36cee20f00015cfaf1",\n "apiVersion": 3,\n "permissions": [\n "General",\n "Spot"\n ],\n "ipWhitelist": [\n "127.**.1",\n "123.**.123"\n ],\n "createdAt": 1729821494000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifySubAccountApiResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifySubAccountApiResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -234,8 +222,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account/apikey */ let data = '{"uid": "226383154", "apiKey": "671afb36cee20f00015cfaf1"}'; - let req = new DeleteSubAccountAPIReq(); - req = req.fromJson(data); + let req = DeleteSubAccountAPIReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -250,8 +237,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new DeleteSubAccountAPIResp(); - resp = resp.fromObject(commonResp.data); + let resp = DeleteSubAccountAPIResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -267,8 +253,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "USDT", "amount": "1", "clientOid": "e6c24d23-6bc2-401b-bf9e-55e2daddfbc1", "direction": "OUT", "accountType": "MAIN", "specialUid": "226383154", "specialAccountType": "MAIN"}'; - let req = new TransferReq(); - req = req.fromJson(data); + let req = TransferReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -284,8 +269,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new TransferResp(); - resp = resp.fromObject(commonResp.data); + let resp = TransferResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -300,8 +284,7 @@ describe('Auto Test', () => { * /api/v3/broker/nd/transfer/detail */ let data = '{"orderId": "671b4600c1e3dd000726866d"}'; - let req = new GetTransferHistoryReq(); - req = req.fromJson(data); + let req = GetTransferHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -317,8 +300,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671b4600c1e3dd000726866d",\n "currency": "USDT",\n "amount": "1",\n "fromUid": 165111215,\n "fromAccountType": "MAIN",\n "fromAccountTag": "DEFAULT",\n "toUid": 226383154,\n "toAccountType": "MAIN",\n "toAccountTag": "DEFAULT",\n "status": "SUCCESS",\n "reason": null,\n "createdAt": 1729840640000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTransferHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTransferHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -334,8 +316,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "USDT", "status": "SUCCESS", "hash": "example_string_default_value", "startTimestamp": 123456, "endTimestamp": 123456, "limit": 100}'; - let req = new GetDepositListReq(); - req = req.fromJson(data); + let req = GetDepositListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -351,8 +332,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "uid": 165111215,\n "hash": "6724e363a492800007ec602b",\n "address": "xxxxxxx@gmail.com",\n "memo": "",\n "amount": "3.0",\n "fee": "0.0",\n "currency": "USDT",\n "isInner": true,\n "walletTxId": "bbbbbbbbb",\n "status": "SUCCESS",\n "chain": "",\n "remark": "",\n "createdAt": 1730470760000,\n "updatedAt": 1730470760000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -367,8 +347,7 @@ describe('Auto Test', () => { * /api/v3/broker/nd/deposit/detail */ let data = '{"currency": "USDT", "hash": "30bb0e0b***4156c5188"}'; - let req = new GetDepositDetailReq(); - req = req.fromJson(data); + let req = GetDepositDetailReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -384,8 +363,7 @@ describe('Auto Test', () => { let data = '{\n "data" : {\n "chain" : "trx",\n "hash" : "30bb0e0b***4156c5188",\n "walletTxId" : "30bb0***610d1030f",\n "uid" : 201496341,\n "updatedAt" : 1713429174000,\n "amount" : "8.5",\n "memo" : "",\n "fee" : "0.0",\n "address" : "THLPzUrbd1o***vP7d",\n "remark" : "Deposit",\n "isInner" : false,\n "currency" : "USDT",\n "status" : "SUCCESS",\n "createdAt" : 1713429173000\n },\n "code" : "200000"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetDepositDetailResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetDepositDetailResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -400,8 +378,7 @@ describe('Auto Test', () => { * /api/v3/broker/nd/withdraw/detail */ let data = '{"withdrawalId": "66617a2***3c9a"}'; - let req = new GetWithdrawDetailReq(); - req = req.fromJson(data); + let req = GetWithdrawDetailReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -417,8 +394,7 @@ describe('Auto Test', () => { let data = '{\n "data": {\n "id": "66617a2***3c9a",\n "chain": "ton",\n "walletTxId": "AJ***eRI=",\n "uid": 157267400,\n "amount": "1.00000000",\n "memo": "7025734",\n "fee": "0.00000000",\n "address": "EQDn***dKbGzr",\n "remark": "",\n "isInner": false,\n "currency": "USDT",\n "status": "SUCCESS",\n "createdAt": 1717664288000,\n "updatedAt": 1717664375000\n },\n "code": "200000"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetWithdrawDetailResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetWithdrawDetailResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -433,8 +409,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/rebase/download */ let data = '{"begin": "20240610", "end": "20241010", "tradeType": "1"}'; - let req = new GetRebaseReq(); - req = req.fromJson(data); + let req = GetRebaseReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -450,8 +425,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "url": "https://kc-v2-promotion.s3.ap-northeast-1.amazonaws.com/broker/671aec522593f600019766d0_file.csv?X-Amz-Security-Token=IQo*********2cd90f14efb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRebaseResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRebaseResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/copytrading/futures/api_futures.test.ts b/sdk/node/src/generate/copytrading/futures/api_futures.test.ts index 367bff8f..9da105d9 100644 --- a/sdk/node/src/generate/copytrading/futures/api_futures.test.ts +++ b/sdk/node/src/generate/copytrading/futures/api_futures.test.ts @@ -31,8 +31,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderReq(); - req = req.fromJson(data); + let req = AddOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -48,8 +47,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "263485113055133696",\n "clientOid": "5c52e11203aa677f331e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -65,8 +63,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderTestReq(); - req = req.fromJson(data); + let req = AddOrderTestReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -82,8 +79,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -99,8 +95,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; - let req = new AddTPSLOrderReq(); - req = req.fromJson(data); + let req = AddTPSLOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -116,8 +111,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddTPSLOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddTPSLOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -132,8 +126,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/orders */ let data = '{"orderId": "263485113055133696"}'; - let req = new CancelOrderByIdReq(); - req = req.fromJson(data); + let req = CancelOrderByIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -149,8 +142,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "263485113055133696"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -165,8 +157,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/orders/client-order */ let data = '{"symbol": "XBTUSDTM", "clientOid": "5c52e11203aa677f331e493fb"}'; - let req = new CancelOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -182,8 +173,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f331e4913fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -199,8 +189,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; - let req = new GetMaxOpenSizeReq(); - req = req.fromJson(data); + let req = GetMaxOpenSizeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -216,8 +205,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": "8",\n "maxSellOpenSize": "5"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxOpenSizeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMaxOpenSizeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -232,8 +220,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/position/margin/max-withdraw-margin */ let data = '{"symbol": "example_string_default_value"}'; - let req = new GetMaxWithdrawMarginReq(); - req = req.fromJson(data); + let req = GetMaxWithdrawMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -248,8 +235,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxWithdrawMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMaxWithdrawMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -264,8 +250,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/position/margin/deposit-margin */ let data = '{"symbol": "XBTUSDTM", "margin": 3, "bizNo": "112233"}'; - let req = new AddIsolatedMarginReq(); - req = req.fromJson(data); + let req = AddIsolatedMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -281,8 +266,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "400000000000974886",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "maintMarginReq": "0.004",\n "riskLimit": 100000,\n "realLeverage": "1.83",\n "crossMode": false,\n "marginMode": "",\n "positionSide": "",\n "leverage": "1.83",\n "delevPercentage": 0.2,\n "openingTimestamp": 1736932881164,\n "currentTimestamp": 1736933530230,\n "currentQty": 1,\n "currentCost": "97.302",\n "currentComm": "0.0583812",\n "unrealisedCost": "97.302",\n "realisedGrossCost": "0.0000000000",\n "realisedCost": "0.0583812000",\n "isOpen": true,\n "markPrice": "96939.98",\n "markValue": "96.9399800000",\n "posCost": "97.302",\n "posCross": "20.9874",\n "posInit": "32.4339999967",\n "posComm": "0.0904415999",\n "posLoss": "0",\n "posMargin": "53.5118415966",\n "posMaint": "0.4796495999",\n "maintMargin": "53.1498215966",\n "realisedGrossPnl": "0.0000000000",\n "realisedPnl": "-0.0583812000",\n "unrealisedPnl": "-0.3620200000",\n "unrealisedPnlPcnt": "-0.0037",\n "unrealisedRoePcnt": "-0.0112",\n "avgEntryPrice": "97302.00",\n "liquidationPrice": "44269.81",\n "bankruptPrice": "43880.61",\n "settleCurrency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddIsolatedMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddIsolatedMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -297,8 +281,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/position/margin/withdraw-margin */ let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; - let req = new RemoveIsolatedMarginReq(); - req = req.fromJson(data); + let req = RemoveIsolatedMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -313,8 +296,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": "0.1"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new RemoveIsolatedMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = RemoveIsolatedMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -329,8 +311,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/position/risk-limit-level/change */ let data = '{"symbol": "XBTUSDTM", "level": 1}'; - let req = new ModifyIsolatedMarginRiskLimtReq(); - req = req.fromJson(data); + let req = ModifyIsolatedMarginRiskLimtReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -345,8 +326,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyIsolatedMarginRiskLimtResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyIsolatedMarginRiskLimtResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -361,8 +341,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/position/margin/auto-deposit-status */ let data = '{"symbol": "XBTUSDTM", "status": true}'; - let req = new ModifyAutoDepositStatusReq(); - req = req.fromJson(data); + let req = ModifyAutoDepositStatusReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -377,8 +356,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyAutoDepositStatusResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyAutoDepositStatusResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/earn/earn/api_earn.test.ts b/sdk/node/src/generate/earn/earn/api_earn.test.ts index 05dfe04b..732b2480 100644 --- a/sdk/node/src/generate/earn/earn/api_earn.test.ts +++ b/sdk/node/src/generate/earn/earn/api_earn.test.ts @@ -26,8 +26,7 @@ describe('Auto Test', () => { * /api/v1/earn/orders */ let data = '{"productId": "2611", "amount": "1", "accountType": "TRADE"}'; - let req = new PurchaseReq(); - req = req.fromJson(data); + let req = PurchaseReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -43,8 +42,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "2767291",\n "orderTxId": "6603694"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new PurchaseResp(); - resp = resp.fromObject(commonResp.data); + let resp = PurchaseResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -59,8 +57,7 @@ describe('Auto Test', () => { * /api/v1/earn/redeem-preview */ let data = '{"orderId": "2767291", "fromAccountType": "MAIN"}'; - let req = new GetRedeemPreviewReq(); - req = req.fromJson(data); + let req = GetRedeemPreviewReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -76,8 +73,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currency": "KCS",\n "redeemAmount": "1",\n "penaltyInterestAmount": "0",\n "redeemPeriod": 3,\n "deliverTime": 1729518951000,\n "manualRedeemable": true,\n "redeemAll": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRedeemPreviewResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRedeemPreviewResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -93,8 +89,7 @@ describe('Auto Test', () => { */ let data = '{"orderId": "2767291", "amount": "example_string_default_value", "fromAccountType": "MAIN", "confirmPunishRedeem": "1"}'; - let req = new RedeemReq(); - req = req.fromJson(data); + let req = RedeemReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -110,8 +105,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderTxId": "6603700",\n "deliverTime": 1729517805000,\n "status": "PENDING",\n "amount": "1"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new RedeemResp(); - resp = resp.fromObject(commonResp.data); + let resp = RedeemResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -126,8 +120,7 @@ describe('Auto Test', () => { * /api/v1/earn/saving/products */ let data = '{"currency": "BTC"}'; - let req = new GetSavingsProductsReq(); - req = req.fromJson(data); + let req = GetSavingsProductsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -143,8 +136,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "2172",\n "currency": "BTC",\n "category": "DEMAND",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "480",\n "productRemainAmount": "132.36153083",\n "userUpperLimit": "20",\n "userLowerLimit": "0.01",\n "redeemPeriod": 0,\n "lockStartTime": 1644807600000,\n "lockEndTime": null,\n "applyStartTime": 1644807600000,\n "applyEndTime": null,\n "returnRate": "0.00047208",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSavingsProductsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSavingsProductsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -159,8 +151,7 @@ describe('Auto Test', () => { * /api/v1/earn/promotion/products */ let data = '{"currency": "BTC"}'; - let req = new GetPromotionProductsReq(); - req = req.fromJson(data); + let req = GetPromotionProductsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -176,8 +167,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "2685",\n "currency": "BTC",\n "category": "ACTIVITY",\n "type": "TIME",\n "precision": 8,\n "productUpperLimit": "50",\n "userUpperLimit": "1",\n "userLowerLimit": "0.001",\n "redeemPeriod": 0,\n "lockStartTime": 1702371601000,\n "lockEndTime": 1729858405000,\n "applyStartTime": 1702371600000,\n "applyEndTime": null,\n "returnRate": "0.03",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "49.78203998",\n "status": "ONGOING",\n "redeemType": "TRANS_DEMAND",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729253605000,\n "duration": 7,\n "newUserOnly": 1\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPromotionProductsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPromotionProductsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -193,8 +183,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "KCS", "productId": "example_string_default_value", "productCategory": "DEMAND", "currentPage": 1, "pageSize": 10}'; - let req = new GetAccountHoldingReq(); - req = req.fromJson(data); + let req = GetAccountHoldingReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -210,8 +199,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "totalNum": 1,\n "totalPage": 1,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "orderId": "2767291",\n "productId": "2611",\n "productCategory": "KCS_STAKING",\n "productType": "DEMAND",\n "currency": "KCS",\n "incomeCurrency": "KCS",\n "returnRate": "0.03471727",\n "holdAmount": "1",\n "redeemedAmount": "0",\n "redeemingAmount": "1",\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "purchaseTime": 1729257513000,\n "redeemPeriod": 3,\n "status": "REDEEMING",\n "earlyRedeemSupported": 0\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAccountHoldingResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetAccountHoldingResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -226,8 +214,7 @@ describe('Auto Test', () => { * /api/v1/earn/staking/products */ let data = '{"currency": "BTC"}'; - let req = new GetStakingProductsReq(); - req = req.fromJson(data); + let req = GetStakingProductsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -243,8 +230,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "2535",\n "currency": "STX",\n "category": "STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "1000000",\n "userUpperLimit": "10000",\n "userLowerLimit": "1",\n "redeemPeriod": 14,\n "lockStartTime": 1688614514000,\n "lockEndTime": null,\n "applyStartTime": 1688614512000,\n "applyEndTime": null,\n "returnRate": "0.045",\n "incomeCurrency": "BTC",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "254032.90178701",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStakingProductsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetStakingProductsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -259,8 +245,7 @@ describe('Auto Test', () => { * /api/v1/earn/kcs-staking/products */ let data = '{"currency": "BTC"}'; - let req = new GetKcsStakingProductsReq(); - req = req.fromJson(data); + let req = GetKcsStakingProductsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -276,8 +261,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "2611",\n "currency": "KCS",\n "category": "KCS_STAKING",\n "type": "DEMAND",\n "precision": 8,\n "productUpperLimit": "100000000",\n "userUpperLimit": "100000000",\n "userLowerLimit": "1",\n "redeemPeriod": 3,\n "lockStartTime": 1701252000000,\n "lockEndTime": null,\n "applyStartTime": 1701252000000,\n "applyEndTime": null,\n "returnRate": "0.03471727",\n "incomeCurrency": "KCS",\n "earlyRedeemSupported": 0,\n "productRemainAmount": "58065850.54998251",\n "status": "ONGOING",\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "interestDate": 1729267200000,\n "duration": 0,\n "newUserOnly": 0\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetKcsStakingProductsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetKcsStakingProductsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -292,8 +276,7 @@ describe('Auto Test', () => { * /api/v1/earn/eth-staking/products */ let data = '{"currency": "BTC"}'; - let req = new GetETHStakingProductsReq(); - req = req.fromJson(data); + let req = GetETHStakingProductsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -309,8 +292,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "ETH2",\n "category": "ETH2",\n "type": "DEMAND",\n "precision": 8,\n "currency": "ETH",\n "incomeCurrency": "ETH2",\n "returnRate": "0.028",\n "userLowerLimit": "0.01",\n "userUpperLimit": "8557.3597075",\n "productUpperLimit": "8557.3597075",\n "productRemainAmount": "8557.3597075",\n "redeemPeriod": 5,\n "redeemType": "MANUAL",\n "incomeReleaseType": "DAILY",\n "applyStartTime": 1729255485000,\n "applyEndTime": null,\n "lockStartTime": 1729255485000,\n "lockEndTime": null,\n "interestDate": 1729267200000,\n "newUserOnly": 0,\n "earlyRedeemSupported": 0,\n "duration": 0,\n "status": "ONGOING"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetETHStakingProductsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetETHStakingProductsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts index b55410ef..725b165e 100644 --- a/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts +++ b/sdk/node/src/generate/futures/fundingfees/api_funding_fees.test.ts @@ -14,8 +14,7 @@ describe('Auto Test', () => { * /api/v1/funding-rate/{symbol}/current */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetCurrentFundingRateReq(); - req = req.fromJson(data); + let req = GetCurrentFundingRateReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -31,8 +30,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": ".XBTUSDTMFPI8H",\n "granularity": 28800000,\n "timePoint": 1731441600000,\n "value": 6.41E-4,\n "predictedValue": 5.2E-5,\n "fundingRateCap": 0.003,\n "fundingRateFloor": -0.003\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCurrentFundingRateResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetCurrentFundingRateResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -47,8 +45,7 @@ describe('Auto Test', () => { * /api/v1/contract/funding-rates */ let data = '{"symbol": "XBTUSDTM", "from": 1700310700000, "to": 1702310700000}'; - let req = new GetPublicFundingHistoryReq(); - req = req.fromJson(data); + let req = GetPublicFundingHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -64,8 +61,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.1E-4,\n "timepoint": 1702296000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.47E-4,\n "timepoint": 1702267200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.52E-4,\n "timepoint": 1702238400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.13E-4,\n "timepoint": 1702209600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.21E-4,\n "timepoint": 1702180800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.06E-4,\n "timepoint": 1702152000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.68E-4,\n "timepoint": 1702123200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.82E-4,\n "timepoint": 1702094400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.0E-4,\n "timepoint": 1702065600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.46E-4,\n "timepoint": 1702036800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.97E-4,\n "timepoint": 1702008000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 5.76E-4,\n "timepoint": 1701979200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.22E-4,\n "timepoint": 1701950400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.92E-4,\n "timepoint": 1701921600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.1E-4,\n "timepoint": 1701892800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.48E-4,\n "timepoint": 1701864000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.68E-4,\n "timepoint": 1701835200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.51E-4,\n "timepoint": 1701806400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.44E-4,\n "timepoint": 1701777600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.25E-4,\n "timepoint": 1701748800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": -8.2E-5,\n "timepoint": 1701720000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.64E-4,\n "timepoint": 1701691200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 4.14E-4,\n "timepoint": 1701662400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.44E-4,\n "timepoint": 1701633600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.99E-4,\n "timepoint": 1701604800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.79E-4,\n "timepoint": 1701576000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 8.7E-5,\n "timepoint": 1701547200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.6E-5,\n "timepoint": 1701518400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": -3.7E-5,\n "timepoint": 1701489600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.5E-5,\n "timepoint": 1701460800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.8E-5,\n "timepoint": 1701432000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.2E-5,\n "timepoint": 1701403200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.45E-4,\n "timepoint": 1701374400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.41E-4,\n "timepoint": 1701345600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 9.4E-5,\n "timepoint": 1701316800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.08E-4,\n "timepoint": 1701288000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.6E-5,\n "timepoint": 1701259200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.0E-5,\n "timepoint": 1701230400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.0E-5,\n "timepoint": 1701201600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.16E-4,\n "timepoint": 1701172800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.04E-4,\n "timepoint": 1701144000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.3E-4,\n "timepoint": 1701115200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.2E-5,\n "timepoint": 1701086400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.33E-4,\n "timepoint": 1701057600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 8.0E-5,\n "timepoint": 1701028800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.11E-4,\n "timepoint": 1701000000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.4E-5,\n "timepoint": 1700971200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.01E-4,\n "timepoint": 1700942400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.9E-5,\n "timepoint": 1700913600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.1E-5,\n "timepoint": 1700884800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.0E-6,\n "timepoint": 1700856000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.03E-4,\n "timepoint": 1700827200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 3.0E-6,\n "timepoint": 1700798400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 6.7E-5,\n "timepoint": 1700769600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.47E-4,\n "timepoint": 1700740800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.8E-5,\n "timepoint": 1700712000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.39E-4,\n "timepoint": 1700683200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 7.5E-5,\n "timepoint": 1700654400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.11E-4,\n "timepoint": 1700625600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 9.8E-5,\n "timepoint": 1700596800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.18E-4,\n "timepoint": 1700568000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.16E-4,\n "timepoint": 1700539200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.6E-4,\n "timepoint": 1700510400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.92E-4,\n "timepoint": 1700481600000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.13E-4,\n "timepoint": 1700452800000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.47E-4,\n "timepoint": 1700424000000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.3E-4,\n "timepoint": 1700395200000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 2.63E-4,\n "timepoint": 1700366400000\n },\n {\n "symbol": "XBTUSDTM",\n "fundingRate": 1.32E-4,\n "timepoint": 1700337600000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPublicFundingHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPublicFundingHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -81,8 +77,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "XBTUSDTM", "from": 1700310700000, "to": 1702310700000, "reverse": true, "offset": 123456, "forward": true, "maxCount": 123456}'; - let req = new GetPrivateFundingHistoryReq(); - req = req.fromJson(data); + let req = GetPrivateFundingHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -98,8 +93,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "id": 1472387374042586,\n "symbol": "XBTUSDTM",\n "timePoint": 1731470400000,\n "fundingRate": 6.41E-4,\n "markPrice": 87139.92,\n "positionQty": 1,\n "positionCost": 87.13992,\n "funding": -0.05585669,\n "settleCurrency": "USDT",\n "context": "{\\"marginMode\\": \\"ISOLATED\\", \\"positionSide\\": \\"BOTH\\"}",\n "marginMode": "ISOLATED"\n }\n ],\n "hasMore": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPrivateFundingHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPrivateFundingHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts b/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts index 640feb70..85407ec0 100644 --- a/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts +++ b/sdk/node/src/generate/futures/futuresprivate/ws_futures_private.test.ts @@ -18,8 +18,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/tradeOrders:XBTUSDTM","type":"message","subject":"symbolOrderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"symbol":"XBTUSDTM","side":"buy","canceledSize":"0","orderId":"247899236673269761","liquidity":"maker","marginMode":"ISOLATED","type":"open","orderTime":1731916985768138917,"size":"1","filledSize":"0","price":"91670","remainSize":"1","status":"open","ts":1731916985789000000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new AllOrderEvent(); - resp = resp.fromObject(commonResp.data); + let resp = AllOrderEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -34,8 +33,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/position:XBTUSDTM","type":"message","data":{"symbol":"XBTUSDTM","maintMarginReq":0.005,"riskLimit":500000,"realLeverage":4.9685590767,"crossMode":false,"delevPercentage":0.10,"openingTimestamp":1731916913097,"autoDeposit":true,"currentTimestamp":1731924561514,"currentQty":1,"currentCost":91.5306,"currentComm":0.09179284,"unrealisedCost":91.6945,"realisedCost":-0.07210716,"isOpen":true,"markPrice":91839.79,"markValue":91.83979,"posCost":91.6945,"posCross":0,"posInit":18.3389,"posComm":0.06602004,"posLoss":0,"posMargin":18.40492004,"posFunding":0,"posMaint":0.5634627025,"maintMargin":18.55021004,"avgEntryPrice":91694.5,"liquidationPrice":73853.0426625,"bankruptPrice":73355.6,"settleCurrency":"USDT","changeReason":"positionChange","riskLimitLevel":2,"realisedGrossCost":-0.1639,"realisedGrossPnl":0.1639,"realisedPnl":0.07210716,"unrealisedPnl":0.14529,"unrealisedPnlPcnt":0.0016,"unrealisedRoePcnt":0.0079,"leverage":4.9685590767,"marginMode":"ISOLATED","positionSide":"BOTH"},"subject":"position.change","userId":"633559791e1cbc0001f319bc","channelType":"private"}'; let commonResp = WsMessage.fromJson(data); - let resp = new AllPositionEvent(); - resp = resp.fromObject(commonResp.data); + let resp = AllPositionEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -50,8 +48,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractAccount/wallet","type":"message","subject":"walletBalance.change","id":"673b0bb925b4bc0001fadfef","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"crossPosMargin":"0","isolatedOrderMargin":"18.1188","holdBalance":"0","equity":"81.273621258","version":"1337","availableBalance":"26.144281178","isolatedPosMargin":"36.80984008","walletBalance":"81.072921258","isolatedFundingFeeMargin":"0","crossUnPnl":"0","totalCrossMargin":"26.144281178","currency":"USDT","isolatedUnPnl":"0.2007","crossOrderMargin":"0","timestamp":"1731916996764"}}'; let commonResp = WsMessage.fromJson(data); - let resp = new BalanceEvent(); - resp = resp.fromObject(commonResp.data); + let resp = BalanceEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -66,8 +63,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/crossLeverage","type":"message","data":{"ETHUSDTM":{"leverage":"8"}},"subject":"user.config","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; let commonResp = WsMessage.fromJson(data); - let resp = new CrossLeverageEvent(); - resp = resp.fromObject(commonResp.data); + let resp = CrossLeverageEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -82,8 +78,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/marginMode","type":"message","data":{"ETHUSDTM":"ISOLATED"},"subject":"user.config","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; let commonResp = WsMessage.fromJson(data); - let resp = new MarginModeEvent(); - resp = resp.fromObject(commonResp.data); + let resp = MarginModeEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -98,8 +93,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/tradeOrders:XBTUSDTM","type":"message","subject":"symbolOrderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"symbol":"XBTUSDTM","side":"buy","canceledSize":"0","orderId":"247899236673269761","liquidity":"maker","marginMode":"ISOLATED","type":"open","orderTime":1731916985768138917,"size":"1","filledSize":"0","price":"91670","remainSize":"1","status":"open","ts":1731916985789000000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderEvent(); - resp = resp.fromObject(commonResp.data); + let resp = OrderEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -114,8 +108,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/position:XBTUSDTM","type":"message","data":{"symbol":"XBTUSDTM","maintMarginReq":0.005,"riskLimit":500000,"realLeverage":4.9685590767,"crossMode":false,"delevPercentage":0.10,"openingTimestamp":1731916913097,"autoDeposit":true,"currentTimestamp":1731924561514,"currentQty":1,"currentCost":91.5306,"currentComm":0.09179284,"unrealisedCost":91.6945,"realisedCost":-0.07210716,"isOpen":true,"markPrice":91839.79,"markValue":91.83979,"posCost":91.6945,"posCross":0,"posInit":18.3389,"posComm":0.06602004,"posLoss":0,"posMargin":18.40492004,"posFunding":0,"posMaint":0.5634627025,"maintMargin":18.55021004,"avgEntryPrice":91694.5,"liquidationPrice":73853.0426625,"bankruptPrice":73355.6,"settleCurrency":"USDT","changeReason":"positionChange","riskLimitLevel":2,"realisedGrossCost":-0.1639,"realisedGrossPnl":0.1639,"realisedPnl":0.07210716,"unrealisedPnl":0.14529,"unrealisedPnlPcnt":0.0016,"unrealisedRoePcnt":0.0079,"leverage":4.9685590767,"marginMode":"ISOLATED","positionSide":"BOTH"},"subject":"position.change","userId":"633559791e1cbc0001f319bc","channelType":"private"}'; let commonResp = WsMessage.fromJson(data); - let resp = new PositionEvent(); - resp = resp.fromObject(commonResp.data); + let resp = PositionEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -130,8 +123,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/advancedOrders","type":"message","data":{"createdAt":1730194206837,"marginMode":"ISOLATED","orderId":"240673378116083712","orderPrice":"0.1","orderType":"stop","side":"buy","size":1,"stop":"down","stopPrice":"1000","stopPriceType":"TP","symbol":"XBTUSDTM","ts":1730194206843133000,"type":"open"},"subject":"stopOrder","id":"6720ab1ea52a9b0001734392","userId":"66f12e8befb04d0001882b49","channelType":"private"}'; let commonResp = WsMessage.fromJson(data); - let resp = new StopOrdersEvent(); - resp = resp.fromObject(commonResp.data); + let resp = StopOrdersEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); diff --git a/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts b/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts index fb5687c9..55aaca0b 100644 --- a/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts +++ b/sdk/node/src/generate/futures/futurespublic/ws_futures_public.test.ts @@ -20,8 +20,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/announcement","subject":"funding.begin","data":{"symbol":"XBTUSDTM","fundingTime":1551770400000,"fundingRate":-0.002966,"timestamp":1551770400000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new AnnouncementEvent(); - resp = resp.fromObject(commonResp.data); + let resp = AnnouncementEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -36,8 +35,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/execution:XBTUSDTM","type":"message","subject":"match","sn":1794100537695,"data":{"symbol":"XBTUSDTM","sequence":1794100537695,"side":"buy","size":2,"price":"90503.9","takerOrderId":"247822202957807616","makerOrderId":"247822167163555840","tradeId":"1794100537695","ts":1731898619520000000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new ExecutionEvent(); - resp = resp.fromObject(commonResp.data); + let resp = ExecutionEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -52,8 +50,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contract/instrument:XBTUSDTM","type":"message","subject":"mark.index.price","data":{"markPrice":90445.02,"indexPrice":90445.02,"granularity":1000,"timestamp":1731899129000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new InstrumentEvent(); - resp = resp.fromObject(commonResp.data); + let resp = InstrumentEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -68,8 +65,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/limitCandle:XBTUSDTM_1min","type":"message","data":{"symbol":"XBTUSDTM","candles":["1731898200","90638.6","90638.6","90638.6","90638.6","21.0","21"],"time":1731898208357},"subject":"candle.stick"}'; let commonResp = WsMessage.fromJson(data); - let resp = new KlinesEvent(); - resp = resp.fromObject(commonResp.data); + let resp = KlinesEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -84,8 +80,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/level2:XBTUSDTM","type":"message","subject":"level2","sn":1709400450243,"data":{"sequence":1709400450243,"change":"90631.2,sell,2","timestamp":1731897467182}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookIncrementEvent(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookIncrementEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -100,8 +95,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/level2Depth50:XBTUSDTM","type":"message","subject":"level2","sn":1731680249700,"data":{"bids":[["89778.6",1534],["89778.2",54]],"sequence":1709294490099,"timestamp":1731680249700,"ts":1731680249700,"asks":[["89778.7",854],["89779.2",4]]}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookLevel50Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookLevel50Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -116,8 +110,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/level2Depth5:XBTUSDTM","type":"message","subject":"level2","sn":1731680019100,"data":{"bids":[["89720.9",513],["89720.8",12],["89718.6",113],["89718.4",19],["89718.3",7]],"sequence":1709294294670,"timestamp":1731680019100,"ts":1731680019100,"asks":[["89721",906],["89721.1",203],["89721.4",113],["89723.2",113],["89725.4",113]]}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookLevel5Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookLevel5Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -132,8 +125,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/snapshot:XBTUSDTM","type":"message","subject":"snapshot.24h","id":"673ab3fff4088b0001664f41","data":{"highPrice":91512.8,"lastPrice":90326.7,"lowPrice":88747.8,"price24HoursBefore":89880.4,"priceChg":446.3,"priceChgPct":0.0049,"symbol":"XBTUSDTM","ts":1731900415023929239,"turnover":526928331.0482177734,"volume":5834.46}}'; let commonResp = WsMessage.fromJson(data); - let resp = new SymbolSnapshotEvent(); - resp = resp.fromObject(commonResp.data); + let resp = SymbolSnapshotEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -148,8 +140,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/ticker:XBTUSDTM","type":"message","subject":"ticker","sn":1793133570931,"data":{"symbol":"XBTUSDTM","sequence":1793133570931,"side":"sell","size":1,"price":"90147.7","bestBidSize":2186,"bestBidPrice":"90147.7","bestAskPrice":"90147.8","tradeId":"1793133570931","bestAskSize":275,"ts":1731679215637000000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new TickerV1Event(); - resp = resp.fromObject(commonResp.data); + let resp = TickerV1Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -164,8 +155,7 @@ describe('Auto Test', () => { let data = '{"topic":"/contractMarket/tickerV2:XBTUSDTM","type":"message","subject":"tickerV2","sn":1709284589209,"data":{"symbol":"XBTUSDTM","sequence":1709284589209,"bestBidSize":713,"bestBidPrice":"88987.4","bestAskPrice":"88987.5","bestAskSize":1037,"ts":1731665526461000000}}'; let commonResp = WsMessage.fromJson(data); - let resp = new TickerV2Event(); - resp = resp.fromObject(commonResp.data); + let resp = TickerV2Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); diff --git a/sdk/node/src/generate/futures/market/api_market.test.ts b/sdk/node/src/generate/futures/market/api_market.test.ts index e0613a39..0b29de43 100644 --- a/sdk/node/src/generate/futures/market/api_market.test.ts +++ b/sdk/node/src/generate/futures/market/api_market.test.ts @@ -35,8 +35,7 @@ describe('Auto Test', () => { * /api/v1/contracts/{symbol} */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetSymbolReq(); - req = req.fromJson(data); + let req = GetSymbolReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -52,8 +51,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDM",\n "rootSymbol": "XBT",\n "type": "FFWCSX",\n "firstOpenDate": 1552638575000,\n "expireDate": null,\n "settleDate": null,\n "baseCurrency": "XBT",\n "quoteCurrency": "USD",\n "settleCurrency": "XBT",\n "maxOrderQty": 10000000,\n "maxPrice": 1000000.0,\n "lotSize": 1,\n "tickSize": 0.1,\n "indexPriceTickSize": 0.1,\n "multiplier": -1.0,\n "initialMargin": 0.014,\n "maintainMargin": 0.007,\n "maxRiskLimit": 1,\n "minRiskLimit": 1,\n "riskStep": 0,\n "makerFeeRate": 2.0E-4,\n "takerFeeRate": 6.0E-4,\n "takerFixFee": 0.0,\n "makerFixFee": 0.0,\n "settlementFee": null,\n "isDeleverage": true,\n "isQuanto": false,\n "isInverse": true,\n "markMethod": "FairPrice",\n "fairMethod": "FundingRate",\n "fundingBaseSymbol": ".XBTINT8H",\n "fundingQuoteSymbol": ".USDINT8H",\n "fundingRateSymbol": ".XBTUSDMFPI8H",\n "indexSymbol": ".BXBT",\n "settlementSymbol": null,\n "status": "Open",\n "fundingFeeRate": 1.75E-4,\n "predictedFundingFeeRate": 1.76E-4,\n "fundingRateGranularity": 28800000,\n "openInterest": "61725904",\n "turnoverOf24h": 209.56303473,\n "volumeOf24h": 1.4354731E7,\n "markPrice": 68336.7,\n "indexPrice": 68335.29,\n "lastTradePrice": 68349.3,\n "nextFundingRateTime": 17402942,\n "maxLeverage": 75,\n "sourceExchanges": [\n "kraken",\n "bitstamp",\n "crypto"\n ],\n "premiumsSymbol1M": ".XBTUSDMPI",\n "premiumsSymbol8H": ".XBTUSDMPI8H",\n "fundingBaseSymbol1M": ".XBTINT",\n "fundingQuoteSymbol1M": ".USDINT",\n "lowPrice": 67436.7,\n "highPrice": 69471.8,\n "priceChgPct": 0.0097,\n "priceChg": 658.7,\n "k": 2645000.0,\n "m": 1640000.0,\n "f": 1.3,\n "mmrLimit": 0.3,\n "mmrLevConstant": 75.0,\n "supportCross": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSymbolResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -83,8 +81,7 @@ describe('Auto Test', () => { * /api/v1/ticker */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetTickerReq(); - req = req.fromJson(data); + let req = GetTickerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -100,8 +97,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"sequence":1697895100310,"symbol":"XBTUSDM","side":"sell","size":2936,"tradeId":"1697901180000","price":"67158.4","bestBidPrice":"67169.6","bestBidSize":32345,"bestAskPrice":"67169.7","bestAskSize":7251,"ts":1729163001780000000}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTickerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTickerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -131,8 +127,7 @@ describe('Auto Test', () => { * /api/v1/level2/snapshot */ let data = '{"symbol": "XBTUSDM"}'; - let req = new GetFullOrderBookReq(); - req = req.fromJson(data); + let req = GetFullOrderBookReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -148,8 +143,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFullOrderBookResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFullOrderBookResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -164,8 +158,7 @@ describe('Auto Test', () => { * /api/v1/level2/depth{size} */ let data = '{"symbol": "XBTUSDM", "size": "20"}'; - let req = new GetPartOrderBookReq(); - req = req.fromJson(data); + let req = GetPartOrderBookReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -181,8 +174,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "sequence": 1697895963339,\n "symbol": "XBTUSDM",\n "bids": [\n [\n 66968,\n 2\n ],\n [\n 66964.8,\n 25596\n ]\n ],\n "asks": [\n [\n 66968.1,\n 13501\n ],\n [\n 66968.7,\n 2032\n ]\n ],\n "ts": 1729168101216000000\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPartOrderBookResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPartOrderBookResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -197,8 +189,7 @@ describe('Auto Test', () => { * /api/v1/trade/history */ let data = '{"symbol": "XBTUSDM"}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); + let req = GetTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -214,8 +205,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "sequence": 1697915257909,\n "contractId": 1,\n "tradeId": "1697915257909",\n "makerOrderId": "236679665752801280",\n "takerOrderId": "236679667975745536",\n "ts": 1729242032152000000,\n "size": 1,\n "price": "67878",\n "side": "sell"\n },\n {\n "sequence": 1697915257749,\n "contractId": 1,\n "tradeId": "1697915257749",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679665400492032",\n "ts": 1729242031535000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n },\n {\n "sequence": 1697915257701,\n "contractId": 1,\n "tradeId": "1697915257701",\n "makerOrderId": "236679660971245570",\n "takerOrderId": "236679661919211521",\n "ts": 1729242030932000000,\n "size": 1,\n "price": "67867.8",\n "side": "sell"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -231,8 +221,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "XBTUSDTM", "granularity": 1, "from": 1728552342000, "to": 1729243542000}'; - let req = new GetKlinesReq(); - req = req.fromJson(data); + let req = GetKlinesReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -248,8 +237,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n [\n 1728576000000,\n 60791.1,\n 61035,\n 58940,\n 60300,\n 5501167\n ],\n [\n 1728604800000,\n 60299.9,\n 60924.1,\n 60077.4,\n 60666.1,\n 1220980\n ],\n [\n 1728633600000,\n 60665.7,\n 62436.8,\n 60650.1,\n 62255.1,\n 3386359\n ]\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetKlinesResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetKlinesResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -264,8 +252,7 @@ describe('Auto Test', () => { * /api/v1/mark-price/{symbol}/current */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetMarkPriceReq(); - req = req.fromJson(data); + let req = GetMarkPriceReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -281,8 +268,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"symbol":"XBTUSDTM","granularity":1000,"timePoint":1729254307000,"value":67687.08,"indexPrice":67683.58}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarkPriceResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMarkPriceResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -298,8 +284,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": ".KXBTUSDT", "startAt": 123456, "endAt": 123456, "reverse": true, "offset": 123456, "forward": true, "maxCount": 10}'; - let req = new GetSpotIndexPriceReq(); - req = req.fromJson(data); + let req = GetSpotIndexPriceReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -315,8 +300,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557515000,\n "value": 69202.94,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69209.27,\n "weight": 0.0533\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0128\n },\n {\n "exchange": "okex",\n "price": 69195.34,\n "weight": 0.11\n },\n {\n "exchange": "bybit",\n "price": 69190.33,\n "weight": 0.0676\n },\n {\n "exchange": "binance",\n "price": 69204.55,\n "weight": 0.6195\n },\n {\n "exchange": "kucoin",\n "price": 69202.91,\n "weight": 0.1368\n }\n ]\n },\n {\n "symbol": ".KXBTUSDT",\n "granularity": 1000,\n "timePoint": 1730557514000,\n "value": 69204.98,\n "decomposionList": [\n {\n "exchange": "gateio",\n "price": 69212.71,\n "weight": 0.0808\n },\n {\n "exchange": "bitmart",\n "price": 69230.77,\n "weight": 0.0134\n },\n {\n "exchange": "okex",\n "price": 69195.49,\n "weight": 0.0536\n },\n {\n "exchange": "bybit",\n "price": 69195.97,\n "weight": 0.0921\n },\n {\n "exchange": "binance",\n "price": 69204.56,\n "weight": 0.5476\n },\n {\n "exchange": "kucoin",\n "price": 69207.8,\n "weight": 0.2125\n }\n ]\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSpotIndexPriceResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSpotIndexPriceResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -332,8 +316,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": ".XBTINT8H", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; - let req = new GetInterestRateIndexReq(); - req = req.fromJson(data); + let req = GetInterestRateIndexReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -349,8 +332,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "dataList": [\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692100000,\n "value": 3.0E-4\n },\n {\n "symbol": ".XBTINT",\n "granularity": 60000,\n "timePoint": 1728692040000,\n "value": 3.0E-4\n }\n ],\n "hasMore": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetInterestRateIndexResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetInterestRateIndexResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -366,8 +348,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": ".XBTUSDTMPI", "startAt": 1728663338000, "endAt": 1728692138000, "reverse": true, "offset": 254062248624417, "forward": true, "maxCount": 10}'; - let req = new GetPremiumIndexReq(); - req = req.fromJson(data); + let req = GetPremiumIndexReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -383,8 +364,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "hasMore": true,\n "dataList": [\n {\n "symbol": ".XBTUSDTMPI",\n "granularity": 60000,\n "timePoint": 1730558040000,\n "value": 0.00006\n },\n {\n "symbol": ".XBTUSDTMPI",\n "granularity": 60000,\n "timePoint": 1730557980000,\n "value": -0.000025\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPremiumIndexResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPremiumIndexResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/futures/order/api_order.test.ts b/sdk/node/src/generate/futures/order/api_order.test.ts index 2f973227..b7abad58 100644 --- a/sdk/node/src/generate/futures/order/api_order.test.ts +++ b/sdk/node/src/generate/futures/order/api_order.test.ts @@ -45,8 +45,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderReq(); - req = req.fromJson(data); + let req = AddOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -62,8 +61,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -79,8 +77,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}'; - let req = new AddOrderTestReq(); - req = req.fromJson(data); + let req = AddOrderTestReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -96,8 +93,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -113,8 +109,7 @@ describe('Auto Test', () => { */ let data = '[{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}, {"clientOid": "5c52e11203aa677f33e493fc", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.1", "size": 1, "timeInForce": "GTC"}]'; - let req = new BatchAddOrdersReq(); - req = req.fromJson(data); + let req = BatchAddOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -130,8 +125,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "orderId": "235919387779985408",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n },\n {\n "orderId": "235919387855482880",\n "clientOid": "5c52e11203aa677f33e493fc",\n "symbol": "XBTUSDTM",\n "code": "200000",\n "msg": "success"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchAddOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -147,8 +141,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "side": "buy", "symbol": "XBTUSDTM", "leverage": 3, "type": "limit", "remark": "order remarks", "reduceOnly": false, "marginMode": "ISOLATED", "price": "0.2", "size": 1, "timeInForce": "GTC", "triggerStopUpPrice": "0.3", "triggerStopDownPrice": "0.1", "stopPriceType": "TP"}'; - let req = new AddTPSLOrderReq(); - req = req.fromJson(data); + let req = AddTPSLOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -164,8 +157,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "234125150956625920",\n "clientOid": "5c52e11203aa677f33e493fb"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddTPSLOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddTPSLOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -180,8 +172,7 @@ describe('Auto Test', () => { * /api/v1/orders/{orderId} */ let data = '{"orderId": "example_string_default_value"}'; - let req = new CancelOrderByIdReq(); - req = req.fromJson(data); + let req = CancelOrderByIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -197,8 +188,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235303670076489728"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -213,8 +203,7 @@ describe('Auto Test', () => { * /api/v1/orders/client-order/{clientOid} */ let data = '{"symbol": "XBTUSDTM", "clientOid": "example_string_default_value"}'; - let req = new CancelOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -230,8 +219,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "clientOid": "017485b0-2957-4681-8a14-5d46b35aee0d"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -246,8 +234,7 @@ describe('Auto Test', () => { * /api/v1/orders/multi-cancel */ let data = '{"orderIdsList": ["250445104152670209", "250445181751463936"]}'; - let req = new BatchCancelOrdersReq(); - req = req.fromJson(data); + let req = BatchCancelOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -263,8 +250,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "orderId": "250445104152670209",\n "clientOid": null,\n "code": "200",\n "msg": "success"\n },\n {\n "orderId": "250445181751463936",\n "clientOid": null,\n "code": "200",\n "msg": "success"\n }\n ]\n}\n'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchCancelOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -279,8 +265,7 @@ describe('Auto Test', () => { * /api/v3/orders */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllOrdersV3Req(); - req = req.fromJson(data); + let req = CancelAllOrdersV3Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -296,8 +281,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersV3Resp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelAllOrdersV3Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -312,8 +296,7 @@ describe('Auto Test', () => { * /api/v1/stopOrders */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllStopOrdersReq(); - req = req.fromJson(data); + let req = CancelAllStopOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -329,8 +312,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllStopOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelAllStopOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -345,8 +327,7 @@ describe('Auto Test', () => { * /api/v1/orders/{order-id} */ let data = '{"order-id": "236655147005071361"}'; - let req = new GetOrderByOrderIdReq(); - req = req.fromJson(data); + let req = GetOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -362,8 +343,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "236655147005071361",\n "symbol": "XBTUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "0.0001",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1729236185949,\n "updatedAt": 1729236185949,\n "endAt": null,\n "orderTime": 1729236185885647952,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -378,8 +358,7 @@ describe('Auto Test', () => { * /api/v1/orders/byClientOid */ let data = '{"clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); - req = req.fromJson(data); + let req = GetOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -395,8 +374,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "250444645610336256",\n "symbol": "XRPUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.1",\n "size": 1,\n "value": "1",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1732523858568,\n "updatedAt": 1732523858568,\n "endAt": null,\n "orderTime": 1732523858550892322,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -412,8 +390,7 @@ describe('Auto Test', () => { */ let data = '{"status": "done", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 123456}'; - let req = new GetOrderListReq(); - req = req.fromJson(data); + let req = GetOrderListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -429,8 +406,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -445,8 +421,7 @@ describe('Auto Test', () => { * /api/v1/recentDoneOrders */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetRecentClosedOrdersReq(); - req = req.fromJson(data); + let req = GetRecentClosedOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -462,8 +437,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "236387137732231168",\n "symbol": "XRPUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "5.51",\n "dealValue": "5.511",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "10.0",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "16698fe6-2746-4aeb-a7fa-61f633ab6090",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729172287496,\n "updatedAt": 1729172287568,\n "endAt": 1729172287568,\n "orderTime": 1729172287496950800,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0.5511",\n "filledSize": 1,\n "filledValue": "5.511",\n "status": "done",\n "reduceOnly": false\n },\n {\n "id": "236317213710184449",\n "symbol": "XBTUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "67.4309",\n "dealValue": "67.4309",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729155616310,\n "updatedAt": 1729155616324,\n "endAt": 1729155616324,\n "orderTime": 1729155616310180400,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "67430.9",\n "filledSize": 1,\n "filledValue": "67.4309",\n "status": "done",\n "reduceOnly": false\n },\n {\n "id": "236317094436728832",\n "symbol": "XBTUSDTM",\n "type": "market",\n "side": "buy",\n "price": "0",\n "size": 1,\n "value": "67.445",\n "dealValue": "67.445",\n "dealSize": 1,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "3",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": "",\n "isActive": false,\n "cancelExist": false,\n "createdAt": 1729155587873,\n "updatedAt": 1729155587946,\n "endAt": 1729155587946,\n "orderTime": 1729155587873332000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "67445.0",\n "filledSize": 1,\n "filledValue": "67.445",\n "status": "done",\n "reduceOnly": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentClosedOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRecentClosedOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -479,8 +453,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "XBTUSDTM", "side": "buy", "type": "limit", "startAt": 123456, "endAt": 123456, "currentPage": 123456, "pageSize": 50}'; - let req = new GetStopOrderListReq(); - req = req.fromJson(data); + let req = GetStopOrderListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -496,8 +469,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "230181737576050688",\n "symbol": "PEOPLEUSDTM",\n "type": "limit",\n "side": "buy",\n "price": "0.05",\n "size": 10,\n "value": "5",\n "dealValue": "0",\n "dealSize": 0,\n "stp": "",\n "stop": "",\n "stopPriceType": "",\n "stopTriggered": false,\n "stopPrice": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "leverage": "1",\n "forceHold": false,\n "closeOrder": false,\n "visibleSize": 0,\n "clientOid": "5a80bd847f1811ef8a7faa665a37b3d7",\n "remark": null,\n "tags": "",\n "isActive": true,\n "cancelExist": false,\n "createdAt": 1727692804813,\n "updatedAt": 1727692804813,\n "endAt": null,\n "orderTime": 1727692804808418000,\n "settleCurrency": "USDT",\n "marginMode": "ISOLATED",\n "avgDealPrice": "0",\n "filledSize": 0,\n "filledValue": "0",\n "status": "open",\n "reduceOnly": false\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetStopOrderListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -512,8 +484,7 @@ describe('Auto Test', () => { * /api/v1/openOrderStatistics */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetOpenOrderValueReq(); - req = req.fromJson(data); + let req = GetOpenOrderValueReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -529,8 +500,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "openOrderBuySize": 1,\n "openOrderSellSize": 0,\n "openOrderBuyCost": "0.0001",\n "openOrderSellCost": "0",\n "settleCurrency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOpenOrderValueResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOpenOrderValueResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -545,8 +515,7 @@ describe('Auto Test', () => { * /api/v1/recentFills */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetRecentTradeHistoryReq(); - req = req.fromJson(data); + let req = GetRecentTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -562,8 +531,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.04045854",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "fee": "0.040467",\n "settleCurrency": "USDT",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRecentTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -579,8 +547,7 @@ describe('Auto Test', () => { */ let data = '{"orderId": "236655147005071361", "symbol": "example_string_default_value", "side": "buy", "type": "limit", "tradeTypes": "trade", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); + let req = GetTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -596,8 +563,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277229880",\n "orderId": "236317213710184449",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67430.9",\n "size": 1,\n "value": "67.4309",\n "openFeePay": "0.04045854",\n "closeFeePay": "0",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.04045854",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155616320000000,\n "createdAt": 1729155616493\n },\n {\n "symbol": "XBTUSDTM",\n "tradeId": "1784277132002",\n "orderId": "236317094436728832",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67445",\n "size": 1,\n "value": "67.445",\n "openFeePay": "0",\n "closeFeePay": "0.040467",\n "stop": "",\n "feeRate": "0.00060",\n "fixFee": "0",\n "feeCurrency": "USDT",\n "marginMode": "ISOLATED",\n "settleCurrency": "USDT",\n "fee": "0.040467",\n "orderType": "market",\n "displayType": "market",\n "tradeType": "trade",\n "subTradeType": null,\n "tradeTime": 1729155587944000000,\n "createdAt": 1729155588104\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -612,8 +578,7 @@ describe('Auto Test', () => { * /api/v1/orders */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new CancelAllOrdersV1Req(); - req = req.fromJson(data); + let req = CancelAllOrdersV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -629,8 +594,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "235919172150824960",\n "235919172150824961"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelAllOrdersV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/futures/positions/api_positions.test.ts b/sdk/node/src/generate/futures/positions/api_positions.test.ts index 68af1d76..40c57a46 100644 --- a/sdk/node/src/generate/futures/positions/api_positions.test.ts +++ b/sdk/node/src/generate/futures/positions/api_positions.test.ts @@ -36,8 +36,7 @@ describe('Auto Test', () => { * /api/v2/position/getMarginMode */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetMarginModeReq(); - req = req.fromJson(data); + let req = GetMarginModeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -53,8 +52,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarginModeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMarginModeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -69,8 +67,7 @@ describe('Auto Test', () => { * /api/v2/position/changeMarginMode */ let data = '{"symbol": "XBTUSDTM", "marginMode": "ISOLATED"}'; - let req = new SwitchMarginModeReq(); - req = req.fromJson(data); + let req = SwitchMarginModeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -86,8 +83,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "marginMode": "ISOLATED"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new SwitchMarginModeResp(); - resp = resp.fromObject(commonResp.data); + let resp = SwitchMarginModeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -103,8 +99,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "XBTUSDTM", "price": "example_string_default_value", "leverage": 123456}'; - let req = new GetMaxOpenSizeReq(); - req = req.fromJson(data); + let req = GetMaxOpenSizeReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -120,8 +115,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "maxBuyOpenSize": 0,\n "maxSellOpenSize": 0\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxOpenSizeResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMaxOpenSizeResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -136,8 +130,7 @@ describe('Auto Test', () => { * /api/v1/position */ let data = '{"symbol": "example_string_default_value"}'; - let req = new GetPositionDetailsReq(); - req = req.fromJson(data); + let req = GetPositionDetailsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -153,8 +146,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.88,\n "delevPercentage": 0.18,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1729482542135,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": 0.01925174,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": 0.01925174,\n "isOpen": true,\n "markPrice": 68900.7,\n "markValue": 68.9007,\n "posCost": 67.4309,\n "posCross": 0.01645214,\n "posCrossMargin": 0,\n "posInit": 22.4769666644,\n "posComm": 0.0539546299,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.03766885,\n "posMargin": 22.5097045843,\n "posFunding": -0.0212068,\n "posMaint": 0.3931320569,\n "maintMargin": 23.9795045843,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.06166534,\n "unrealisedPnl": 1.4698,\n "unrealisedPnlPcnt": 0.0218,\n "unrealisedRoePcnt": 0.0654,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45314.33,\n "bankruptPrice": 44975.16,\n "settleCurrency": "USDT",\n "maintainMargin": 0.005,\n "riskLimitLevel": 2,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.88\n }\n}\n'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPositionDetailsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPositionDetailsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -169,8 +161,7 @@ describe('Auto Test', () => { * /api/v1/positions */ let data = '{"currency": "USDT"}'; - let req = new GetPositionListReq(); - req = req.fromJson(data); + let req = GetPositionListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -186,8 +177,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "500000000001046430",\n "symbol": "ETHUSDM",\n "crossMode": true,\n "delevPercentage": 0.71,\n "openingTimestamp": 1730635780702,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": -4.069805E-4,\n "currentComm": 2.441E-7,\n "unrealisedCost": -4.069805E-4,\n "realisedGrossCost": 0.0,\n "realisedCost": 2.441E-7,\n "isOpen": true,\n "markPrice": 2454.12,\n "markValue": -4.07478E-4,\n "posCost": -4.069805E-4,\n "posInit": 4.06981E-5,\n "posMargin": 4.07478E-5,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -2.441E-7,\n "unrealisedPnl": -4.975E-7,\n "unrealisedPnlPcnt": -0.0012,\n "unrealisedRoePcnt": -0.0122,\n "avgEntryPrice": 2457.12,\n "liquidationPrice": 1429.96,\n "bankruptPrice": 1414.96,\n "settleCurrency": "ETH",\n "isInverse": true,\n "marginMode": "CROSS",\n "positionSide": "BOTH",\n "leverage": 10\n },\n {\n "id": "500000000000988255",\n "symbol": "XBTUSDTM",\n "autoDeposit": true,\n "crossMode": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 2.97,\n "delevPercentage": 0.5,\n "openingTimestamp": 1729155616322,\n "currentTimestamp": 1730636040926,\n "currentQty": 1,\n "currentCost": 67.4309,\n "currentComm": -0.15936162,\n "unrealisedCost": 67.4309,\n "realisedGrossCost": 0.0,\n "realisedCost": -0.15936162,\n "isOpen": true,\n "markPrice": 68323.06,\n "markValue": 68.32306,\n "posCost": 67.4309,\n "posCross": 0.06225152,\n "posCrossMargin": 0,\n "posInit": 22.2769666644,\n "posComm": 0.0539821899,\n "posCommCommon": 0.0539447199,\n "posLoss": 0.26210915,\n "posMargin": 22.1310912243,\n "posFunding": -0.19982016,\n "posMaint": 0.4046228699,\n "maintMargin": 23.0232512243,\n "realisedGrossPnl": 0.0,\n "realisedPnl": -0.2402787,\n "unrealisedPnl": 0.89216,\n "unrealisedPnlPcnt": 0.0132,\n "unrealisedRoePcnt": 0.04,\n "avgEntryPrice": 67430.9,\n "liquidationPrice": 45704.44,\n "bankruptPrice": 45353.8,\n "settleCurrency": "USDT",\n "isInverse": false,\n "maintainMargin": 0.005,\n "marginMode": "ISOLATED",\n "positionSide": "BOTH",\n "leverage": 2.97\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPositionListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPositionListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -203,8 +193,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "example_string_default_value", "from": 123456, "to": 123456, "limit": 10, "pageId": 1}'; - let req = new GetPositionsHistoryReq(); - req = req.fromJson(data); + let req = GetPositionsHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -220,8 +209,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 3,\n "totalPage": 1,\n "items": [\n {\n "closeId": "500000000027312193",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "CLOSE_SHORT",\n "pnl": "-3.79237944",\n "realisedGrossCost": "3.795",\n "withdrawPnl": "0.0",\n "tradeFee": "0.078657",\n "fundingFee": "0.08127756",\n "openTime": 1727073653603,\n "closeTime": 1729155587945,\n "openPrice": "63650.0",\n "closePrice": "67445.0",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026809668",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "SUIUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-1.10919296",\n "realisedGrossCost": "1.11297635",\n "withdrawPnl": "0.0",\n "tradeFee": "0.00200295",\n "fundingFee": "0.00578634",\n "openTime": 1726473389296,\n "closeTime": 1728738683541,\n "openPrice": "1.1072",\n "closePrice": "2.22017635",\n "marginMode": "ISOLATED"\n },\n {\n "closeId": "500000000026819355",\n "userId": "633559791e1cbc0001f319bc",\n "symbol": "XBTUSDTM",\n "settleCurrency": "USDT",\n "leverage": "0.0",\n "type": "LIQUID_SHORT",\n "pnl": "-5.941896296",\n "realisedGrossCost": "5.86937042",\n "withdrawPnl": "0.0",\n "tradeFee": "0.074020096",\n "fundingFee": "0.00149422",\n "openTime": 1726490775358,\n "closeTime": 1727061049859,\n "openPrice": "58679.6",\n "closePrice": "64548.97042",\n "marginMode": "ISOLATED"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPositionsHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPositionsHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -236,8 +224,7 @@ describe('Auto Test', () => { * /api/v1/margin/maxWithdrawMargin */ let data = '{"symbol": "example_string_default_value"}'; - let req = new GetMaxWithdrawMarginReq(); - req = req.fromJson(data); + let req = GetMaxWithdrawMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -252,8 +239,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": "21.1135719252"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMaxWithdrawMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMaxWithdrawMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -268,8 +254,7 @@ describe('Auto Test', () => { * /api/v2/getCrossUserLeverage */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetCrossMarginLeverageReq(); - req = req.fromJson(data); + let req = GetCrossMarginLeverageReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -285,8 +270,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginLeverageResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetCrossMarginLeverageResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -301,8 +285,7 @@ describe('Auto Test', () => { * /api/v2/changeCrossUserLeverage */ let data = '{"symbol": "XBTUSDTM", "leverage": "10"}'; - let req = new ModifyMarginLeverageReq(); - req = req.fromJson(data); + let req = ModifyMarginLeverageReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -318,8 +301,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "XBTUSDTM",\n "leverage": "3"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyMarginLeverageResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyMarginLeverageResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -334,8 +316,7 @@ describe('Auto Test', () => { * /api/v1/position/margin/deposit-margin */ let data = '{"symbol": "string", "margin": 0, "bizNo": "string"}'; - let req = new AddIsolatedMarginReq(); - req = req.fromJson(data); + let req = AddIsolatedMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -351,8 +332,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "6200c9b83aecfb000152ddcd",\n "symbol": "XBTUSDTM",\n "autoDeposit": false,\n "maintMarginReq": 0.005,\n "riskLimit": 500000,\n "realLeverage": 18.72,\n "crossMode": false,\n "delevPercentage": 0.66,\n "openingTimestamp": 1646287090131,\n "currentTimestamp": 1646295055021,\n "currentQty": 1,\n "currentCost": 43.388,\n "currentComm": 0.0260328,\n "unrealisedCost": 43.388,\n "realisedGrossCost": 0,\n "realisedCost": 0.0260328,\n "isOpen": true,\n "markPrice": 43536.65,\n "markValue": 43.53665,\n "posCost": 43.388,\n "posCross": 0.000024985,\n "posInit": 2.1694,\n "posComm": 0.02733446,\n "posLoss": 0,\n "posMargin": 2.19675944,\n "posMaint": 0.24861326,\n "maintMargin": 2.34540944,\n "realisedGrossPnl": 0,\n "realisedPnl": -0.0260328,\n "unrealisedPnl": 0.14865,\n "unrealisedPnlPcnt": 0.0034,\n "unrealisedRoePcnt": 0.0685,\n "avgEntryPrice": 43388,\n "liquidationPrice": 41440,\n "bankruptPrice": 41218,\n "userId": 1234321123,\n "settleCurrency": "USDT"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddIsolatedMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddIsolatedMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -367,8 +347,7 @@ describe('Auto Test', () => { * /api/v1/margin/withdrawMargin */ let data = '{"symbol": "XBTUSDTM", "withdrawAmount": "0.0000001"}'; - let req = new RemoveIsolatedMarginReq(); - req = req.fromJson(data); + let req = RemoveIsolatedMarginReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -383,8 +362,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": "0.1"\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new RemoveIsolatedMarginResp(); - resp = resp.fromObject(commonResp.data); + let resp = RemoveIsolatedMarginResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -399,8 +377,7 @@ describe('Auto Test', () => { * /api/v1/contracts/risk-limit/{symbol} */ let data = '{"symbol": "XBTUSDTM"}'; - let req = new GetIsolatedMarginRiskLimitReq(); - req = req.fromJson(data); + let req = GetIsolatedMarginRiskLimitReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -416,8 +393,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "symbol": "XBTUSDTM",\n "level": 1,\n "maxRiskLimit": 100000,\n "minRiskLimit": 0,\n "maxLeverage": 125,\n "initialMargin": 0.008,\n "maintainMargin": 0.004\n },\n {\n "symbol": "XBTUSDTM",\n "level": 2,\n "maxRiskLimit": 500000,\n "minRiskLimit": 100000,\n "maxLeverage": 100,\n "initialMargin": 0.01,\n "maintainMargin": 0.005\n },\n {\n "symbol": "XBTUSDTM",\n "level": 3,\n "maxRiskLimit": 1000000,\n "minRiskLimit": 500000,\n "maxLeverage": 75,\n "initialMargin": 0.014,\n "maintainMargin": 0.007\n },\n {\n "symbol": "XBTUSDTM",\n "level": 4,\n "maxRiskLimit": 2000000,\n "minRiskLimit": 1000000,\n "maxLeverage": 50,\n "initialMargin": 0.02,\n "maintainMargin": 0.01\n },\n {\n "symbol": "XBTUSDTM",\n "level": 5,\n "maxRiskLimit": 3000000,\n "minRiskLimit": 2000000,\n "maxLeverage": 30,\n "initialMargin": 0.034,\n "maintainMargin": 0.017\n },\n {\n "symbol": "XBTUSDTM",\n "level": 6,\n "maxRiskLimit": 5000000,\n "minRiskLimit": 3000000,\n "maxLeverage": 20,\n "initialMargin": 0.05,\n "maintainMargin": 0.025\n },\n {\n "symbol": "XBTUSDTM",\n "level": 7,\n "maxRiskLimit": 8000000,\n "minRiskLimit": 5000000,\n "maxLeverage": 10,\n "initialMargin": 0.1,\n "maintainMargin": 0.05\n },\n {\n "symbol": "XBTUSDTM",\n "level": 8,\n "maxRiskLimit": 12000000,\n "minRiskLimit": 8000000,\n "maxLeverage": 5,\n "initialMargin": 0.2,\n "maintainMargin": 0.1\n },\n {\n "symbol": "XBTUSDTM",\n "level": 9,\n "maxRiskLimit": 20000000,\n "minRiskLimit": 12000000,\n "maxLeverage": 4,\n "initialMargin": 0.25,\n "maintainMargin": 0.125\n },\n {\n "symbol": "XBTUSDTM",\n "level": 10,\n "maxRiskLimit": 30000000,\n "minRiskLimit": 20000000,\n "maxLeverage": 3,\n "initialMargin": 0.334,\n "maintainMargin": 0.167\n },\n {\n "symbol": "XBTUSDTM",\n "level": 11,\n "maxRiskLimit": 40000000,\n "minRiskLimit": 30000000,\n "maxLeverage": 2,\n "initialMargin": 0.5,\n "maintainMargin": 0.25\n },\n {\n "symbol": "XBTUSDTM",\n "level": 12,\n "maxRiskLimit": 50000000,\n "minRiskLimit": 40000000,\n "maxLeverage": 1,\n "initialMargin": 1.0,\n "maintainMargin": 0.5\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetIsolatedMarginRiskLimitResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetIsolatedMarginRiskLimitResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -432,8 +408,7 @@ describe('Auto Test', () => { * /api/v1/position/risk-limit-level/change */ let data = '{"symbol": "XBTUSDTM", "level": 2}'; - let req = new ModifyIsolatedMarginRiskLimtReq(); - req = req.fromJson(data); + let req = ModifyIsolatedMarginRiskLimtReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -448,8 +423,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyIsolatedMarginRiskLimtResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyIsolatedMarginRiskLimtResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -464,8 +438,7 @@ describe('Auto Test', () => { * /api/v1/position/margin/auto-deposit-status */ let data = '{"symbol": "XBTUSDTM", "status": true}'; - let req = new ModifyAutoDepositStatusReq(); - req = req.fromJson(data); + let req = ModifyAutoDepositStatusReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -480,8 +453,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": true\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyAutoDepositStatusResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyAutoDepositStatusResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/margin/credit/api_credit.test.ts b/sdk/node/src/generate/margin/credit/api_credit.test.ts index 91213f4f..6e60c107 100644 --- a/sdk/node/src/generate/margin/credit/api_credit.test.ts +++ b/sdk/node/src/generate/margin/credit/api_credit.test.ts @@ -22,8 +22,7 @@ describe('Auto Test', () => { * /api/v3/project/list */ let data = '{"currency": "BTC"}'; - let req = new GetLoanMarketReq(); - req = req.fromJson(data); + let req = GetLoanMarketReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -39,8 +38,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "currency": "BTC",\n "purchaseEnable": true,\n "redeemEnable": true,\n "increment": "0.00000001",\n "minPurchaseSize": "0.001",\n "maxPurchaseSize": "40",\n "interestIncrement": "0.0001",\n "minInterestRate": "0.005",\n "marketInterestRate": "0.005",\n "maxInterestRate": "0.32",\n "autoPurchaseEnable": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetLoanMarketResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetLoanMarketResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -55,8 +53,7 @@ describe('Auto Test', () => { * /api/v3/project/marketInterestRate */ let data = '{"currency": "BTC"}'; - let req = new GetLoanMarketInterestRateReq(); - req = req.fromJson(data); + let req = GetLoanMarketInterestRateReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -72,8 +69,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "time": "202410170000",\n "marketInterestRate": "0.005"\n },\n {\n "time": "202410170100",\n "marketInterestRate": "0.005"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetLoanMarketInterestRateResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetLoanMarketInterestRateResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -88,8 +84,7 @@ describe('Auto Test', () => { * /api/v3/purchase */ let data = '{"currency": "BTC", "size": "0.001", "interestRate": "0.1"}'; - let req = new PurchaseReq(); - req = req.fromJson(data); + let req = PurchaseReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -105,8 +100,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new PurchaseResp(); - resp = resp.fromObject(commonResp.data); + let resp = PurchaseResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -122,8 +116,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "purchaseOrderNo": "671bafa804c26d000773c533", "interestRate": "0.09"}'; - let req = new ModifyPurchaseReq(); - req = req.fromJson(data); + let req = ModifyPurchaseReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -138,8 +131,7 @@ describe('Auto Test', () => { */ let data = '{\n "code": "200000",\n "data": null\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyPurchaseResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyPurchaseResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -155,8 +147,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "DONE", "purchaseOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; - let req = new GetPurchaseOrdersReq(); - req = req.fromJson(data); + let req = GetPurchaseOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -172,8 +163,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bb15a3b3f930007880bae",\n "purchaseSize": "0.001",\n "matchSize": "0",\n "interestRate": "0.1",\n "incomeSize": "0",\n "applyTime": 1729868122172,\n "status": "PENDING"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPurchaseOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPurchaseOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -189,8 +179,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "size": "0.001", "purchaseOrderNo": "671bafa804c26d000773c533"}'; - let req = new RedeemReq(); - req = req.fromJson(data); + let req = RedeemReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -206,8 +195,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderNo": "671bafa804c26d000773c533"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new RedeemResp(); - resp = resp.fromObject(commonResp.data); + let resp = RedeemResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -223,8 +211,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "status": "DONE", "redeemOrderNo": "example_string_default_value", "currentPage": 1, "pageSize": 50}'; - let req = new GetRedeemOrdersReq(); - req = req.fromJson(data); + let req = GetRedeemOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -240,8 +227,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 10,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "currency": "BTC",\n "purchaseOrderNo": "671bafa804c26d000773c533",\n "redeemOrderNo": "671bb01004c26d000773c55c",\n "redeemSize": "0.001",\n "receiptSize": "0.001",\n "applyTime": null,\n "status": "DONE"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRedeemOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRedeemOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/margin/debit/api_debit.test.ts b/sdk/node/src/generate/margin/debit/api_debit.test.ts index d4e8f753..0a4a4ef7 100644 --- a/sdk/node/src/generate/margin/debit/api_debit.test.ts +++ b/sdk/node/src/generate/margin/debit/api_debit.test.ts @@ -21,8 +21,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "USDT", "size": 10, "timeInForce": "FOK", "isIsolated": false, "isHf": false}'; - let req = new BorrowReq(); - req = req.fromJson(data); + let req = BorrowReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -38,8 +37,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"orderNo":"67187162c0d6990007717b15","actualSize":"10"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new BorrowResp(); - resp = resp.fromObject(commonResp.data); + let resp = BorrowResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -55,8 +53,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetBorrowHistoryReq(); - req = req.fromJson(data); + let req = GetBorrowHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -72,8 +69,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "timestamp": 1729657580449,\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 2,\n "totalPage": 1,\n "items": [\n {\n "orderNo": "67187162c0d6990007717b15",\n "symbol": null,\n "currency": "USDT",\n "size": "10",\n "actualSize": "10",\n "status": "SUCCESS",\n "createdTime": 1729655138000\n },\n {\n "orderNo": "67187155b088e70007149585",\n "symbol": null,\n "currency": "USDT",\n "size": "0.1",\n "actualSize": "0",\n "status": "FAILED",\n "createdTime": 1729655125000\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetBorrowHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetBorrowHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -88,8 +84,7 @@ describe('Auto Test', () => { * /api/v3/margin/repay */ let data = '{"currency": "USDT", "size": 10}'; - let req = new RepayReq(); - req = req.fromJson(data); + let req = RepayReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -105,8 +100,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"timestamp":1729655606816,"orderNo":"671873361d5bd400075096ad","actualSize":"10"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new RepayResp(); - resp = resp.fromObject(commonResp.data); + let resp = RepayResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -122,8 +116,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "orderNo": "example_string_default_value", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetRepayHistoryReq(); - req = req.fromJson(data); + let req = GetRepayHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -139,8 +132,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"timestamp":1729663471891,"currentPage":1,"pageSize":50,"totalNum":1,"totalPage":1,"items":[{"orderNo":"671873361d5bd400075096ad","symbol":null,"currency":"USDT","size":"10","principal":"9.99986518","interest":"0.00013482","status":"SUCCESS","createdTime":1729655606000}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRepayHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRepayHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -156,8 +148,7 @@ describe('Auto Test', () => { */ let data = '{"currency": "BTC", "isIsolated": true, "symbol": "BTC-USDT", "startTime": 123456, "endTime": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetInterestHistoryReq(); - req = req.fromJson(data); + let req = GetInterestHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -173,8 +164,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"timestamp":1729665170701,"currentPage":1,"pageSize":50,"totalNum":3,"totalPage":1,"items":[{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729663213375},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729659618802},{"currency":"USDT","dayRatio":"0.000296","interestAmount":"0.00000001","createdTime":1729656028077}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetInterestHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetInterestHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -189,8 +179,7 @@ describe('Auto Test', () => { * /api/v3/position/update-user-leverage */ let data = '{"leverage": "5"}'; - let req = new ModifyLeverageReq(); - req = req.fromJson(data); + let req = ModifyLeverageReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -205,8 +194,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":null}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyLeverageResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyLeverageResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts b/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts index a9aa164d..86c79b8d 100644 --- a/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts +++ b/sdk/node/src/generate/margin/marginprivate/ws_margin_private.test.ts @@ -12,8 +12,7 @@ describe('Auto Test', () => { let data = '{"topic":"/margin/position","subject":"debt.ratio","type":"message","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"debtRatio":0,"totalAsset":0.00052431772284080000000,"marginCoefficientTotalAsset":"0.0005243177228408","totalDebt":"0","assetList":{"BTC":{"total":"0.00002","available":"0","hold":"0.00002"},"USDT":{"total":"33.68855864","available":"15.01916691","hold":"18.66939173"}},"debtList":{"BTC":"0","USDT":"0"},"timestamp":1729912435657}}'; let commonResp = WsMessage.fromJson(data); - let resp = new CrossMarginPositionEvent(); - resp = resp.fromObject(commonResp.data); + let resp = CrossMarginPositionEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -28,8 +27,7 @@ describe('Auto Test', () => { let data = '{"topic":"/margin/isolatedPosition:BTC-USDT","subject":"positionChange","type":"message","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"tag":"BTC-USDT","status":"DEBT","statusBizType":"DEFAULT_DEBT","accumulatedPrincipal":"5.01","changeAssets":{"BTC":{"total":"0.00043478","hold":"0","liabilityPrincipal":"0","liabilityInterest":"0"},"USDT":{"total":"0.98092004","hold":"0","liabilityPrincipal":"26","liabilityInterest":"0.00025644"}},"timestamp":1730121097742}}'; let commonResp = WsMessage.fromJson(data); - let resp = new IsolatedMarginPositionEvent(); - resp = resp.fromObject(commonResp.data); + let resp = IsolatedMarginPositionEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); diff --git a/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts b/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts index ef0c7590..92b3a202 100644 --- a/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts +++ b/sdk/node/src/generate/margin/marginpublic/ws_margin_public.test.ts @@ -12,8 +12,7 @@ describe('Auto Test', () => { let data = '{"id":"5c24c5da03aa673885cd67a0","type":"message","topic":"/indicator/index:USDT-BTC","subject":"tick","data":{"symbol":"USDT-BTC","granularity":5000,"timestamp":1551770400000,"value":0.0001092}}'; let commonResp = WsMessage.fromJson(data); - let resp = new IndexPriceEvent(); - resp = resp.fromObject(commonResp.data); + let resp = IndexPriceEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -28,8 +27,7 @@ describe('Auto Test', () => { let data = '{"id":"5c24c5da03aa673885cd67aa","type":"message","topic":"/indicator/markPrice:USDT-BTC","subject":"tick","data":{"symbol":"USDT-BTC","granularity":5000,"timestamp":1551770400000,"value":0.0001093}}'; let commonResp = WsMessage.fromJson(data); - let resp = new MarkPriceEvent(); - resp = resp.fromObject(commonResp.data); + let resp = MarkPriceEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); diff --git a/sdk/node/src/generate/margin/market/api_market.test.ts b/sdk/node/src/generate/margin/market/api_market.test.ts index c8afa1a3..c987ca46 100644 --- a/sdk/node/src/generate/margin/market/api_market.test.ts +++ b/sdk/node/src/generate/margin/market/api_market.test.ts @@ -17,8 +17,7 @@ describe('Auto Test', () => { * /api/v3/margin/symbols */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetCrossMarginSymbolsReq(); - req = req.fromJson(data); + let req = GetCrossMarginSymbolsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -34,8 +33,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "timestamp": 1729665839353,\n "items": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "enableTrading": true,\n "market": "USDS",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "baseIncrement": "0.00000001",\n "baseMinSize": "0.00001",\n "baseMaxSize": "10000000000",\n "quoteIncrement": "0.000001",\n "quoteMinSize": "0.1",\n "quoteMaxSize": "99999999",\n "priceIncrement": "0.1",\n "feeCurrency": "USDT",\n "priceLimitRate": "0.1",\n "minFunds": "0.1"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCrossMarginSymbolsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetCrossMarginSymbolsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -65,8 +63,7 @@ describe('Auto Test', () => { * /api/v3/etf/info */ let data = '{"currency": "BTCUP"}'; - let req = new GetETFInfoReq(); - req = req.fromJson(data); + let req = GetETFInfoReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -82,8 +79,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "currency": "BTCUP",\n "netAsset": "33.846",\n "targetLeverage": "2-4",\n "actualLeverage": "2.1648",\n "issuedSize": "107134.87655291",\n "basket": "118.324559 XBTUSDTM"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetETFInfoResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetETFInfoResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -113,8 +109,7 @@ describe('Auto Test', () => { * /api/v1/mark-price/{symbol}/current */ let data = '{"symbol": "USDT-BTC"}'; - let req = new GetMarkPriceDetailReq(); - req = req.fromJson(data); + let req = GetMarkPriceDetailReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -130,8 +125,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbol": "USDT-BTC",\n "timePoint": 1729676888000,\n "value": 1.5045E-5\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarkPriceDetailResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMarkPriceDetailResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/margin/order/api_order.test.ts b/sdk/node/src/generate/margin/order/api_order.test.ts index bc33a96f..ab82bbc9 100644 --- a/sdk/node/src/generate/margin/order/api_order.test.ts +++ b/sdk/node/src/generate/margin/order/api_order.test.ts @@ -35,8 +35,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderReq(); - req = req.fromJson(data); + let req = AddOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -52,8 +51,7 @@ describe('Auto Test', () => { let data = '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "671663e02188630007e21c9c",\n "clientOid": "5c52e11203aa677f33e1493fb",\n "borrowSize": "10.2",\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -69,8 +67,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderTestReq(); - req = req.fromJson(data); + let req = AddOrderTestReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -86,8 +83,7 @@ describe('Auto Test', () => { let data = '{\n "success": true,\n "code": "200000",\n "data": {\n "orderId": "5bd6e9286d99522a52e458de",\n "clientOid": "5c52e11203aa677f33e493fb",\n "borrowSize": 10.2,\n "loanApplyId": "600656d9a33ac90009de4f6f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -102,8 +98,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders/{orderId} */ let data = '{"orderId": "671663e02188630007e21c9c", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdReq(); - req = req.fromJson(data); + let req = CancelOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -118,8 +113,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"orderId":"671663e02188630007e21c9c"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -134,8 +128,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders/client-order/{clientOid} */ let data = '{"clientOid": "5c52e11203aa677f33e1493fb", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -150,8 +143,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e1493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -166,8 +158,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders */ let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; - let req = new CancelAllOrdersBySymbolReq(); - req = req.fromJson(data); + let req = CancelAllOrdersBySymbolReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -182,8 +173,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":"success"}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersBySymbolResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelAllOrdersBySymbolResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -198,8 +188,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/order/active/symbols */ let data = '{"tradeType": "MARGIN_TRADE"}'; - let req = new GetSymbolsWithOpenOrderReq(); - req = req.fromJson(data); + let req = GetSymbolsWithOpenOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -215,8 +204,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "symbolSize": 1,\n "symbols": [\n "BTC-USDT"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolsWithOpenOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSymbolsWithOpenOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -231,8 +219,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders/active */ let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE"}'; - let req = new GetOpenOrdersReq(); - req = req.fromJson(data); + let req = GetOpenOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -248,8 +235,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "671667306afcdb000723107f",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "active": true,\n "tax": "0",\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729521460940\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOpenOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOpenOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -265,8 +251,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetClosedOrdersReq(); - req = req.fromJson(data); + let req = GetClosedOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -282,8 +267,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "lastId": 136112949351,\n "items": [\n {\n "id": "6716491f6afcdb00078365c8",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "remainSize": "0",\n "remainFunds": "0",\n "cancelledSize": "0.00001",\n "cancelledFunds": "0.5",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": null,\n "tags": null,\n "cancelExist": true,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729513759162,\n "lastUpdatedAt": 1729521126597\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetClosedOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetClosedOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -299,8 +283,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "tradeType": "MARGIN_TRADE", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); + let req = GetTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -316,8 +299,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 137891621991,\n "symbol": "BTC-USDT",\n "tradeId": 11040911994273793,\n "orderId": "671868085584bc0007d85f46",\n "counterOrderId": "67186805b7cbdf00071621f9",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "67141.6",\n "size": "0.00001",\n "funds": "0.671416",\n "fee": "0.000671416",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "MARGIN_TRADE",\n "tax": "0",\n "taxRate": "0",\n "type": "limit",\n "createdAt": 1729652744998\n }\n ],\n "lastId": 137891621991\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -332,8 +314,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders/{orderId} */ let data = '{"symbol": "BTC-USDT", "orderId": "671667306afcdb000723107f"}'; - let req = new GetOrderByOrderIdReq(); - req = req.fromJson(data); + let req = GetOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -349,8 +330,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -365,8 +345,7 @@ describe('Auto Test', () => { * /api/v3/hf/margin/orders/client-order/{clientOid} */ let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); - req = req.fromJson(data); + let req = GetOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -382,8 +361,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "671667306afcdb000723107f",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "stop": null,\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e493fb",\n "remark": null,\n "tags": null,\n "cancelExist": false,\n "createdAt": 1729521456248,\n "lastUpdatedAt": 1729651011877,\n "tradeType": "MARGIN_TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -399,8 +377,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; - let req = new AddOrderV1Req(); - req = req.fromJson(data); + let req = AddOrderV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -416,8 +393,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -433,8 +409,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e4193fb", "remark": "order remarks"}'; - let req = new AddOrderTestV1Req(); - req = req.fromJson(data); + let req = AddOrderTestV1Req.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -450,8 +425,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671bb90194422f00073ff4f0",\n "loanApplyId": null,\n "borrowSize": null,\n "clientOid": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestV1Resp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestV1Resp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts index 77c7fd67..06949651 100644 --- a/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts +++ b/sdk/node/src/generate/margin/risklimit/api_risk_limit.test.ts @@ -10,8 +10,7 @@ describe('Auto Test', () => { * /api/v3/margin/currencies */ let data = '{"isIsolated": true, "currency": "BTC", "symbol": "BTC-USDT"}'; - let req = new GetMarginRiskLimitReq(); - req = req.fromJson(data); + let req = GetMarginRiskLimitReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -27,8 +26,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "timestamp": 1729678659275,\n "currency": "BTC",\n "borrowMaxAmount": "75.15",\n "buyMaxAmount": "217.12",\n "holdMaxAmount": "217.12",\n "borrowCoefficient": "1",\n "marginCoefficient": "1",\n "precision": 8,\n "borrowMinAmount": "0.001",\n "borrowMinUnit": "0.0001",\n "borrowEnabled": true\n }\n ]\n}\n'; let commonResp = RestResponse.fromJson(data); - let resp = new GetMarginRiskLimitResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetMarginRiskLimitResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/spot/market/api_market.test.ts b/sdk/node/src/generate/spot/market/api_market.test.ts index 5d8e1081..e0ed0a91 100644 --- a/sdk/node/src/generate/spot/market/api_market.test.ts +++ b/sdk/node/src/generate/spot/market/api_market.test.ts @@ -38,8 +38,7 @@ describe('Auto Test', () => { */ let data = '{"currentPage": 1, "pageSize": 50, "annType": "latest-announcements", "lang": "en_US", "startTime": 1729594043000, "endTime": 1729697729000}'; - let req = new GetAnnouncementsReq(); - req = req.fromJson(data); + let req = GetAnnouncementsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -55,8 +54,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "totalNum": 195,\n "totalPage": 13,\n "currentPage": 1,\n "pageSize": 15,\n "items": [\n {\n "annId": 129045,\n "annTitle": "KuCoin Isolated Margin Adds the Scroll (SCR) Trading Pair",\n "annType": [\n "latest-announcements"\n ],\n "annDesc": "To enrich the variety of assets available,\xa0KuCoin\u2019s Isolated Margin Trading platform has added the Scroll (SCR)\xa0asset and trading pair.",\n "cTime": 1729594043000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/kucoin-isolated-margin-adds-scr?lang=en_US"\n },\n {\n "annId": 129001,\n "annTitle": "DAPP-30D Fixed Promotion, Enjoy an APR of 200%!\u200b",\n "annType": [\n "latest-announcements",\n "activities"\n ],\n "annDesc": "KuCoin Earn will be launching the DAPP Fixed Promotion at 10:00:00 on October 22, 2024 (UTC). The available product is \u201cDAPP-30D\'\' with an APR of 200%.",\n "cTime": 1729588460000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/dapp-30d-fixed-promotion-enjoy?lang=en_US"\n },\n {\n "annId": 128581,\n "annTitle": "NAYM (NAYM) Gets Listed on KuCoin! World Premiere!",\n "annType": [\n "latest-announcements",\n "new-listings"\n ],\n "annDesc": "Trading:\xa011:00 on October 22, 2024 (UTC)",\n "cTime": 1729497729000,\n "language": "en_US",\n "annUrl": "https://www.kucoin.com/announcement/en-naym-naym-gets-listed-on-kucoin-world-premiere?lang=en_US"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAnnouncementsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetAnnouncementsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -71,8 +69,7 @@ describe('Auto Test', () => { * /api/v3/currencies/{currency} */ let data = '{"currency": "BTC", "chain": "eth"}'; - let req = new GetCurrencyReq(); - req = req.fromJson(data); + let req = GetCurrencyReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -88,8 +85,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"currency":"BTC","name":"BTC","fullName":"Bitcoin","precision":8,"confirms":null,"contractAddress":null,"isMarginEnabled":true,"isDebitEnabled":true,"chains":[{"chainName":"BTC","withdrawalMinSize":"0.001","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":3,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"btc"},{"chainName":"Lightning Network","withdrawalMinSize":"0.00001","depositMinSize":"0.00001","withdrawFeeRate":"0","withdrawalMinFee":"0.000015","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":1,"preConfirms":1,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":"0.03","needTag":false,"chainId":"btcln"},{"chainName":"KCC","withdrawalMinSize":"0.0008","depositMinSize":null,"withdrawFeeRate":"0","withdrawalMinFee":"0.00002","isWithdrawEnabled":true,"isDepositEnabled":true,"confirms":20,"preConfirms":20,"contractAddress":"0xfa93c12cd345c658bc4644d1d4e1b9615952258c","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"kcc"},{"chainName":"BTC-Segwit","withdrawalMinSize":"0.0008","depositMinSize":"0.0002","withdrawFeeRate":"0","withdrawalMinFee":"0.0005","isWithdrawEnabled":false,"isDepositEnabled":true,"confirms":2,"preConfirms":2,"contractAddress":"","withdrawPrecision":8,"maxWithdraw":null,"maxDeposit":null,"needTag":false,"chainId":"bech32"}]}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetCurrencyResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetCurrencyResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -119,8 +115,7 @@ describe('Auto Test', () => { * /api/v2/symbols/{symbol} */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetSymbolReq(); - req = req.fromJson(data); + let req = GetSymbolReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -136,8 +131,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"symbol":"BTC-USDT","name":"BTC-USDT","baseCurrency":"BTC","quoteCurrency":"USDT","feeCurrency":"USDT","market":"USDS","baseMinSize":"0.00001","quoteMinSize":"0.1","baseMaxSize":"10000000000","quoteMaxSize":"99999999","baseIncrement":"0.00000001","quoteIncrement":"0.000001","priceIncrement":"0.1","priceLimitRate":"0.1","minFunds":"0.1","isMarginEnabled":true,"enableTrading":true,"feeCategory":1,"makerFeeCoefficient":"1.00","takerFeeCoefficient":"1.00","st":false}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetSymbolResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetSymbolResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -152,8 +146,7 @@ describe('Auto Test', () => { * /api/v2/symbols */ let data = '{"market": "ALTS"}'; - let req = new GetAllSymbolsReq(); - req = req.fromJson(data); + let req = GetAllSymbolsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -169,8 +162,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "name": "BTC-USDT",\n "baseCurrency": "BTC",\n "quoteCurrency": "USDT",\n "feeCurrency": "USDT",\n "market": "USDS",\n "baseMinSize": "0.00001",\n "quoteMinSize": "0.1",\n "baseMaxSize": "10000000000",\n "quoteMaxSize": "99999999",\n "baseIncrement": "0.00000001",\n "quoteIncrement": "0.000001",\n "priceIncrement": "0.1",\n "priceLimitRate": "0.1",\n "minFunds": "0.1",\n "isMarginEnabled": true,\n "enableTrading": true,\n "feeCategory": 1,\n "makerFeeCoefficient": "1.00",\n "takerFeeCoefficient": "1.00",\n "st": false\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetAllSymbolsResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetAllSymbolsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -185,8 +177,7 @@ describe('Auto Test', () => { * /api/v1/market/orderbook/level1 */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetTickerReq(); - req = req.fromJson(data); + let req = GetTickerReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -202,8 +193,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"time":1729172965609,"sequence":"14609309753","price":"67269","size":"0.000025","bestBid":"67267.5","bestBidSize":"0.000025","bestAsk":"67267.6","bestAskSize":"1.24808993"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTickerResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTickerResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -233,8 +223,7 @@ describe('Auto Test', () => { * /api/v1/market/histories */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); + let req = GetTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -250,8 +239,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "sequence": "10976028003549185",\n "price": "67122",\n "size": "0.000025",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549188",\n "price": "67122",\n "size": "0.01792257",\n "side": "buy",\n "time": 1729177117877000000\n },\n {\n "sequence": "10976028003549191",\n "price": "67122.9",\n "size": "0.05654289",\n "side": "buy",\n "time": 1729177117877000000\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -267,8 +255,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "type": "1min", "startAt": 1566703297, "endAt": 1566789757}'; - let req = new GetKlinesReq(); - req = req.fromJson(data); + let req = GetKlinesReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -284,8 +271,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n [\n "1566789720",\n "10411.5",\n "10401.9",\n "10411.5",\n "10396.3",\n "29.11357276",\n "302889.301529914"\n ],\n [\n "1566789660",\n "10416",\n "10411.5",\n "10422.3",\n "10411.5",\n "15.61781842",\n "162703.708997029"\n ],\n [\n "1566789600",\n "10408.6",\n "10416",\n "10416",\n "10405.4",\n "12.45584973",\n "129666.51508559"\n ]\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetKlinesResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetKlinesResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -300,8 +286,7 @@ describe('Auto Test', () => { * /api/v1/market/orderbook/level2_{size} */ let data = '{"symbol": "BTC-USDT", "size": "20"}'; - let req = new GetPartOrderBookReq(); - req = req.fromJson(data); + let req = GetPartOrderBookReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -317,8 +302,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetPartOrderBookResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetPartOrderBookResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -333,8 +317,7 @@ describe('Auto Test', () => { * /api/v3/market/orderbook/level2 */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetFullOrderBookReq(); - req = req.fromJson(data); + let req = GetFullOrderBookReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -350,8 +333,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "time": 1729176273859,\n "sequence": "14610502970",\n "bids": [\n [\n "66976.4",\n "0.69109872"\n ],\n [\n "66976.3",\n "0.14377"\n ]\n ],\n "asks": [\n [\n "66976.5",\n "0.05408199"\n ],\n [\n "66976.8",\n "0.0005"\n ]\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFullOrderBookResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFullOrderBookResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -366,8 +348,7 @@ describe('Auto Test', () => { * /api/v1/prices */ let data = '{"base": "USD", "currencies": "example_string_default_value"}'; - let req = new GetFiatPriceReq(); - req = req.fromJson(data); + let req = GetFiatPriceReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -383,8 +364,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"AGLD":"1.1174410000000001","DFI":"0.0168915500000000","PYTHUP":"0.0397880960000000","ISLM":"0.0606196750000000","NEAR":"4.7185395500000000","AIOZ":"0.4862867350000000","AUDIO":"0.1219390000000000","BBL":"0.0067766100000000","WLD":"2.2893547500000000","HNT":"5.8990489999999984","ETHFI":"1.5892050000000000","DMAIL":"0.2726636000000000","OPUP":"0.0986506500000000","VET3S":"0.0003700448850000","MANA3S":"0.0006056970000000","TIDAL":"0.0001154422500000","HALO":"0.0058270850000000","OPUL":"0.0839480050000000","MANA3L":"0.0029569407900000","DGB":"0.0066556705000000","AA":"0.2406796000000000","BCH":"366.2167999999996484","GMEE":"0.0113333305000000","JST":"0.0302348750000000","PBUX":"0.0208795550000000","AR":"18.5457224999999909","SEI":"0.4332832500000000","PSTAKE":"0.0493153300000000","LMWR":"0.1618190500000000","UNFIDOWN":"0.0062058955000000","BB":"0.3245376500000000","JTO":"2.1239375000000002","WEMIX":"0.7916040000000000","G":"0.0324037900000000","MARSH":"0.0617591050000000","BN":"0.0036961510000000","FLIP":"1.0976509000000000","FLR":"0.0144827550000000","BIGTIME":"0.1238780300000000","FLY":"0.0005157420000000","T":"0.0233483200000000","W":"0.2865566500000000","BDX":"0.0774012800000000","BABYDOGE":"0.0000000029375305","SFP":"0.7256370000000000","DIA":"0.9179408000000000","ISME":"0.0022388800000000","LYM":"0.0010155919500000","VET3L":"0.0000289755050000","JUP":"0.8230882500000000","LYX":"1.4501745500000001","AIEPK":"0.0050094940000000","SILLY":"0.0159420250000000","SCPT":"0.0122038950000000","WOO":"0.1796601250000000","BLUR":"0.2462768000000000","STRK":"0.3963117450000000","BFC":"0.0383608100000000","DC":"0.0003097450500000","KARATE":"0.0007296350000000","SUSHI3L":"0.5115441000000000","NETVR":"0.0976111700000000","WAVES":"1.0806594000000000","LITH":"0.0001520239500000","HAPI":"8.6533711499999987","SUSHI3S":"1.2752620500000000","CEEK":"0.0294852500000000","FLOKI":"0.0001414292500000","SHR":"0.0012463765000000","SAND":"0.2566616050000000","TURT":"0.0020889550000000","UMA":"2.5207390000000000","BEPRO":"0.0003955021500000","SCRT":"0.1995002000000000","TUSD":"0.9945025000000000","COOKIE":"0.0220089900000000","LRDS":"0.6218889000000000","SIN":"0.0033633175000000","OAS":"0.0331933950000000","ROOT":"0.0183108400000000","ADA3L":"0.0046396790000000","TIAUP":"0.1228385500000000","HTR":"0.0353023400000000","UNB":"0.0003837080500000","UNA":"0.0164917500000000","HARD":"0.1087056200000000","G3":"0.0502648550000000","ADA3S":"0.0006191202850000","MYRO":"0.1071863800000000","HTX":"0.0000013693150000","FT":"0.3585206500000000","BTCDOWN":"0.1065467000000000","UNI":"7.3571195999999993","FX":"0.1379310000000000","OBI":"0.0079030465000000","UNO":"0.0137131400000000","WRX":"0.1221389000000000","TIADOWN":"0.0000914642450000","ETHDOWN":"0.1306346500000000","WELL":"0.0471244260000000","SWFTC":"0.0028966509500000","SKL":"0.0362418700000000","UOS":"0.0867765900000000","AIPAD":"0.0478660550000000","BRETT":"0.1037481000000000","SKY":"0.0520139800000000","FRM":"0.0153123400000000","VISION":"0.0014451770500000","LENDS":"0.0047276350000000","SLF":"0.3318340000000000","BULL":"0.0023988000000000","FLOW":"0.5372312500000000","ODDZ":"0.0063368300000000","SLN":"0.2804597000000000","UPO":"0.0440779500000000","SLP":"0.0023997995000000","ID":"0.3718140000000000","SLIM":"0.0906446550000000","SPOT":"0.0021289350000000","DOP":"0.0023028480000000","ISSP":"0.0000874562500000","UQC":"3.2339822000000003","IO":"1.8185902499999999","DOT":"4.2022978000000005","1INCH":"0.2645676500000000","SMH":"0.3448275000000000","MAK":"0.0396701550000000","TOKO":"0.0005923037000000","TURBO":"0.0108085930000000","UNFI":"2.8555714999999996","MAN":"0.0210764565000000","EVER":"0.0332733550000000","FTM":"0.7259068650000000","SHRAP":"0.0476361700000000","MAV":"0.1738130500000000","MAX":"0.2864966800000000","DPR":"0.0018240875000000","FTT":"2.0559715000000002","ARKM":"1.7444273499999999","ATOM":"4.2954512000000002","PENDLE":"4.1554212500000007","QUICK":"0.0365317250000000","BLZ":"0.1217191100000000","BOBA":"0.2014092450000000","MBL":"0.0027856065000000","OFN":"0.1252373500000000","UNIO":"0.0025487250000000","SNS":"0.0200899500000000","SNX":"1.4282854999999999","NXRA":"0.0272763550000000","TAIKO":"1.4392800000000001","AVAX3L":"0.1410875109550000","L3":"0.0608395650000000","API3":"1.3728132500000001","XRP3S":"0.0028095945000000","QKC":"0.0085157400000000","AVAX3S":"0.5148424500000000","ROSE":"0.0693453100000000","SATS":"0.0000002701648500","BMX":"0.3100449000000000","PORTAL":"0.2811593500000000","TOMI":"0.0309045400000000","XRP3L":"2.1586201500000002","SOL":"151.7250995000003583","SON":"0.0002421788500000","BNC":"0.1882058500000000","SOCIAL":"0.0026486750000000","CGPT":"0.1305147100000000","CELR":"0.0127736100000000","BNB":"591.0973035000118935","OGN":"0.0852573500000000","CELO":"0.7711142500000000","AUCTION":"13.1634150000000014","MANTA":"0.7564216000000000","LAYER":"0.0372713550000000","AERO":"1.3783104999999999","CETUS":"0.1808295400000000","LL":"0.0201199350000000","SPA":"0.0067426270000000","PYTHDOWN":"0.0011834080000000","NEIROCTO":"0.0019964013000000","UTK":"0.0365217300000000","GMRX":"0.0007386305000000","BOB":"0.0000380619595000","HOTCROSS":"0.0056491740000000","AERGO":"0.1007595950000000","MOCA":"0.0783608000000000","SQD":"0.0380809500000000","MV":"0.0081359300000000","BNB3L":"0.2761618500000000","BNB3S":"0.0008545725000000","GALAX3L":"0.0057571999600000","KAI":"0.0020080954500000","SQR":"0.0470764500000000","GALAX3S":"0.1933033000000000","EGLD":"25.5272299999999713","ZBCN":"0.0010404795000000","KAS":"0.1216691350000000","MEW":"0.0086176890000000","PUNDIX":"0.4130933500000000","LOOKS":"0.0392803500000000","FXS":"1.9060465000000000","BOSON":"0.2732633000000000","BRISE":"0.0000000860569500","AEVO":"0.3388305000000000","FLUX":"0.5276360500000000","PRCL":"0.1969015000000000","UNFIUP":"0.0011654170000000","SEIDOWN":"0.0442778500000000","DOAI":"0.0052363805000000","QNT":"65.4312679999998206","REDO":"0.2837580500000000","STRIKE":"6.8225869999999997","ETHW":"3.2418782499999998","OM":"1.5396797750000000","OP":"1.6911539999999999","WHALE":"0.8134930500000000","1CAT":"0.0018460765000000","NEON":"0.4446775500000000","GTAI":"0.7786105000000000","SSV":"21.2393749999999841","ETH2":"2601.6678843156403923","KCS":"8.7646155000000020","ARPA":"0.0393882960000000","ARTFI":"0.0141029450000000","BRL":"0.1742807323452485","ALEX":"0.0924537500000000","STG":"0.2943527500000000","SHIB":"0.0000178060925000","IOTX":"0.0394202800000000","OLE":"0.0171414250000000","KDA":"0.5653172000000000","CERE":"0.0022548720000000","DOCK":"0.0018990500000000","STX":"1.8157916500000000","OLT":"0.0007596200000000","QI":"0.0131754090000000","SDAO":"0.2748625000000000","BLAST":"0.0087636160000000","LINK3S":"0.0000702948350000","IOST":"0.0049745115000000","SUI":"2.0589700000000000","CAKE":"1.7941024999999999","BSW":"0.0586706500000000","OMG":"0.2597700500000000","VOLT":"0.0000002716641000","LINK3L":"1.3408292499999999","GEEQ":"0.0385607100000000","PYUSD":"0.9988003500000000","SUN":"0.0186106900000000","TOWER":"0.0014812590000000","BTC":"67133.4165000832051564","IOTA":"0.1189405000000000","REEF":"0.0019960015000000","TRIAS":"3.3683149999999998","KEY":"0.0037594713240047","ETH3L":"0.0003305946200000","BTT":"0.0000009117439000","ONE":"0.0132003965000000","RENDER":"5.2263854999999995","ETH3S":"0.5517240000000000","ANKR":"0.0264867500000000","ALGO":"0.1188405500000000","SYLO":"0.0007600198000000","ZCX":"0.0784707450000000","SD":"0.3851073500000000","ONT":"0.1877960550000000","MJT":"0.0132433750000000","DYM":"1.6659666000000001","DYP":"0.0205397250000000","BAKEUP":"0.0389894955000000","OOE":"0.0079360300000000","ZELIX":"0.0000649675000000","DOGE3L":"0.3837080500000000","ARTY":"0.3980009000000000","QORPO":"0.1204297550000000","ICE":"0.0051504235000000","NOTAI":"0.0000892753400000","DOGE3S":"0.2291853500000000","NAKA":"1.0695649500000000","GALAX":"0.0212893500000000","MKR":"1245.8767500000163833","DODO":"0.1152423500000000","ICP":"7.6731615000000027","ZEC":"35.9400209999999543","ZEE":"0.0065767100000000","ICX":"0.1383308000000000","KMNO":"0.0921499020000000","TT":"0.0033883050000000","DOT3L":"0.1454272500000000","XAI":"0.2038980000000000","ZEN":"8.0149905000000007","DOGE":"0.1213093150000000","ALPHA":"0.0567416150000000","DUSK":"0.1964517250000000","DOT3S":"0.0053613180000000","SXP":"0.2538730000000000","HBAR":"0.0510044850000000","SYNT":"0.0467166300000000","ZEX":"0.0571714000000000","BONDLY":"0.0022208890000000","MLK":"0.2080859050000000","KICKS":"0.0001301249050000","PEPE":"0.0000100249850000","OUSD":"0.9982006500000000","LUNCDOWN":"0.0000733333150000","DOGS":"0.0007086455000000","REV3L":"0.0094672640000000","CTSI":"0.1257371000000000","C98":"0.1219390000000000","OSMO":"0.5370313500000000","NTRN":"0.3869064500000000","CFX2S":"0.0084757600000000","SYN":"0.5636180500000000","VIDT":"0.0308745550000000","SYS":"0.0997501000000000","GAS":"4.3029474500000008","BOME":"0.0087336310000000","COMBO":"0.4068964500000000","XCH":"14.9825050000000010","VR":"0.0063538215000000","CFX2L":"0.0499660045000000","VSYS":"0.0005201398000000","PANDORA":"1629.2949450001102772","THETA":"1.2461766000000000","XCN":"0.0012699647000000","NEXG":"0.0039180400000000","MELOS":"0.0021244372500000","XCV":"0.0013253370000000","ORN":"0.8797599000000000","WLKN":"0.0010624685000000","AAVE":"154.2708259999996162","MNT":"0.6168914000000000","BONK":"0.0000227296295000","PERP":"0.6037979500000000","XDC":"0.0276361750000000","MNW":"0.3681158500000000","XDB":"0.0002578710000000","BOND":"1.5662165000000000","SUIA":"0.0809595000000000","MOG":"0.0000019330330000","SUTER":"0.0001840079500000","TIME":"16.2648634999999969","RACA":"0.0001949025000000","BICO":"0.2021988500000000","MON":"0.1066466500000000","SWEAT":"0.0063718125000000","MOXIE":"0.0022088950000000","BABYBNB":"0.0289755050000000","IGU":"0.0050674650000000","HMSTR":"0.0037990995000000","XEC":"0.0000354722550000","MONI":"0.0058470750000000","XR":"0.2374812000000000","PEOPLE":"0.0796601500000000","PUMLX":"0.0054572700000000","ZIL":"0.0145927000000000","WLDDOWN":"0.2089954500000000","VAI":"0.0799999800000000","XEN":"0.0000000839580000","MPC":"0.1001499000000000","XEM":"0.0176951480000000","JASMY3S":"0.0019670160000000","OTK":"0.0290464695000000","TRAC":"0.4521738000000000","DFYN":"0.0070664650000000","BIDP":"0.0001939030000000","JASMY3L":"0.0001653772700000","INJDOWN":"0.0000194902500000","KLV":"0.0019310340000000","WAXL":"0.7858069000000000","TRBDOWN":"0.0023138425000000","BCH3L":"4.6390663064999996","GMT3S":"0.0000457771000000","KMD":"0.2493752500000000","BCH3S":"0.9634180500000000","ECOX":"0.0987506000000000","AAVE3S":"0.0560719500000000","GMT3L":"0.0053983694650000","EPIK":"0.0045857060000000","SUIP":"0.1067565950000000","AAVE3L":"0.3638687346200000","ZK":"0.1262368500000000","ZKF":"0.0008595700000000","OMNIA":"0.7624186000000000","ZKJ":"1.1124435000000000","ZKL":"0.1255372000000000","GAFI":"3.0634675000000001","CARV":"0.8703646000000000","KNC":"0.4433782000000000","CATS":"0.0000599700000000","PROM":"5.2833570000000006","ALEPH":"0.1756121500000000","PONKE":"0.3958020000000000","OVR":"0.1553223000000000","CATI":"0.4105146400000000","ORDER":"0.1183008200000000","GFT":"0.0166616650000000","BIFI":"0.0020489750000000","GGC":"6.9965029985000000","GGG":"0.0403798000000000","DAPPX":"0.0043788095000000","SUKU":"0.0618790450000000","ULTI":"0.0168015950000000","CREDI":"0.0192903500000000","ERTHA":"0.0010014990000000","FURY":"0.1405297000000000","KARRAT":"0.5577210000000000","MOBILE":"0.0009005495000000","SIDUS":"0.0037671155000000","NAVI":"0.1254672350000000","TAO":"583.4081500000051807","USDJ":"1.1386304000000001","MTL":"0.9563216000000000","VET":"0.0225387250000000","FITFI":"0.0036421780000000","USDT":"0.9995000000000000","OXT":"0.0695652000000000","CANDY":"0.0005597200000000","USDP":"0.9932031500000000","MTS":"0.0027516235000000","TADA":"0.0283858000000000","MTV":"0.0006559718500000","NAVX":"0.1342228550000000","ILV":"35.6771524999999671","VINU":"0.0000000109045450","GHX":"0.0903548000000000","EDU":"0.5167415000000000","HYVE":"0.0137331300000000","BTC3L":"0.0058620675000000","ANYONE":"0.9015490000000000","BEAT":"0.0012593700000000","KING":"0.0004821588000000","CREAM":"15.6541689999999973","CAS":"0.0038590695000000","IMX":"1.4944524000000000","CAT":"0.0000256981445000","BTC3S":"0.0014142925000000","USDE":"0.9985005000000000","USDD":"1.0000997000000000","CWAR":"0.0037981000000000","USDC":"0.9997998500000000","KRL":"0.3543127550000000","INJ":"21.7691100000000194","GAME":"0.0139630150000000","TRIBL":"1.0994500000000000","XLM":"0.0948525500000000","TRBUP":"0.0012293850000000","VRADOWN":"0.0013433280000000","SUPER":"1.2853570000000000","EIGEN":"3.1536223999999999","IOI":"0.0146926500000000","KSM":"17.5212350000000129","CCD":"0.0034832575000000","EGO":"0.0093553200000000","EGP":"2.7946019999999998","MXC":"0.0066866550000000","TEL":"0.0014432780000000","MOVR":"9.1340307000000027","XMR":"155.5421899999990755","MXM":"0.0092853550000000","OORT":"0.1099949750000000","GLM":"0.3231383500000000","RAY":"2.0228880499999998","XTAG":"0.0218190850000000","GLQ":"0.0854572500000000","CWEB":"0.0038480750000000","REVU":"0.0105047450000000","REVV":"0.0039760110000000","ZRO":"3.7952014499999994","XNL":"0.0093853050000000","XNO":"0.8496749500000000","SAROS":"0.0019290350000000","KACE":"2.1165411999999998","ZRX":"0.3186406000000000","WLTH":"0.0374312750000000","ATOM3L":"0.0321719060000000","GMM":"0.0001497251000000","BEER":"0.0000138670630000","GMT":"0.1275362000000000","HEART":"0.0159920000000000","GMX":"22.7186349999999882","ABBC":"0.0061769100000000","OMNI":"8.9235359999999970","ATOM3S":"0.0007945225400000","IRL":"0.0099650150000000","CFG":"0.3248375000000000","WSDM":"0.0139830050000000","GNS":"1.8390800000000001","VANRY":"0.0809295150000000","CFX":"0.1595202000000000","GRAIL":"817.1212349999937891","BEFI":"0.0175712100000000","VELO":"0.0132043945000000","XPR":"0.0008077959000000","DOVI":"0.0584707500000000","ACE":"0.0021349320000000","ACH":"0.0190534685000000","ISP":"0.0012161916000000","XCAD":"0.2834582000000000","MINA":"0.5630183500000000","TIA":"5.9318325999999999","DRIFT":"0.4350823500000000","ACQ":"0.0056981495000000","ACS":"0.0014917537500000","MIND":"0.0018920535000000","STORE":"0.0062358805000000","REN":"0.0351224300000000","ELA":"1.7282354500000000","DREAMS":"0.0002498750000000","ADA":"0.3463267500000000","ELF":"0.3777110500000000","REQ":"0.0959919800000000","STORJ":"0.5662167500000000","LADYS":"0.0000000837581000","PAXG":"2697.9303600003123340","REZ":"0.0409795000000000","XRD":"0.0157821050000000","CHO":"0.0205097400000000","CHR":"0.1769115000000000","ADS":"0.1889055000000000","CHZ":"0.0738030800000000","ADX":"0.1575212000000000","XRP":"0.5525036100000000","JASMY":"0.0188615645000000","KAGI":"0.1834582250000000","FIDA":"0.2282858000000000","PBR":"0.0291953950000000","AEG":"0.0093453250000000","H2O":"0.1610194500000000","CHMB":"0.0001715641750000","SAND3L":"0.0015447972150000","PBX":"0.0006879558500000","SOLVE":"0.0084557700000000","DECHAT":"0.1512243500000000","GARI":"0.0076861550000000","SHIB2L":"1.1996998499999999","SHIB2S":"0.0240879500000000","ENA":"0.3942028000000000","VEMP":"0.0029335325000000","ENJ":"0.1467266000000000","AFG":"0.0072163900000000","RATS":"0.0001211593900000","GRT":"0.1646076550000000","FORWARD":"0.0012873560000000","TFUEL":"0.0598800450000000","ENS":"17.0634640000000052","KASDOWN":"0.0258770550000000","XTM":"0.0251074400000000","DEGEN":"0.0084857550000000","TLM":"0.0100449750000000","DYDXDOWN":"0.1042598440000000","CKB":"0.0146026950000000","LUNC":"0.0000889255150000","AURORA":"0.1204397500000000","LUNA":"0.3624187000000000","XTZ":"0.6776610000000000","ELON":"0.0000001410294500","DMTR":"0.0891554000000000","EOS":"0.4759619000000000","GST":"0.0118940500000000","FORT":"0.1155422000000000","FLAME":"0.0247076400000000","PATEX":"0.9605195000000000","DEEP":"0.0328885475000000","ID3L":"0.0016201895000000","GTC":"0.6625685500000000","ID3S":"0.0071674145000000","RIO":"0.7616190000000000","CLH":"0.0008555720000000","BURGER":"0.4016990500000000","VRA":"0.0029765110000000","SUNDOG":"0.2173912500000000","GTT":"0.0002038980000000","INJUP":"0.2327835500000000","CPOOL":"0.1557720750000000","EPX":"0.0000740629500000","CLV":"0.0329835000000000","FEAR":"0.0560519600000000","MEME":"0.0124847545000000","ROOBEE":"0.0004520738500000","DEFI":"0.0192903500000000","TOKEN":"0.0477361200000000","GRAPE":"0.0020599695000000","KASUP":"0.3996001000000000","XWG":"0.0003843077500000","SKEY":"0.0621289200000000","SFUND":"1.3243375000000000","EQX":"0.0032823580000000","ORDIUP":"0.0548315705000000","TON":"5.1857058499999995","DEGO":"2.2667660500000001","IZI":"0.0088455750000000","ERG":"0.6605695500000000","ERN":"1.9255367500000001","VENOM":"0.0817591000000000","VOXEL":"0.1497251000000000","RLC":"1.4649671500000000","PHA":"0.1093453000000000","DYDXUP":"0.0112573685000000","APE3S":"0.0008475760000000","ORBS":"0.0288955450000000","OPDOWN":"0.6758619000000000","ESE":"0.0139130400000000","APE3L":"0.1339330000000000","HMND":"0.0982208650000000","COQ":"0.0000014432780000","AURY":"0.3340329000000000","CULT":"0.0000028025980000","AKT":"2.4642672500000001","GLMR":"0.1606196500000000","XYM":"0.0142528700000000","ORAI":"6.1769100000000012","XYO":"0.0058680645000000","ETC":"18.8458723500000169","LAI":"0.0142828550000000","PIP":"0.0178310800000000","ETH":"2607.6655149998362673","NEO":"10.3575186499999991","RMV":"0.0081659150000000","KLAY":"0.1251374000000000","PIT":"0.0000000003268365","TARA":"0.0043978000000000","KALT":"0.1128735350000000","PIX":"0.0001023687900000","ETN":"0.0021579205000000","CSIX":"0.0141729100000000","TRADE":"0.4708644500000000","MAVIA":"1.3592200500000001","HIGH":"1.3043474999999999","TRB":"62.5387150000000006","ORDI":"35.7421200000000126","TRVL":"0.0373643085000000","AMB":"0.0059670150000000","TRU":"0.0762018800000000","LOGX":"0.0271963950000000","FINC":"0.0362018900000000","INFRA":"0.1978010500000000","NATIX":"0.0008729633000000","NFP":"0.2152923000000000","TRY":"0.0292166033323590","TRX":"0.1597201000000000","LBP":"0.0001243378000000","LBR":"0.0595702000000000","EUL":"2.9735125000000000","NFT":"0.0000004077960000","SEIUP":"0.0478110825000000","PUFFER":"0.3676161000000000","EUR":"1.0811249323958897","ORCA":"2.0664662499999999","NEAR3L":"0.0117010765350000","AMP":"0.0038330825000000","XDEFI":"0.0472563600000000","HIFI":"0.4947525000000000","TRUF":"0.0459570100000000","AITECH":"0.1045477000000000","AMU":"0.0043978000000000","USTC":"0.0214692600000000","KNGL":"0.0499750000000000","FOXY":"0.0102686631000000","NGC":"0.0147935995000000","TENET":"0.0043278350000000","NEAR3S":"0.0072553705000000","MAHA":"1.1904045000000000","NGL":"0.0701748950000000","TST":"0.0080359800000000","HIPPO":"0.0104447750000000","AXS3S":"0.0308705570000000","CRO":"0.0781409100000000","ZPAY":"0.0050574700000000","MNDE":"0.1026786350000000","CRV":"0.2534732000000000","SWASH":"0.0056271850000000","AXS3L":"0.0106388779000000","VERSE":"0.0001803098000000","RPK":"0.0049975000000000","RPL":"10.9745099999999958","AZERO":"0.3789104500000000","SOUL":"0.0534332700000000","VXV":"0.2619689500000000","LDO":"1.0885554500000000","MAGIC":"0.3390304000000000","ALICE":"1.0324835000000000","SEAM":"1.1933030499999999","PLU":"1.9300345000000001","AOG":"0.0031224380000000","SMOLE":"0.0000387806000000","EWT":"1.1094450000000000","TSUGT":"0.0029185400000000","PMG":"0.0800599500000000","OPAI":"0.0006826585000000","LOCUS":"0.0216591650000000","CTA":"0.0825087250000000","NIM":"0.0013673160000000","CTC":"0.4033982000000000","APE":"0.7035480500000000","MERL":"0.2720639000000000","JAM":"0.0004770613500000","CTI":"0.0130314810000000","APP":"0.0021989000000000","APT":"9.9947001500000000","WLDUP":"0.0093043455000000","ZEND":"0.1280759300000000","FIRE":"0.9113441000000000","DENT":"0.0008630682500000","PYTH":"0.3390603850000000","LFT":"0.0155322300000000","DPET":"0.0319040400000000","ORDIDOWN":"0.3788105000000000","KPOL":"0.0029175405000000","ETHUP":"8.4971493000000032","BAND":"1.0939527500000001","POL":"0.3656171000000000","ASTR":"0.0582608550000000","NKN":"0.0691654000000000","RSR":"0.0068055955000000","DVPN":"0.0005979009000000","TWT":"1.1119437500000000","ARB":"0.5510243500000000","CVC":"0.1409801746501747","ARC":"0.0300849500000000","XETA":"0.0022888550000000","MTRG":"0.4007995000000000","LOKA":"0.1867066000000000","LPOOL":"0.0660069800000000","TURBOS":"0.0034812585000000","CVX":"1.7816087499999999","ARX":"0.0007556220000000","MPLX":"0.4355221300000000","SUSHI":"0.7011492500000000","NLK":"0.0114442750000000","PEPE2":"0.0000000313843000","WBTC":"66881.4425499645548419","SUI3L":"0.0211204345000000","CWS":"0.1927036000000000","SUI3S":"0.0000579110300000","INSP":"0.0264167850000000","MANA":"0.2945026750000000","VRTX":"0.0641679000000000","CSPR":"0.0116441750000000","ATA":"0.0785007300000000","OPEN":"0.0080049955000000","HAI":"0.0448275750000000","NMR":"14.7436245000000072","ATH":"0.0540929400000000","LIT":"0.6282857000000000","TLOS":"0.3263467450000000","TNSR":"0.3662168000000000","CXT":"0.0871364100000000","POLYX":"0.2346826000000000","ZERO":"0.0002507745500000","ROUTE":"0.0610694500000000","LOOM":"0.0580009850000000","PRE":"0.0078680640000000","VRAUP":"0.0134652640000000","HBB":"0.0714742450000000","RVN":"0.0165017450000000","PRQ":"0.0715741950000000","ONDO":"0.7134930750000000","PEPEDOWN":"0.0000155022450000","WOOP":"0.0020179905000000","LUNCUP":"0.0168355780000000","KAVA":"0.3522238000000000","LKI":"0.0104187880000000","AVA":"0.4857570000000000","NOM":"0.0233883000000000","MAPO":"0.0089015470000000","PEPEUP":"0.0114252845000000","STRAX":"0.0487156300000000","NOT":"0.0078670645000000","ZERC":"0.1108245600000000","BCUT":"0.0255672100000000","MASA":"0.0691354150000000","WAN":"0.1785077544737212","WAT":"0.0003273762300000","WAX":"0.0327636100000000","MASK":"2.2259864500000002","EOS3L":"0.0002122138400000","IDEA":"0.0005887055000000","EOS3S":"0.0034472755000000","YFI":"4919.4290549999908843","MOODENG":"0.0774612500000000","XCUR":"0.0048845565000000","HYDRA":"0.2225886500000000","POPCAT":"1.3382305500000000","LQTY":"0.7848074000000000","PIXEL":"0.1406596350000000","LMR":"0.0145437245000000","ZETA":"0.5997999500000000","YGG":"0.4717640000000000","AXS":"4.6006985000000006","BCHSV":"49.8250749999999370","NRN":"0.0395802000000000","FTON":"0.0091954000000000","COMP":"43.6581599999999881","XPRT":"0.1819090000000000","HFT":"0.1443278000000000","UXLINK":"0.5085456000000000","STAMP":"0.0335032400000000","RUNE":"4.9233370999999996","ZEUS":"0.2587705500000000","LTC3L":"1.8294848000000001","DAPP":"0.1763118000000000","FORTH":"2.9508238500000004","ALPINE":"1.5322335000000000","SENSO":"0.0328835500000000","LTC3S":"0.0006986505000000","DEXE":"8.3795081500000028","GOAL":"0.0175912000000000","AVAX":"27.5602130000000058","LISTA":"0.3782108000000000","AMPL":"1.3743124999999999","WORK":"0.1384307500000000","BRWL":"0.0017391300000000","BANANA":"57.1314200000001362","PUSH":"0.0750624500000000","WEN":"0.0001015492000000","NEIRO":"0.0879560000000000","BTCUP":"34.7711057499999789","SOL3S":"0.0007816090000000","BRAWL":"0.0004776610500000","LAY3R":"0.2161918500000000","LPT":"11.9304317999999945","GODS":"0.1807096000000000","SAND3S":"4.6152911999999992","RDNT":"0.0640679500000000","SOL3L":"1.8351913752850000","NIBI":"0.0653772950000000","NUM":"0.0436181800000000","PYR":"2.5590198499999997","DAG":"0.0226176855000000","DAI":"0.9989006596042375","HIP":"0.0034982500000000","DAO":"0.2848575000000000","AVAIL":"0.1300929210000000","DAR":"0.1512243500000000","FET":"1.3760116500000000","FCON":"0.0001197600900000","XAVA":"0.3789104500000000","LRC":"0.1208395500000000","UNI3S":"0.0000653573050000","PZP":"0.0599600050000000","POKT":"0.0424787500000000","DASH":"23.6881500000000109","BAKEDOWN":"0.0003324636850000","POLC":"0.0061389290000000","DBR":"0.0377671070000000","CIRUS":"0.0055772100000000","UNI3L":"0.0993921490650000","NWC":"0.0681659000000000","POLK":"0.0142628650000000","LSD":"0.9420287500000000","MARS4":"0.0005878059500000","LSK":"0.8080957500000000","BLOCK":"0.0261869000000000","ANALOS":"0.0000446776500000","SAFE":"0.8779608000000000","DCK":"0.0234082900000000","LSS":"0.0562718500000000","DCR":"12.4337799999999929","LIKE":"0.0559720000000000","DATA":"0.0361819000000000","WIF":"2.5696145499999999","BLOK":"0.0006546725000000","LTC":"71.6261690000000611","METIS":"42.0289750000000612","WIN":"0.0000868365600000","HLG":"0.0018790600000000","LTO":"0.1166116650000000","DYDX":"0.9341327000000000","ARB3S":"0.0509025360000000","MUBI":"0.0303848000000000","ARB3L":"0.0025917035000000","RBTC1":"0.0000039480250000","POND":"0.0118640650000000","LINA":"0.0037771105000000","MYRIA":"0.0025337325000000","LINK":"11.0244849999999944","QTUM":"2.4262016723130069","TUNE":"0.0148025950000000","UFO":"0.0000006479758500","CYBER":"2.8755615000000001","WILD":"0.2433782500000000","POLS":"0.2809594500000000","NYM":"0.0719640000000000","FIL":"3.6786597500000005","BAL":"2.0099945000000000","SCA":"0.3999999000000000","STND":"0.0133123405000000","WMTX":"0.2138930000000000","SCLP":"0.1545227000000000","MANEKI":"0.0073963000000000","BAT":"0.1721139000000000","AKRO":"0.0042302838000000","FTM3L":"8.2574692000000024","BAX":"0.0000709645000000","FTM3S":"0.0000255072400000","COTI":"0.0951524000000000"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetFiatPriceResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetFiatPriceResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -399,8 +379,7 @@ describe('Auto Test', () => { * /api/v1/market/stats */ let data = '{"symbol": "BTC-USDT"}'; - let req = new Get24hrStatsReq(); - req = req.fromJson(data); + let req = Get24hrStatsReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -416,8 +395,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"time":1729175612158,"symbol":"BTC-USDT","buy":"66982.4","sell":"66982.5","changeRate":"-0.0114","changePrice":"-778.1","high":"68107.7","low":"66683.3","vol":"1738.02898182","volValue":"117321982.415978333","last":"66981.5","averagePrice":"67281.21437289","takerFeeRate":"0.001","makerFeeRate":"0.001","takerCoefficient":"1","makerCoefficient":"1"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new Get24hrStatsResp(); - resp = resp.fromObject(commonResp.data); + let resp = Get24hrStatsResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/spot/order/api_order.test.ts b/sdk/node/src/generate/spot/order/api_order.test.ts index e6e2c35c..ee61bbfd 100644 --- a/sdk/node/src/generate/spot/order/api_order.test.ts +++ b/sdk/node/src/generate/spot/order/api_order.test.ts @@ -102,8 +102,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderReq(); - req = req.fromJson(data); + let req = AddOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -119,8 +118,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -136,8 +134,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; - let req = new AddOrderSyncReq(); - req = req.fromJson(data); + let req = AddOrderSyncReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -153,8 +150,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"orderId":"67111a7cb7cbdf000703e1f6","clientOid":"5c52e11203aa677f33e493f","orderTime":1729174140586,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729174140588}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderSyncResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderSyncResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -170,8 +166,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493f", "remark": "order remarks"}'; - let req = new AddOrderTestReq(); - req = req.fromJson(data); + let req = AddOrderTestReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -187,8 +182,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -204,8 +198,7 @@ describe('Auto Test', () => { */ let data = '{"orderList": [{"clientOid": "client order id 12", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 13", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; - let req = new BatchAddOrdersReq(); - req = req.fromJson(data); + let req = BatchAddOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -221,8 +214,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "orderId": "6710d8336afcdb0007319c27",\n "clientOid": "client order id 12",\n "success": true\n },\n {\n "success": false,\n "failMsg": "The order funds should more then 0.1 USDT."\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchAddOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -238,8 +230,7 @@ describe('Auto Test', () => { */ let data = '{"orderList": [{"clientOid": "client order id 13", "symbol": "BTC-USDT", "type": "limit", "side": "buy", "price": "30000", "size": "0.00001"}, {"clientOid": "client order id 14", "symbol": "ETH-USDT", "type": "limit", "side": "sell", "price": "2000", "size": "0.00001"}]}'; - let req = new BatchAddOrdersSyncReq(); - req = req.fromJson(data); + let req = BatchAddOrdersSyncReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -255,8 +246,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":[{"orderId":"6711195e5584bc0007bd5aef","clientOid":"client order id 13","orderTime":1729173854299,"originSize":"0.00001","dealSize":"0","remainSize":"0.00001","canceledSize":"0","status":"open","matchTime":1729173854326,"success":true},{"success":false,"failMsg":"The order funds should more then 0.1 USDT."}]}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersSyncResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchAddOrdersSyncResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -271,8 +261,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/{orderId} */ let data = '{"orderId": "671124f9365ccb00073debd4", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdReq(); - req = req.fromJson(data); + let req = CancelOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -288,8 +277,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671124f9365ccb00073debd4"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -304,8 +292,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/sync/{orderId} */ let data = '{"orderId": "671128ee365ccb0007534d45", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByOrderIdSyncReq(); - req = req.fromJson(data); + let req = CancelOrderByOrderIdSyncReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -321,8 +308,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "671128ee365ccb0007534d45",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdSyncResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByOrderIdSyncResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -337,8 +323,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/client-order/{clientOid} */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -353,8 +338,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -369,8 +353,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/sync/client-order/{clientOid} */ let data = '{"clientOid": "5c52e11203aa677f33e493fb", "symbol": "BTC-USDT"}'; - let req = new CancelOrderByClientOidSyncReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidSyncReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -386,8 +369,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "clientOid": "5c52e11203aa677f33e493fb",\n "originSize": "0.00001",\n "dealSize": "0",\n "remainSize": "0",\n "canceledSize": "0.00001",\n "status": "done"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidSyncResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidSyncResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -403,8 +385,7 @@ describe('Auto Test', () => { */ let data = '{"orderId": "6711f73c1ef16c000717bb31", "symbol": "BTC-USDT", "cancelSize": "0.00001"}'; - let req = new CancelPartialOrderReq(); - req = req.fromJson(data); + let req = CancelPartialOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -420,8 +401,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "6711f73c1ef16c000717bb31",\n "cancelSize": "0.00001"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelPartialOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelPartialOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -436,8 +416,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders */ let data = '{"symbol": "BTC-USDT"}'; - let req = new CancelAllOrdersBySymbolReq(); - req = req.fromJson(data); + let req = CancelAllOrdersBySymbolReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -452,8 +431,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":"success"}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelAllOrdersBySymbolResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelAllOrdersBySymbolResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -484,8 +462,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; - let req = new ModifyOrderReq(); - req = req.fromJson(data); + let req = ModifyOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -501,8 +478,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"newOrderId":"67112258f9406e0007408827","clientOid":"client order id 12"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new ModifyOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = ModifyOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -517,8 +493,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/{orderId} */ let data = '{"symbol": "BTC-USDT", "orderId": "6717422bd51c29000775ea03"}'; - let req = new GetOrderByOrderIdReq(); - req = req.fromJson(data); + let req = GetOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -534,8 +509,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -550,8 +524,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/client-order/{clientOid} */ let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e493fb"}'; - let req = new GetOrderByClientOidReq(); - req = req.fromJson(data); + let req = GetOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -567,8 +540,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -598,8 +570,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/active */ let data = '{"symbol": "BTC-USDT"}'; - let req = new GetOpenOrdersReq(); - req = req.fromJson(data); + let req = GetOpenOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -615,8 +586,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "67120bbef094e200070976f6",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0.5",\n "dealSize": "0",\n "dealFunds": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": "order tags",\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": true,\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "remainSize": "0.00001",\n "remainFunds": "0.5",\n "tax": "0",\n "active": true,\n "createdAt": 1729235902748,\n "lastUpdatedAt": 1729235909862\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOpenOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOpenOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -632,8 +602,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 20, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetClosedOrdersReq(); - req = req.fromJson(data); + let req = GetClosedOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -649,8 +618,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "lastId": 19814995255305,\n "items": [\n {\n "id": "6717422bd51c29000775ea03",\n "clientOid": "5c52e11203aa677f33e493fb",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "70000",\n "size": "0.00001",\n "funds": "0.7",\n "dealSize": "0.00001",\n "dealFunds": "0.677176",\n "remainSize": "0",\n "remainFunds": "0.022824",\n "cancelledSize": "0",\n "cancelledFunds": "0",\n "fee": "0.000677176",\n "feeCurrency": "USDT",\n "stp": null,\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "remark": "order remarks",\n "tags": null,\n "cancelExist": false,\n "tradeType": "TRADE",\n "inOrderBook": false,\n "active": false,\n "tax": "0",\n "createdAt": 1729577515444,\n "lastUpdatedAt": 1729577515481\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetClosedOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetClosedOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -666,8 +634,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "lastId": 254062248624417, "limit": 100, "startAt": 1728663338000, "endAt": 1728692138000}'; - let req = new GetTradeHistoryReq(); - req = req.fromJson(data); + let req = GetTradeHistoryReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -683,8 +650,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "items": [\n {\n "id": 19814995255305,\n "orderId": "6717422bd51c29000775ea03",\n "counterOrderId": "67174228135f9e000709da8c",\n "tradeId": 11029373945659392,\n "symbol": "BTC-USDT",\n "side": "buy",\n "liquidity": "taker",\n "type": "limit",\n "forceTaker": false,\n "price": "67717.6",\n "size": "0.00001",\n "funds": "0.677176",\n "fee": "0.000677176",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "taxRate": "0",\n "tax": "0",\n "createdAt": 1729577515473\n }\n ],\n "lastId": 19814995255305\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -714,8 +680,7 @@ describe('Auto Test', () => { * /api/v1/hf/orders/dead-cancel-all */ let data = '{"timeout": 5, "symbols": "BTC-USDT,ETH-USDT"}'; - let req = new SetDCPReq(); - req = req.fromJson(data); + let req = SetDCPReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -730,8 +695,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"currentTime":1729656588,"triggerTime":1729656593}}'; let commonResp = RestResponse.fromJson(data); - let resp = new SetDCPResp(); - resp = resp.fromObject(commonResp.data); + let resp = SetDCPResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -747,8 +711,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddStopOrderReq(); - req = req.fromJson(data); + let req = AddStopOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -764,8 +727,7 @@ describe('Auto Test', () => { let data = '{"code":"200000","data":{"orderId":"670fd33bf9406e0007ab3945","clientOid":"5c52e11203aa677f33e493fb"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddStopOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddStopOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -780,8 +742,7 @@ describe('Auto Test', () => { * /api/v1/stop-order/cancelOrderByClientOid */ let data = '{"symbol": "BTC-USDT", "clientOid": "689ff597f4414061aa819cc414836abd"}'; - let req = new CancelStopOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelStopOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -797,8 +758,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "vs8hoo8ksc8mario0035a74n",\n "clientOid": "689ff597f4414061aa819cc414836abd"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelStopOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelStopOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -813,8 +773,7 @@ describe('Auto Test', () => { * /api/v1/stop-order/{orderId} */ let data = '{"orderId": "671124f9365ccb00073debd4"}'; - let req = new CancelStopOrderByOrderIdReq(); - req = req.fromJson(data); + let req = CancelStopOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -830,8 +789,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelStopOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelStopOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -847,8 +805,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "example_string_default_value", "tradeType": "example_string_default_value", "orderIds": "example_string_default_value"}'; - let req = new BatchCancelStopOrderReq(); - req = req.fromJson(data); + let req = BatchCancelStopOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -864,8 +821,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "671124f9365ccb00073debd4"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelStopOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchCancelStopOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -881,8 +837,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "orderId": "670fd33bf9406e0007ab3945", "newPrice": "30000", "newSize": "0.0001"}'; - let req = new GetStopOrdersListReq(); - req = req.fromJson(data); + let req = GetStopOrdersListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -898,8 +853,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "vs8hoo8kqjnklv4m0038lrfq",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "404814a0fb4311eb9098acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1628755183702150100,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1628755183704,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrdersListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetStopOrdersListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -914,8 +868,7 @@ describe('Auto Test', () => { * /api/v1/stop-order/{orderId} */ let data = '{"orderId": "example_string_default_value"}'; - let req = new GetStopOrderByOrderIdReq(); - req = req.fromJson(data); + let req = GetStopOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -931,8 +884,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "vs8hoo8q2ceshiue003b67c0",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "40e0eb9efe6311eb8e58acde48001122",\n "remark": null,\n "tags": null,\n "orderTime": 1629098781127530200,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629098781128,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "10.00000000000000000000"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetStopOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -948,8 +900,7 @@ describe('Auto Test', () => { */ let data = '{"clientOid": "example_string_default_value", "symbol": "example_string_default_value"}'; - let req = new GetStopOrderByClientOidReq(); - req = req.fromJson(data); + let req = GetStopOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -965,8 +916,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "vs8hoo8os561f5np0032vngj",\n "symbol": "KCS-USDT",\n "userId": "60fe4956c43cbc0006562c2c",\n "status": "NEW",\n "type": "limit",\n "side": "buy",\n "price": "0.01000000000000000000",\n "size": "0.01000000000000000000",\n "funds": null,\n "stp": null,\n "timeInForce": "GTC",\n "cancelAfter": -1,\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "clientOid": "2b700942b5db41cebe578cff48960e09",\n "remark": null,\n "tags": null,\n "orderTime": 1629020492834532600,\n "domainId": "kucoin",\n "tradeSource": "USER",\n "tradeType": "TRADE",\n "feeCurrency": "USDT",\n "takerFeeRate": "0.00200000000000000000",\n "makerFeeRate": "0.00200000000000000000",\n "createdAt": 1629020492837,\n "stop": "loss",\n "stopTriggerTime": null,\n "stopPrice": "1.00000000000000000000"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetStopOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetStopOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -982,8 +932,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "side": "buy", "price": "94000", "size": "0.1", "clientOid": "5c52e11203aa67f1e493fb", "stopPrice": "98000", "limitPrice": "96000", "remark": "this is remark", "tradeType": "TRADE"}'; - let req = new AddOcoOrderReq(); - req = req.fromJson(data); + let req = AddOcoOrderReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -998,8 +947,7 @@ describe('Auto Test', () => { */ let data = '{"code":"200000","data":{"orderId":"674c316e688dea0007c7b986"}}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOcoOrderResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOcoOrderResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1014,8 +962,7 @@ describe('Auto Test', () => { * /api/v3/oco/order/{orderId} */ let data = '{"orderId": "674c316e688dea0007c7b986"}'; - let req = new CancelOcoOrderByOrderIdReq(); - req = req.fromJson(data); + let req = CancelOcoOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1031,8 +978,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6kkmkk57003gok16",\n "vs93gpqc6kkmkk57003gok17"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOcoOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOcoOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1047,8 +993,7 @@ describe('Auto Test', () => { * /api/v3/oco/client-order/{clientOid} */ let data = '{"clientOid": "5c52e11203aa67f1e493fb"}'; - let req = new CancelOcoOrderByClientOidReq(); - req = req.fromJson(data); + let req = CancelOcoOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1064,8 +1009,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc6r0mkk57003gok3h",\n "vs93gpqc6r0mkk57003gok3i"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOcoOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOcoOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1081,8 +1025,7 @@ describe('Auto Test', () => { */ let data = '{"orderIds": "674c388172cf2800072ee746,674c38bdfd8300000795167e", "symbol": "BTC-USDT"}'; - let req = new BatchCancelOcoOrdersReq(); - req = req.fromJson(data); + let req = BatchCancelOcoOrdersReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1098,8 +1041,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "vs93gpqc750mkk57003gok6i",\n "vs93gpqc750mkk57003gok6j",\n "vs93gpqc75c39p83003tnriu",\n "vs93gpqc75c39p83003tnriv"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelOcoOrdersResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchCancelOcoOrdersResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1114,8 +1056,7 @@ describe('Auto Test', () => { * /api/v3/oco/order/{orderId} */ let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; - let req = new GetOcoOrderByOrderIdReq(); - req = req.fromJson(data); + let req = GetOcoOrderByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1131,8 +1072,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOcoOrderByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1147,8 +1087,7 @@ describe('Auto Test', () => { * /api/v3/oco/client-order/{clientOid} */ let data = '{"clientOid": "5c52e1203aa6f3g7f1e493fb"}'; - let req = new GetOcoOrderByClientOidReq(); - req = req.fromJson(data); + let req = GetOcoOrderByClientOidReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1164,8 +1103,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderByClientOidResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOcoOrderByClientOidResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1180,8 +1118,7 @@ describe('Auto Test', () => { * /api/v3/oco/order/details/{orderId} */ let data = '{"orderId": "674c3b6e688dea0007c7bab2"}'; - let req = new GetOcoOrderDetailByOrderIdReq(); - req = req.fromJson(data); + let req = GetOcoOrderDetailByOrderIdReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1197,8 +1134,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "674c3b6e688dea0007c7bab2",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f37f1e493fb",\n "orderTime": 1733049198863,\n "status": "NEW",\n "orders": [\n {\n "id": "vs93gpqc7dn6h3fa003sfelj",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "94000.00000000000000000000",\n "stopPrice": "94000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n },\n {\n "id": "vs93gpqc7dn6h3fa003sfelk",\n "symbol": "BTC-USDT",\n "side": "buy",\n "price": "96000.00000000000000000000",\n "stopPrice": "98000.00000000000000000000",\n "size": "0.10000000000000000000",\n "status": "NEW"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderDetailByOrderIdResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOcoOrderDetailByOrderIdResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1214,8 +1150,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "startAt": 123456, "endAt": 123456, "orderIds": "example_string_default_value", "pageSize": 50, "currentPage": 1}'; - let req = new GetOcoOrderListReq(); - req = req.fromJson(data); + let req = GetOcoOrderListReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1231,8 +1166,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "orderId": "674c3cfa72cf2800072ee7ce",\n "symbol": "BTC-USDT",\n "clientOid": "5c52e1203aa6f3g7f1e493fb",\n "orderTime": 1733049594803,\n "status": "NEW"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOcoOrderListResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOcoOrderListResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1248,8 +1182,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderOldReq(); - req = req.fromJson(data); + let req = AddOrderOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1265,8 +1198,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "674a8635b38d120007709c0f"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1282,8 +1214,7 @@ describe('Auto Test', () => { */ let data = '{"type": "limit", "symbol": "BTC-USDT", "side": "buy", "price": "50000", "size": "0.00001", "clientOid": "5c52e11203aa677f33e493fb", "remark": "order remarks"}'; - let req = new AddOrderTestOldReq(); - req = req.fromJson(data); + let req = AddOrderTestOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1299,8 +1230,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "orderId": "674a8776291d9e00074f1edf"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new AddOrderTestOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = AddOrderTestOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1316,8 +1246,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "orderList": [{"clientOid": "3d07008668054da6b3cb12e432c2b13a", "side": "buy", "type": "limit", "price": "50000", "size": "0.0001"}, {"clientOid": "37245dbe6e134b5c97732bfb36cd4a9d", "side": "buy", "type": "limit", "price": "49999", "size": "0.0001"}]}'; - let req = new BatchAddOrdersOldReq(); - req = req.fromJson(data); + let req = BatchAddOrdersOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1333,8 +1262,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "data": [\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dfef434f0007efc431",\n "status": "success",\n "failMsg": null,\n "clientOid": "3d07008668054da6b3cb12e432c2b13a"\n },\n {\n "symbol": "BTC-USDT",\n "type": "limit",\n "side": "buy",\n "price": "49999",\n "size": "0.0001",\n "funds": null,\n "stp": "",\n "stop": "",\n "stopPrice": null,\n "timeInForce": "GTC",\n "cancelAfter": 0,\n "postOnly": false,\n "hidden": false,\n "iceberge": false,\n "iceberg": false,\n "visibleSize": null,\n "channel": "API",\n "id": "674a97dffb378b00077b9c20",\n "status": "fail",\n "failMsg": "Balance insufficient!",\n "clientOid": "37245dbe6e134b5c97732bfb36cd4a9d"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchAddOrdersOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchAddOrdersOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1349,8 +1277,7 @@ describe('Auto Test', () => { * /api/v1/orders/{orderId} */ let data = '{"symbol": "BTC-USDT", "orderId": "674a97dfef434f0007efc431"}'; - let req = new CancelOrderByOrderIdOldReq(); - req = req.fromJson(data); + let req = CancelOrderByOrderIdOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1366,8 +1293,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a97dfef434f0007efc431"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByOrderIdOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByOrderIdOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1382,8 +1308,7 @@ describe('Auto Test', () => { * /api/v1/order/client-order/{clientOid} */ let data = '{"symbol": "BTC-USDT", "clientOid": "5c52e11203aa677f33e4923fb"}'; - let req = new CancelOrderByClientOidOldReq(); - req = req.fromJson(data); + let req = CancelOrderByClientOidOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1399,8 +1324,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderId": "674a9a872033a50007e2790d",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "cancelledOcoOrderIds": null\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new CancelOrderByClientOidOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = CancelOrderByClientOidOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1415,8 +1339,7 @@ describe('Auto Test', () => { * /api/v1/orders */ let data = '{"symbol": "BTC-USDT", "tradeType": "TRADE"}'; - let req = new BatchCancelOrderOldReq(); - req = req.fromJson(data); + let req = BatchCancelOrderOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1432,8 +1355,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "cancelledOrderIds": [\n "674a8635b38d120007709c0f",\n "674a8630439c100007d3bce1"\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new BatchCancelOrderOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = BatchCancelOrderOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1449,8 +1371,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "status": "active", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 123456, "endAt": 123456, "currentPage": 1, "pageSize": 50}'; - let req = new GetOrdersListOldReq(); - req = req.fromJson(data); + let req = GetOrdersListOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1466,8 +1387,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrdersListOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrdersListOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1482,8 +1402,7 @@ describe('Auto Test', () => { * /api/v1/limit/orders */ let data = '{"currentPage": 1, "pageSize": 50}'; - let req = new GetRecentOrdersListOldReq(); - req = req.fromJson(data); + let req = GetRecentOrdersListOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1499,8 +1418,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "id": "674a9a872033a50007e2790d",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.00001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "5c52e11203aa677f33e4923fb",\n "remark": "order remarks",\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732942471752,\n "tradeType": "TRADE"\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentOrdersListOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRecentOrdersListOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1515,8 +1433,7 @@ describe('Auto Test', () => { * /api/v1/orders/{orderId} */ let data = '{"orderId": "674a97dfef434f0007efc431"}'; - let req = new GetOrderByOrderIdOldReq(); - req = req.fromJson(data); + let req = GetOrderByOrderIdOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1532,8 +1449,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByOrderIdOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByOrderIdOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1548,8 +1464,7 @@ describe('Auto Test', () => { * /api/v1/order/client-order/{clientOid} */ let data = '{"clientOid": "3d07008668054da6b3cb12e432c2b13a"}'; - let req = new GetOrderByClientOidOldReq(); - req = req.fromJson(data); + let req = GetOrderByClientOidOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1565,8 +1480,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "id": "674a97dfef434f0007efc431",\n "symbol": "BTC-USDT",\n "opType": "DEAL",\n "type": "limit",\n "side": "buy",\n "price": "50000",\n "size": "0.0001",\n "funds": "0",\n "dealFunds": "0",\n "dealSize": "0",\n "fee": "0",\n "feeCurrency": "USDT",\n "stp": "",\n "stop": "",\n "stopTriggered": false,\n "stopPrice": "0",\n "timeInForce": "GTC",\n "postOnly": false,\n "hidden": false,\n "iceberg": false,\n "visibleSize": "0",\n "cancelAfter": 0,\n "channel": "API",\n "clientOid": "3d07008668054da6b3cb12e432c2b13a",\n "remark": null,\n "tags": null,\n "isActive": false,\n "cancelExist": true,\n "createdAt": 1732941791518,\n "tradeType": "TRADE"\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetOrderByClientOidOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetOrderByClientOidOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1582,8 +1496,7 @@ describe('Auto Test', () => { */ let data = '{"symbol": "BTC-USDT", "orderId": "example_string_default_value", "side": "buy", "type": "limit", "tradeType": "TRADE", "startAt": 1728663338000, "endAt": 1728692138000, "currentPage": 1, "pageSize": 50}'; - let req = new GetTradeHistoryOldReq(); - req = req.fromJson(data); + let req = GetTradeHistoryOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1599,8 +1512,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": {\n "currentPage": 1,\n "pageSize": 50,\n "totalNum": 1,\n "totalPage": 1,\n "items": [\n {\n "symbol": "DOGE-USDT",\n "tradeId": "10862827223795713",\n "orderId": "6745698ef4f1200007c561a8",\n "counterOrderId": "6745695ef15b270007ac5076",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "0.40739",\n "size": "10",\n "funds": "4.0739",\n "fee": "0.0040739",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "market",\n "createdAt": 1732602254928\n }\n ]\n }\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetTradeHistoryOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetTradeHistoryOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), @@ -1615,8 +1527,7 @@ describe('Auto Test', () => { * /api/v1/limit/fills */ let data = '{"currentPage": 1, "pageSize": 50}'; - let req = new GetRecentTradeHistoryOldReq(); - req = req.fromJson(data); + let req = GetRecentTradeHistoryOldReq.fromJson(data); expect(Object.values(req).every((value) => value === null || value === undefined)).toBe( false, ); @@ -1632,8 +1543,7 @@ describe('Auto Test', () => { let data = '{\n "code": "200000",\n "data": [\n {\n "symbol": "BTC-USDT",\n "tradeId": "11732720444522497",\n "orderId": "674aab24754b1e00077dbc69",\n "counterOrderId": "674aab1fb26bfb0007a18b67",\n "side": "buy",\n "liquidity": "taker",\n "forceTaker": false,\n "price": "96999.6",\n "size": "0.00001",\n "funds": "0.969996",\n "fee": "0.000969996",\n "feeRate": "0.001",\n "feeCurrency": "USDT",\n "stop": "",\n "tradeType": "TRADE",\n "type": "limit",\n "createdAt": 1732946724082\n }\n ]\n}'; let commonResp = RestResponse.fromJson(data); - let resp = new GetRecentTradeHistoryOldResp(); - resp = resp.fromObject(commonResp.data); + let resp = GetRecentTradeHistoryOldResp.fromObject(commonResp.data); if (commonResp.data !== null) { expect( Object.values(resp).every((value) => value === null || value === undefined), diff --git a/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts b/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts index 4d7f7069..267f3557 100644 --- a/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts +++ b/sdk/node/src/generate/spot/spotprivate/ws_spot_private.test.ts @@ -13,8 +13,7 @@ describe('Auto Test', () => { let data = '{"topic":"/account/balance","type":"message","subject":"account.balance","id":"354689988084000","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"accountId":"548674591753","currency":"USDT","total":"21.133773386762","available":"20.132773386762","hold":"1.001","availableChange":"-0.5005","holdChange":"0.5005","relationContext":{"symbol":"BTC-USDT","orderId":"6721d0632db25b0007071fdc"},"relationEvent":"trade.hold","relationEventId":"354689988084000","time":"1730269283892"}}'; let commonResp = WsMessage.fromJson(data); - let resp = new AccountEvent(); - resp = resp.fromObject(commonResp.data); + let resp = AccountEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -29,8 +28,7 @@ describe('Auto Test', () => { let data = '{"topic":"/spotMarket/tradeOrdersV2","type":"message","subject":"orderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"canceledSize":"0","clientOid":"5c52e11203aa677f33e493fb","filledSize":"0","orderId":"6720ecd9ec71f4000747731a","orderTime":1730211033305,"orderType":"limit","originSize":"0.00001","price":"50000","remainSize":"0.00001","side":"buy","size":"0.00001","status":"open","symbol":"BTC-USDT","ts":1730211033335000000,"type":"open"}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderV1Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderV1Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -45,8 +43,7 @@ describe('Auto Test', () => { let data = '{"topic":"/spotMarket/tradeOrdersV2","type":"message","subject":"orderChange","userId":"633559791e1cbc0001f319bc","channelType":"private","data":{"clientOid":"5c52e11203aa677f33e493fc","orderId":"6720da3fa30a360007f5f832","orderTime":1730206271588,"orderType":"market","originSize":"0.00001","side":"buy","status":"new","symbol":"BTC-USDT","ts":1730206271616000000,"type":"received"}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderV2Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderV2Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); diff --git a/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts b/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts index 0db49a8a..47c5db49 100644 --- a/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts +++ b/sdk/node/src/generate/spot/spotpublic/ws_spot_public.test.ts @@ -20,8 +20,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/ticker:all","type":"message","subject":"BTC-USDT","data":{"bestAsk":"67218.7","bestAskSize":"1.92318539","bestBid":"67218.6","bestBidSize":"0.01045638","price":"67220","sequence":"14691455768","size":"0.00004316","time":1729757723612}}'; let commonResp = WsMessage.fromJson(data); - let resp = new AllTickersEvent(); - resp = resp.fromObject(commonResp.data); + let resp = AllTickersEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -36,8 +35,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/candles:BTC-USDT_1hour","type":"message","subject":"trade.candles.update","data":{"symbol":"BTC-USDT","candles":["1729839600","67644.9","67437.6","67724.8","67243.8","44.88321441","3027558.991928447"],"time":1729842192785164840}}'; let commonResp = WsMessage.fromJson(data); - let resp = new KlinesEvent(); - resp = resp.fromObject(commonResp.data); + let resp = KlinesEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -52,8 +50,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/snapshot:BTC","type":"message","subject":"trade.snapshot","data":{"sequence":"1729785948015","data":{"askSize":1375.1096,"averagePrice":0.00000262,"baseCurrency":"CHR","bidSize":152.0912,"board":0,"buy":0.00000263,"changePrice":0.00000005300000000000,"changeRate":0.0200,"close":0.000002698,"datetime":1729785948008,"high":0.00000274600000000000,"lastTradedPrice":0.000002698,"low":0.00000255800000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":false,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00000000900000000000,"changeRate":-0.0033,"high":0.00000270700000000000,"low":0.00000264200000000000,"open":0.00000270700000000000,"vol":27.10350000000000000000,"volValue":0.00007185015660000000},"marketChange24h":{"changePrice":0.00000005300000000000,"changeRate":0.0200,"high":0.00000274600000000000,"low":0.00000255800000000000,"open":0.00000264500000000000,"vol":6824.94800000000000000000,"volValue":0.01789509649520000000},"marketChange4h":{"changePrice":0.00000000600000000000,"changeRate":0.0022,"high":0.00000270700000000000,"low":0.00000264200000000000,"open":0.00000269200000000000,"vol":92.69020000000000000000,"volValue":0.00024903875740000000},"markets":["BTC","DePIN","Layer 1"],"open":0.00000264500000000000,"quoteCurrency":"BTC","sell":0.000002695,"siteTypes":["global"],"sort":100,"symbol":"CHR-BTC","symbolCode":"CHR-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":6824.94800000000000000000,"volValue":0.01789509649520000000}}}'; let commonResp = WsMessage.fromJson(data); - let resp = new MarketSnapshotEvent(); - resp = resp.fromObject(commonResp.data); + let resp = MarketSnapshotEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -68,8 +65,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/level2:BTC-USDT","type":"message","subject":"trade.l2update","data":{"changes":{"asks":[["67993.3","1.21427407","14701689783"]],"bids":[]},"sequenceEnd":14701689783,"sequenceStart":14701689783,"symbol":"BTC-USDT","time":1729816425625}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookIncrementEvent(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookIncrementEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -84,8 +80,7 @@ describe('Auto Test', () => { let data = '{"topic":"/spotMarket/level1:BTC-USDT","type":"message","subject":"level1","data":{"asks":["68145.8","0.51987471"],"bids":["68145.7","1.29267802"],"timestamp":1729816058766}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookLevel1Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookLevel1Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -100,8 +95,7 @@ describe('Auto Test', () => { let data = '{"topic":"/spotMarket/level2Depth50:BTC-USDT","type":"message","subject":"level2","data":{"asks":[["95964.3","0.08168874"],["95967.9","0.00985094"],["95969.9","0.00078081"],["95971.2","0.10016039"],["95971.3","0.12531139"],["95971.7","0.00291"],["95971.9","0.10271829"],["95973.3","0.00021"],["95974.7","0.10271829"],["95976.9","0.03095177"],["95977","0.10271829"],["95978.7","0.00022411"],["95979.1","0.00023017"],["95981","0.00022008"],["95981.2","0.14330324"],["95982.3","0.27922082"],["95982.5","0.02302674"],["95983.8","0.00011035"],["95985","0.00104222"],["95985.1","0.00021808"],["95985.5","0.211127"],["95986.2","0.09690904"],["95986.3","0.31261"],["95986.9","0.09225037"],["95987","0.01042013"],["95990.5","0.12712438"],["95990.6","0.0916115"],["95992.2","0.279"],["95992.7","0.00521084"],["95995.2","0.00033"],["95999.1","0.02973561"],["96001.1","0.083825"],["96002.6","0.01900906"],["96002.7","0.00041665"],["96002.8","0.12531139"],["96002.9","0.279"],["96004.8","0.02081884"],["96006.3","0.00065542"],["96008.5","0.00033166"],["96011","0.08776246"],["96012.5","0.279"],["96013.3","0.00066666"],["96013.9","0.26097183"],["96014","0.01087009"],["96017","0.06248892"],["96017.1","0.20829641"],["96022","0.00107066"],["96022.1","0.279"],["96022.9","0.0006499"],["96024.6","0.00104131"]],"bids":[["95964.2","1.35483359"],["95964.1","0.01117492"],["95962.1","0.0062"],["95961.8","0.03081549"],["95961.7","0.10271829"],["95958.5","0.04681571"],["95958.4","0.05177498"],["95958.2","0.00155911"],["95957.8","0.10271829"],["95954.7","0.16312181"],["95954.6","0.44102109"],["95952.6","0.10271829"],["95951.3","0.0062"],["95951","0.17075141"],["95950.9","0.279"],["95949.5","0.13567811"],["95949.2","0.05177498"],["95948.3","0.10271829"],["95947.2","0.04634798"],["95944.7","0.10271829"],["95944.2","0.05177498"],["95942.3","0.26028569"],["95942.2","0.10271829"],["95940.6","0.12531139"],["95940.2","0.43349327"],["95938.3","0.01041604"],["95937.4","0.04957577"],["95937.2","0.00305"],["95936.3","0.10271829"],["95934","0.05177498"],["95931.9","0.03394093"],["95931.8","0.10271829"],["95930","0.01041814"],["95927.9","0.10271829"],["95927","0.13312774"],["95926.9","0.33077498"],["95924.9","0.10271829"],["95924","0.00180915"],["95923.8","0.00022434"],["95919.6","0.00021854"],["95919.1","0.01471872"],["95919","0.05177498"],["95918.1","0.00001889"],["95917.8","0.1521089"],["95917.5","0.00010962"],["95916.2","0.00021958"],["95915.5","0.12531139"],["95915.3","0.279"],["95913.6","0.01739249"],["95913.5","0.05177498"]],"timestamp":1733124805073}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookLevel50Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookLevel50Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -116,8 +110,7 @@ describe('Auto Test', () => { let data = '{"topic":"/spotMarket/level2Depth5:BTC-USDT","type":"message","subject":"level2","data":{"asks":[["67996.7","1.14213262"],["67996.8","0.21748212"],["67996.9","0.1503747"],["67997","0.11446863"],["67997.1","0.14842782"]],"bids":[["67996.6","0.37969491"],["67995.3","0.20779746"],["67994.5","0.00047785"],["67993.4","0.405"],["67993.3","0.13528566"]],"timestamp":1729822226746}}'; let commonResp = WsMessage.fromJson(data); - let resp = new OrderbookLevel5Event(); - resp = resp.fromObject(commonResp.data); + let resp = OrderbookLevel5Event.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -132,8 +125,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/snapshot:BTC-USDT","type":"message","subject":"trade.snapshot","data":{"sequence":"14691517895","data":{"askSize":1.15955795,"averagePrice":66867.89967612,"baseCurrency":"BTC","bidSize":0.81772627,"board":1,"buy":67158.1,"changePrice":315.20000000000000000000,"changeRate":0.0047,"close":67158.1,"datetime":1729758286011,"high":67611.80000000000000000000,"lastTradedPrice":67158.1,"low":65257.10000000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"USDS","marketChange1h":{"changePrice":-102.10000000000000000000,"changeRate":-0.0015,"high":67310.60000000000000000000,"low":67051.80000000000000000000,"open":67260.20000000000000000000,"vol":53.73698081000000000000,"volValue":3609965.13819127700000000000},"marketChange24h":{"changePrice":315.20000000000000000000,"changeRate":0.0047,"high":67611.80000000000000000000,"low":65257.10000000000000000000,"open":66842.90000000000000000000,"vol":2227.69895852000000000000,"volValue":147972941.07857507300000000000},"marketChange4h":{"changePrice":-166.30000000000000000000,"changeRate":-0.0024,"high":67476.60000000000000000000,"low":67051.80000000000000000000,"open":67324.40000000000000000000,"vol":173.76971188000000000000,"volValue":11695949.43841656500000000000},"markets":["USDS","PoW"],"open":66842.90000000000000000000,"quoteCurrency":"USDT","sell":67158.2,"siteTypes":["turkey","thailand","global"],"sort":100,"symbol":"BTC-USDT","symbolCode":"BTC-USDT","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2227.69895852000000000000,"volValue":147972941.07857507300000000000}}}'; let commonResp = WsMessage.fromJson(data); - let resp = new SymbolSnapshotEvent(); - resp = resp.fromObject(commonResp.data); + let resp = SymbolSnapshotEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -148,8 +140,7 @@ describe('Auto Test', () => { let data = '{"type":"message","topic":"/market/ticker:BTC-USDT","subject":"trade.ticker","data":{"sequence":"1545896668986","price":"0.08","size":"0.011","bestAsk":"0.08","bestAskSize":"0.18","bestBid":"0.049","bestBidSize":"0.036","Time":1704873323416}}'; let commonResp = WsMessage.fromJson(data); - let resp = new TickerEvent(); - resp = resp.fromObject(commonResp.data); + let resp = TickerEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); @@ -164,8 +155,7 @@ describe('Auto Test', () => { let data = '{"topic":"/market/match:BTC-USDT","type":"message","subject":"trade.l3match","data":{"makerOrderId":"671b5007389355000701b1d3","price":"67523","sequence":"11067996711960577","side":"buy","size":"0.003","symbol":"BTC-USDT","takerOrderId":"671b50161777ff00074c168d","time":"1729843222921000000","tradeId":"11067996711960577","type":"match"}}'; let commonResp = WsMessage.fromJson(data); - let resp = new TradeEvent(); - resp = resp.fromObject(commonResp.data); + let resp = TradeEvent.fromObject(commonResp.data); expect(Object.values(resp).every((value) => value === null || value === undefined)).toBe( false, ); From 0106a03baf2108a3003ad3ede8ef6b8662754205 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 17:23:14 +0800 Subject: [PATCH 050/106] fix(nodejs):fix build error --- sdk/node/src/internal/infra/default_transport.ts | 8 +++++--- sdk/node/src/internal/infra/default_ws_client.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index a13d3a9e..e55936f2 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -206,14 +206,16 @@ export class DefaultTransport implements Transport { if (method === 'GET' || method === 'DELETE') { if (requestObj) { // create a new object for query parameters - const queryObj = { ...requestObj }; - + const queryObj: Record = { ...requestObj }; + // check path variables and remove from query const pathVarPattern = /{([^}]+)}/g; let match; while ((match = pathVarPattern.exec(rawpath)) !== null) { const pathVarName = match[1]; - delete queryObj[pathVarName]; + if (pathVarName in queryObj) { + delete queryObj[pathVarName]; + } } const queryParams = this.rawQuery(queryObj); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index f3872b9a..edbfc729 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -431,7 +431,7 @@ export class WebSocketClient { } } - private async reconnect(): void { + private async reconnect(): Promise { const reconnectLoop = async () => { while (!this.reconnectClosed) { if (this.disconnected && !this.shutdown) { From 5345e8b0c96a3b4e70d5f94d42d698d220bf1def Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 20 Jan 2025 17:24:52 +0800 Subject: [PATCH 051/106] feat(nodejs): update ws model --- .../main/resources/node-sdk/model_ws.mustache | 10 +- .../futuresprivate/model_all_order_event.ts | 58 ++++++-- .../model_all_position_event.ts | 118 +++++++++++---- .../futuresprivate/model_balance_event.ts | 62 ++++++-- .../model_cross_leverage_data_value.ts | 6 +- .../model_cross_leverage_event.ts | 6 +- .../futuresprivate/model_margin_mode_event.ts | 6 +- .../futuresprivate/model_order_event.ts | 58 ++++++-- .../futuresprivate/model_position_event.ts | 118 +++++++++++---- .../futuresprivate/model_stop_orders_event.ts | 54 +++++-- .../futurespublic/model_announcement_event.ts | 18 ++- .../futurespublic/model_execution_event.ts | 38 +++-- .../futurespublic/model_instrument_event.ts | 10 +- .../futurespublic/model_klines_event.ts | 14 +- .../model_orderbook_increment_event.ts | 14 +- .../model_orderbook_level50_event.ts | 22 ++- .../model_orderbook_level5_event.ts | 22 ++- .../model_symbol_snapshot_event.ts | 42 ++++-- .../futurespublic/model_ticker_v1_event.ts | 46 ++++-- .../futurespublic/model_ticker_v2_event.ts | 30 +++- ..._cross_margin_position_asset_list_value.ts | 14 +- .../model_cross_margin_position_event.ts | 34 ++++- ...ted_margin_position_change_assets_value.ts | 18 ++- .../model_isolated_margin_position_event.ts | 26 +++- .../marginpublic/model_index_price_event.ts | 18 ++- .../marginpublic/model_mark_price_event.ts | 18 ++- .../spot/spotprivate/model_account_event.ts | 46 ++++-- .../model_account_relation_context.ts | 10 +- .../spot/spotprivate/model_order_v1_event.ts | 42 ++++-- .../spot/spotprivate/model_order_v2_event.ts | 42 ++++-- .../spotpublic/model_all_tickers_event.ts | 34 ++++- .../spot/spotpublic/model_klines_event.ts | 14 +- .../spotpublic/model_market_snapshot_data.ts | 138 +++++++++++++----- ...el_market_snapshot_data_market_change1h.ts | 30 +++- ...l_market_snapshot_data_market_change24h.ts | 30 +++- ...el_market_snapshot_data_market_change4h.ts | 30 +++- .../spotpublic/model_market_snapshot_event.ts | 10 +- .../model_orderbook_increment_changes.ts | 10 +- .../model_orderbook_increment_event.ts | 22 ++- .../model_orderbook_level1_event.ts | 14 +- .../model_orderbook_level50_changes.ts | 10 +- .../model_orderbook_level50_event.ts | 22 ++- .../model_orderbook_level5_event.ts | 14 +- .../spotpublic/model_symbol_snapshot_data.ts | 138 +++++++++++++----- ...el_symbol_snapshot_data_market_change1h.ts | 30 +++- ...l_symbol_snapshot_data_market_change24h.ts | 30 +++- ...el_symbol_snapshot_data_market_change4h.ts | 30 +++- .../spotpublic/model_symbol_snapshot_event.ts | 10 +- .../spot/spotpublic/model_ticker_event.ts | 34 ++++- .../spot/spotpublic/model_trade_event.ts | 42 ++++-- 50 files changed, 1310 insertions(+), 402 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 9b80aaff..1aef6f40 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -24,9 +24,17 @@ export class {{classname}} implements Serializable{ {{#vendorExtensions.x-use-base-name}} @Expose({ name: "{{baseName}}" }) {{/vendorExtensions.x-use-base-name}} - {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; {{/vars}} + private constructor() { +{{#vars}} + {{#required}} + // @ts-ignore + this.{{name}} = null; + {{/required}} +{{/vars}} + } {{#vendorExtensions.x-response-model}} /** * common response diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index fa007bd4..9a113e8d 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -9,7 +9,7 @@ export class AllOrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * User-specified order type */ @@ -17,51 +17,51 @@ export class AllOrderEvent implements Response { /** * buy or sell */ - side?: AllOrderEvent.SideEnum; + side: AllOrderEvent.SideEnum; /** * Cumulative number of cancellations */ - canceledSize?: string; + canceledSize: string; /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; /** * Margin Mode */ - marginMode?: AllOrderEvent.MarginModeEnum; + marginMode: AllOrderEvent.MarginModeEnum; /** * Order Type */ - type?: AllOrderEvent.TypeEnum; + type: AllOrderEvent.TypeEnum; /** * Order time(Nanosecond) */ - orderTime?: number; + orderTime: number; /** * User-specified order size */ - size?: string; + size: string; /** * Cumulative number of filled */ - filledSize?: string; + filledSize: string; /** * Price */ - price?: string; + price: string; /** * Remain size */ - remainSize?: string; + remainSize: string; /** * Order Status */ - status?: AllOrderEvent.StatusEnum; + status: AllOrderEvent.StatusEnum; /** * Push time(Nanosecond) */ - ts?: number; + ts: number; /** * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** */ @@ -93,8 +93,38 @@ export class AllOrderEvent implements Response { /** * normal order or liquid order */ - tradeType?: AllOrderEvent.TradeTypeEnum; + tradeType: AllOrderEvent.TradeTypeEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.canceledSize = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.tradeType = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index aea686fa..d08cc69a 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -9,119 +9,119 @@ export class AllPositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * Whether it is cross margin. */ - crossMode?: boolean; + crossMode: boolean; /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; /** * Current postion quantity */ - currentQty?: number; + currentQty: number; /** * Current postion value */ - currentCost?: number; + currentCost: number; /** * Current commission */ - currentComm?: number; + currentComm: number; /** * Unrealised value */ - unrealisedCost?: number; + unrealisedCost: number; /** * Accumulated realised gross profit value */ - realisedGrossCost?: number; + realisedGrossCost: number; /** * Current realised position value */ - realisedCost?: number; + realisedCost: number; /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; /** * Mark price */ - markPrice?: number; + markPrice: number; /** * Mark Value */ - markValue?: number; + markValue: number; /** * Position value */ - posCost?: number; + posCost: number; /** * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction */ - posInit?: number; + posInit: number; /** * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) */ - posMargin?: number; + posMargin: number; /** * Accumulated realised gross profit value */ - realisedGrossPnl?: number; + realisedGrossPnl: number; /** * Realised profit and loss */ - realisedPnl?: number; + realisedPnl: number; /** * Unrealised profit and loss */ - unrealisedPnl?: number; + unrealisedPnl: number; /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: number; + unrealisedPnlPcnt: number; /** * Rate of return on investment */ - unrealisedRoePcnt?: number; + unrealisedRoePcnt: number; /** * Average entry price */ - avgEntryPrice?: number; + avgEntryPrice: number; /** * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. */ - liquidationPrice?: number; + liquidationPrice: number; /** * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. */ - bankruptPrice?: number; + bankruptPrice: number; /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; /** * Margin Mode: CROSS,ISOLATED */ - marginMode?: AllPositionEvent.MarginModeEnum; + marginMode: AllPositionEvent.MarginModeEnum; /** * Position Side */ - positionSide?: AllPositionEvent.PositionSideEnum; + positionSide: AllPositionEvent.PositionSideEnum; /** * Leverage */ - leverage?: number; + leverage: number; /** * Auto deposit margin or not **Only applicable to Isolated Margin** */ @@ -191,6 +191,66 @@ export class AllPositionEvent implements Response { */ msg?: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.positionSide = null; + // @ts-ignore + this.leverage = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index 5c47fa00..6f7649ff 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -9,64 +9,96 @@ export class BalanceEvent implements Response { /** * Margin of the cross margin position */ - crossPosMargin?: string; + crossPosMargin: string; /** * Margin of the isolated margin order */ - isolatedOrderMargin?: string; + isolatedOrderMargin: string; /** * Frozen Balance */ - holdBalance?: string; + holdBalance: string; /** * Equity */ - equity?: string; + equity: string; /** * Version. When holding a cross margin position, the available balance may change with fluctuations in the mark price, leading to discrepancies in the available balance for the same version number. */ - version?: string; + version: string; /** * Available Balance */ - availableBalance?: string; + availableBalance: string; /** * Margin of the isolated margin position, including isolated margin funding fees */ - isolatedPosMargin?: string; + isolatedPosMargin: string; /** * Wallet Balance */ - walletBalance?: string; + walletBalance: string; /** * Isolated margin funding fee */ - isolatedFundingFeeMargin?: string; + isolatedFundingFeeMargin: string; /** * Unrealized PNL in cross margin mode */ - crossUnPnl?: string; + crossUnPnl: string; /** * Total margin under cross margin mode */ - totalCrossMargin?: string; + totalCrossMargin: string; /** * Currency Symbol */ - currency?: string; + currency: string; /** * Unrealized PNL in isolated margin mode */ - isolatedUnPnl?: string; + isolatedUnPnl: string; /** * Margin of the cross margin order */ - crossOrderMargin?: string; + crossOrderMargin: string; /** * Last modified time */ - timestamp?: string; + timestamp: string; + private constructor() { + // @ts-ignore + this.crossPosMargin = null; + // @ts-ignore + this.isolatedOrderMargin = null; + // @ts-ignore + this.holdBalance = null; + // @ts-ignore + this.equity = null; + // @ts-ignore + this.version = null; + // @ts-ignore + this.availableBalance = null; + // @ts-ignore + this.isolatedPosMargin = null; + // @ts-ignore + this.walletBalance = null; + // @ts-ignore + this.isolatedFundingFeeMargin = null; + // @ts-ignore + this.crossUnPnl = null; + // @ts-ignore + this.totalCrossMargin = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.isolatedUnPnl = null; + // @ts-ignore + this.crossOrderMargin = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts index 99e1ecc0..133104b5 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -7,8 +7,12 @@ export class CrossLeverageDataValue implements Serializable { /** * */ - leverage?: string; + leverage: string; + private constructor() { + // @ts-ignore + this.leverage = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index ff26acc1..5702e0b7 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -10,8 +10,12 @@ export class CrossLeverageEvent implements Response { /** * */ - data?: { [key: string]: CrossLeverageDataValue }; + data: { [key: string]: CrossLeverageDataValue }; + private constructor() { + // @ts-ignore + this.data = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index 79f34675..44978322 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -9,8 +9,12 @@ export class MarginModeEvent implements Response { /** * The SYMBOL is the key with value \"CROSS\" or \"ISOLATED\" */ - SYMBOL?: string; + SYMBOL: string; + private constructor() { + // @ts-ignore + this.SYMBOL = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index 47e7b77c..a110fe0f 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -9,7 +9,7 @@ export class OrderEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * User-specified order type */ @@ -17,51 +17,51 @@ export class OrderEvent implements Response { /** * buy or sell */ - side?: OrderEvent.SideEnum; + side: OrderEvent.SideEnum; /** * Cumulative number of cancellations */ - canceledSize?: string; + canceledSize: string; /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; /** * Margin Mode */ - marginMode?: OrderEvent.MarginModeEnum; + marginMode: OrderEvent.MarginModeEnum; /** * Order Type */ - type?: OrderEvent.TypeEnum; + type: OrderEvent.TypeEnum; /** * Order time(Nanosecond) */ - orderTime?: number; + orderTime: number; /** * User-specified order size */ - size?: string; + size: string; /** * Cumulative number of filled */ - filledSize?: string; + filledSize: string; /** * Price */ - price?: string; + price: string; /** * Remain size */ - remainSize?: string; + remainSize: string; /** * Order Status */ - status?: OrderEvent.StatusEnum; + status: OrderEvent.StatusEnum; /** * Push time(Nanosecond) */ - ts?: number; + ts: number; /** * Actual transaction order type, If the counterparty order is an [Hidden/Iceberg Order](https://www.kucoin.com/docs-new/doc-338146), even if it is a maker order, this param will be displayed as taker. For actual trading fee, please refer to the **feeType** */ @@ -93,8 +93,38 @@ export class OrderEvent implements Response { /** * normal order or liquid order */ - tradeType?: OrderEvent.TradeTypeEnum; + tradeType: OrderEvent.TradeTypeEnum; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.canceledSize = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.type = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.filledSize = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.remainSize = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.tradeType = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index a7bde21b..e3d9b588 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -9,119 +9,119 @@ export class PositionEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * Whether it is cross margin. */ - crossMode?: boolean; + crossMode: boolean; /** * ADL ranking percentile */ - delevPercentage?: number; + delevPercentage: number; /** * Open time */ - openingTimestamp?: number; + openingTimestamp: number; /** * Current timestamp */ - currentTimestamp?: number; + currentTimestamp: number; /** * Current postion quantity */ - currentQty?: number; + currentQty: number; /** * Current postion value */ - currentCost?: number; + currentCost: number; /** * Current commission */ - currentComm?: number; + currentComm: number; /** * Unrealised value */ - unrealisedCost?: number; + unrealisedCost: number; /** * Accumulated realised gross profit value */ - realisedGrossCost?: number; + realisedGrossCost: number; /** * Current realised position value */ - realisedCost?: number; + realisedCost: number; /** * Opened position or not */ - isOpen?: boolean; + isOpen: boolean; /** * Mark price */ - markPrice?: number; + markPrice: number; /** * Mark Value */ - markValue?: number; + markValue: number; /** * Position value */ - posCost?: number; + posCost: number; /** * Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction */ - posInit?: number; + posInit: number; /** * Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.) */ - posMargin?: number; + posMargin: number; /** * Accumulated realised gross profit value */ - realisedGrossPnl?: number; + realisedGrossPnl: number; /** * Realised profit and loss */ - realisedPnl?: number; + realisedPnl: number; /** * Unrealised profit and loss */ - unrealisedPnl?: number; + unrealisedPnl: number; /** * Profit-loss ratio of the position */ - unrealisedPnlPcnt?: number; + unrealisedPnlPcnt: number; /** * Rate of return on investment */ - unrealisedRoePcnt?: number; + unrealisedRoePcnt: number; /** * Average entry price */ - avgEntryPrice?: number; + avgEntryPrice: number; /** * Liquidation price For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate. */ - liquidationPrice?: number; + liquidationPrice: number; /** * Bankruptcy price For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate. */ - bankruptPrice?: number; + bankruptPrice: number; /** * Currency used to clear and settle the trades */ - settleCurrency?: string; + settleCurrency: string; /** * Margin Mode: CROSS,ISOLATED */ - marginMode?: PositionEvent.MarginModeEnum; + marginMode: PositionEvent.MarginModeEnum; /** * Position Side */ - positionSide?: PositionEvent.PositionSideEnum; + positionSide: PositionEvent.PositionSideEnum; /** * Leverage */ - leverage?: number; + leverage: number; /** * Auto deposit margin or not **Only applicable to Isolated Margin** */ @@ -191,6 +191,66 @@ export class PositionEvent implements Response { */ msg?: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.crossMode = null; + // @ts-ignore + this.delevPercentage = null; + // @ts-ignore + this.openingTimestamp = null; + // @ts-ignore + this.currentTimestamp = null; + // @ts-ignore + this.currentQty = null; + // @ts-ignore + this.currentCost = null; + // @ts-ignore + this.currentComm = null; + // @ts-ignore + this.unrealisedCost = null; + // @ts-ignore + this.realisedGrossCost = null; + // @ts-ignore + this.realisedCost = null; + // @ts-ignore + this.isOpen = null; + // @ts-ignore + this.markPrice = null; + // @ts-ignore + this.markValue = null; + // @ts-ignore + this.posCost = null; + // @ts-ignore + this.posInit = null; + // @ts-ignore + this.posMargin = null; + // @ts-ignore + this.realisedGrossPnl = null; + // @ts-ignore + this.realisedPnl = null; + // @ts-ignore + this.unrealisedPnl = null; + // @ts-ignore + this.unrealisedPnlPcnt = null; + // @ts-ignore + this.unrealisedRoePcnt = null; + // @ts-ignore + this.avgEntryPrice = null; + // @ts-ignore + this.liquidationPrice = null; + // @ts-ignore + this.bankruptPrice = null; + // @ts-ignore + this.settleCurrency = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.positionSide = null; + // @ts-ignore + this.leverage = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index df4ba06c..8da8311d 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -9,56 +9,84 @@ export class StopOrdersEvent implements Response { /** * */ - createdAt?: number; + createdAt: number; /** * Margin Mode */ - marginMode?: StopOrdersEvent.MarginModeEnum; + marginMode: StopOrdersEvent.MarginModeEnum; /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; /** * Order price */ - orderPrice?: string; + orderPrice: string; /** * User-specified order type */ - orderType?: StopOrdersEvent.OrderTypeEnum; + orderType: StopOrdersEvent.OrderTypeEnum; /** * buy or sell */ - side?: StopOrdersEvent.SideEnum; + side: StopOrdersEvent.SideEnum; /** * User-specified order size */ - size?: number; + size: number; /** * Either \'down\' or \'up\' */ - stop?: StopOrdersEvent.StopEnum; + stop: StopOrdersEvent.StopEnum; /** * Stop Price */ - stopPrice?: string; + stopPrice: string; /** * */ - stopPriceType?: string; + stopPriceType: string; /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-221752070) */ - symbol?: string; + symbol: string; /** * */ - ts?: number; + ts: number; /** * Order Type */ - type?: StopOrdersEvent.TypeEnum; + type: StopOrdersEvent.TypeEnum; + private constructor() { + // @ts-ignore + this.createdAt = null; + // @ts-ignore + this.marginMode = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderPrice = null; + // @ts-ignore + this.orderType = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.stop = null; + // @ts-ignore + this.stopPrice = null; + // @ts-ignore + this.stopPriceType = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.type = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index 67594953..b53abdae 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -9,20 +9,30 @@ export class AnnouncementEvent implements Response { /** * Symbol */ - symbol?: string; + symbol: string; /** * Funding time */ - fundingTime?: number; + fundingTime: number; /** * Funding rate */ - fundingRate?: number; + fundingRate: number; /** * */ - timestamp?: number; + timestamp: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.fundingTime = null; + // @ts-ignore + this.fundingRate = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index 31785302..4c35ab26 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -9,40 +9,60 @@ export class ExecutionEvent implements Response { /** * */ - symbol?: string; + symbol: string; /** * */ - sequence?: number; + sequence: number; /** * */ - side?: string; + side: string; /** * */ - size?: number; + size: number; /** * */ - price?: string; + price: string; /** * */ - takerOrderId?: string; + takerOrderId: string; /** * */ - makerOrderId?: string; + makerOrderId: string; /** * */ - tradeId?: string; + tradeId: string; /** * */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.takerOrderId = null; + // @ts-ignore + this.makerOrderId = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.ts = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index e02154f5..53ff30b2 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -9,7 +9,7 @@ export class InstrumentEvent implements Response { /** * Granularity (predicted funding rate: 1-min granularity: 60000; Funding rate: 8-hours granularity: 28800000. ) */ - granularity?: number; + granularity: number; /** * */ @@ -17,7 +17,7 @@ export class InstrumentEvent implements Response { /** * */ - timestamp?: number; + timestamp: number; /** * */ @@ -27,6 +27,12 @@ export class InstrumentEvent implements Response { */ indexPrice?: number; + private constructor() { + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index 87cf1802..be3d6268 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -9,16 +9,24 @@ export class KlinesEvent implements Response { /** * Symbol of the contract, Please refer to [Get Symbol endpoint: symbol](https://www.kucoin.com/docs-new/api-3470220) */ - symbol?: string; + symbol: string; /** * Start time, open price, close price, high price, low price, Transaction volume(This value is incorrect, please do not use it, we will fix it in subsequent versions), Transaction amount */ - candles?: Array; + candles: Array; /** * timestamp(ms) */ - time?: number; + time: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.candles = null; + // @ts-ignore + this.time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index 76eccda8..dfbf2728 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -9,16 +9,24 @@ export class OrderbookIncrementEvent implements Response { /** * */ - sequence?: number; + sequence: number; /** * */ - change?: string; + change: string; /** * */ - timestamp?: number; + timestamp: number; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.change = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts index 1afa5703..f5e64241 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -9,24 +9,36 @@ export class OrderbookLevel50Event implements Response { /** * */ - bids?: Array>; + bids: Array>; /** * */ - sequence?: number; + sequence: number; /** * */ - timestamp?: number; + timestamp: number; /** * */ - ts?: number; + ts: number; /** * */ - asks?: Array>; + asks: Array>; + private constructor() { + // @ts-ignore + this.bids = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.asks = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts index 5137b041..22bc8b46 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -9,24 +9,36 @@ export class OrderbookLevel5Event implements Response { /** * */ - bids?: Array>; + bids: Array>; /** * */ - sequence?: number; + sequence: number; /** * */ - timestamp?: number; + timestamp: number; /** * */ - ts?: number; + ts: number; /** * */ - asks?: Array>; + asks: Array>; + private constructor() { + // @ts-ignore + this.bids = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.asks = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts index d956299a..0087a2cc 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -9,44 +9,66 @@ export class SymbolSnapshotEvent implements Response { /** * */ - highPrice?: number; + highPrice: number; /** * */ - lastPrice?: number; + lastPrice: number; /** * */ - lowPrice?: number; + lowPrice: number; /** * */ - price24HoursBefore?: number; + price24HoursBefore: number; /** * */ - priceChg?: number; + priceChg: number; /** * */ - priceChgPct?: number; + priceChgPct: number; /** * */ - symbol?: string; + symbol: string; /** * */ - ts?: number; + ts: number; /** * */ - turnover?: number; + turnover: number; /** * */ - volume?: number; + volume: number; + private constructor() { + // @ts-ignore + this.highPrice = null; + // @ts-ignore + this.lastPrice = null; + // @ts-ignore + this.lowPrice = null; + // @ts-ignore + this.price24HoursBefore = null; + // @ts-ignore + this.priceChg = null; + // @ts-ignore + this.priceChgPct = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.turnover = null; + // @ts-ignore + this.volume = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts index 2a169d17..3f6fb7e6 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -9,48 +9,72 @@ export class TickerV1Event implements Response { /** * */ - symbol?: string; + symbol: string; /** * */ - sequence?: number; + sequence: number; /** * */ - side?: string; + side: string; /** * */ - size?: number; + size: number; /** * */ - price?: string; + price: string; /** * */ - bestBidSize?: number; + bestBidSize: number; /** * */ - bestBidPrice?: string; + bestBidPrice: string; /** * */ - bestAskPrice?: string; + bestAskPrice: string; /** * */ - tradeId?: string; + tradeId: string; /** * */ - bestAskSize?: number; + bestAskSize: number; /** * */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.bestBidPrice = null; + // @ts-ignore + this.bestAskPrice = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.ts = null; + } /** * common response */ diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index ebaa1d1f..9f2d0a01 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -9,32 +9,48 @@ export class TickerV2Event implements Response { /** * */ - symbol?: string; + symbol: string; /** * */ - sequence?: number; + sequence: number; /** * */ - bestBidSize?: number; + bestBidSize: number; /** * */ - bestBidPrice?: string; + bestBidPrice: string; /** * */ - bestAskPrice?: string; + bestAskPrice: string; /** * */ - bestAskSize?: number; + bestAskSize: number; /** * */ - ts?: number; + ts: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.bestBidPrice = null; + // @ts-ignore + this.bestAskPrice = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.ts = null; + } /** * common response */ diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts index d94d11dd..4887d234 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -7,16 +7,24 @@ export class CrossMarginPositionAssetListValue implements Serializable { /** * */ - total?: string; + total: string; /** * */ - available?: string; + available: string; /** * */ - hold?: string; + hold: string; + private constructor() { + // @ts-ignore + this.total = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.hold = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index b3a93322..c527b93d 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -10,36 +10,54 @@ export class CrossMarginPositionEvent implements Response { /** * Debt ratio */ - debtRatio?: number; + debtRatio: number; /** * Total asset in BTC (interest included) */ - totalAsset?: number; + totalAsset: number; /** * */ - marginCoefficientTotalAsset?: string; + marginCoefficientTotalAsset: string; /** * Total debt in BTC (interest included) */ - totalDebt?: string; + totalDebt: string; /** * Asset list (interest included) */ - assetList?: { [key: string]: CrossMarginPositionAssetListValue }; + assetList: { [key: string]: CrossMarginPositionAssetListValue }; /** * Debt list (interest included) */ - debtList?: { [key: string]: string }; + debtList: { [key: string]: string }; /** * */ - timestamp?: number; + timestamp: number; /** * Event type, **Only applicable to \"debt.ratio\" subject** */ - type?: CrossMarginPositionEvent.TypeEnum; + type: CrossMarginPositionEvent.TypeEnum; + private constructor() { + // @ts-ignore + this.debtRatio = null; + // @ts-ignore + this.totalAsset = null; + // @ts-ignore + this.marginCoefficientTotalAsset = null; + // @ts-ignore + this.totalDebt = null; + // @ts-ignore + this.assetList = null; + // @ts-ignore + this.debtList = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.type = null; + } /** * common response */ diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts index b109dca6..1f8dc86e 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts @@ -7,20 +7,30 @@ export class IsolatedMarginPositionChangeAssetsValue implements Serializable { /** * */ - total?: string; + total: string; /** * */ - hold?: string; + hold: string; /** * */ - liabilityPrincipal?: string; + liabilityPrincipal: string; /** * */ - liabilityInterest?: string; + liabilityInterest: string; + private constructor() { + // @ts-ignore + this.total = null; + // @ts-ignore + this.hold = null; + // @ts-ignore + this.liabilityPrincipal = null; + // @ts-ignore + this.liabilityInterest = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index 743c6198..a9dd5f4f 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -10,28 +10,42 @@ export class IsolatedMarginPositionEvent implements Response { /** * Isolated margin symbol */ - tag?: string; + tag: string; /** * Position status */ - status?: IsolatedMarginPositionEvent.StatusEnum; + status: IsolatedMarginPositionEvent.StatusEnum; /** * Status type */ - statusBizType?: IsolatedMarginPositionEvent.StatusBizTypeEnum; + statusBizType: IsolatedMarginPositionEvent.StatusBizTypeEnum; /** * Accumulated principal */ - accumulatedPrincipal?: string; + accumulatedPrincipal: string; /** * */ - changeAssets?: { [key: string]: IsolatedMarginPositionChangeAssetsValue }; + changeAssets: { [key: string]: IsolatedMarginPositionChangeAssetsValue }; /** * */ - timestamp?: number; + timestamp: number; + private constructor() { + // @ts-ignore + this.tag = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.statusBizType = null; + // @ts-ignore + this.accumulatedPrincipal = null; + // @ts-ignore + this.changeAssets = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index 73593975..ecc44f35 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -9,20 +9,30 @@ export class IndexPriceEvent implements Response { /** * */ - symbol?: string; + symbol: string; /** * */ - granularity?: number; + granularity: number; /** * */ - timestamp?: number; + timestamp: number; /** * */ - value?: number; + value: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.value = null; + } /** * common response */ diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index 8bd875b4..e64c574c 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -9,20 +9,30 @@ export class MarkPriceEvent implements Response { /** * */ - symbol?: string; + symbol: string; /** * */ - granularity?: number; + granularity: number; /** * */ - timestamp?: number; + timestamp: number; /** * */ - value?: number; + value: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.granularity = null; + // @ts-ignore + this.timestamp = null; + // @ts-ignore + this.value = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 6bc2917a..290f293c 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -10,48 +10,72 @@ export class AccountEvent implements Response { /** * Account ID */ - accountId?: string; + accountId: string; /** * Funds available to withdraw or trade */ - available?: string; + available: string; /** * The change of available Funds */ - availableChange?: string; + availableChange: string; /** * currency */ - currency?: string; + currency: string; /** * Funds on hold (not available for use) */ - hold?: string; + hold: string; /** * The change of hold funds */ - holdChange?: string; + holdChange: string; /** * */ - relationContext?: AccountRelationContext; + relationContext: AccountRelationContext; /** * Relation event */ - relationEvent?: string; + relationEvent: string; /** * Relation event Id */ - relationEventId?: string; + relationEventId: string; /** * */ - time?: string; + time: string; /** * Total balance = available + hold */ - total?: string; + total: string; + private constructor() { + // @ts-ignore + this.accountId = null; + // @ts-ignore + this.available = null; + // @ts-ignore + this.availableChange = null; + // @ts-ignore + this.currency = null; + // @ts-ignore + this.hold = null; + // @ts-ignore + this.holdChange = null; + // @ts-ignore + this.relationContext = null; + // @ts-ignore + this.relationEvent = null; + // @ts-ignore + this.relationEventId = null; + // @ts-ignore + this.time = null; + // @ts-ignore + this.total = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts index f0fd8c7d..65ab0ed9 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -7,12 +7,18 @@ export class AccountRelationContext implements Serializable { /** * */ - symbol?: string; + symbol: string; /** * */ - orderId?: string; + orderId: string; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.orderId = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts index 286fd753..56eb0d97 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -13,7 +13,7 @@ export class OrderV1Event implements Response { /** * Client Order Id,The ClientOid field is a unique ID created by the user */ - clientOid?: string; + clientOid: string; /** * Cumulative number of filled */ @@ -21,19 +21,19 @@ export class OrderV1Event implements Response { /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; /** * Order time(millisecond) */ - orderTime?: number; + orderTime: number; /** * User-specified order type */ - orderType?: OrderV1Event.OrderTypeEnum; + orderType: OrderV1Event.OrderTypeEnum; /** * User-specified order size */ - originSize?: string; + originSize: string; /** * Specify price for currency */ @@ -49,7 +49,7 @@ export class OrderV1Event implements Response { /** * buy or sell */ - side?: OrderV1Event.SideEnum; + side: OrderV1Event.SideEnum; /** * User-specified order size */ @@ -57,19 +57,19 @@ export class OrderV1Event implements Response { /** * Order Status */ - status?: OrderV1Event.StatusEnum; + status: OrderV1Event.StatusEnum; /** * Symbol */ - symbol?: string; + symbol: string; /** * Push time(Nanosecond) */ - ts?: number; + ts: number; /** * Order Type */ - type?: OrderV1Event.TypeEnum; + type: OrderV1Event.TypeEnum; /** * The size before order update */ @@ -95,6 +95,28 @@ export class OrderV1Event implements Response { */ tradeId?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.orderType = null; + // @ts-ignore + this.originSize = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.type = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index d1e87fd3..f2095bce 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -13,7 +13,7 @@ export class OrderV2Event implements Response { /** * Client Order Id,The ClientOid field is a unique ID created by the user */ - clientOid?: string; + clientOid: string; /** * Cumulative number of filled */ @@ -21,19 +21,19 @@ export class OrderV2Event implements Response { /** * The unique order id generated by the trading system */ - orderId?: string; + orderId: string; /** * Order time(millisecond) */ - orderTime?: number; + orderTime: number; /** * User-specified order type */ - orderType?: OrderV2Event.OrderTypeEnum; + orderType: OrderV2Event.OrderTypeEnum; /** * User-specified order size */ - originSize?: string; + originSize: string; /** * Price */ @@ -49,7 +49,7 @@ export class OrderV2Event implements Response { /** * buy or sell */ - side?: OrderV2Event.SideEnum; + side: OrderV2Event.SideEnum; /** * User-specified order size */ @@ -57,19 +57,19 @@ export class OrderV2Event implements Response { /** * Order Status */ - status?: OrderV2Event.StatusEnum; + status: OrderV2Event.StatusEnum; /** * Symbol */ - symbol?: string; + symbol: string; /** * Push time(Nanosecond) */ - ts?: number; + ts: number; /** * Order Type */ - type?: OrderV2Event.TypeEnum; + type: OrderV2Event.TypeEnum; /** * The size before order update */ @@ -95,6 +95,28 @@ export class OrderV2Event implements Response { */ tradeId?: string; + private constructor() { + // @ts-ignore + this.clientOid = null; + // @ts-ignore + this.orderId = null; + // @ts-ignore + this.orderTime = null; + // @ts-ignore + this.orderType = null; + // @ts-ignore + this.originSize = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.status = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.ts = null; + // @ts-ignore + this.type = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index 55c423ae..f2cf715d 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -9,36 +9,54 @@ export class AllTickersEvent implements Response { /** * */ - bestAsk?: string; + bestAsk: string; /** * */ - bestAskSize?: string; + bestAskSize: string; /** * */ - bestBid?: string; + bestBid: string; /** * */ - bestBidSize?: string; + bestBidSize: string; /** * */ - price?: string; + price: string; /** * */ - sequence?: string; + sequence: string; /** * */ - size?: string; + size: string; /** * The matching time of the latest transaction */ - time?: number; + time: number; + private constructor() { + // @ts-ignore + this.bestAsk = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.bestBid = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index f2a7846f..52ed59dc 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -9,16 +9,24 @@ export class KlinesEvent implements Response { /** * symbol */ - symbol?: string; + symbol: string; /** * Start time of the candle cycle,open price,close price, high price,low price,Transaction volume,Transaction amount */ - candles?: Array; + candles: Array; /** * now(us) */ - time?: number; + time: number; + private constructor() { + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.candles = null; + // @ts-ignore + this.time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts index 7fe34fb7..cc0ca315 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -10,140 +10,210 @@ export class MarketSnapshotData implements Serializable { /** * */ - askSize?: number; + askSize: number; /** * */ - averagePrice?: number; + averagePrice: number; /** * */ - baseCurrency?: string; + baseCurrency: string; /** * */ - bidSize?: number; + bidSize: number; /** * Trading pair partition: 0.primary partition 1.KuCoin Plus\", example = \"1\" */ - board?: MarketSnapshotData.BoardEnum; + board: MarketSnapshotData.BoardEnum; /** * */ - buy?: number; + buy: number; /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - close?: number; + close: number; /** * */ - datetime?: number; + datetime: number; /** * */ - high?: number; + high: number; /** * */ - lastTradedPrice?: number; + lastTradedPrice: number; /** * */ - low?: number; + low: number; /** * */ - makerCoefficient?: number; + makerCoefficient: number; /** * */ - makerFeeRate?: number; + makerFeeRate: number; /** * */ - marginTrade?: boolean; + marginTrade: boolean; /** * Trading Pair Mark: 0.default 1.ST. 2.NEW\", example = \"1\" */ - mark?: MarketSnapshotData.MarkEnum; + mark: MarketSnapshotData.MarkEnum; /** * */ - market?: string; + market: string; /** * */ - marketChange1h?: MarketSnapshotDataMarketChange1h; + marketChange1h: MarketSnapshotDataMarketChange1h; /** * */ - marketChange24h?: MarketSnapshotDataMarketChange24h; + marketChange24h: MarketSnapshotDataMarketChange24h; /** * */ - marketChange4h?: MarketSnapshotDataMarketChange4h; + marketChange4h: MarketSnapshotDataMarketChange4h; /** * */ - markets?: Array; + markets: Array; /** * */ - open?: number; + open: number; /** * */ - quoteCurrency?: string; + quoteCurrency: string; /** * */ - sell?: number; + sell: number; /** * */ - siteTypes?: Array; + siteTypes: Array; /** * sorting number */ - sort?: number; + sort: number; /** * */ - symbol?: string; + symbol: string; /** * */ - symbolCode?: string; + symbolCode: string; /** * */ - takerCoefficient?: number; + takerCoefficient: number; /** * */ - takerFeeRate?: number; + takerFeeRate: number; /** * */ - trading?: boolean; + trading: boolean; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.askSize = null; + // @ts-ignore + this.averagePrice = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.bidSize = null; + // @ts-ignore + this.board = null; + // @ts-ignore + this.buy = null; + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.close = null; + // @ts-ignore + this.datetime = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.lastTradedPrice = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.makerCoefficient = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.marginTrade = null; + // @ts-ignore + this.mark = null; + // @ts-ignore + this.market = null; + // @ts-ignore + this.marketChange1h = null; + // @ts-ignore + this.marketChange24h = null; + // @ts-ignore + this.marketChange4h = null; + // @ts-ignore + this.markets = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.sell = null; + // @ts-ignore + this.siteTypes = null; + // @ts-ignore + this.sort = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.symbolCode = null; + // @ts-ignore + this.takerCoefficient = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.trading = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts index 9ee98dfb..d786df02 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -7,32 +7,48 @@ export class MarketSnapshotDataMarketChange1h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts index 714d3950..f240bcd8 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -7,32 +7,48 @@ export class MarketSnapshotDataMarketChange24h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts index 879d9a79..14f7e27b 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -7,32 +7,48 @@ export class MarketSnapshotDataMarketChange4h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index 09a8d732..229c532e 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -10,12 +10,18 @@ export class MarketSnapshotEvent implements Response { /** * */ - sequence?: string; + sequence: string; /** * */ - data?: MarketSnapshotData; + data: MarketSnapshotData; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.data = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts index d85a8339..363e373b 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts @@ -7,12 +7,18 @@ export class OrderbookIncrementChanges implements Serializable { /** * price,size,sequence */ - asks?: Array>; + asks: Array>; /** * */ - bids?: Array>; + bids: Array>; + private constructor() { + // @ts-ignore + this.asks = null; + // @ts-ignore + this.bids = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index 99fd6c99..7c5589b5 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -10,24 +10,36 @@ export class OrderbookIncrementEvent implements Response { /** * */ - changes?: OrderbookIncrementChanges; + changes: OrderbookIncrementChanges; /** * */ - sequenceEnd?: number; + sequenceEnd: number; /** * */ - sequenceStart?: number; + sequenceStart: number; /** * */ - symbol?: string; + symbol: string; /** * milliseconds */ - time?: number; + time: number; + private constructor() { + // @ts-ignore + this.changes = null; + // @ts-ignore + this.sequenceEnd = null; + // @ts-ignore + this.sequenceStart = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts index fda0f0dd..1d6dc566 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -9,16 +9,24 @@ export class OrderbookLevel1Event implements Response { /** * price, size */ - asks?: Array; + asks: Array; /** * */ - bids?: Array; + bids: Array; /** * */ - timestamp?: number; + timestamp: number; + private constructor() { + // @ts-ignore + this.asks = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts index c9674b48..5539a881 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts @@ -7,12 +7,18 @@ export class OrderbookLevel50Changes implements Serializable { /** * */ - asks?: Array>; + asks: Array>; /** * */ - bids?: Array>; + bids: Array>; + private constructor() { + // @ts-ignore + this.asks = null; + // @ts-ignore + this.bids = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index 063a4e4f..39cd70fa 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -10,24 +10,36 @@ export class OrderbookLevel50Event implements Response { /** * */ - changes?: OrderbookLevel50Changes; + changes: OrderbookLevel50Changes; /** * */ - sequenceEnd?: number; + sequenceEnd: number; /** * */ - sequenceStart?: number; + sequenceStart: number; /** * */ - symbol?: string; + symbol: string; /** * */ - time?: number; + time: number; + private constructor() { + // @ts-ignore + this.changes = null; + // @ts-ignore + this.sequenceEnd = null; + // @ts-ignore + this.sequenceStart = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts index d2d99232..1d83b255 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -9,16 +9,24 @@ export class OrderbookLevel5Event implements Response { /** * price, size */ - asks?: Array>; + asks: Array>; /** * */ - bids?: Array>; + bids: Array>; /** * */ - timestamp?: number; + timestamp: number; + private constructor() { + // @ts-ignore + this.asks = null; + // @ts-ignore + this.bids = null; + // @ts-ignore + this.timestamp = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts index e8c4a5cc..e93ad284 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts @@ -10,140 +10,210 @@ export class SymbolSnapshotData implements Serializable { /** * */ - askSize?: number; + askSize: number; /** * */ - averagePrice?: number; + averagePrice: number; /** * */ - baseCurrency?: string; + baseCurrency: string; /** * */ - bidSize?: number; + bidSize: number; /** * Trading pair partition: 0.primary partition 1.KuCoin Plus\", example = \"1\" */ - board?: SymbolSnapshotData.BoardEnum; + board: SymbolSnapshotData.BoardEnum; /** * */ - buy?: number; + buy: number; /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - close?: number; + close: number; /** * */ - datetime?: number; + datetime: number; /** * */ - high?: number; + high: number; /** * */ - lastTradedPrice?: number; + lastTradedPrice: number; /** * */ - low?: number; + low: number; /** * */ - makerCoefficient?: number; + makerCoefficient: number; /** * */ - makerFeeRate?: number; + makerFeeRate: number; /** * */ - marginTrade?: boolean; + marginTrade: boolean; /** * Trading Pair Mark: 0.default 1.ST. 2.NEW\", example = \"1\" */ - mark?: SymbolSnapshotData.MarkEnum; + mark: SymbolSnapshotData.MarkEnum; /** * */ - market?: string; + market: string; /** * */ - marketChange1h?: SymbolSnapshotDataMarketChange1h; + marketChange1h: SymbolSnapshotDataMarketChange1h; /** * */ - marketChange24h?: SymbolSnapshotDataMarketChange24h; + marketChange24h: SymbolSnapshotDataMarketChange24h; /** * */ - marketChange4h?: SymbolSnapshotDataMarketChange4h; + marketChange4h: SymbolSnapshotDataMarketChange4h; /** * */ - markets?: Array; + markets: Array; /** * */ - open?: number; + open: number; /** * */ - quoteCurrency?: string; + quoteCurrency: string; /** * */ - sell?: number; + sell: number; /** * */ - siteTypes?: Array; + siteTypes: Array; /** * sorting number(Pointless) */ - sort?: number; + sort: number; /** * */ - symbol?: string; + symbol: string; /** * */ - symbolCode?: string; + symbolCode: string; /** * */ - takerCoefficient?: number; + takerCoefficient: number; /** * */ - takerFeeRate?: number; + takerFeeRate: number; /** * */ - trading?: boolean; + trading: boolean; /** * */ - vol?: number; + vol: number; /** * 24-hour rolling transaction volume, refreshed every 2s */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.askSize = null; + // @ts-ignore + this.averagePrice = null; + // @ts-ignore + this.baseCurrency = null; + // @ts-ignore + this.bidSize = null; + // @ts-ignore + this.board = null; + // @ts-ignore + this.buy = null; + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.close = null; + // @ts-ignore + this.datetime = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.lastTradedPrice = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.makerCoefficient = null; + // @ts-ignore + this.makerFeeRate = null; + // @ts-ignore + this.marginTrade = null; + // @ts-ignore + this.mark = null; + // @ts-ignore + this.market = null; + // @ts-ignore + this.marketChange1h = null; + // @ts-ignore + this.marketChange24h = null; + // @ts-ignore + this.marketChange4h = null; + // @ts-ignore + this.markets = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.quoteCurrency = null; + // @ts-ignore + this.sell = null; + // @ts-ignore + this.siteTypes = null; + // @ts-ignore + this.sort = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.symbolCode = null; + // @ts-ignore + this.takerCoefficient = null; + // @ts-ignore + this.takerFeeRate = null; + // @ts-ignore + this.trading = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts index 037a7515..a37d91b9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -7,32 +7,48 @@ export class SymbolSnapshotDataMarketChange1h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts index e0291dce..d9e37520 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -7,32 +7,48 @@ export class SymbolSnapshotDataMarketChange24h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts index f375f8c2..d4d7fdc9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -7,32 +7,48 @@ export class SymbolSnapshotDataMarketChange4h implements Serializable { /** * */ - changePrice?: number; + changePrice: number; /** * */ - changeRate?: number; + changeRate: number; /** * */ - high?: number; + high: number; /** * */ - low?: number; + low: number; /** * */ - open?: number; + open: number; /** * */ - vol?: number; + vol: number; /** * */ - volValue?: number; + volValue: number; + private constructor() { + // @ts-ignore + this.changePrice = null; + // @ts-ignore + this.changeRate = null; + // @ts-ignore + this.high = null; + // @ts-ignore + this.low = null; + // @ts-ignore + this.open = null; + // @ts-ignore + this.vol = null; + // @ts-ignore + this.volValue = null; + } toJson(): string { return JSON.stringify(instanceToPlain(this)); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index 7b30d2b1..c9de7aac 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -10,12 +10,18 @@ export class SymbolSnapshotEvent implements Response { /** * */ - sequence?: string; + sequence: string; /** * */ - data?: SymbolSnapshotData; + data: SymbolSnapshotData; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.data = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts index 906fd8ab..31b6d45c 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -9,36 +9,54 @@ export class TickerEvent implements Response { /** * Sequence number */ - sequence?: string; + sequence: string; /** * Last traded price */ - price?: string; + price: string; /** * Last traded amount */ - size?: string; + size: string; /** * Best ask price */ - bestAsk?: string; + bestAsk: string; /** * Best ask size */ - bestAskSize?: string; + bestAskSize: string; /** * Best bid price */ - bestBid?: string; + bestBid: string; /** * Best bid size */ - bestBidSize?: string; + bestBidSize: string; /** * The matching time of the latest transaction */ - Time?: number; + Time: number; + private constructor() { + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.bestAsk = null; + // @ts-ignore + this.bestAskSize = null; + // @ts-ignore + this.bestBid = null; + // @ts-ignore + this.bestBidSize = null; + // @ts-ignore + this.Time = null; + } /** * common response */ diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index 90dd302d..28f43c3f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -9,44 +9,66 @@ export class TradeEvent implements Response { /** * */ - makerOrderId?: string; + makerOrderId: string; /** * */ - price?: string; + price: string; /** * */ - sequence?: string; + sequence: string; /** * */ - side?: string; + side: string; /** * */ - size?: string; + size: string; /** * */ - symbol?: string; + symbol: string; /** * */ - takerOrderId?: string; + takerOrderId: string; /** * */ - time?: string; + time: string; /** * */ - tradeId?: string; + tradeId: string; /** * */ - type?: string; + type: string; + private constructor() { + // @ts-ignore + this.makerOrderId = null; + // @ts-ignore + this.price = null; + // @ts-ignore + this.sequence = null; + // @ts-ignore + this.side = null; + // @ts-ignore + this.size = null; + // @ts-ignore + this.symbol = null; + // @ts-ignore + this.takerOrderId = null; + // @ts-ignore + this.time = null; + // @ts-ignore + this.tradeId = null; + // @ts-ignore + this.type = null; + } /** * common response */ From cf1dfba4761ce584ea9980666e81d7493eaf9a63 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 20 Jan 2025 18:17:08 +0800 Subject: [PATCH 052/106] =?UTF-8?q?feat(nodejs)=EF=BC=9Amodify=20rest=20im?= =?UTF-8?q?pl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/infra/default_transport.ts | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index e55936f2..c003cab1 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -272,19 +272,24 @@ export class DefaultTransport implements Transport { response: AxiosResponse, responseCls: StaticDeserializable, ): Response { - // todo missing logic - if (response.status >= 400) { - console.error('[RESPONSE ERROR]', { - status: response.status, - statusText: response.statusText, - data: response.data, - }); - } + // Initialize response object first + let responseObj = responseCls.fromObject({}); const commonResponse = RestResponse.fromJson(JSON.stringify(response.data)); + commonResponse.rateLimit = this.processLimit(response.headers); - let responseObj = responseCls.fromObject(commonResponse.data); + if (commonResponse.data === null) { + responseObj.setCommonResponse(commonResponse); + return responseObj; + } + + try{ + responseObj = responseCls.fromObject(commonResponse.data); + }catch(e){ + throw e; + } + responseObj.setCommonResponse(commonResponse); return responseObj; From 4b235b67fc4f215c44b6072bda0b1130d13a02b2 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 21 Jan 2025 09:51:29 +0800 Subject: [PATCH 053/106] feat(nodejs): update tests --- sdk/node/example/example_api.ts | 32 ++++++++++--------- .../e2e/rest/account_test/account_api.test.ts | 30 ++++++++--------- .../rest/account_test/account_deposit.test.ts | 14 ++++---- .../e2e/rest/account_test/account_fee.test.ts | 6 ++-- .../account_test/account_subaccount.test.ts | 26 +++++++-------- .../account_test/account_transfer.test.ts | 14 ++++---- .../account_test/account_withdraw.test.ts | 12 +++---- 7 files changed, 68 insertions(+), 66 deletions(-) diff --git a/sdk/node/example/example_api.ts b/sdk/node/example/example_api.ts index 03c619d4..b792a0a4 100644 --- a/sdk/node/example/example_api.ts +++ b/sdk/node/example/example_api.ts @@ -3,15 +3,17 @@ import { AccountService, ClientOptionBuilder, DefaultClient, - DomainType, Futures, FuturesService, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, Spot, SpotService, TransportOptionBuilder, } from 'kucoin-universal-sdk'; -import { randomUUID } from 'crypto'; +import {randomUUID} from 'crypto'; async function restExample() { console.log('Starting REST example'); @@ -41,8 +43,9 @@ async function restExample() { .setBrokerName(brokerName) .setBrokerKey(brokerKey) .setBrokerPartner(brokerPartner) - .setSpotEndpoint(DomainType.Spot) - .setFuturesEndpoint(DomainType.Futures) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) .setTransportOption(httpTransportOption) .build(); @@ -67,8 +70,7 @@ async function accountServiceExample(accountService: AccountService) { // Get fee api const feeApi = accountService.getFeeApi(); - const getActualFeeReq = new Account.GetSpotActualFeeReqBuilder() - .setSymbols('BTC-USDT,ETH-USDT') + const getActualFeeReq = Account.GetSpotActualFeeReq.builder().setSymbols('BTC-USDT,ETH-USDT') .build(); const getActualFeeResp = feeApi.getSpotActualFee(getActualFeeReq).then((resp) => { if (resp.data) { @@ -92,7 +94,7 @@ async function spotServiceExample(spotService: SpotService) { const orderApi = spotService.getOrderApi(); // Add limit order - const addOrderReq = new Spot.AddOrderSyncReqBuilder() + const addOrderReq = Spot.AddOrderSyncReq.builder() .setClientOid(randomUUID().toString()) .setSide(Spot.AddOrderSyncReq.SideEnum.BUY) .setSymbol('BTC-USDT') @@ -106,8 +108,8 @@ async function spotServiceExample(spotService: SpotService) { console.log(`Add order success, id: ${addOrderResp.orderId}, oid: ${addOrderResp.clientOid}`); // Query order detail - const orderId = addOrderResp.orderId!; - const queryOrderDetailReq = new Spot.GetOrderByOrderIdReqBuilder() + const orderId = addOrderResp.orderId; + const queryOrderDetailReq = Spot.GetOrderByOrderIdReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -115,7 +117,7 @@ async function spotServiceExample(spotService: SpotService) { console.log(`Order detail: ${orderDetailResp.toJson()}`); // Cancel order - const cancelOrderReq = new Spot.CancelOrderByOrderIdSyncReqBuilder() + const cancelOrderReq = Spot.CancelOrderByOrderIdSyncReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -127,21 +129,21 @@ async function futuresServiceExample(futuresService: FuturesService) { const marketApi = futuresService.getMarketApi(); const allSymbolResp = await marketApi.getAllSymbols(); - const maxQuery = Math.min(allSymbolResp.data!.length, 10); + const maxQuery = Math.min(allSymbolResp.data.length, 10); for (let i = 0; i < maxQuery; i++) { - const symbol = allSymbolResp.data![i]; + const symbol = allSymbolResp.data[i]; const start = Date.now() - 10 * 60 * 1000; const end = Date.now(); - const getKlineReq = new Futures.GetKlinesReqBuilder() - .setSymbol(symbol.symbol!) + const getKlineReq = Futures.GetKlinesReq.builder() + .setSymbol(symbol.symbol) .setGranularity(Futures.GetKlinesReq.GranularityEnum._1) .setFrom(start) .setTo(end) .build(); const getKlineResp = await marketApi.getKlines(getKlineReq); - const rows = getKlineResp.data!.map((row: any) => { + const rows = getKlineResp.data.map((row: any) => { const timestamp = new Date(row[0]).toISOString(); return `[Time: ${timestamp}, Open: ${row[1]}, High: ${row[2]}, Low: ${row[3]}, Close: ${row[4]}, Volume: ${row[5]}]`; }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts index 90c42b85..870b0a24 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts @@ -73,7 +73,7 @@ describe('Auto Test', () => { expect(result.maxMarginSubQuantity).toEqual(expect.anything()); expect(result.maxFuturesSubQuantity).toEqual(expect.anything()); expect(result.maxOptionSubQuantity).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -94,7 +94,7 @@ describe('Auto Test', () => { expect(result.uid).toEqual(expect.anything()); expect(result.isMaster).toEqual(expect.anything()); expect(result.subName).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -107,7 +107,7 @@ describe('Auto Test', () => { let resp = api.getSpotAccountType(); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -123,7 +123,7 @@ describe('Auto Test', () => { let resp = api.getSpotAccountList(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -142,7 +142,7 @@ describe('Auto Test', () => { expect(result.balance).toEqual(expect.anything()); expect(result.available).toEqual(expect.anything()); expect(result.holds).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -162,7 +162,7 @@ describe('Auto Test', () => { expect(result.debtRatio).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.accounts).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -181,7 +181,7 @@ describe('Auto Test', () => { expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); expect(result.timestamp).toEqual(expect.anything()); expect(result.assets).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -205,7 +205,7 @@ describe('Auto Test', () => { expect(result.availableBalance).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); expect(result.riskRatio).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -225,7 +225,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -241,7 +241,7 @@ describe('Auto Test', () => { let resp = api.getSpotHFLedger(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -257,7 +257,7 @@ describe('Auto Test', () => { let resp = api.getMarginHFLedger(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -274,7 +274,7 @@ describe('Auto Test', () => { return resp.then(result => { expect(result.dataList).toEqual(expect.anything()); expect(result.hasMore).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -288,7 +288,7 @@ describe('Auto Test', () => { return resp.then(result => { expect(result.debtRatio).toEqual(expect.anything()); expect(result.accounts).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -306,7 +306,7 @@ describe('Auto Test', () => { expect(result.totalConversionBalance).toEqual(expect.anything()); expect(result.liabilityConversionBalance).toEqual(expect.anything()); expect(result.assets).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -326,7 +326,7 @@ describe('Auto Test', () => { expect(result.debtRatio).toEqual(expect.anything()); expect(result.baseAsset).toEqual(expect.anything()); expect(result.quoteAsset).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts index 8afc7cc4..a6fcdce3 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts @@ -64,7 +64,7 @@ describe('Auto Test', () => { expect(result.expirationDate).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); expect(result.chainName).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -80,7 +80,7 @@ describe('Auto Test', () => { let resp = api.getDepositAddressV3(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -100,7 +100,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -116,7 +116,7 @@ describe('Auto Test', () => { let resp = api.getDepositAddressV2(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -138,7 +138,7 @@ describe('Auto Test', () => { expect(result.to).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); expect(result.contractAddress).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -158,7 +158,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -179,7 +179,7 @@ describe('Auto Test', () => { expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts index 71c856d0..a6538885 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts @@ -54,7 +54,7 @@ describe('Auto Test', () => { return resp.then(result => { expect(result.takerFeeRate).toEqual(expect.anything()); expect(result.makerFeeRate).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -70,7 +70,7 @@ describe('Auto Test', () => { let resp = api.getSpotActualFee(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -88,7 +88,7 @@ describe('Auto Test', () => { expect(result.symbol).toEqual(expect.anything()); expect(result.takerFeeRate).toEqual(expect.anything()); expect(result.makerFeeRate).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts index 7e0c7a2d..0015de41 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts @@ -73,7 +73,7 @@ describe('Auto Test', () => { expect(result.subName).toEqual(expect.anything()); expect(result.remarks).toEqual(expect.anything()); expect(result.access).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -89,7 +89,7 @@ describe('Auto Test', () => { let resp = api.addSubAccountMarginPermission(req); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -105,7 +105,7 @@ describe('Auto Test', () => { let resp = api.addSubAccountFuturesPermission(req); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -125,7 +125,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -146,7 +146,7 @@ describe('Auto Test', () => { expect(result.tradeAccounts).toEqual(expect.anything()); expect(result.marginAccounts).toEqual(expect.anything()); expect(result.tradeHFAccounts).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -166,7 +166,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -183,7 +183,7 @@ describe('Auto Test', () => { return resp.then((result) => { expect(result.summary).toEqual(expect.anything()); expect(result.accounts).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -212,7 +212,7 @@ describe('Auto Test', () => { expect(result.permission).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -237,7 +237,7 @@ describe('Auto Test', () => { expect(result.apiKey).toEqual(expect.anything()); expect(result.permission).toEqual(expect.anything()); expect(result.ipWhitelist).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -253,7 +253,7 @@ describe('Auto Test', () => { let resp = api.getSubAccountApiList(req); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -270,7 +270,7 @@ describe('Auto Test', () => { return resp.then((result) => { expect(result.subName).toEqual(expect.anything()); expect(result.apiKey).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -283,7 +283,7 @@ describe('Auto Test', () => { let resp = api.getSpotSubAccountsSummaryV1(); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -296,7 +296,7 @@ describe('Auto Test', () => { let resp = api.getSpotSubAccountListV1(); return resp.then((result) => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts index b7f6ca2d..8fc24ea1 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts @@ -67,7 +67,7 @@ describe('Auto Test', () => { expect(result.available).toEqual(expect.anything()); expect(result.holds).toEqual(expect.anything()); expect(result.transferable).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -83,7 +83,7 @@ describe('Auto Test', () => { let resp = api.flexTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -99,7 +99,7 @@ describe('Auto Test', () => { let resp = api.subAccountTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -115,7 +115,7 @@ describe('Auto Test', () => { let resp = api.innerTransfer(req); return resp.then(result => { expect(result.orderId).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -147,7 +147,7 @@ describe('Auto Test', () => { expect(result.reason).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); expect(result.updatedAt).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -163,7 +163,7 @@ describe('Auto Test', () => { let resp = api.futuresAccountTransferIn(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -183,7 +183,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts index f65cf97f..30f8242f 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts @@ -76,7 +76,7 @@ describe('Auto Test', () => { expect(result.chain).toEqual(expect.anything()); expect(result.reason).toEqual(expect.anything()); expect(result.lockedAmount).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -92,7 +92,7 @@ describe('Auto Test', () => { let resp = api.withdrawalV3(req); return resp.then(result => { expect(result.withdrawalId).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -108,7 +108,7 @@ describe('Auto Test', () => { let resp = api.cancelWithdrawal(req); return resp.then(result => { expect(result.data).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -128,7 +128,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -148,7 +148,7 @@ describe('Auto Test', () => { expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); expect(result.items).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); @@ -164,7 +164,7 @@ describe('Auto Test', () => { let resp = api.withdrawalV1(req); return resp.then(result => { expect(result.withdrawalId).toEqual(expect.anything()); - console.log(resp); + console.log(result); }); }); From 1aa4e8bfdb185d8937c0d906ad71f762d13a13f1 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 21 Jan 2025 11:28:13 +0800 Subject: [PATCH 054/106] =?UTF-8?q?feat(nodejs)=EF=BC=9Awebsocket=20use=20?= =?UTF-8?q?mutilthread?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/infra/default_ws_service.ts | 128 ++++++++++++++---- sdk/node/src/internal/infra/message_worker.ts | 93 +++++++++++++ 2 files changed, 192 insertions(+), 29 deletions(-) create mode 100644 sdk/node/src/internal/infra/message_worker.ts diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index dd761047..393eabb0 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -13,6 +13,9 @@ import { WsMessage } from '@model/common'; import { MessageType } from '@model/constant'; import { randomUUID } from 'crypto'; import { EventEmitter } from 'events'; +import { Worker } from 'worker_threads'; +import path from 'path'; +import fs from 'fs'; /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. @@ -31,6 +34,7 @@ export class DefaultWsService implements WebSocketService { private messageLoop?: NodeJS.Timeout; private recoveryLoop?: NodeJS.Timeout; private readonly eventEmitter: EventEmitter; + private messageWorker?: Worker; /** * Creates a new instance of DefaultWsService @@ -115,53 +119,117 @@ export class DefaultWsService implements WebSocketService { } /** - * Starts the message processing loop - * Continuously reads messages from the WebSocket connection and dispatches them to appropriate callbacks - * Messages are processed every 1ms + * Starts the message processing loop using a dedicated Worker Thread + * Creates a worker thread for message processing to handle WebSocket messages */ private startMessageLoop(): void { - // Process all messages in queue every 1ms - this.messageLoop = setInterval(async () => { - if (this.stopSignal) { - if (this.messageLoop) clearInterval(this.messageLoop); - return; + try { + // Get the worker file path relative to the compiled js file + const workerPath = path.join(__dirname, '..', '..', '..', 'dist', 'internal', 'infra', 'message_worker.js'); + console.log('[Main] Worker file path:', workerPath); + console.log('[Main] Current directory:', __dirname); + + if (!fs.existsSync(workerPath)) { + throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); } - try { - // Process all messages in the queue - while (true) { - const msg = await this.client.read(); - if (!msg) break; // Exit loop when queue is empty - - if (msg.type !== MessageType.Message) continue; + // Create a new worker thread + this.messageWorker = new Worker(workerPath); + console.log('[Main] Worker created successfully'); + // Handle messages processed by the worker + this.messageWorker.on('message', async (msg: WsMessage) => { + console.log('[Main] Received processed message from worker:', { + topic: msg.topic, + type: msg.type + }); + + try { const callbackManager = this.topicManager.getCallbackManager(msg.topic); if (!callbackManager) { console.error( - `Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`, + `[Main] Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`, ); - continue; + return; } const cb = callbackManager.get(msg.topic); if (!cb) { console.error( - `Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`, + `[Main] Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`, ); - continue; + return; } try { await cb.onMessage(msg); + console.log('[Main] Message processed by callback successfully'); } catch (err) { - console.error('Exception in callback:', err); + console.error('[Main] Exception in callback:', err); this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } + } catch (err) { + console.error('[Main] Error processing message in main thread:', err); + } + }); + + // Handle worker errors + this.messageWorker.on('error', (error) => { + console.error('[Main] Worker thread error:', error); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(error)); + }); + + // Handle worker exit + this.messageWorker.on('exit', (code) => { + console.log(`[Main] Worker stopped with exit code ${code}`); + if (code !== 0) { + console.error('[Main] Worker stopped with non-zero exit code'); + } + }); + + } catch (error) { + console.error('[Main] Error creating worker:', error); + throw error; + } + + // Start message reading loop + const readMessages = async () => { + while (!this.stopSignal) { + try { + const msg = await this.client.read(); + if (!msg) { + await new Promise(resolve => setTimeout(resolve, 10)); // Wait 1 second before next try + continue; + } + + // Send message to worker thread for processing + if (this.messageWorker?.listenerCount('message') === 0) { + console.warn('[Main] Worker has no message listeners, recreating worker...'); + this.messageWorker?.terminate(); + this.startMessageLoop(); + continue; + } + + this.messageWorker?.postMessage(msg); + } catch (err) { + console.error('[Main] Error reading message:', err); + await new Promise(resolve => setTimeout(resolve, 100)); // Wait 1 second before retry + continue; } - } catch (err) { - console.error('Error in message loop:', err); } - }, 1); + + // Only terminate worker if stop signal is received + if (this.stopSignal) { + console.log('[Main] Stop signal received, terminating worker...'); + this.messageWorker?.terminate(); + } + }; + + // Start the message reading loop + readMessages().catch(err => { + console.error('[Main] Fatal error in message reading loop:', err); + this.notifyEvent(WebSocketEvent.EventErrorReceived, String(err)); + }); } /** @@ -227,14 +295,16 @@ export class DefaultWsService implements WebSocketService { } /** - * Stops the WebSocket service - * Clears all intervals and stops the client + * Stops the message processing and cleans up resources */ stop(): Promise { - this.stopSignal = true; - if (this.messageLoop) clearInterval(this.messageLoop); - if (this.recoveryLoop) clearInterval(this.recoveryLoop); - return this.client.stop(); + return new Promise((resolve) => { + this.stopSignal = true; + this.messageWorker?.terminate(); + if (this.messageLoop) clearInterval(this.messageLoop); + if (this.recoveryLoop) clearInterval(this.recoveryLoop); + resolve(); + }); } /** diff --git a/sdk/node/src/internal/infra/message_worker.ts b/sdk/node/src/internal/infra/message_worker.ts new file mode 100644 index 00000000..d9b42511 --- /dev/null +++ b/sdk/node/src/internal/infra/message_worker.ts @@ -0,0 +1,93 @@ +import { parentPort } from 'worker_threads'; +import { WsMessage } from '@model/common'; +import { MessageType } from '@model/constant'; + +// Log worker initialization +console.log('[Worker] Initializing worker thread'); + +if (!parentPort) { + console.error('[Worker] parentPort is null - worker must be run as a worker thread'); + process.exit(1); +} + +// Handle messages from the main thread +parentPort.on('message', (message: WsMessage) => { + console.log('[Worker] Received message:', { + type: message.type, + topic: message.topic, + timestamp: new Date().toISOString() + }); + + try { + // Process all message types + switch (message.type) { + case MessageType.Message: + // Market data message + console.log('[Worker] Processing market data message for topic:', message.topic); + parentPort!.postMessage({ + ...message, + processedAt: new Date().toISOString() + }); + break; + + case MessageType.SubscribeMessage: + case MessageType.UnsubscribeMessage: + // Subscription related messages + console.log(`[Worker] Processing ${message.type} message for topic:`, message.topic); + parentPort!.postMessage(message); + break; + + case MessageType.WelcomeMessage: + case MessageType.PingMessage: + case MessageType.PongMessage: + case MessageType.AckMessage: + // System messages + console.log(`[Worker] Processing system message type:`, message.type); + parentPort!.postMessage(message); + break; + + case MessageType.ErrorMessage: + // Error messages + console.error('[Worker] Received error message:', message); + parentPort!.postMessage(message); + break; + + default: + // Other message types + console.log('[Worker] Processing unknown message type:', message.type); + parentPort!.postMessage(message); + } + + console.log('[Worker] Successfully processed message'); + } catch (error) { + console.error('[Worker] Error processing message:', error); + } +}); + +// Handle errors +parentPort.on('error', (error) => { + console.error('[Worker] Error event:', error); +}); + +// Handle close +parentPort.on('close', () => { + console.log('[Worker] Close event: Worker is shutting down'); +}); + +// Keep the worker alive +process.on('exit', () => { + console.log('[Worker] Process exit event received'); +}); + +// Handle uncaught exceptions +process.on('uncaughtException', (error) => { + console.error('[Worker] Uncaught exception:', error); +}); + +// Handle unhandled rejections +process.on('unhandledRejection', (reason) => { + console.error('[Worker] Unhandled rejection:', reason); +}); + +// Log worker startup +console.log('[Worker] Started and ready to process messages at:', new Date().toISOString()); From f774fc66810874961e87be1e89f287699d6a5234 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 21 Jan 2025 11:31:59 +0800 Subject: [PATCH 055/106] feat(nodejs): add example project --- sdk/node/example/package-lock.json | 3651 +++++++++++++++++ sdk/node/example/package.json | 41 + sdk/node/example/src/js/example_api.js | 151 + .../example/src/js/example_get_started.js | 61 + sdk/node/example/{ => src/ts}/example_api.ts | 0 .../{ => src/ts}/example_get_started.ts | 0 sdk/node/example/tsconfig.json | 28 + sdk/node/tsconfig.json | 4 +- 8 files changed, 3934 insertions(+), 2 deletions(-) create mode 100644 sdk/node/example/package-lock.json create mode 100644 sdk/node/example/package.json create mode 100644 sdk/node/example/src/js/example_api.js create mode 100644 sdk/node/example/src/js/example_get_started.js rename sdk/node/example/{ => src/ts}/example_api.ts (100%) rename sdk/node/example/{ => src/ts}/example_get_started.ts (100%) create mode 100644 sdk/node/example/tsconfig.json diff --git a/sdk/node/example/package-lock.json b/sdk/node/example/package-lock.json new file mode 100644 index 00000000..6763cd90 --- /dev/null +++ b/sdk/node/example/package-lock.json @@ -0,0 +1,3651 @@ +{ + "name": "kucoin-universal-sdk-example", + "version": "0.1.0-alpha", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + } + }, + "@babel/compat-data": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.5.tgz", + "integrity": "sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg==", + "dev": true + }, + "@babel/core": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.5.tgz", + "integrity": "sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw==", + "dev": true, + "requires": { + "@babel/parser": "^7.26.5", + "@babel/types": "^7.26.5", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "requires": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + } + }, + "@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", + "dev": true + }, + "@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "dev": true + }, + "@babel/helpers": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "dev": true, + "requires": { + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" + } + }, + "@babel/parser": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.5.tgz", + "integrity": "sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw==", + "dev": true, + "requires": { + "@babel/types": "^7.26.5" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/template": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" + } + }, + "@babel/traverse": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.5.tgz", + "integrity": "sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.5", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.5", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.5.tgz", + "integrity": "sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.4.3" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + } + } + }, + "@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true + }, + "@eslint/config-array": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", + "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "dev": true, + "requires": { + "@eslint/object-schema": "^2.1.5", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.15" + } + }, + "@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@eslint/js": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz", + "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==", + "dev": true + }, + "@eslint/object-schema": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", + "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "dev": true + }, + "@eslint/plugin-kit": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", + "dev": true, + "requires": { + "@eslint/core": "^0.10.0", + "levn": "^0.4.1" + } + }, + "@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true + }, + "@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "requires": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "dependencies": { + "@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true + } + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } + }, + "@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "requires": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + } + }, + "@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3" + } + }, + "@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + } + }, + "@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + } + }, + "@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + } + }, + "@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true + }, + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, + "@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, + "@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", + "dev": true, + "requires": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "@types/node": { + "version": "22.10.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz", + "integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==", + "dev": true, + "requires": { + "undici-types": "~6.20.0" + } + }, + "@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true + }, + "@types/yargs": { + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.21.0.tgz", + "integrity": "sha512-eTH+UOR4I7WbdQnG4Z48ebIA6Bgi7WO8HvFEneeYBxG8qCOYgTOFPSg6ek9ITIDvGjDQzWHcoWHCDO2biByNzA==", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.21.0", + "@typescript-eslint/type-utils": "8.21.0", + "@typescript-eslint/utils": "8.21.0", + "@typescript-eslint/visitor-keys": "8.21.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.21.0.tgz", + "integrity": "sha512-Wy+/sdEH9kI3w9civgACwabHbKl+qIOu0uFZ9IMKzX3Jpv9og0ZBJrZExGrPpFAY7rWsXuxs5e7CPPP17A4eYA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "8.21.0", + "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/typescript-estree": "8.21.0", + "@typescript-eslint/visitor-keys": "8.21.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.21.0.tgz", + "integrity": "sha512-G3IBKz0/0IPfdeGRMbp+4rbjfSSdnGkXsM/pFZA8zM9t9klXDnB/YnKOBQ0GoPmoROa4bCq2NeHgJa5ydsQ4mA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/visitor-keys": "8.21.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.21.0.tgz", + "integrity": "sha512-95OsL6J2BtzoBxHicoXHxgk3z+9P3BEcQTpBKriqiYzLKnM2DeSqs+sndMKdamU8FosiadQFT3D+BSL9EKnAJQ==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "8.21.0", + "@typescript-eslint/utils": "8.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.0" + } + }, + "@typescript-eslint/types": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", + "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.21.0.tgz", + "integrity": "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/visitor-keys": "8.21.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.0" + } + }, + "@typescript-eslint/utils": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.21.0.tgz", + "integrity": "sha512-xcXBfcq0Kaxgj7dwejMbFyq7IOHgpNMtVuDveK7w3ZGwG9owKzhALVwKpTF2yrZmEwl9SWdetf3fxNzJQaVuxw==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.21.0", + "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/typescript-estree": "8.21.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", + "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.21.0", + "eslint-visitor-keys": "^4.2.0" + } + }, + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true + }, + "babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "requires": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + } + }, + "babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, + "browserslist": { + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + } + }, + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001695", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001695.tgz", + "integrity": "sha512-vHyLade6wTgI2u1ec3WQBxv+2BrTERV28UXQu9LO6lZ9pYeMk34vjXFLOxo1A4UBA8XTL4njRQZdno/yYaSmWw==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true + }, + "chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + } + }, + "cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "requires": { + "jake": "^10.8.5" + } + }, + "electron-to-chromium": { + "version": "1.5.84", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.84.tgz", + "integrity": "sha512-I+DQ8xgafao9Ha6y0qjHHvpZ9OfyA1qKlkHkjywxzniORU2awxyz7f/iVJcULmrF2yrM3nHQf+iDjJtbbexd/g==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + }, + "eslint": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz", + "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.10.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.18.0", + "@eslint/plugin-kit": "^0.2.5", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true + }, + "eslint-plugin-prettier": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz", + "integrity": "sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" + } + }, + "eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true + }, + "espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "requires": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastq": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", + "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "requires": { + "flat-cache": "^4.0.0" + } + }, + "filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "requires": { + "minimatch": "^5.0.1" + }, + "dependencies": { + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "requires": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + } + }, + "flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "requires": { + "hasown": "^2.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "requires": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + } + }, + "istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "requires": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "dependencies": { + "jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + } + } + } + }, + "jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + } + }, + "jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true + }, + "jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true + }, + "jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true + }, + "jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + } + }, + "jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + } + }, + "jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "requires": { + "semver": "^7.5.3" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "requires": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "mylas": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz", + "integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + } + } + }, + "plimit-lit": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz", + "integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==", + "dev": true, + "requires": { + "queue-lit": "^1.5.1" + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, + "pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true + }, + "pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true + }, + "queue-lit": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz", + "integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "requires": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "synckit": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", + "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", + "dev": true, + "requires": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + } + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true + }, + "ts-jest": { + "version": "29.2.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz", + "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==", + "dev": true, + "requires": { + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.6.3", + "yargs-parser": "^21.1.1" + } + }, + "tsc-alias": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.10.tgz", + "integrity": "sha512-Ibv4KAWfFkFdKJxnWfVtdOmB0Zi1RJVxcbPGiCDsFpCQSsmpWyuzHG3rQyI5YkobWwxFPEyQfu1hdo4qLG2zPw==", + "dev": true, + "requires": { + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "globby": "^11.0.4", + "mylas": "^2.1.9", + "normalize-path": "^3.0.0", + "plimit-lit": "^1.2.6" + } + }, + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, + "typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "dev": true + }, + "undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true + }, + "update-browserslist-db": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", + "dev": true, + "requires": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/sdk/node/example/package.json b/sdk/node/example/package.json new file mode 100644 index 00000000..3e288cf8 --- /dev/null +++ b/sdk/node/example/package.json @@ -0,0 +1,41 @@ +{ + "name": "kucoin-universal-sdk-example", + "version": "0.1.0-alpha", + "description": "KuCoin Universal SDK Examples", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc && tsc-alias", + "lint": "eslint 'src/**/*.{ts,js}' --fix", + "format": "prettier --write 'src/**/*.{ts,js,json}'", + "test": "jest", + "clean": "rm -rf dist" + }, + "repository": { + "type": "git", + "url": "https://github.com/Kucoin/kucoin-universal-sdk" + }, + "author": "KuCoin", + "license": "MIT", + "devDependencies": { + "@types/jest": "^29.5.14", + "@typescript-eslint/eslint-plugin": "^8.19.0", + "@typescript-eslint/parser": "^8.19.0", + "eslint": "^9.17.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "jest": "^29.7.0", + "prettier": "^3.4.2", + "ts-jest": "^29.2.5", + "tsc-alias": "^1.8.10", + "typescript": "^5.7.2" + }, + "peerDependencies": {}, + "engines": { + "node": ">=14" + }, + "dependencies": {} +} diff --git a/sdk/node/example/src/js/example_api.js b/sdk/node/example/src/js/example_api.js new file mode 100644 index 00000000..da2cfac8 --- /dev/null +++ b/sdk/node/example/src/js/example_api.js @@ -0,0 +1,151 @@ +const { + Account, + ClientOptionBuilder, + DefaultClient, + Futures, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder, +} = require('kucoin-universal-sdk'); + +const { randomUUID } = require('crypto'); + +async function restExample() { + console.log('Starting REST example'); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Optional: Retrieve broker secret information from environment variables + const brokerName = process.env.BROKER_NAME || ''; + const brokerKey = process.env.BROKER_KEY || ''; + const brokerPartner = process.env.BROKER_PARTNER || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setBrokerName(brokerName) + .setBrokerKey(brokerKey) + .setBrokerPartner(brokerPartner) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + + await accountServiceExample(kucoinRestService.getAccountService()); + await spotServiceExample(kucoinRestService.getSpotService()); + await futuresServiceExample(kucoinRestService.getFuturesService()); +} + +async function accountServiceExample(accountService) { + // Get account api + const accountApi = accountService.getAccountApi(); + // Get summary information + const accountInfoResp = accountApi.getAccountInfo().then((info) => { + console.log(`Account info: level: ${info.level}, SubAccountSize: ${info.subQuantity}`); + }); + + // Get fee api + const feeApi = accountService.getFeeApi(); + const getActualFeeReq = Account.GetSpotActualFeeReq.builder() + .setSymbols('BTC-USDT,ETH-USDT') + .build(); + + const getActualFeeResp = feeApi.getSpotActualFee(getActualFeeReq).then((resp) => { + if (resp.data) { + resp.data.forEach((feeData) => { + console.log( + `Fee info: symbol: ${feeData.symbol}, TakerFee: ${feeData.takerFeeRate}, MakerFee: ${feeData.makerFeeRate}`, + ); + }); + } + }); + + await Promise.all([accountInfoResp, getActualFeeResp]).catch((err) => { + console.error('Account API error:', err); + }); +} + +async function spotServiceExample(spotService) { + const orderApi = spotService.getOrderApi(); + + // Add limit order + const addOrderReq = Spot.AddOrderSyncReq.builder() + .setClientOid(randomUUID().toString()) + .setSide(Spot.AddOrderSyncReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(Spot.AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark('sdk_example') + .setPrice('10000') + .setSize('0.001') + .build(); + + const addOrderResp = await orderApi.addOrderSync(addOrderReq); + console.log(`Add order success, id: ${addOrderResp.orderId}, oid: ${addOrderResp.clientOid}`); + + // Query order detail + const orderId = addOrderResp.orderId; + const queryOrderDetailReq = Spot.GetOrderByOrderIdReq.builder() + .setOrderId(orderId) + .setSymbol('BTC-USDT') + .build(); + const orderDetailResp = await orderApi.getOrderByOrderId(queryOrderDetailReq); + console.log(`Order detail: ${JSON.stringify(orderDetailResp)}`); + + // Cancel order + const cancelOrderReq = Spot.CancelOrderByOrderIdSyncReq.builder() + .setOrderId(orderId) + .setSymbol('BTC-USDT') + .build(); + const cancelOrderResp = await orderApi.cancelOrderByOrderIdSync(cancelOrderReq); + console.log(`Cancel order success, id: ${cancelOrderResp.orderId}`); +} + +async function futuresServiceExample(futuresService) { + const marketApi = futuresService.getMarketApi(); + const allSymbolResp = await marketApi.getAllSymbols(); + + const maxQuery = Math.min(allSymbolResp.data.length, 10); + for (let i = 0; i < maxQuery; i++) { + const symbol = allSymbolResp.data[i]; + const start = Date.now() - 10 * 60 * 1000; + const end = Date.now(); + + const getKlineReq = Futures.GetKlinesReq.builder() + .setSymbol(symbol.symbol) + .setGranularity(Futures.GetKlinesReq.GranularityEnum._1) + .setFrom(start) + .setTo(end) + .build(); + + const getKlineResp = await marketApi.getKlines(getKlineReq); + const rows = getKlineResp.data.map((row) => { + const timestamp = new Date(row[0]).toISOString(); + return `[Time: ${timestamp}, Open: ${row[1]}, High: ${row[2]}, Low: ${row[3]}, Close: ${row[4]}, Volume: ${row[5]}]`; + }); + console.log(`Symbol: ${symbol.symbol}, Kline: ${rows.join(', ')}`); + } +} + +restExample().catch((err) => { + console.error('Error occurred:', err); +}); diff --git a/sdk/node/example/src/js/example_get_started.js b/sdk/node/example/src/js/example_get_started.js new file mode 100644 index 00000000..c17468e1 --- /dev/null +++ b/sdk/node/example/src/js/example_get_started.js @@ -0,0 +1,61 @@ +const { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder +} = require('kucoin-universal-sdk'); + +function example() { + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + + const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); + + // Create request by interface + let request = Spot.GetPartOrderBookReq.create({ + symbol: 'BTC-USDT', + size: '20', + }); + + // Or create request by builder + request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + + // Query for part orderbook depth data. (aggregated by price) + spotMarketApi.getPartOrderBook(request) + .then((result) => { + console.log(`Time: ${result.time}, Seq: ${result.sequence}, Bids: ${result.bids}, Asks: ${result.asks}`); + }) + .catch((err) => { + console.error('fail to get part order book', err); + }); +} + +example(); diff --git a/sdk/node/example/example_api.ts b/sdk/node/example/src/ts/example_api.ts similarity index 100% rename from sdk/node/example/example_api.ts rename to sdk/node/example/src/ts/example_api.ts diff --git a/sdk/node/example/example_get_started.ts b/sdk/node/example/src/ts/example_get_started.ts similarity index 100% rename from sdk/node/example/example_get_started.ts rename to sdk/node/example/src/ts/example_get_started.ts diff --git a/sdk/node/example/tsconfig.json b/sdk/node/example/tsconfig.json new file mode 100644 index 00000000..3b029991 --- /dev/null +++ b/sdk/node/example/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "ES2019", + "module": "CommonJS", + "moduleResolution": "Node", + "declaration": true, + "sourceMap": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "outDir": "./dist", + "baseUrl": "./", + "paths": { + "@src/*": [ + "src/*" + ] + }, + "experimentalDecorators": true, + "emitDecoratorMetadata": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "tests" + ] +} diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index 7d1dd053..c86fba88 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "target": "ES2020", - "module": "ESNext", + "target": "ES2019", + "module": "CommonJS", "moduleResolution": "Node", "declaration": true, "sourceMap": true, From c3ad00827350a1ce9a288d7b98cf42dbf7185c20 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 21 Jan 2025 14:11:20 +0800 Subject: [PATCH 056/106] =?UTF-8?q?feat(nodejs):=20remove=20queue-typescri?= =?UTF-8?q?pt=EF=BC=8Cuse=20stream=20to=20store=20websocket=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/infra/default_ws_client.ts | 271 +++++++++--------- .../src/internal/infra/default_ws_service.ts | 181 +++++++----- sdk/node/src/internal/infra/message_worker.ts | 9 +- 3 files changed, 237 insertions(+), 224 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index edbfc729..72f587ee 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,6 +1,6 @@ import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; -import { Queue } from 'queue-typescript'; +import { Readable, Writable } from 'stream'; import { WsMessage } from '../../model/common'; import { MessageType } from '../../model/constant'; @@ -8,28 +8,77 @@ import { WebSocketClientOption } from '../../model/websocket_option'; import { WebSocketEvent } from '../../model/websocket_option'; import { WsToken, WsTokenProvider } from '../interfaces/websocket'; -export class WriteMsg { - public msg: WsMessage; - public ts: number; - public timeout: number; - public exception: Error | null; - public eventEmitter: EventEmitter; - - constructor(msg: WsMessage, timeout: number) { - this.msg = msg; - this.ts = Date.now(); - this.timeout = timeout; - this.exception = null; - this.eventEmitter = new EventEmitter(); +/** + * WriteMsg represents a message to be written to the WebSocket connection + */ +export interface WriteMsg { + msg: WsMessage; + resolve: (value: void | PromiseLike) => void; + reject: (reason?: any) => void; +} + +/** + * MessageQueue implements a message queue using Node.js streams + */ +class MessageQueue extends Readable { + private messages: WsMessage[] = []; + private maxSize: number; + + constructor(maxSize: number = 1024) { + super({ + objectMode: true, + highWaterMark: maxSize + }); + this.maxSize = maxSize; + } + + _read(size: number): void { + while (this.messages.length > 0 && size > 0) { + const message = this.messages.shift(); + if (!this.push(message)) { + break; + } + size--; + } } - setException(exception: Error): void { - this.exception = exception; - this.eventEmitter.emit('error', exception); + enqueue(message: WsMessage): boolean { + if (this.messages.length >= this.maxSize) { + return false; + } + this.messages.push(message); + this._read(1); + return true; } - complete(): void { - this.eventEmitter.emit('complete'); + clear(): void { + this.messages = []; + } +} + +/** + * MessageWriter implements a message writer using Node.js streams + */ +class MessageWriter extends Writable { + constructor(private client: WebSocket) { + super({ + objectMode: true, + highWaterMark: 256 + }); + } + + _write(message: WsMessage, encoding: string, callback: (error?: Error | null) => void): void { + try { + this.client.send(JSON.stringify(message), (error) => { + if (error) { + callback(error); + } else { + callback(); + } + }); + } catch (error) { + callback(error as Error); + } } } @@ -48,19 +97,18 @@ export class WebSocketClient { private closed: boolean; private reconnectClosed: boolean; - private readMsg: Queue; - private writeMsg: Queue; - private readMsgMaxSize: number; - private writeMsgMaxSize: number; + private readMsgQueue: MessageQueue; + private writeMsgQueue: MessageQueue; private ackEvents: Map; private metric: { pingSuccess: number; pingErr: number }; private keepAliveInterval: NodeJS.Timeout | null; - private writeInterval: NodeJS.Timeout | null; private welcomeReceived: boolean; private eventEmitter: EventEmitter; private lastPingTime: number | null; + private messageWriter: MessageWriter | null = null; + constructor( tokenProvider: WsTokenProvider, options: WebSocketClientOption, @@ -79,15 +127,13 @@ export class WebSocketClient { this.welcomeReceived = false; // Message queues - this.readMsg = new Queue(); - this.writeMsg = new Queue(); - this.readMsgMaxSize = options.readMessageBuffer; - this.writeMsgMaxSize = options.writeMessageBuffer; + this.readMsgQueue = new MessageQueue(options.readMessageBuffer); + this.writeMsgQueue = new MessageQueue(options.writeMessageBuffer); + this.ackEvents = new Map(); this.metric = { pingSuccess: 0, pingErr: 0 }; this.keepAliveInterval = null; - this.writeInterval = null; this.eventEmitter = externalEventEmitter || new EventEmitter(); this.lastPingTime = null; @@ -120,38 +166,50 @@ export class WebSocketClient { this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); } - if (!this.writeInterval) { - this.writeInterval = setInterval(() => this.writeMessage(), 100); - } + this.messageWriter = new MessageWriter(this.conn as WebSocket); + this.writeMsgQueue.pipe(this.messageWriter); } // Stop the WebSocket client - public async stop(): Promise { - // Set shutdown flag to prevent reconnection attempts + stop(): Promise { + console.debug('Stopping WebSocket client...'); this.shutdown = true; this.reconnectClosed = true; + // Clear intervals and resources first + this.clearResources(); + + return new Promise((resolve) => { + // Close WebSocket connection if it exists + if (this.conn && this.conn.readyState === WebSocket.OPEN) { + this.conn.once('close', () => { + console.debug('WebSocket client stopped'); + resolve(); + }); + this.conn.close(); + } else { + console.debug('WebSocket client stopped'); + resolve(); + } + }); + } + + // Clear all resources + private clearResources(): void { // Clear intervals if (this.keepAliveInterval) { clearInterval(this.keepAliveInterval); this.keepAliveInterval = null; } - if (this.writeInterval) { - clearInterval(this.writeInterval); - this.writeInterval = null; - } - // Wait for any pending messages to be processed - await new Promise((resolve) => { - setTimeout(async () => { - try { - await this.close(); - } catch (error) { - console.error('Error during WebSocket close:', error); - } - resolve(); - }, 100); - }); + // Clear message queues + this.clearMessageQueues(); + + // Reset state + this.disconnected = true; + this.connected = false; + this.welcomeReceived = false; + this.lastPingTime = null; } // dial connects to the WebSocket server @@ -214,23 +272,19 @@ export class WebSocketClient { // close callback private onClose(code: number, reason: string): void { - console.log(`WebSocket closed with status code ${code}, message: ${reason}`); - this.connected = false; + console.debug(`WebSocket closed with code ${code}: ${reason}`); this.disconnected = true; - // Clear any pending messages and intervals - this.clearMessageQueues(); - if (this.keepAliveInterval) { - clearInterval(this.keepAliveInterval); - this.keepAliveInterval = null; - } - if (this.writeInterval) { - clearInterval(this.writeInterval); - this.writeInterval = null; - } + // Clear resources + this.clearResources(); // Notify event - this.notifyEvent(WebSocketEvent.EventDisconnected, reason); + this.notifyEvent(WebSocketEvent.EventDisconnected, `${code}:${reason}`); + + // Handle reconnection if needed + if (!this.shutdown && !this.reconnectClosed) { + this.reconnect(); + } } // receive message callback @@ -240,7 +294,6 @@ export class WebSocketClient { return; } - console.debug('onMessage Received type:message message:' + message); let m: WsMessage; try { m = JSON.parse(message); @@ -259,8 +312,8 @@ export class WebSocketClient { if (!this.shutdown && !this.closed) { this.notifyEvent(WebSocketEvent.EventMessageReceived, ''); // queue message - if (this.readMsg.length < this.readMsgMaxSize) { - this.readMsg.enqueue(m); + if (this.readMsgQueue.enqueue(m)) { + this.readMsgQueue._read(1); } else { this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); console.warn('Read buffer full'); @@ -296,17 +349,17 @@ export class WebSocketClient { if (m.type === MessageType.PongMessage) { console.debug('[HandleAckEvent] Handling pong message'); this.metric.pingSuccess++; - data.complete(); + data.resolve(); return; } if (m.type === MessageType.ErrorMessage) { const error = m.data; this.notifyEvent(WebSocketEvent.EventErrorReceived, error); - data.setException(new Error(error)); + data.reject(new Error(error)); this.metric.pingErr++; } else { - data.complete(); + data.resolve(); } } @@ -315,82 +368,36 @@ export class WebSocketClient { * @returns The first message in the queue, or undefined if queue is empty */ read(): WsMessage | undefined { - if (this.readMsg.length === 0) { - return undefined; - } - return this.readMsg.dequeue(); + return this.readMsgQueue.read(); } // write message write(ms: WsMessage, timeout: number): Promise { return new Promise((resolve, reject) => { - console.log('Write message:', ms); + if (!this.connected) { reject(new Error('Not connected')); return; } - const msg = new WriteMsg(ms, timeout); + const msg: WriteMsg = { msg: ms, resolve, reject }; if (!ms.id) { reject(new Error('Message ID is undefined')); return; } // write message to queue and check if it reaches the max size - if (this.writeMsg.length < this.writeMsgMaxSize) { - this.writeMsg.enqueue(msg); + if (this.writeMsgQueue.enqueue(ms)) { this.ackEvents.set(ms.id, msg); - - // Listen for message completion - msg.eventEmitter.once('complete', () => { - resolve(); - }); - - msg.eventEmitter.once('error', (error) => { - reject(error); - }); - - // Trigger message sending - setImmediate(() => this.writeMessage()); + this.writeMsgQueue._read(1); } else { reject(new Error('Write buffer is full')); } }); } - // send message - private writeMessage(): void { - if (this.closed || !this.conn) return; - - // Process all messages in the queue - while (this.writeMsg.length > 0) { - const msg = this.writeMsg.dequeue(); - if (!msg) break; - - try { - // Send the complete message as JSON string - this.conn.send(JSON.stringify(msg.msg)); - console.debug('Message sent:', msg.msg); - msg.ts = Date.now(); - - // Only complete non-ping messages immediately - // Ping messages will be completed when we receive the pong response - if (msg.msg.type !== MessageType.PingMessage) { - msg.complete(); - } - } catch (e) { - console.error('Failed to send message:', e); - if (msg.msg.id) { - this.ackEvents.delete(msg.msg.id); - } - msg.setException(e as Error); - } - } - } - // keep-alive private keepAlive(): void { - console.debug('[KeepAlive] Start checking...'); if (!this.tokenInfo || this.shutdown || this.closed) { console.debug('[KeepAlive] Skip - basic check failed'); @@ -407,19 +414,14 @@ export class WebSocketClient { const currentTime = Date.now() / 1000; const timeSinceLastPing = currentTime - (this.lastPingTime || 0); - console.debug( - `[KeepAlive] Current: ${currentTime}, LastPing: ${this.lastPingTime}, Interval: ${interval}, TimeSince: ${timeSinceLastPing}`, - ); if (timeSinceLastPing >= interval) { - console.debug('[KeepAlive] Sending ping message...'); const pingMsg = this.newPingMessage(); try { this.write(pingMsg, timeout).catch((e) => { console.error('[KeepAlive] Heartbeat ping error:', e); this.disconnected = true; }); - console.debug('[KeepAlive] Ping sent'); } catch (e) { console.error('[KeepAlive] Heartbeat ping error:', e); this.metric.pingErr++; @@ -494,23 +496,12 @@ export class WebSocketClient { // Clear all message queues and cleanup resources private clearMessageQueues(): void { // Clear read message queue - while (this.readMsg.length > 0) { - this.readMsg.dequeue(); - } + this.readMsgQueue.clear(); // Clear write message queue and reject pending promises - while (this.writeMsg.length > 0) { - const writeMsg = this.writeMsg.dequeue(); - if (writeMsg) { - writeMsg.setException(new Error('WebSocket connection closed')); - writeMsg.complete(); - } - } - - // Clear ack events + this.writeMsgQueue.clear(); this.ackEvents.forEach((writeMsg) => { - writeMsg.setException(new Error('WebSocket connection closed')); - writeMsg.complete(); + writeMsg.reject(new Error('WebSocket connection closed')); }); this.ackEvents.clear(); } @@ -523,10 +514,6 @@ export class WebSocketClient { clearInterval(this.keepAliveInterval); this.keepAliveInterval = null; } - if (this.writeInterval) { - clearInterval(this.writeInterval); - this.writeInterval = null; - } // Clear message queues this.clearMessageQueues(); diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 393eabb0..853bcd6b 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -14,6 +14,7 @@ import { MessageType } from '@model/constant'; import { randomUUID } from 'crypto'; import { EventEmitter } from 'events'; import { Worker } from 'worker_threads'; +import { Transform, TransformCallback } from 'stream'; import path from 'path'; import fs from 'fs'; @@ -118,6 +119,28 @@ export class DefaultWsService implements WebSocketService { } } + /** + * MessageTransform handles the transformation of WebSocket messages + */ + private MessageTransform = class extends Transform { + constructor(private worker: Worker) { + super({ + objectMode: true, // Enable object mode for handling WsMessage objects + highWaterMark: 1024 // Set buffer size to 1024 messages + }); + } + + _transform(message: WsMessage, encoding: string, callback: TransformCallback): void { + try { + // Post message to worker and handle response asynchronously + this.worker.postMessage(message); + callback(); + } catch (error) { + callback(error instanceof Error ? error : new Error(String(error))); + } + } + }; + /** * Starts the message processing loop using a dedicated Worker Thread * Creates a worker thread for message processing to handle WebSocket messages @@ -126,8 +149,6 @@ export class DefaultWsService implements WebSocketService { try { // Get the worker file path relative to the compiled js file const workerPath = path.join(__dirname, '..', '..', '..', 'dist', 'internal', 'infra', 'message_worker.js'); - console.log('[Main] Worker file path:', workerPath); - console.log('[Main] Current directory:', __dirname); if (!fs.existsSync(workerPath)) { throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); @@ -135,41 +156,38 @@ export class DefaultWsService implements WebSocketService { // Create a new worker thread this.messageWorker = new Worker(workerPath); - console.log('[Main] Worker created successfully'); + + // Create message transform stream + const messageStream = new this.MessageTransform(this.messageWorker); + + // Handle stream errors + messageStream.on('error', (error) => { + console.error('[Main] Message stream error:', error); + this.notifyEvent(WebSocketEvent.EventErrorReceived, String(error)); + }); // Handle messages processed by the worker - this.messageWorker.on('message', async (msg: WsMessage) => { - console.log('[Main] Received processed message from worker:', { - topic: msg.topic, - type: msg.type - }); - - try { - const callbackManager = this.topicManager.getCallbackManager(msg.topic); - if (!callbackManager) { - console.error( - `[Main] Cannot find callback manager, id: ${msg.id}, topic: ${msg.topic}`, - ); - return; - } + this.messageWorker.on('message', (msg: WsMessage) => { + if (this.stopSignal) { + return; + } - const cb = callbackManager.get(msg.topic); - if (!cb) { - console.error( - `[Main] Cannot find callback for id: ${msg.id}, topic: ${msg.topic}`, - ); - return; - } + const callbackManager = this.topicManager.getCallbackManager(msg.topic); + if (!callbackManager) { + return; + } - try { - await cb.onMessage(msg); - console.log('[Main] Message processed by callback successfully'); - } catch (err) { - console.error('[Main] Exception in callback:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); - } + const cb = callbackManager.get(msg.topic); + if (!cb) { + return; + } + + try { + // Execute callback without checking return value + cb.onMessage(msg); } catch (err) { console.error('[Main] Error processing message in main thread:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } }); @@ -181,55 +199,53 @@ export class DefaultWsService implements WebSocketService { // Handle worker exit this.messageWorker.on('exit', (code) => { - console.log(`[Main] Worker stopped with exit code ${code}`); - if (code !== 0) { + if (code !== 0 && !this.stopSignal) { console.error('[Main] Worker stopped with non-zero exit code'); } }); - } catch (error) { - console.error('[Main] Error creating worker:', error); - throw error; - } - - // Start message reading loop - const readMessages = async () => { - while (!this.stopSignal) { - try { - const msg = await this.client.read(); - if (!msg) { - await new Promise(resolve => setTimeout(resolve, 10)); // Wait 1 second before next try - continue; - } + // Start message reading loop + const readMessages = async () => { + while (!this.stopSignal) { + try { + const msg = await this.client.read(); + if (!msg) { + await new Promise(resolve => setTimeout(resolve, 10)); + continue; + } - // Send message to worker thread for processing - if (this.messageWorker?.listenerCount('message') === 0) { - console.warn('[Main] Worker has no message listeners, recreating worker...'); - this.messageWorker?.terminate(); - this.startMessageLoop(); + // Write message to stream + if (!messageStream.write(msg)) { + // If buffer is full, wait for drain event + await new Promise(resolve => messageStream.once('drain', resolve)); + } + } catch (err) { + if (!this.stopSignal) { + console.error('[Main] Error reading message:', err); + await new Promise(resolve => setTimeout(resolve, 100)); + } continue; } + } - this.messageWorker?.postMessage(msg); - } catch (err) { - console.error('[Main] Error reading message:', err); - await new Promise(resolve => setTimeout(resolve, 100)); // Wait 1 second before retry - continue; + // Clean up when loop ends + if (this.stopSignal) { + messageStream.end(); } - } + }; - // Only terminate worker if stop signal is received - if (this.stopSignal) { - console.log('[Main] Stop signal received, terminating worker...'); - this.messageWorker?.terminate(); - } - }; + // Start the message reading loop + readMessages().catch(err => { + if (!this.stopSignal) { + console.error('[Main] Fatal error in message reading loop:', err); + this.notifyEvent(WebSocketEvent.EventErrorReceived, String(err)); + } + }); - // Start the message reading loop - readMessages().catch(err => { - console.error('[Main] Fatal error in message reading loop:', err); - this.notifyEvent(WebSocketEvent.EventErrorReceived, String(err)); - }); + } catch (error) { + console.error('[Main] Error creating worker:', error); + throw error; + } } /** @@ -298,12 +314,29 @@ export class DefaultWsService implements WebSocketService { * Stops the message processing and cleans up resources */ stop(): Promise { + console.debug('Stopping WebSocket service...'); + this.stopSignal = true; + return new Promise((resolve) => { - this.stopSignal = true; - this.messageWorker?.terminate(); - if (this.messageLoop) clearInterval(this.messageLoop); - if (this.recoveryLoop) clearInterval(this.recoveryLoop); - resolve(); + // Terminate worker and clear intervals + if (this.messageWorker) { + this.messageWorker.terminate(); + this.messageWorker = undefined; + } + if (this.messageLoop) { + clearInterval(this.messageLoop); + this.messageLoop = undefined; + } + if (this.recoveryLoop) { + clearInterval(this.recoveryLoop); + this.recoveryLoop = undefined; + } + + // Stop the WebSocket client + this.client.stop().then(() => { + console.debug('WebSocket service stopped'); + resolve(); + }); }); } diff --git a/sdk/node/src/internal/infra/message_worker.ts b/sdk/node/src/internal/infra/message_worker.ts index d9b42511..766816e9 100644 --- a/sdk/node/src/internal/infra/message_worker.ts +++ b/sdk/node/src/internal/infra/message_worker.ts @@ -12,18 +12,12 @@ if (!parentPort) { // Handle messages from the main thread parentPort.on('message', (message: WsMessage) => { - console.log('[Worker] Received message:', { - type: message.type, - topic: message.topic, - timestamp: new Date().toISOString() - }); try { // Process all message types switch (message.type) { case MessageType.Message: - // Market data message - console.log('[Worker] Processing market data message for topic:', message.topic); + // message parentPort!.postMessage({ ...message, processedAt: new Date().toISOString() @@ -58,7 +52,6 @@ parentPort.on('message', (message: WsMessage) => { parentPort!.postMessage(message); } - console.log('[Worker] Successfully processed message'); } catch (error) { console.error('[Worker] Error processing message:', error); } From c654ca468b647881b464d9cc9a838a847f61de1c Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 21 Jan 2025 17:20:19 +0800 Subject: [PATCH 057/106] feat(nodejs): update docs --- .../main/resources/node-sdk/model.mustache | 39 ++++++++++++++++--- .../main/resources/node-sdk/model_ws.mustache | 22 +++++++++-- .../account/model_get_account_info_resp.ts | 14 ++++++- .../account/model_get_apikey_info_resp.ts | 14 ++++++- ...model_get_cross_margin_account_accounts.ts | 14 ++++++- .../model_get_cross_margin_account_req.ts | 17 +++++++- .../model_get_cross_margin_account_resp.ts | 14 ++++++- .../account/model_get_futures_account_req.ts | 17 +++++++- .../account/model_get_futures_account_resp.ts | 14 ++++++- .../model_get_futures_ledger_data_list.ts | 14 ++++++- .../account/model_get_futures_ledger_req.ts | 17 +++++++- .../account/model_get_futures_ledger_resp.ts | 14 ++++++- ...odel_get_isolated_margin_account_assets.ts | 14 ++++++- ...olated_margin_account_assets_base_asset.ts | 14 ++++++- ...lated_margin_account_assets_quote_asset.ts | 14 ++++++- ...ted_margin_account_detail_v1_base_asset.ts | 14 ++++++- ...ed_margin_account_detail_v1_quote_asset.ts | 14 ++++++- ...t_isolated_margin_account_detail_v1_req.ts | 17 +++++++- ..._isolated_margin_account_detail_v1_resp.ts | 14 ++++++- ..._isolated_margin_account_list_v1_assets.ts | 14 ++++++- ...argin_account_list_v1_assets_base_asset.ts | 14 ++++++- ...rgin_account_list_v1_assets_quote_asset.ts | 14 ++++++- ...get_isolated_margin_account_list_v1_req.ts | 17 +++++++- ...et_isolated_margin_account_list_v1_resp.ts | 14 ++++++- .../model_get_isolated_margin_account_req.ts | 17 +++++++- .../model_get_isolated_margin_account_resp.ts | 14 ++++++- ...odel_get_margin_account_detail_accounts.ts | 14 ++++++- .../model_get_margin_account_detail_resp.ts | 14 ++++++- .../model_get_margin_hf_ledger_data.ts | 14 ++++++- .../account/model_get_margin_hf_ledger_req.ts | 17 +++++++- .../model_get_margin_hf_ledger_resp.ts | 14 ++++++- .../model_get_spot_account_detail_req.ts | 17 +++++++- .../model_get_spot_account_detail_resp.ts | 14 ++++++- .../model_get_spot_account_list_data.ts | 14 ++++++- .../model_get_spot_account_list_req.ts | 17 +++++++- .../model_get_spot_account_list_resp.ts | 14 ++++++- .../model_get_spot_account_type_resp.ts | 14 ++++++- .../account/model_get_spot_hf_ledger_data.ts | 14 ++++++- .../account/model_get_spot_hf_ledger_req.ts | 17 +++++++- .../account/model_get_spot_hf_ledger_resp.ts | 14 ++++++- .../account/model_get_spot_ledger_items.ts | 14 ++++++- .../account/model_get_spot_ledger_req.ts | 17 +++++++- .../account/model_get_spot_ledger_resp.ts | 14 ++++++- .../model_add_deposit_address_v1_req.ts | 17 +++++++- .../model_add_deposit_address_v1_resp.ts | 14 ++++++- .../model_add_deposit_address_v3_req.ts | 17 +++++++- .../model_add_deposit_address_v3_resp.ts | 14 ++++++- .../model_get_deposit_address_v1_req.ts | 17 +++++++- .../model_get_deposit_address_v1_resp.ts | 14 ++++++- .../model_get_deposit_address_v2_data.ts | 14 ++++++- .../model_get_deposit_address_v2_req.ts | 17 +++++++- .../model_get_deposit_address_v2_resp.ts | 14 ++++++- .../model_get_deposit_address_v3_data.ts | 14 ++++++- .../model_get_deposit_address_v3_req.ts | 17 +++++++- .../model_get_deposit_address_v3_resp.ts | 14 ++++++- .../model_get_deposit_history_items.ts | 14 ++++++- .../model_get_deposit_history_old_items.ts | 14 ++++++- .../model_get_deposit_history_old_req.ts | 17 +++++++- .../model_get_deposit_history_old_resp.ts | 14 ++++++- .../deposit/model_get_deposit_history_req.ts | 17 +++++++- .../deposit/model_get_deposit_history_resp.ts | 14 ++++++- .../account/fee/model_get_basic_fee_req.ts | 17 +++++++- .../account/fee/model_get_basic_fee_resp.ts | 14 ++++++- .../fee/model_get_futures_actual_fee_req.ts | 17 +++++++- .../fee/model_get_futures_actual_fee_resp.ts | 14 ++++++- .../fee/model_get_spot_actual_fee_data.ts | 14 ++++++- .../fee/model_get_spot_actual_fee_req.ts | 17 +++++++- .../fee/model_get_spot_actual_fee_resp.ts | 14 ++++++- .../model_add_sub_account_api_req.ts | 17 +++++++- .../model_add_sub_account_api_resp.ts | 14 ++++++- ..._add_sub_account_futures_permission_req.ts | 17 +++++++- ...add_sub_account_futures_permission_resp.ts | 14 ++++++- ...l_add_sub_account_margin_permission_req.ts | 17 +++++++- ..._add_sub_account_margin_permission_resp.ts | 14 ++++++- .../subaccount/model_add_sub_account_req.ts | 17 +++++++- .../subaccount/model_add_sub_account_resp.ts | 14 ++++++- .../model_delete_sub_account_api_req.ts | 17 +++++++- .../model_delete_sub_account_api_resp.ts | 14 ++++++- ...et_futures_sub_account_list_v2_accounts.ts | 14 ++++++- ...del_get_futures_sub_account_list_v2_req.ts | 17 +++++++- ...el_get_futures_sub_account_list_v2_resp.ts | 14 ++++++- ...get_futures_sub_account_list_v2_summary.ts | 14 ++++++- ...t_spot_sub_account_detail_main_accounts.ts | 14 ++++++- ...spot_sub_account_detail_margin_accounts.ts | 14 ++++++- .../model_get_spot_sub_account_detail_req.ts | 17 +++++++- .../model_get_spot_sub_account_detail_resp.ts | 14 ++++++- ..._spot_sub_account_detail_trade_accounts.ts | 14 ++++++- ...model_get_spot_sub_account_list_v1_data.ts | 14 ++++++- ..._sub_account_list_v1_data_main_accounts.ts | 14 ++++++- ...ub_account_list_v1_data_margin_accounts.ts | 14 ++++++- ...sub_account_list_v1_data_trade_accounts.ts | 14 ++++++- ...model_get_spot_sub_account_list_v1_resp.ts | 14 ++++++- ...odel_get_spot_sub_account_list_v2_items.ts | 14 ++++++- ...sub_account_list_v2_items_main_accounts.ts | 14 ++++++- ...b_account_list_v2_items_margin_accounts.ts | 14 ++++++- ...ub_account_list_v2_items_trade_accounts.ts | 14 ++++++- .../model_get_spot_sub_account_list_v2_req.ts | 17 +++++++- ...model_get_spot_sub_account_list_v2_resp.ts | 14 ++++++- ...l_get_spot_sub_accounts_summary_v1_data.ts | 14 ++++++- ...l_get_spot_sub_accounts_summary_v1_resp.ts | 14 ++++++- ..._get_spot_sub_accounts_summary_v2_items.ts | 14 ++++++- ...el_get_spot_sub_accounts_summary_v2_req.ts | 17 +++++++- ...l_get_spot_sub_accounts_summary_v2_resp.ts | 14 ++++++- .../model_get_sub_account_api_list_data.ts | 14 ++++++- .../model_get_sub_account_api_list_req.ts | 17 +++++++- .../model_get_sub_account_api_list_resp.ts | 14 ++++++- .../model_modify_sub_account_api_req.ts | 17 +++++++- .../model_modify_sub_account_api_resp.ts | 14 ++++++- .../transfer/model_flex_transfer_req.ts | 17 +++++++- .../transfer/model_flex_transfer_resp.ts | 14 ++++++- .../model_futures_account_transfer_in_req.ts | 17 +++++++- .../model_futures_account_transfer_in_resp.ts | 14 ++++++- .../model_futures_account_transfer_out_req.ts | 17 +++++++- ...model_futures_account_transfer_out_resp.ts | 14 ++++++- ...tures_account_transfer_out_ledger_items.ts | 14 ++++++- ...futures_account_transfer_out_ledger_req.ts | 17 +++++++- ...utures_account_transfer_out_ledger_resp.ts | 14 ++++++- .../transfer/model_get_transfer_quotas_req.ts | 17 +++++++- .../model_get_transfer_quotas_resp.ts | 14 ++++++- .../transfer/model_inner_transfer_req.ts | 17 +++++++- .../transfer/model_inner_transfer_resp.ts | 14 ++++++- .../model_sub_account_transfer_req.ts | 17 +++++++- .../model_sub_account_transfer_resp.ts | 14 ++++++- .../withdrawal/model_cancel_withdrawal_req.ts | 17 +++++++- .../model_cancel_withdrawal_resp.ts | 14 ++++++- .../model_get_withdrawal_history_items.ts | 14 ++++++- .../model_get_withdrawal_history_old_items.ts | 14 ++++++- .../model_get_withdrawal_history_old_req.ts | 17 +++++++- .../model_get_withdrawal_history_old_resp.ts | 14 ++++++- .../model_get_withdrawal_history_req.ts | 17 +++++++- .../model_get_withdrawal_history_resp.ts | 14 ++++++- .../model_get_withdrawal_quotas_req.ts | 17 +++++++- .../model_get_withdrawal_quotas_resp.ts | 14 ++++++- .../withdrawal/model_withdrawal_v1_req.ts | 17 +++++++- .../withdrawal/model_withdrawal_v1_resp.ts | 14 ++++++- .../withdrawal/model_withdrawal_v3_req.ts | 17 +++++++- .../withdrawal/model_withdrawal_v3_resp.ts | 14 ++++++- .../affiliate/model_get_account_ltv.ts | 14 ++++++- .../affiliate/model_get_account_margins.ts | 14 ++++++- .../affiliate/model_get_account_orders.ts | 14 ++++++- .../affiliate/model_get_account_resp.ts | 14 ++++++- .../broker/apibroker/model_get_rebase_req.ts | 17 +++++++- .../broker/apibroker/model_get_rebase_resp.ts | 14 ++++++- .../ndbroker/model_add_sub_account_api_req.ts | 17 +++++++- .../model_add_sub_account_api_resp.ts | 14 ++++++- .../ndbroker/model_add_sub_account_req.ts | 17 +++++++- .../ndbroker/model_add_sub_account_resp.ts | 14 ++++++- .../model_delete_sub_account_api_req.ts | 17 +++++++- .../model_delete_sub_account_api_resp.ts | 14 ++++++- .../ndbroker/model_get_broker_info_req.ts | 17 +++++++- .../ndbroker/model_get_broker_info_resp.ts | 14 ++++++- .../ndbroker/model_get_deposit_detail_req.ts | 17 +++++++- .../ndbroker/model_get_deposit_detail_resp.ts | 14 ++++++- .../ndbroker/model_get_deposit_list_data.ts | 14 ++++++- .../ndbroker/model_get_deposit_list_req.ts | 17 +++++++- .../ndbroker/model_get_deposit_list_resp.ts | 14 ++++++- .../broker/ndbroker/model_get_rebase_req.ts | 17 +++++++- .../broker/ndbroker/model_get_rebase_resp.ts | 14 ++++++- .../model_get_sub_account_api_data.ts | 14 ++++++- .../ndbroker/model_get_sub_account_api_req.ts | 17 +++++++- .../model_get_sub_account_api_resp.ts | 14 ++++++- .../ndbroker/model_get_sub_account_items.ts | 14 ++++++- .../ndbroker/model_get_sub_account_req.ts | 17 +++++++- .../ndbroker/model_get_sub_account_resp.ts | 14 ++++++- .../model_get_transfer_history_req.ts | 17 +++++++- .../model_get_transfer_history_resp.ts | 14 ++++++- .../ndbroker/model_get_withdraw_detail_req.ts | 17 +++++++- .../model_get_withdraw_detail_resp.ts | 14 ++++++- .../model_modify_sub_account_api_req.ts | 17 +++++++- .../model_modify_sub_account_api_resp.ts | 14 ++++++- .../broker/ndbroker/model_transfer_req.ts | 17 +++++++- .../broker/ndbroker/model_transfer_resp.ts | 14 ++++++- .../futures/model_add_isolated_margin_req.ts | 17 +++++++- .../futures/model_add_isolated_margin_resp.ts | 14 ++++++- .../futures/model_add_order_req.ts | 17 +++++++- .../futures/model_add_order_resp.ts | 14 ++++++- .../futures/model_add_order_test_req.ts | 17 +++++++- .../futures/model_add_order_test_resp.ts | 14 ++++++- .../futures/model_add_tpsl_order_req.ts | 17 +++++++- .../futures/model_add_tpsl_order_resp.ts | 14 ++++++- .../model_cancel_order_by_client_oid_req.ts | 17 +++++++- .../model_cancel_order_by_client_oid_resp.ts | 14 ++++++- .../futures/model_cancel_order_by_id_req.ts | 17 +++++++- .../futures/model_cancel_order_by_id_resp.ts | 14 ++++++- .../futures/model_get_max_open_size_req.ts | 17 +++++++- .../futures/model_get_max_open_size_resp.ts | 14 ++++++- .../model_get_max_withdraw_margin_req.ts | 17 +++++++- .../model_get_max_withdraw_margin_resp.ts | 14 ++++++- .../model_modify_auto_deposit_status_req.ts | 17 +++++++- .../model_modify_auto_deposit_status_resp.ts | 14 ++++++- ...el_modify_isolated_margin_risk_limt_req.ts | 17 +++++++- ...l_modify_isolated_margin_risk_limt_resp.ts | 14 ++++++- .../model_remove_isolated_margin_req.ts | 17 +++++++- .../model_remove_isolated_margin_resp.ts | 14 ++++++- .../earn/model_get_account_holding_items.ts | 14 ++++++- .../earn/model_get_account_holding_req.ts | 17 +++++++- .../earn/model_get_account_holding_resp.ts | 14 ++++++- .../model_get_eth_staking_products_data.ts | 14 ++++++- .../model_get_eth_staking_products_req.ts | 17 +++++++- .../model_get_eth_staking_products_resp.ts | 14 ++++++- .../model_get_kcs_staking_products_data.ts | 14 ++++++- .../model_get_kcs_staking_products_req.ts | 17 +++++++- .../model_get_kcs_staking_products_resp.ts | 14 ++++++- .../earn/model_get_promotion_products_data.ts | 14 ++++++- .../earn/model_get_promotion_products_req.ts | 17 +++++++- .../earn/model_get_promotion_products_resp.ts | 14 ++++++- .../earn/earn/model_get_redeem_preview_req.ts | 17 +++++++- .../earn/model_get_redeem_preview_resp.ts | 14 ++++++- .../earn/model_get_savings_products_data.ts | 14 ++++++- .../earn/model_get_savings_products_req.ts | 17 +++++++- .../earn/model_get_savings_products_resp.ts | 14 ++++++- .../earn/model_get_staking_products_data.ts | 14 ++++++- .../earn/model_get_staking_products_req.ts | 17 +++++++- .../earn/model_get_staking_products_resp.ts | 14 ++++++- .../generate/earn/earn/model_purchase_req.ts | 17 +++++++- .../generate/earn/earn/model_purchase_resp.ts | 14 ++++++- .../generate/earn/earn/model_redeem_req.ts | 17 +++++++- .../generate/earn/earn/model_redeem_resp.ts | 14 ++++++- .../model_get_current_funding_rate_req.ts | 17 +++++++- .../model_get_current_funding_rate_resp.ts | 14 ++++++- ...l_get_private_funding_history_data_list.ts | 14 ++++++- .../model_get_private_funding_history_req.ts | 17 +++++++- .../model_get_private_funding_history_resp.ts | 14 ++++++- .../model_get_public_funding_history_data.ts | 14 ++++++- .../model_get_public_funding_history_req.ts | 17 +++++++- .../model_get_public_funding_history_resp.ts | 14 ++++++- .../futuresprivate/model_all_order_event.ts | 11 +++++- .../model_all_position_event.ts | 11 +++++- .../futuresprivate/model_balance_event.ts | 11 +++++- .../model_cross_leverage_data_value.ts | 11 +++++- .../model_cross_leverage_event.ts | 11 +++++- .../futuresprivate/model_margin_mode_event.ts | 11 +++++- .../futuresprivate/model_order_event.ts | 11 +++++- .../futuresprivate/model_position_event.ts | 11 +++++- .../futuresprivate/model_stop_orders_event.ts | 11 +++++- .../futurespublic/model_announcement_event.ts | 11 +++++- .../futurespublic/model_execution_event.ts | 11 +++++- .../futurespublic/model_instrument_event.ts | 11 +++++- .../futurespublic/model_klines_event.ts | 11 +++++- .../model_orderbook_increment_event.ts | 11 +++++- .../model_orderbook_level50_event.ts | 11 +++++- .../model_orderbook_level5_event.ts | 11 +++++- .../model_symbol_snapshot_event.ts | 11 +++++- .../futurespublic/model_ticker_v1_event.ts | 11 +++++- .../futurespublic/model_ticker_v2_event.ts | 11 +++++- .../market/model_get24hr_stats_resp.ts | 14 ++++++- .../market/model_get_all_symbols_data.ts | 14 ++++++- .../market/model_get_all_symbols_resp.ts | 14 ++++++- .../market/model_get_all_tickers_data.ts | 14 ++++++- .../market/model_get_all_tickers_resp.ts | 14 ++++++- .../market/model_get_full_order_book_req.ts | 17 +++++++- .../market/model_get_full_order_book_resp.ts | 14 ++++++- ...model_get_interest_rate_index_data_list.ts | 14 ++++++- .../model_get_interest_rate_index_req.ts | 17 +++++++- .../model_get_interest_rate_index_resp.ts | 14 ++++++- .../futures/market/model_get_klines_req.ts | 17 +++++++- .../futures/market/model_get_klines_resp.ts | 14 ++++++- .../market/model_get_mark_price_req.ts | 17 +++++++- .../market/model_get_mark_price_resp.ts | 14 ++++++- .../market/model_get_part_order_book_req.ts | 17 +++++++- .../market/model_get_part_order_book_resp.ts | 14 ++++++- .../model_get_premium_index_data_list.ts | 14 ++++++- .../market/model_get_premium_index_req.ts | 17 +++++++- .../market/model_get_premium_index_resp.ts | 14 ++++++- ...odel_get_private_token_instance_servers.ts | 14 ++++++- .../market/model_get_private_token_resp.ts | 14 ++++++- ...model_get_public_token_instance_servers.ts | 14 ++++++- .../market/model_get_public_token_resp.ts | 14 ++++++- .../market/model_get_server_time_resp.ts | 14 ++++++- .../market/model_get_service_status_resp.ts | 14 ++++++- .../model_get_spot_index_price_data_list.ts | 14 ++++++- ..._index_price_data_list_decomposion_list.ts | 14 ++++++- .../market/model_get_spot_index_price_req.ts | 17 +++++++- .../market/model_get_spot_index_price_resp.ts | 14 ++++++- .../futures/market/model_get_symbol_req.ts | 17 +++++++- .../futures/market/model_get_symbol_resp.ts | 14 ++++++- .../futures/market/model_get_ticker_req.ts | 17 +++++++- .../futures/market/model_get_ticker_resp.ts | 14 ++++++- .../market/model_get_trade_history_data.ts | 14 ++++++- .../market/model_get_trade_history_req.ts | 17 +++++++- .../market/model_get_trade_history_resp.ts | 14 ++++++- .../futures/order/model_add_order_req.ts | 17 +++++++- .../futures/order/model_add_order_resp.ts | 14 ++++++- .../futures/order/model_add_order_test_req.ts | 17 +++++++- .../order/model_add_order_test_resp.ts | 14 ++++++- .../futures/order/model_add_tpsl_order_req.ts | 17 +++++++- .../order/model_add_tpsl_order_resp.ts | 14 ++++++- .../order/model_batch_add_orders_data.ts | 14 ++++++- .../order/model_batch_add_orders_item.ts | 17 +++++++- .../order/model_batch_add_orders_req.ts | 17 +++++++- .../order/model_batch_add_orders_resp.ts | 14 ++++++- ...el_batch_cancel_orders_client_oids_list.ts | 17 +++++++- .../order/model_batch_cancel_orders_data.ts | 14 ++++++- .../order/model_batch_cancel_orders_req.ts | 17 +++++++- .../order/model_batch_cancel_orders_resp.ts | 14 ++++++- .../order/model_cancel_all_orders_v1_req.ts | 17 +++++++- .../order/model_cancel_all_orders_v1_resp.ts | 14 ++++++- .../order/model_cancel_all_orders_v3_req.ts | 17 +++++++- .../order/model_cancel_all_orders_v3_resp.ts | 14 ++++++- .../order/model_cancel_all_stop_orders_req.ts | 17 +++++++- .../model_cancel_all_stop_orders_resp.ts | 14 ++++++- .../model_cancel_order_by_client_oid_req.ts | 17 +++++++- .../model_cancel_order_by_client_oid_resp.ts | 14 ++++++- .../order/model_cancel_order_by_id_req.ts | 17 +++++++- .../order/model_cancel_order_by_id_resp.ts | 14 ++++++- .../order/model_get_open_order_value_req.ts | 17 +++++++- .../order/model_get_open_order_value_resp.ts | 14 ++++++- .../model_get_order_by_client_oid_req.ts | 17 +++++++- .../model_get_order_by_client_oid_resp.ts | 14 ++++++- .../order/model_get_order_by_order_id_req.ts | 17 +++++++- .../order/model_get_order_by_order_id_resp.ts | 14 ++++++- .../order/model_get_order_list_items.ts | 14 ++++++- .../futures/order/model_get_order_list_req.ts | 17 +++++++- .../order/model_get_order_list_resp.ts | 14 ++++++- .../model_get_recent_closed_orders_data.ts | 14 ++++++- .../model_get_recent_closed_orders_req.ts | 17 +++++++- .../model_get_recent_closed_orders_resp.ts | 14 ++++++- .../model_get_recent_trade_history_data.ts | 14 ++++++- .../model_get_recent_trade_history_req.ts | 17 +++++++- .../model_get_recent_trade_history_resp.ts | 14 ++++++- .../order/model_get_stop_order_list_items.ts | 14 ++++++- .../order/model_get_stop_order_list_req.ts | 17 +++++++- .../order/model_get_stop_order_list_resp.ts | 14 ++++++- .../order/model_get_trade_history_items.ts | 14 ++++++- .../order/model_get_trade_history_req.ts | 17 +++++++- .../order/model_get_trade_history_resp.ts | 14 ++++++- .../model_add_isolated_margin_req.ts | 17 +++++++- .../model_add_isolated_margin_resp.ts | 14 ++++++- .../model_get_cross_margin_leverage_req.ts | 17 +++++++- .../model_get_cross_margin_leverage_resp.ts | 14 ++++++- ...del_get_isolated_margin_risk_limit_data.ts | 14 ++++++- ...odel_get_isolated_margin_risk_limit_req.ts | 17 +++++++- ...del_get_isolated_margin_risk_limit_resp.ts | 14 ++++++- .../positions/model_get_margin_mode_req.ts | 17 +++++++- .../positions/model_get_margin_mode_resp.ts | 14 ++++++- .../positions/model_get_max_open_size_req.ts | 17 +++++++- .../positions/model_get_max_open_size_resp.ts | 14 ++++++- .../model_get_max_withdraw_margin_req.ts | 17 +++++++- .../model_get_max_withdraw_margin_resp.ts | 14 ++++++- .../model_get_position_details_req.ts | 17 +++++++- .../model_get_position_details_resp.ts | 14 ++++++- .../positions/model_get_position_list_data.ts | 14 ++++++- .../positions/model_get_position_list_req.ts | 17 +++++++- .../positions/model_get_position_list_resp.ts | 14 ++++++- .../model_get_positions_history_items.ts | 14 ++++++- .../model_get_positions_history_req.ts | 17 +++++++- .../model_get_positions_history_resp.ts | 14 ++++++- .../model_modify_auto_deposit_status_req.ts | 17 +++++++- .../model_modify_auto_deposit_status_resp.ts | 14 ++++++- ...el_modify_isolated_margin_risk_limt_req.ts | 17 +++++++- ...l_modify_isolated_margin_risk_limt_resp.ts | 14 ++++++- .../model_modify_margin_leverage_req.ts | 17 +++++++- .../model_modify_margin_leverage_resp.ts | 14 ++++++- .../model_remove_isolated_margin_req.ts | 17 +++++++- .../model_remove_isolated_margin_resp.ts | 14 ++++++- .../positions/model_switch_margin_mode_req.ts | 17 +++++++- .../model_switch_margin_mode_resp.ts | 14 ++++++- .../credit/model_get_loan_market_data.ts | 14 ++++++- ...odel_get_loan_market_interest_rate_data.ts | 14 ++++++- ...model_get_loan_market_interest_rate_req.ts | 17 +++++++- ...odel_get_loan_market_interest_rate_resp.ts | 14 ++++++- .../credit/model_get_loan_market_req.ts | 17 +++++++- .../credit/model_get_loan_market_resp.ts | 14 ++++++- .../credit/model_get_purchase_orders_items.ts | 14 ++++++- .../credit/model_get_purchase_orders_req.ts | 17 +++++++- .../credit/model_get_purchase_orders_resp.ts | 14 ++++++- .../credit/model_get_redeem_orders_items.ts | 14 ++++++- .../credit/model_get_redeem_orders_req.ts | 17 +++++++- .../credit/model_get_redeem_orders_resp.ts | 14 ++++++- .../credit/model_modify_purchase_req.ts | 17 +++++++- .../credit/model_modify_purchase_resp.ts | 14 ++++++- .../margin/credit/model_purchase_req.ts | 17 +++++++- .../margin/credit/model_purchase_resp.ts | 14 ++++++- .../margin/credit/model_redeem_req.ts | 17 +++++++- .../margin/credit/model_redeem_resp.ts | 14 ++++++- .../generate/margin/debit/model_borrow_req.ts | 17 +++++++- .../margin/debit/model_borrow_resp.ts | 14 ++++++- .../debit/model_get_borrow_history_items.ts | 14 ++++++- .../debit/model_get_borrow_history_req.ts | 17 +++++++- .../debit/model_get_borrow_history_resp.ts | 14 ++++++- .../debit/model_get_interest_history_items.ts | 14 ++++++- .../debit/model_get_interest_history_req.ts | 17 +++++++- .../debit/model_get_interest_history_resp.ts | 14 ++++++- .../debit/model_get_repay_history_items.ts | 14 ++++++- .../debit/model_get_repay_history_req.ts | 17 +++++++- .../debit/model_get_repay_history_resp.ts | 14 ++++++- .../margin/debit/model_modify_leverage_req.ts | 17 +++++++- .../debit/model_modify_leverage_resp.ts | 14 ++++++- .../generate/margin/debit/model_repay_req.ts | 17 +++++++- .../generate/margin/debit/model_repay_resp.ts | 14 ++++++- ..._cross_margin_position_asset_list_value.ts | 11 +++++- .../model_cross_margin_position_event.ts | 11 +++++- ...ted_margin_position_change_assets_value.ts | 11 +++++- .../model_isolated_margin_position_event.ts | 11 +++++- .../marginpublic/model_index_price_event.ts | 11 +++++- .../marginpublic/model_mark_price_event.ts | 11 +++++- .../model_get_cross_margin_symbols_items.ts | 14 ++++++- .../model_get_cross_margin_symbols_req.ts | 17 +++++++- .../model_get_cross_margin_symbols_resp.ts | 14 ++++++- .../margin/market/model_get_etf_info_data.ts | 14 ++++++- .../margin/market/model_get_etf_info_req.ts | 17 +++++++- .../margin/market/model_get_etf_info_resp.ts | 14 ++++++- .../model_get_isolated_margin_symbols_data.ts | 14 ++++++- .../model_get_isolated_margin_symbols_resp.ts | 14 ++++++- .../market/model_get_margin_config_resp.ts | 14 ++++++- .../market/model_get_mark_price_detail_req.ts | 17 +++++++- .../model_get_mark_price_detail_resp.ts | 14 ++++++- .../market/model_get_mark_price_list_data.ts | 14 ++++++- .../market/model_get_mark_price_list_resp.ts | 14 ++++++- .../margin/order/model_add_order_req.ts | 17 +++++++- .../margin/order/model_add_order_resp.ts | 14 ++++++- .../margin/order/model_add_order_test_req.ts | 17 +++++++- .../margin/order/model_add_order_test_resp.ts | 14 ++++++- .../order/model_add_order_test_v1_req.ts | 17 +++++++- .../order/model_add_order_test_v1_resp.ts | 14 ++++++- .../margin/order/model_add_order_v1_req.ts | 17 +++++++- .../margin/order/model_add_order_v1_resp.ts | 14 ++++++- .../model_cancel_all_orders_by_symbol_req.ts | 17 +++++++- .../model_cancel_all_orders_by_symbol_resp.ts | 14 ++++++- .../model_cancel_order_by_client_oid_req.ts | 17 +++++++- .../model_cancel_order_by_client_oid_resp.ts | 14 ++++++- .../model_cancel_order_by_order_id_req.ts | 17 +++++++- .../model_cancel_order_by_order_id_resp.ts | 14 ++++++- .../order/model_get_closed_orders_items.ts | 14 ++++++- .../order/model_get_closed_orders_req.ts | 17 +++++++- .../order/model_get_closed_orders_resp.ts | 14 ++++++- .../order/model_get_open_orders_data.ts | 14 ++++++- .../margin/order/model_get_open_orders_req.ts | 17 +++++++- .../order/model_get_open_orders_resp.ts | 14 ++++++- .../model_get_order_by_client_oid_req.ts | 17 +++++++- .../model_get_order_by_client_oid_resp.ts | 14 ++++++- .../order/model_get_order_by_order_id_req.ts | 17 +++++++- .../order/model_get_order_by_order_id_resp.ts | 14 ++++++- .../model_get_symbols_with_open_order_req.ts | 17 +++++++- .../model_get_symbols_with_open_order_resp.ts | 14 ++++++- .../order/model_get_trade_history_items.ts | 14 ++++++- .../order/model_get_trade_history_req.ts | 17 +++++++- .../order/model_get_trade_history_resp.ts | 14 ++++++- .../model_get_margin_risk_limit_data.ts | 14 ++++++- .../model_get_margin_risk_limit_req.ts | 17 +++++++- .../model_get_margin_risk_limit_resp.ts | 14 ++++++- .../spot/market/model_get24hr_stats_req.ts | 17 +++++++- .../spot/market/model_get24hr_stats_resp.ts | 14 ++++++- .../market/model_get_all_currencies_data.ts | 14 ++++++- .../model_get_all_currencies_data_chains.ts | 14 ++++++- .../market/model_get_all_currencies_resp.ts | 14 ++++++- .../spot/market/model_get_all_symbols_data.ts | 14 ++++++- .../spot/market/model_get_all_symbols_req.ts | 17 +++++++- .../spot/market/model_get_all_symbols_resp.ts | 14 ++++++- .../spot/market/model_get_all_tickers_resp.ts | 14 ++++++- .../market/model_get_all_tickers_ticker.ts | 14 ++++++- .../market/model_get_announcements_items.ts | 14 ++++++- .../market/model_get_announcements_req.ts | 17 +++++++- .../market/model_get_announcements_resp.ts | 14 ++++++- .../spot/market/model_get_currency_chains.ts | 14 ++++++- .../spot/market/model_get_currency_req.ts | 17 +++++++- .../spot/market/model_get_currency_resp.ts | 14 ++++++- .../spot/market/model_get_fiat_price_req.ts | 17 +++++++- .../spot/market/model_get_fiat_price_resp.ts | 14 ++++++- .../market/model_get_full_order_book_req.ts | 17 +++++++- .../market/model_get_full_order_book_resp.ts | 14 ++++++- .../spot/market/model_get_klines_req.ts | 17 +++++++- .../spot/market/model_get_klines_resp.ts | 14 ++++++- .../spot/market/model_get_market_list_resp.ts | 14 ++++++- .../market/model_get_part_order_book_req.ts | 17 +++++++- .../market/model_get_part_order_book_resp.ts | 14 ++++++- ...odel_get_private_token_instance_servers.ts | 14 ++++++- .../market/model_get_private_token_resp.ts | 14 ++++++- ...model_get_public_token_instance_servers.ts | 14 ++++++- .../market/model_get_public_token_resp.ts | 14 ++++++- .../spot/market/model_get_server_time_resp.ts | 14 ++++++- .../market/model_get_service_status_resp.ts | 14 ++++++- .../spot/market/model_get_symbol_req.ts | 17 +++++++- .../spot/market/model_get_symbol_resp.ts | 14 ++++++- .../spot/market/model_get_ticker_req.ts | 17 +++++++- .../spot/market/model_get_ticker_resp.ts | 14 ++++++- .../market/model_get_trade_history_data.ts | 14 ++++++- .../market/model_get_trade_history_req.ts | 17 +++++++- .../market/model_get_trade_history_resp.ts | 14 ++++++- .../spot/order/model_add_oco_order_req.ts | 17 +++++++- .../spot/order/model_add_oco_order_resp.ts | 14 ++++++- .../spot/order/model_add_order_old_req.ts | 17 +++++++- .../spot/order/model_add_order_old_resp.ts | 14 ++++++- .../spot/order/model_add_order_req.ts | 17 +++++++- .../spot/order/model_add_order_resp.ts | 14 ++++++- .../spot/order/model_add_order_sync_req.ts | 17 +++++++- .../spot/order/model_add_order_sync_resp.ts | 14 ++++++- .../order/model_add_order_test_old_req.ts | 17 +++++++- .../order/model_add_order_test_old_resp.ts | 14 ++++++- .../spot/order/model_add_order_test_req.ts | 17 +++++++- .../spot/order/model_add_order_test_resp.ts | 14 ++++++- .../spot/order/model_add_stop_order_req.ts | 17 +++++++- .../spot/order/model_add_stop_order_resp.ts | 14 ++++++- .../spot/order/model_batch_add_orders_data.ts | 14 ++++++- .../order/model_batch_add_orders_old_data.ts | 14 ++++++- .../model_batch_add_orders_old_order_list.ts | 17 +++++++- .../order/model_batch_add_orders_old_req.ts | 17 +++++++- .../order/model_batch_add_orders_old_resp.ts | 14 ++++++- .../model_batch_add_orders_order_list.ts | 17 +++++++- .../spot/order/model_batch_add_orders_req.ts | 17 +++++++- .../spot/order/model_batch_add_orders_resp.ts | 14 ++++++- .../order/model_batch_add_orders_sync_data.ts | 14 ++++++- .../model_batch_add_orders_sync_order_list.ts | 17 +++++++- .../order/model_batch_add_orders_sync_req.ts | 17 +++++++- .../order/model_batch_add_orders_sync_resp.ts | 14 ++++++- .../model_batch_cancel_oco_orders_req.ts | 17 +++++++- .../model_batch_cancel_oco_orders_resp.ts | 14 ++++++- .../order/model_batch_cancel_order_old_req.ts | 17 +++++++- .../model_batch_cancel_order_old_resp.ts | 14 ++++++- .../model_batch_cancel_stop_order_req.ts | 17 +++++++- .../model_batch_cancel_stop_order_resp.ts | 14 ++++++- .../model_cancel_all_orders_by_symbol_req.ts | 17 +++++++- .../model_cancel_all_orders_by_symbol_resp.ts | 14 ++++++- .../model_cancel_all_orders_failed_symbols.ts | 14 ++++++- .../order/model_cancel_all_orders_resp.ts | 14 ++++++- ...odel_cancel_oco_order_by_client_oid_req.ts | 17 +++++++- ...del_cancel_oco_order_by_client_oid_resp.ts | 14 ++++++- .../model_cancel_oco_order_by_order_id_req.ts | 17 +++++++- ...model_cancel_oco_order_by_order_id_resp.ts | 14 ++++++- ...odel_cancel_order_by_client_oid_old_req.ts | 17 +++++++- ...del_cancel_order_by_client_oid_old_resp.ts | 14 ++++++- .../model_cancel_order_by_client_oid_req.ts | 17 +++++++- .../model_cancel_order_by_client_oid_resp.ts | 14 ++++++- ...del_cancel_order_by_client_oid_sync_req.ts | 17 +++++++- ...el_cancel_order_by_client_oid_sync_resp.ts | 14 ++++++- .../model_cancel_order_by_order_id_old_req.ts | 17 +++++++- ...model_cancel_order_by_order_id_old_resp.ts | 14 ++++++- .../model_cancel_order_by_order_id_req.ts | 17 +++++++- .../model_cancel_order_by_order_id_resp.ts | 14 ++++++- ...model_cancel_order_by_order_id_sync_req.ts | 17 +++++++- ...odel_cancel_order_by_order_id_sync_resp.ts | 14 ++++++- .../order/model_cancel_partial_order_req.ts | 17 +++++++- .../order/model_cancel_partial_order_resp.ts | 14 ++++++- ...del_cancel_stop_order_by_client_oid_req.ts | 17 +++++++- ...el_cancel_stop_order_by_client_oid_resp.ts | 14 ++++++- ...model_cancel_stop_order_by_order_id_req.ts | 17 +++++++- ...odel_cancel_stop_order_by_order_id_resp.ts | 14 ++++++- .../order/model_get_closed_orders_items.ts | 14 ++++++- .../spot/order/model_get_closed_orders_req.ts | 17 +++++++- .../order/model_get_closed_orders_resp.ts | 14 ++++++- .../generate/spot/order/model_get_dcp_resp.ts | 14 ++++++- .../model_get_oco_order_by_client_oid_req.ts | 17 +++++++- .../model_get_oco_order_by_client_oid_resp.ts | 14 ++++++- .../model_get_oco_order_by_order_id_req.ts | 17 +++++++- .../model_get_oco_order_by_order_id_resp.ts | 14 ++++++- ...get_oco_order_detail_by_order_id_orders.ts | 14 ++++++- ...el_get_oco_order_detail_by_order_id_req.ts | 17 +++++++- ...l_get_oco_order_detail_by_order_id_resp.ts | 14 ++++++- .../order/model_get_oco_order_list_items.ts | 14 ++++++- .../order/model_get_oco_order_list_req.ts | 17 +++++++- .../order/model_get_oco_order_list_resp.ts | 14 ++++++- .../spot/order/model_get_open_orders_data.ts | 14 ++++++- .../spot/order/model_get_open_orders_req.ts | 17 +++++++- .../spot/order/model_get_open_orders_resp.ts | 14 ++++++- .../model_get_order_by_client_oid_old_req.ts | 17 +++++++- .../model_get_order_by_client_oid_old_resp.ts | 14 ++++++- .../model_get_order_by_client_oid_req.ts | 17 +++++++- .../model_get_order_by_client_oid_resp.ts | 14 ++++++- .../model_get_order_by_order_id_old_req.ts | 17 +++++++- .../model_get_order_by_order_id_old_resp.ts | 14 ++++++- .../order/model_get_order_by_order_id_req.ts | 17 +++++++- .../order/model_get_order_by_order_id_resp.ts | 14 ++++++- .../order/model_get_orders_list_old_items.ts | 14 ++++++- .../order/model_get_orders_list_old_req.ts | 17 +++++++- .../order/model_get_orders_list_old_resp.ts | 14 ++++++- .../model_get_recent_orders_list_old_data.ts | 14 ++++++- .../model_get_recent_orders_list_old_req.ts | 17 +++++++- .../model_get_recent_orders_list_old_resp.ts | 14 ++++++- ...model_get_recent_trade_history_old_data.ts | 14 ++++++- .../model_get_recent_trade_history_old_req.ts | 17 +++++++- ...model_get_recent_trade_history_old_resp.ts | 14 ++++++- ...model_get_stop_order_by_client_oid_data.ts | 14 ++++++- .../model_get_stop_order_by_client_oid_req.ts | 17 +++++++- ...model_get_stop_order_by_client_oid_resp.ts | 14 ++++++- .../model_get_stop_order_by_order_id_req.ts | 17 +++++++- .../model_get_stop_order_by_order_id_resp.ts | 14 ++++++- .../order/model_get_stop_orders_list_items.ts | 14 ++++++- .../order/model_get_stop_orders_list_req.ts | 17 +++++++- .../order/model_get_stop_orders_list_resp.ts | 14 ++++++- .../model_get_symbols_with_open_order_resp.ts | 14 ++++++- .../order/model_get_trade_history_items.ts | 14 ++++++- .../model_get_trade_history_old_items.ts | 14 ++++++- .../order/model_get_trade_history_old_req.ts | 17 +++++++- .../order/model_get_trade_history_old_resp.ts | 14 ++++++- .../spot/order/model_get_trade_history_req.ts | 17 +++++++- .../order/model_get_trade_history_resp.ts | 14 ++++++- .../spot/order/model_modify_order_req.ts | 17 +++++++- .../spot/order/model_modify_order_resp.ts | 14 ++++++- .../generate/spot/order/model_set_dcp_req.ts | 17 +++++++- .../generate/spot/order/model_set_dcp_resp.ts | 14 ++++++- .../spot/spotprivate/model_account_event.ts | 11 +++++- .../model_account_relation_context.ts | 11 +++++- .../spot/spotprivate/model_order_v1_event.ts | 11 +++++- .../spot/spotprivate/model_order_v2_event.ts | 11 +++++- .../spotpublic/model_all_tickers_event.ts | 11 +++++- .../spot/spotpublic/model_klines_event.ts | 11 +++++- .../spotpublic/model_market_snapshot_data.ts | 11 +++++- ...el_market_snapshot_data_market_change1h.ts | 11 +++++- ...l_market_snapshot_data_market_change24h.ts | 11 +++++- ...el_market_snapshot_data_market_change4h.ts | 11 +++++- .../spotpublic/model_market_snapshot_event.ts | 11 +++++- .../model_orderbook_increment_changes.ts | 11 +++++- .../model_orderbook_increment_event.ts | 11 +++++- .../model_orderbook_level1_event.ts | 11 +++++- .../model_orderbook_level50_changes.ts | 11 +++++- .../model_orderbook_level50_event.ts | 11 +++++- .../model_orderbook_level5_event.ts | 11 +++++- .../spotpublic/model_symbol_snapshot_data.ts | 11 +++++- ...el_symbol_snapshot_data_market_change1h.ts | 11 +++++- ...l_symbol_snapshot_data_market_change24h.ts | 11 +++++- ...el_symbol_snapshot_data_market_change4h.ts | 11 +++++- .../spotpublic/model_symbol_snapshot_event.ts | 11 +++++- .../spot/spotpublic/model_ticker_event.ts | 11 +++++- .../spot/spotpublic/model_trade_event.ts | 11 +++++- sdk/node/src/generate/version.ts | 2 +- .../model_get_account_detail_ltv.ts | 14 ++++++- .../model_get_account_detail_margins.ts | 14 ++++++- .../model_get_account_detail_orders.ts | 14 ++++++- .../model_get_account_detail_resp.ts | 14 ++++++- .../viplending/model_get_accounts_data.ts | 14 ++++++- .../viplending/model_get_accounts_resp.ts | 14 ++++++- 621 files changed, 7966 insertions(+), 1247 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/model.mustache b/generator/plugin/src/main/resources/node-sdk/model.mustache index 86d5a772..6550cd3d 100644 --- a/generator/plugin/src/main/resources/node-sdk/model.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model.mustache @@ -31,6 +31,9 @@ export class {{classname}} implements Serializable{ {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}}; {{{vendorExtensions.x-default-value}}} {{/vars}} + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { {{#vars}} {{#required}} @@ -51,14 +54,21 @@ export class {{classname}} implements Serializable{ } {{#vendorExtensions.x-original-response}} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): {{classname}} { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): {{classname}} { return plainToClassFromExist(new {{classname}}(), {data : jsonObject}); } @@ -107,14 +117,21 @@ export class {{classname}} implements Serializable{ } {{#vendorExtensions.x-request-raw-array}} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.items)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): {{classname}} { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): {{classname}} { return plainToClassFromExist(new {{classname}}(), {items: jsonObject}); } @@ -123,14 +140,21 @@ export class {{classname}} implements Serializable{ {{/vendorExtensions.x-request-model}} {{^vendorExtensions.x-original-response}} {{^vendorExtensions.x-request-raw-array}} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): {{classname}} { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): {{classname}} { return plainToClassFromExist(new {{classname}}(), jsonObject); } @@ -171,6 +195,9 @@ export class {{classname}}Builder { } {{/vars}} + /** + * Get the final object. + */ build():{{classname}} { return this.obj; } diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 1aef6f40..0f2c8b9e 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -48,28 +48,42 @@ export class {{classname}} implements Serializable{ {{/vendorExtensions.x-response-model}} {{#vendorExtensions.x-original-response}} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): {{classname}} { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): {{classname}} { return plainToClassFromExist(new {{classname}}(), {data : jsonObject}); } {{/vendorExtensions.x-original-response}} {{^vendorExtensions.x-original-response}} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): {{classname}} { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): {{classname}} { return plainToClassFromExist(new {{classname}}(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts index 3760c904..929f8046 100644 --- a/sdk/node/src/generate/account/account/model_get_account_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_account_info_resp.ts @@ -65,6 +65,9 @@ export class GetAccountInfoResp implements Response { */ maxOptionSubQuantity: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.level = null; @@ -101,14 +104,21 @@ export class GetAccountInfoResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountInfoResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountInfoResp { return plainToClassFromExist(new GetAccountInfoResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts index 67b6afd0..5cf48184 100644 --- a/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_apikey_info_resp.ts @@ -50,6 +50,9 @@ export class GetApikeyInfoResp implements Response { */ subName?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.remark = null; @@ -76,14 +79,21 @@ export class GetApikeyInfoResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetApikeyInfoResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetApikeyInfoResp { return plainToClassFromExist(new GetApikeyInfoResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts index c0cb9f7b..60cb80e5 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_accounts.ts @@ -44,6 +44,9 @@ export class GetCrossMarginAccountAccounts implements Serializable { */ transferInEnabled: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -62,14 +65,21 @@ export class GetCrossMarginAccountAccounts implements Serializable { // @ts-ignore this.transferInEnabled = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginAccountAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginAccountAccounts { return plainToClassFromExist(new GetCrossMarginAccountAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts index ba4e227e..eaf9b517 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_req.ts @@ -16,6 +16,9 @@ export class GetCrossMarginAccountReq implements Serializable { queryType?: GetCrossMarginAccountReq.QueryTypeEnum = GetCrossMarginAccountReq.QueryTypeEnum.MARGIN; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetCrossMarginAccountReq` class. @@ -52,14 +55,21 @@ export class GetCrossMarginAccountReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginAccountReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginAccountReq { return plainToClassFromExist(new GetCrossMarginAccountReq(), jsonObject); } @@ -118,6 +128,9 @@ export class GetCrossMarginAccountReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetCrossMarginAccountReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts index e08aeac9..47560592 100644 --- a/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_cross_margin_account_resp.ts @@ -32,6 +32,9 @@ export class GetCrossMarginAccountResp implements Response { @Type(() => GetCrossMarginAccountAccounts) accounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.totalAssetOfQuoteCurrency = null; @@ -54,14 +57,21 @@ export class GetCrossMarginAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginAccountResp { return plainToClassFromExist(new GetCrossMarginAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts index 3963ce8b..32f70973 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_req.ts @@ -9,6 +9,9 @@ export class GetFuturesAccountReq implements Serializable { */ currency?: string = 'XBT'; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFuturesAccountReq` class. @@ -36,14 +39,21 @@ export class GetFuturesAccountReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesAccountReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesAccountReq { return plainToClassFromExist(new GetFuturesAccountReq(), jsonObject); } @@ -61,6 +71,9 @@ export class GetFuturesAccountReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFuturesAccountReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts index 859cd213..54c077de 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_account_resp.ts @@ -50,6 +50,9 @@ export class GetFuturesAccountResp implements Response { */ riskRatio: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountEquity = null; @@ -80,14 +83,21 @@ export class GetFuturesAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesAccountResp { return plainToClassFromExist(new GetFuturesAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts index f497b4f0..a811428b 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_data_list.ts @@ -49,6 +49,9 @@ export class GetFuturesLedgerDataList implements Serializable { */ currency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -69,14 +72,21 @@ export class GetFuturesLedgerDataList implements Serializable { // @ts-ignore this.currency = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesLedgerDataList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesLedgerDataList { return plainToClassFromExist(new GetFuturesLedgerDataList(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts index 245e0998..9e33cacf 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_req.ts @@ -39,6 +39,9 @@ export class GetFuturesLedgerReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFuturesLedgerReq` class. @@ -100,14 +103,21 @@ export class GetFuturesLedgerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesLedgerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesLedgerReq { return plainToClassFromExist(new GetFuturesLedgerReq(), jsonObject); } @@ -173,6 +183,9 @@ export class GetFuturesLedgerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFuturesLedgerReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts index 77e33c17..d591d92d 100644 --- a/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_futures_ledger_resp.ts @@ -17,6 +17,9 @@ export class GetFuturesLedgerResp implements Response { */ hasMore: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.dataList = null; @@ -33,14 +36,21 @@ export class GetFuturesLedgerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesLedgerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesLedgerResp { return plainToClassFromExist(new GetFuturesLedgerResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts index 94179335..3f28171e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets.ts @@ -33,6 +33,9 @@ export class GetIsolatedMarginAccountAssets implements Serializable { @Type(() => GetIsolatedMarginAccountAssetsQuoteAsset) quoteAsset: GetIsolatedMarginAccountAssetsQuoteAsset; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -45,14 +48,21 @@ export class GetIsolatedMarginAccountAssets implements Serializable { // @ts-ignore this.quoteAsset = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountAssets { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssets { return plainToClassFromExist(new GetIsolatedMarginAccountAssets(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts index 323461f5..54f44384 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_base_asset.ts @@ -44,6 +44,9 @@ export class GetIsolatedMarginAccountAssetsBaseAsset implements Serializable { */ maxBorrowSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -62,14 +65,21 @@ export class GetIsolatedMarginAccountAssetsBaseAsset implements Serializable { // @ts-ignore this.maxBorrowSize = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountAssetsBaseAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsBaseAsset { return plainToClassFromExist(new GetIsolatedMarginAccountAssetsBaseAsset(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts index bf9b2f12..d9f61bf8 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_assets_quote_asset.ts @@ -44,6 +44,9 @@ export class GetIsolatedMarginAccountAssetsQuoteAsset implements Serializable { */ maxBorrowSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -62,14 +65,21 @@ export class GetIsolatedMarginAccountAssetsQuoteAsset implements Serializable { // @ts-ignore this.maxBorrowSize = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountAssetsQuoteAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountAssetsQuoteAsset { return plainToClassFromExist(new GetIsolatedMarginAccountAssetsQuoteAsset(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts index b04a8a66..a510cdb2 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_base_asset.ts @@ -39,6 +39,9 @@ export class GetIsolatedMarginAccountDetailV1BaseAsset implements Serializable { */ borrowableAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -55,14 +58,21 @@ export class GetIsolatedMarginAccountDetailV1BaseAsset implements Serializable { // @ts-ignore this.borrowableAmount = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountDetailV1BaseAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1BaseAsset { return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1BaseAsset(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts index 28ffea8e..2447b351 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_quote_asset.ts @@ -39,6 +39,9 @@ export class GetIsolatedMarginAccountDetailV1QuoteAsset implements Serializable */ borrowableAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -55,14 +58,21 @@ export class GetIsolatedMarginAccountDetailV1QuoteAsset implements Serializable // @ts-ignore this.borrowableAmount = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountDetailV1QuoteAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1QuoteAsset { return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1QuoteAsset(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts index fa6e2875..5600739e 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_req.ts @@ -11,6 +11,9 @@ export class GetIsolatedMarginAccountDetailV1Req implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginAccountDetailV1Req` class. @@ -36,14 +39,21 @@ export class GetIsolatedMarginAccountDetailV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountDetailV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountDetailV1Req { return plainToClassFromExist(new GetIsolatedMarginAccountDetailV1Req(), jsonObject); } @@ -61,6 +71,9 @@ export class GetIsolatedMarginAccountDetailV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetIsolatedMarginAccountDetailV1Req { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts index 63baef8f..b851e958 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_detail_v1_resp.ts @@ -34,6 +34,9 @@ export class GetIsolatedMarginAccountDetailV1Resp implements Response GetIsolatedMarginAccountDetailV1QuoteAsset) quoteAsset: GetIsolatedMarginAccountDetailV1QuoteAsset; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -56,14 +59,21 @@ export class GetIsolatedMarginAccountDetailV1Resp implements Response GetIsolatedMarginAccountListV1AssetsQuoteAsset) quoteAsset: GetIsolatedMarginAccountListV1AssetsQuoteAsset; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -45,14 +48,21 @@ export class GetIsolatedMarginAccountListV1Assets implements Serializable { // @ts-ignore this.quoteAsset = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountListV1Assets { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Assets { return plainToClassFromExist(new GetIsolatedMarginAccountListV1Assets(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts index 542856d2..cbff53e9 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_base_asset.ts @@ -39,6 +39,9 @@ export class GetIsolatedMarginAccountListV1AssetsBaseAsset implements Serializab */ borrowableAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -55,14 +58,21 @@ export class GetIsolatedMarginAccountListV1AssetsBaseAsset implements Serializab // @ts-ignore this.borrowableAmount = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountListV1AssetsBaseAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsBaseAsset { return plainToClassFromExist( new GetIsolatedMarginAccountListV1AssetsBaseAsset(), diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts index aa84a856..b8830912 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_assets_quote_asset.ts @@ -39,6 +39,9 @@ export class GetIsolatedMarginAccountListV1AssetsQuoteAsset implements Serializa */ borrowableAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -55,14 +58,21 @@ export class GetIsolatedMarginAccountListV1AssetsQuoteAsset implements Serializa // @ts-ignore this.borrowableAmount = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountListV1AssetsQuoteAsset { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1AssetsQuoteAsset { return plainToClassFromExist( new GetIsolatedMarginAccountListV1AssetsQuoteAsset(), diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts index 3a9f67a1..b4f70d64 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_req.ts @@ -10,6 +10,9 @@ export class GetIsolatedMarginAccountListV1Req implements Serializable { balanceCurrency?: GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum = GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginAccountListV1Req` class. @@ -39,14 +42,21 @@ export class GetIsolatedMarginAccountListV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountListV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountListV1Req { return plainToClassFromExist(new GetIsolatedMarginAccountListV1Req(), jsonObject); } @@ -83,6 +93,9 @@ export class GetIsolatedMarginAccountListV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetIsolatedMarginAccountListV1Req { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts index f75e78d6..4906b5be 100644 --- a/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_isolated_margin_account_list_v1_resp.ts @@ -22,6 +22,9 @@ export class GetIsolatedMarginAccountListV1Resp implements Response GetIsolatedMarginAccountListV1Assets) assets: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.totalConversionBalance = null; @@ -40,14 +43,21 @@ export class GetIsolatedMarginAccountListV1Resp implements Response { @Type(() => GetIsolatedMarginAccountAssets) assets: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.totalAssetOfQuoteCurrency = null; @@ -47,14 +50,21 @@ export class GetIsolatedMarginAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginAccountResp { return plainToClassFromExist(new GetIsolatedMarginAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts index dd639d7a..a5d66308 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_accounts.ts @@ -34,6 +34,9 @@ export class GetMarginAccountDetailAccounts implements Serializable { */ maxBorrowSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -48,14 +51,21 @@ export class GetMarginAccountDetailAccounts implements Serializable { // @ts-ignore this.maxBorrowSize = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginAccountDetailAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginAccountDetailAccounts { return plainToClassFromExist(new GetMarginAccountDetailAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts index ad52b4b1..ca62f5a8 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_account_detail_resp.ts @@ -17,6 +17,9 @@ export class GetMarginAccountDetailResp implements Response { @Type(() => GetMarginAccountDetailAccounts) accounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.debtRatio = null; @@ -33,14 +36,21 @@ export class GetMarginAccountDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginAccountDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginAccountDetailResp { return plainToClassFromExist(new GetMarginAccountDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts index 16eaddd9..25a5df5d 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_data.ts @@ -59,15 +59,25 @@ export class GetMarginHFLedgerData implements Serializable { */ tax?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginHFLedgerData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginHFLedgerData { return plainToClassFromExist(new GetMarginHFLedgerData(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts index 1f979f20..5c5afcfd 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_req.ts @@ -39,6 +39,9 @@ export class GetMarginHFLedgerReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMarginHFLedgerReq` class. @@ -96,14 +99,21 @@ export class GetMarginHFLedgerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginHFLedgerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginHFLedgerReq { return plainToClassFromExist(new GetMarginHFLedgerReq(), jsonObject); } @@ -182,6 +192,9 @@ export class GetMarginHFLedgerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMarginHFLedgerReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts index 6ce7aae5..36b843eb 100644 --- a/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_margin_hf_ledger_resp.ts @@ -12,6 +12,9 @@ export class GetMarginHFLedgerResp implements Response { @Type(() => GetMarginHFLedgerData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetMarginHFLedgerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginHFLedgerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginHFLedgerResp { return plainToClassFromExist(new GetMarginHFLedgerResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts index 84d5bf08..37e9fa11 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_req.ts @@ -11,6 +11,9 @@ export class GetSpotAccountDetailReq implements Serializable { @Reflect.metadata('path', 'accountId') accountId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotAccountDetailReq` class. @@ -34,14 +37,21 @@ export class GetSpotAccountDetailReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountDetailReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountDetailReq { return plainToClassFromExist(new GetSpotAccountDetailReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetSpotAccountDetailReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotAccountDetailReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts index 0394980c..74022fbd 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_detail_resp.ts @@ -25,6 +25,9 @@ export class GetSpotAccountDetailResp implements Response { */ holds: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -45,14 +48,21 @@ export class GetSpotAccountDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountDetailResp { return plainToClassFromExist(new GetSpotAccountDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts index 90cd4b17..90bf9b00 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_data.ts @@ -34,6 +34,9 @@ export class GetSpotAccountListData implements Serializable { */ holds: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -48,14 +51,21 @@ export class GetSpotAccountListData implements Serializable { // @ts-ignore this.holds = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountListData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountListData { return plainToClassFromExist(new GetSpotAccountListData(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts index ff03367c..5da9c76d 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_req.ts @@ -14,6 +14,9 @@ export class GetSpotAccountListReq implements Serializable { */ type?: GetSpotAccountListReq.TypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotAccountListReq` class. @@ -42,14 +45,21 @@ export class GetSpotAccountListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountListReq { return plainToClassFromExist(new GetSpotAccountListReq(), jsonObject); } @@ -88,6 +98,9 @@ export class GetSpotAccountListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotAccountListReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts index ae8bc5f7..8d216359 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_list_resp.ts @@ -12,6 +12,9 @@ export class GetSpotAccountListResp implements Response { @Type(() => GetSpotAccountListData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSpotAccountListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountListResp { return plainToClassFromExist(new GetSpotAccountListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts index d292b8fd..3ba2851b 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_account_type_resp.ts @@ -10,6 +10,9 @@ export class GetSpotAccountTypeResp implements Response { */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetSpotAccountTypeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotAccountTypeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotAccountTypeResp { return plainToClassFromExist(new GetSpotAccountTypeResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts index 028fdcd2..64dcd85e 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_data.ts @@ -59,6 +59,9 @@ export class GetSpotHFLedgerData implements Serializable { */ context: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -83,14 +86,21 @@ export class GetSpotHFLedgerData implements Serializable { // @ts-ignore this.context = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotHFLedgerData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotHFLedgerData { return plainToClassFromExist(new GetSpotHFLedgerData(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts index a223af72..a77e2272 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_req.ts @@ -39,6 +39,9 @@ export class GetSpotHFLedgerReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotHFLedgerReq` class. @@ -96,14 +99,21 @@ export class GetSpotHFLedgerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotHFLedgerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotHFLedgerReq { return plainToClassFromExist(new GetSpotHFLedgerReq(), jsonObject); } @@ -192,6 +202,9 @@ export class GetSpotHFLedgerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotHFLedgerReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts index 209529a0..192924da 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_hf_ledger_resp.ts @@ -12,6 +12,9 @@ export class GetSpotHFLedgerResp implements Response { @Type(() => GetSpotHFLedgerData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSpotHFLedgerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotHFLedgerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotHFLedgerResp { return plainToClassFromExist(new GetSpotHFLedgerResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts index ee37c39a..644eef44 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_items.ts @@ -54,15 +54,25 @@ export class GetSpotLedgerItems implements Serializable { */ context?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotLedgerItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotLedgerItems { return plainToClassFromExist(new GetSpotLedgerItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts index 617a38f0..84dc5036 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_req.ts @@ -39,6 +39,9 @@ export class GetSpotLedgerReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotLedgerReq` class. @@ -100,14 +103,21 @@ export class GetSpotLedgerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotLedgerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotLedgerReq { return plainToClassFromExist(new GetSpotLedgerReq(), jsonObject); } @@ -186,6 +196,9 @@ export class GetSpotLedgerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotLedgerReq { return this.obj; } diff --git a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts index 35cafa4b..083fa332 100644 --- a/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts +++ b/sdk/node/src/generate/account/account/model_get_spot_ledger_resp.ts @@ -32,6 +32,9 @@ export class GetSpotLedgerResp implements Response { @Type(() => GetSpotLedgerItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetSpotLedgerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotLedgerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotLedgerResp { return plainToClassFromExist(new GetSpotLedgerResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts index c182fec7..face852d 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_req.ts @@ -14,6 +14,9 @@ export class AddDepositAddressV1Req implements Serializable { */ chain?: string = 'eth'; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -49,14 +52,21 @@ export class AddDepositAddressV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddDepositAddressV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddDepositAddressV1Req { return plainToClassFromExist(new AddDepositAddressV1Req(), jsonObject); } @@ -82,6 +92,9 @@ export class AddDepositAddressV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddDepositAddressV1Req { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts index dcf5b3ea..55df52cd 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v1_resp.ts @@ -35,6 +35,9 @@ export class AddDepositAddressV1Resp implements Response { */ currency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.address = null; @@ -59,14 +62,21 @@ export class AddDepositAddressV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddDepositAddressV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddDepositAddressV1Resp { return plainToClassFromExist(new AddDepositAddressV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts index 25ca4754..36731d1a 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_req.ts @@ -24,6 +24,9 @@ export class AddDepositAddressV3Req implements Serializable { */ amount?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -73,14 +76,21 @@ export class AddDepositAddressV3Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddDepositAddressV3Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddDepositAddressV3Req { return plainToClassFromExist(new AddDepositAddressV3Req(), jsonObject); } @@ -135,6 +145,9 @@ export class AddDepositAddressV3ReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddDepositAddressV3Req { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts index adf4ae02..19931414 100644 --- a/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_add_deposit_address_v3_resp.ts @@ -40,6 +40,9 @@ export class AddDepositAddressV3Resp implements Response { */ chainName: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.address = null; @@ -66,14 +69,21 @@ export class AddDepositAddressV3Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddDepositAddressV3Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddDepositAddressV3Resp { return plainToClassFromExist(new AddDepositAddressV3Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts index 73432a1b..025d1fa7 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_req.ts @@ -14,6 +14,9 @@ export class GetDepositAddressV1Req implements Serializable { */ chain?: string = 'eth'; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositAddressV1Req` class. @@ -46,14 +49,21 @@ export class GetDepositAddressV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV1Req { return plainToClassFromExist(new GetDepositAddressV1Req(), jsonObject); } @@ -79,6 +89,9 @@ export class GetDepositAddressV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositAddressV1Req { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts index 9a3b7ff0..4596844d 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v1_resp.ts @@ -40,6 +40,9 @@ export class GetDepositAddressV1Resp implements Response { */ contractAddress?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * common response @@ -51,14 +54,21 @@ export class GetDepositAddressV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV1Resp { return plainToClassFromExist(new GetDepositAddressV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts index b761e2c4..b6209198 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_data.ts @@ -39,15 +39,25 @@ export class GetDepositAddressV2Data implements Serializable { */ contractAddress?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV2Data { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV2Data { return plainToClassFromExist(new GetDepositAddressV2Data(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts index ce347b61..e6fd7f30 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_req.ts @@ -9,6 +9,9 @@ export class GetDepositAddressV2Req implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositAddressV2Req` class. @@ -32,14 +35,21 @@ export class GetDepositAddressV2Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV2Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV2Req { return plainToClassFromExist(new GetDepositAddressV2Req(), jsonObject); } @@ -57,6 +67,9 @@ export class GetDepositAddressV2ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositAddressV2Req { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts index e4163d6d..2a1e1c37 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v2_resp.ts @@ -12,6 +12,9 @@ export class GetDepositAddressV2Resp implements Response { @Type(() => GetDepositAddressV2Data) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetDepositAddressV2Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV2Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV2Resp { return plainToClassFromExist(new GetDepositAddressV2Resp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts index c93219a5..609669d5 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_data.ts @@ -44,6 +44,9 @@ export class GetDepositAddressV3Data implements Serializable { */ chainName: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.address = null; @@ -62,14 +65,21 @@ export class GetDepositAddressV3Data implements Serializable { // @ts-ignore this.chainName = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV3Data { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV3Data { return plainToClassFromExist(new GetDepositAddressV3Data(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts index a2a64318..572accac 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_req.ts @@ -19,6 +19,9 @@ export class GetDepositAddressV3Req implements Serializable { */ chain?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositAddressV3Req` class. @@ -52,14 +55,21 @@ export class GetDepositAddressV3Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV3Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV3Req { return plainToClassFromExist(new GetDepositAddressV3Req(), jsonObject); } @@ -93,6 +103,9 @@ export class GetDepositAddressV3ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositAddressV3Req { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts index 9b66db67..ef6832bd 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_address_v3_resp.ts @@ -12,6 +12,9 @@ export class GetDepositAddressV3Resp implements Response { @Type(() => GetDepositAddressV3Data) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetDepositAddressV3Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositAddressV3Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositAddressV3Resp { return plainToClassFromExist(new GetDepositAddressV3Resp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts index 27a9cf44..ae0c197f 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_items.ts @@ -69,15 +69,25 @@ export class GetDepositHistoryItems implements Serializable { */ arrears?: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryItems { return plainToClassFromExist(new GetDepositHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts index efb0223b..7c69a5b1 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_items.ts @@ -34,15 +34,25 @@ export class GetDepositHistoryOldItems implements Serializable { */ status?: GetDepositHistoryOldItems.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryOldItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryOldItems { return plainToClassFromExist(new GetDepositHistoryOldItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts index 016c0def..e3f0de3e 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_req.ts @@ -24,6 +24,9 @@ export class GetDepositHistoryOldReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositHistoryOldReq` class. @@ -62,14 +65,21 @@ export class GetDepositHistoryOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryOldReq { return plainToClassFromExist(new GetDepositHistoryOldReq(), jsonObject); } @@ -128,6 +138,9 @@ export class GetDepositHistoryOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositHistoryOldReq { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts index 8a260194..58a85ec7 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_old_resp.ts @@ -32,6 +32,9 @@ export class GetDepositHistoryOldResp implements Response { @Type(() => GetDepositHistoryOldItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetDepositHistoryOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryOldResp { return plainToClassFromExist(new GetDepositHistoryOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts index 88159311..cd83303d 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_req.ts @@ -34,6 +34,9 @@ export class GetDepositHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositHistoryReq` class. @@ -86,14 +89,21 @@ export class GetDepositHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryReq { return plainToClassFromExist(new GetDepositHistoryReq(), jsonObject); } @@ -168,6 +178,9 @@ export class GetDepositHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts index 44027000..42b22df6 100644 --- a/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts +++ b/sdk/node/src/generate/account/deposit/model_get_deposit_history_resp.ts @@ -32,6 +32,9 @@ export class GetDepositHistoryResp implements Response { @Type(() => GetDepositHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetDepositHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositHistoryResp { return plainToClassFromExist(new GetDepositHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts index b15b49a7..73224158 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_req.ts @@ -9,6 +9,9 @@ export class GetBasicFeeReq implements Serializable { */ currencyType?: GetBasicFeeReq.CurrencyTypeEnum = GetBasicFeeReq.CurrencyTypeEnum._0; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetBasicFeeReq` class. @@ -36,14 +39,21 @@ export class GetBasicFeeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBasicFeeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBasicFeeReq { return plainToClassFromExist(new GetBasicFeeReq(), jsonObject); } @@ -74,6 +84,9 @@ export class GetBasicFeeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetBasicFeeReq { return this.obj; } diff --git a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts index 87b0c96c..b11747df 100644 --- a/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_basic_fee_resp.ts @@ -15,6 +15,9 @@ export class GetBasicFeeResp implements Response { */ makerFeeRate: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.takerFeeRate = null; @@ -31,14 +34,21 @@ export class GetBasicFeeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBasicFeeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBasicFeeResp { return plainToClassFromExist(new GetBasicFeeResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts index 45c6d163..50c318ee 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_req.ts @@ -9,6 +9,9 @@ export class GetFuturesActualFeeReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFuturesActualFeeReq` class. @@ -32,14 +35,21 @@ export class GetFuturesActualFeeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesActualFeeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesActualFeeReq { return plainToClassFromExist(new GetFuturesActualFeeReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetFuturesActualFeeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFuturesActualFeeReq { return this.obj; } diff --git a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts index d56a64fc..5487ad94 100644 --- a/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_futures_actual_fee_resp.ts @@ -20,6 +20,9 @@ export class GetFuturesActualFeeResp implements Response { */ makerFeeRate: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -38,14 +41,21 @@ export class GetFuturesActualFeeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesActualFeeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesActualFeeResp { return plainToClassFromExist(new GetFuturesActualFeeResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts index 2478a928..1deb394b 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_data.ts @@ -19,6 +19,9 @@ export class GetSpotActualFeeData implements Serializable { */ makerFeeRate: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -27,14 +30,21 @@ export class GetSpotActualFeeData implements Serializable { // @ts-ignore this.makerFeeRate = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotActualFeeData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotActualFeeData { return plainToClassFromExist(new GetSpotActualFeeData(), jsonObject); } diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts index f943632e..f97e90db 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_req.ts @@ -9,6 +9,9 @@ export class GetSpotActualFeeReq implements Serializable { */ symbols?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotActualFeeReq` class. @@ -32,14 +35,21 @@ export class GetSpotActualFeeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotActualFeeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotActualFeeReq { return plainToClassFromExist(new GetSpotActualFeeReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetSpotActualFeeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotActualFeeReq { return this.obj; } diff --git a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts index 886a3f0d..57eff5b2 100644 --- a/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts +++ b/sdk/node/src/generate/account/fee/model_get_spot_actual_fee_resp.ts @@ -12,6 +12,9 @@ export class GetSpotActualFeeResp implements Response { @Type(() => GetSpotActualFeeData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSpotActualFeeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotActualFeeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotActualFeeResp { return plainToClassFromExist(new GetSpotActualFeeResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts index d16cf964..9a85e5fe 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_req.ts @@ -34,6 +34,9 @@ export class AddSubAccountApiReq implements Serializable { */ subName: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.passphrase = null; @@ -97,14 +100,21 @@ export class AddSubAccountApiReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountApiReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountApiReq { return plainToClassFromExist(new AddSubAccountApiReq(), jsonObject); } @@ -187,6 +197,9 @@ export class AddSubAccountApiReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddSubAccountApiReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts index f7a445ee..f8991453 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_api_resp.ts @@ -50,6 +50,9 @@ export class AddSubAccountApiResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subName = null; @@ -78,14 +81,21 @@ export class AddSubAccountApiResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountApiResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountApiResp { return plainToClassFromExist(new AddSubAccountApiResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts index 6f268ca2..2ef2c47b 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_req.ts @@ -9,6 +9,9 @@ export class AddSubAccountFuturesPermissionReq implements Serializable { */ uid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -37,14 +40,21 @@ export class AddSubAccountFuturesPermissionReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountFuturesPermissionReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountFuturesPermissionReq { return plainToClassFromExist(new AddSubAccountFuturesPermissionReq(), jsonObject); } @@ -62,6 +72,9 @@ export class AddSubAccountFuturesPermissionReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddSubAccountFuturesPermissionReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts index a11c61a5..8665cdc8 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_futures_permission_resp.ts @@ -10,6 +10,9 @@ export class AddSubAccountFuturesPermissionResp implements Response */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class AddSubAccountMarginPermissionResp implements Response this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountMarginPermissionResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountMarginPermissionResp { return plainToClassFromExist(new AddSubAccountMarginPermissionResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts index 0a78dc23..139152bd 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_req.ts @@ -24,6 +24,9 @@ export class AddSubAccountReq implements Serializable { */ access: AddSubAccountReq.AccessEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.password = null; @@ -69,14 +72,21 @@ export class AddSubAccountReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountReq { return plainToClassFromExist(new AddSubAccountReq(), jsonObject); } @@ -135,6 +145,9 @@ export class AddSubAccountReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddSubAccountReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts index c5bb84c0..004d41d1 100644 --- a/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_add_sub_account_resp.ts @@ -25,6 +25,9 @@ export class AddSubAccountResp implements Response { */ access: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -45,14 +48,21 @@ export class AddSubAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountResp { return plainToClassFromExist(new AddSubAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts index c0408f97..9db5bd65 100644 --- a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_req.ts @@ -19,6 +19,9 @@ export class DeleteSubAccountApiReq implements Serializable { */ passphrase?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `DeleteSubAccountApiReq` class. @@ -52,14 +55,21 @@ export class DeleteSubAccountApiReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): DeleteSubAccountApiReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): DeleteSubAccountApiReq { return plainToClassFromExist(new DeleteSubAccountApiReq(), jsonObject); } @@ -93,6 +103,9 @@ export class DeleteSubAccountApiReqBuilder { return this; } + /** + * Get the final object. + */ build(): DeleteSubAccountApiReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts index 3093d1c4..cdc9de39 100644 --- a/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_delete_sub_account_api_resp.ts @@ -15,6 +15,9 @@ export class DeleteSubAccountApiResp implements Response { */ apiKey: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subName = null; @@ -31,14 +34,21 @@ export class DeleteSubAccountApiResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): DeleteSubAccountApiResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): DeleteSubAccountApiResp { return plainToClassFromExist(new DeleteSubAccountApiResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts index ed240f89..53d744b0 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_accounts.ts @@ -49,6 +49,9 @@ export class GetFuturesSubAccountListV2Accounts implements Serializable { */ currency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountName = null; @@ -69,14 +72,21 @@ export class GetFuturesSubAccountListV2Accounts implements Serializable { // @ts-ignore this.currency = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesSubAccountListV2Accounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Accounts { return plainToClassFromExist(new GetFuturesSubAccountListV2Accounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts index f9703adc..0015ffd4 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_req.ts @@ -9,6 +9,9 @@ export class GetFuturesSubAccountListV2Req implements Serializable { */ currency?: string = 'XBT'; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFuturesSubAccountListV2Req` class. @@ -36,14 +39,21 @@ export class GetFuturesSubAccountListV2Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesSubAccountListV2Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Req { return plainToClassFromExist(new GetFuturesSubAccountListV2Req(), jsonObject); } @@ -61,6 +71,9 @@ export class GetFuturesSubAccountListV2ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFuturesSubAccountListV2Req { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts index f06f7142..6251b425 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_resp.ts @@ -19,6 +19,9 @@ export class GetFuturesSubAccountListV2Resp implements Response { @Type(() => GetFuturesSubAccountListV2Accounts) accounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.summary = null; @@ -35,14 +38,21 @@ export class GetFuturesSubAccountListV2Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesSubAccountListV2Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Resp { return plainToClassFromExist(new GetFuturesSubAccountListV2Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts index 12c905cd..124813ff 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_futures_sub_account_list_v2_summary.ts @@ -44,6 +44,9 @@ export class GetFuturesSubAccountListV2Summary implements Serializable { */ currency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountEquityTotal = null; @@ -62,14 +65,21 @@ export class GetFuturesSubAccountListV2Summary implements Serializable { // @ts-ignore this.currency = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesSubAccountListV2Summary { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesSubAccountListV2Summary { return plainToClassFromExist(new GetFuturesSubAccountListV2Summary(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts index 5d50759f..d6b5d937 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_main_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountDetailMainAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountDetailMainAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountDetailMainAccounts { return plainToClassFromExist(new GetSpotSubAccountDetailMainAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts index 2c55c801..1c67ad36 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_margin_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountDetailMarginAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountDetailMarginAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountDetailMarginAccounts { return plainToClassFromExist(new GetSpotSubAccountDetailMarginAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts index b96dc5e3..7ab15f3f 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_req.ts @@ -16,6 +16,9 @@ export class GetSpotSubAccountDetailReq implements Serializable { */ includeBaseAmount?: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountDetailReq` class. @@ -44,14 +47,21 @@ export class GetSpotSubAccountDetailReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountDetailReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountDetailReq { return plainToClassFromExist(new GetSpotSubAccountDetailReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetSpotSubAccountDetailReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotSubAccountDetailReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts index 462e1a9e..8b0c5f11 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_resp.ts @@ -41,6 +41,9 @@ export class GetSpotSubAccountDetailResp implements Response { */ tradeHFAccounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subUserId = null; @@ -65,14 +68,21 @@ export class GetSpotSubAccountDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountDetailResp { return plainToClassFromExist(new GetSpotSubAccountDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts index e6380343..3a6e8dcc 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_detail_trade_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountDetailTradeAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountDetailTradeAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountDetailTradeAccounts { return plainToClassFromExist(new GetSpotSubAccountDetailTradeAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts index 4081793f..fe0d240f 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data.ts @@ -40,6 +40,9 @@ export class GetSpotSubAccountListV1Data implements Serializable { */ tradeHFAccounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subUserId = null; @@ -54,14 +57,21 @@ export class GetSpotSubAccountListV1Data implements Serializable { // @ts-ignore this.tradeHFAccounts = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV1Data { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV1Data { return plainToClassFromExist(new GetSpotSubAccountListV1Data(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts index 96a74b30..4bceae40 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_main_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV1DataMainAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV1DataMainAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMainAccounts { return plainToClassFromExist(new GetSpotSubAccountListV1DataMainAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts index a1cd44bb..2148c6f1 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_margin_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV1DataMarginAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV1DataMarginAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataMarginAccounts { return plainToClassFromExist(new GetSpotSubAccountListV1DataMarginAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts index 8fd493bc..ad5da929 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_data_trade_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV1DataTradeAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV1DataTradeAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV1DataTradeAccounts { return plainToClassFromExist(new GetSpotSubAccountListV1DataTradeAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts index d4f9c3ea..2daccee8 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v1_resp.ts @@ -12,6 +12,9 @@ export class GetSpotSubAccountListV1Resp implements Response { @Type(() => GetSpotSubAccountListV1Data) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSpotSubAccountListV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV1Resp { return plainToClassFromExist(new GetSpotSubAccountListV1Resp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts index e7e5886c..e05d369e 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items.ts @@ -40,6 +40,9 @@ export class GetSpotSubAccountListV2Items implements Serializable { */ tradeHFAccounts: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subUserId = null; @@ -54,14 +57,21 @@ export class GetSpotSubAccountListV2Items implements Serializable { // @ts-ignore this.tradeHFAccounts = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2Items { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2Items { return plainToClassFromExist(new GetSpotSubAccountListV2Items(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts index 1e52c452..5ea1064b 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_main_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV2ItemsMainAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2ItemsMainAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMainAccounts { return plainToClassFromExist(new GetSpotSubAccountListV2ItemsMainAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts index c3302d39..c928c6cd 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_margin_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV2ItemsMarginAccounts implements Serializable */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2ItemsMarginAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsMarginAccounts { return plainToClassFromExist(new GetSpotSubAccountListV2ItemsMarginAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts index 245afedb..042c997c 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_items_trade_accounts.ts @@ -44,15 +44,25 @@ export class GetSpotSubAccountListV2ItemsTradeAccounts implements Serializable { */ tag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2ItemsTradeAccounts { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2ItemsTradeAccounts { return plainToClassFromExist(new GetSpotSubAccountListV2ItemsTradeAccounts(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts index e0107806..3ff55586 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_req.ts @@ -14,6 +14,9 @@ export class GetSpotSubAccountListV2Req implements Serializable { */ pageSize?: number = 10; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountListV2Req` class. @@ -50,14 +53,21 @@ export class GetSpotSubAccountListV2Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2Req { return plainToClassFromExist(new GetSpotSubAccountListV2Req(), jsonObject); } @@ -83,6 +93,9 @@ export class GetSpotSubAccountListV2ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotSubAccountListV2Req { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts index add42f61..634e487a 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_account_list_v2_resp.ts @@ -32,6 +32,9 @@ export class GetSpotSubAccountListV2Resp implements Response { @Type(() => GetSpotSubAccountListV2Items) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetSpotSubAccountListV2Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountListV2Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountListV2Resp { return plainToClassFromExist(new GetSpotSubAccountListV2Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts index a3f47ae9..1595d395 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_data.ts @@ -34,6 +34,9 @@ export class GetSpotSubAccountsSummaryV1Data implements Serializable { */ access: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.userId = null; @@ -48,14 +51,21 @@ export class GetSpotSubAccountsSummaryV1Data implements Serializable { // @ts-ignore this.access = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountsSummaryV1Data { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Data { return plainToClassFromExist(new GetSpotSubAccountsSummaryV1Data(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts index ec18bf14..88ab35bf 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v1_resp.ts @@ -12,6 +12,9 @@ export class GetSpotSubAccountsSummaryV1Resp implements Response { @Type(() => GetSpotSubAccountsSummaryV1Data) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSpotSubAccountsSummaryV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountsSummaryV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV1Resp { return plainToClassFromExist(new GetSpotSubAccountsSummaryV1Resp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts index f362d6dd..92f41325 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_items.ts @@ -59,6 +59,9 @@ export class GetSpotSubAccountsSummaryV2Items implements Serializable { */ hostedStatus: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.userId = null; @@ -83,14 +86,21 @@ export class GetSpotSubAccountsSummaryV2Items implements Serializable { // @ts-ignore this.hostedStatus = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountsSummaryV2Items { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Items { return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Items(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts index baef2654..373bf2fd 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_req.ts @@ -14,6 +14,9 @@ export class GetSpotSubAccountsSummaryV2Req implements Serializable { */ pageSize?: number = 10; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotSubAccountsSummaryV2Req` class. @@ -46,14 +49,21 @@ export class GetSpotSubAccountsSummaryV2Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountsSummaryV2Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Req { return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Req(), jsonObject); } @@ -79,6 +89,9 @@ export class GetSpotSubAccountsSummaryV2ReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotSubAccountsSummaryV2Req { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts index 0152c466..075e02e8 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_spot_sub_accounts_summary_v2_resp.ts @@ -32,6 +32,9 @@ export class GetSpotSubAccountsSummaryV2Resp implements Response { @Type(() => GetSpotSubAccountsSummaryV2Items) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetSpotSubAccountsSummaryV2Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotSubAccountsSummaryV2Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotSubAccountsSummaryV2Resp { return plainToClassFromExist(new GetSpotSubAccountsSummaryV2Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts index 071470fb..6de35f48 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_data.ts @@ -49,15 +49,25 @@ export class GetSubAccountApiListData implements Serializable { */ isMaster?: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountApiListData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountApiListData { return plainToClassFromExist(new GetSubAccountApiListData(), jsonObject); } diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts index 26e42b80..b017bd9a 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_req.ts @@ -14,6 +14,9 @@ export class GetSubAccountApiListReq implements Serializable { */ subName?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSubAccountApiListReq` class. @@ -42,14 +45,21 @@ export class GetSubAccountApiListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountApiListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountApiListReq { return plainToClassFromExist(new GetSubAccountApiListReq(), jsonObject); } @@ -75,6 +85,9 @@ export class GetSubAccountApiListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSubAccountApiListReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts index f593c9e5..7dc197c4 100644 --- a/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_get_sub_account_api_list_resp.ts @@ -12,6 +12,9 @@ export class GetSubAccountApiListResp implements Response { @Type(() => GetSubAccountApiListData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSubAccountApiListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountApiListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountApiListResp { return plainToClassFromExist(new GetSubAccountApiListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts index 0ebf88e5..c81a88ef 100644 --- a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_req.ts @@ -34,6 +34,9 @@ export class ModifySubAccountApiReq implements Serializable { */ apiKey: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.passphrase = null; @@ -97,14 +100,21 @@ export class ModifySubAccountApiReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifySubAccountApiReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifySubAccountApiReq { return plainToClassFromExist(new ModifySubAccountApiReq(), jsonObject); } @@ -187,6 +197,9 @@ export class ModifySubAccountApiReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifySubAccountApiReq { return this.obj; } diff --git a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts index 0c79f231..8a13ec49 100644 --- a/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts +++ b/sdk/node/src/generate/account/subaccount/model_modify_sub_account_api_resp.ts @@ -25,6 +25,9 @@ export class ModifySubAccountApiResp implements Response { */ ipWhitelist?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.subName = null; @@ -43,14 +46,21 @@ export class ModifySubAccountApiResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifySubAccountApiResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifySubAccountApiResp { return plainToClassFromExist(new ModifySubAccountApiResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts index 78587f75..708a7b1c 100644 --- a/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_req.ts @@ -54,6 +54,9 @@ export class FlexTransferReq implements Serializable { */ toAccountTag?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -135,14 +138,21 @@ export class FlexTransferReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FlexTransferReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FlexTransferReq { return plainToClassFromExist(new FlexTransferReq(), jsonObject); } @@ -317,6 +327,9 @@ export class FlexTransferReqBuilder { return this; } + /** + * Get the final object. + */ build(): FlexTransferReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts index 58defd89..e88b426e 100644 --- a/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_flex_transfer_resp.ts @@ -10,6 +10,9 @@ export class FlexTransferResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class FlexTransferResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FlexTransferResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FlexTransferResp { return plainToClassFromExist(new FlexTransferResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts index 1dd4b98f..82cab53d 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_req.ts @@ -19,6 +19,9 @@ export class FuturesAccountTransferInReq implements Serializable { */ payAccountType: FuturesAccountTransferInReq.PayAccountTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -59,14 +62,21 @@ export class FuturesAccountTransferInReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FuturesAccountTransferInReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FuturesAccountTransferInReq { return plainToClassFromExist(new FuturesAccountTransferInReq(), jsonObject); } @@ -115,6 +125,9 @@ export class FuturesAccountTransferInReqBuilder { return this; } + /** + * Get the final object. + */ build(): FuturesAccountTransferInReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts index 2705fd47..464352cd 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_in_resp.ts @@ -10,6 +10,9 @@ export class FuturesAccountTransferInResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class FuturesAccountTransferInResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FuturesAccountTransferInResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FuturesAccountTransferInResp { return plainToClassFromExist(new FuturesAccountTransferInResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts index 6c72973c..6034ca19 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_req.ts @@ -19,6 +19,9 @@ export class FuturesAccountTransferOutReq implements Serializable { */ recAccountType: FuturesAccountTransferOutReq.RecAccountTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -59,14 +62,21 @@ export class FuturesAccountTransferOutReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FuturesAccountTransferOutReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FuturesAccountTransferOutReq { return plainToClassFromExist(new FuturesAccountTransferOutReq(), jsonObject); } @@ -115,6 +125,9 @@ export class FuturesAccountTransferOutReqBuilder { return this; } + /** + * Get the final object. + */ build(): FuturesAccountTransferOutReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts index fd4c505a..bf28faa9 100644 --- a/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_futures_account_transfer_out_resp.ts @@ -90,6 +90,9 @@ export class FuturesAccountTransferOutResp implements Response { */ updatedAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.applyId = null; @@ -136,14 +139,21 @@ export class FuturesAccountTransferOutResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): FuturesAccountTransferOutResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): FuturesAccountTransferOutResp { return plainToClassFromExist(new FuturesAccountTransferOutResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts index d0c833d0..78950dce 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_items.ts @@ -54,15 +54,25 @@ export class GetFuturesAccountTransferOutLedgerItems implements Serializable { */ remark?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesAccountTransferOutLedgerItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerItems { return plainToClassFromExist(new GetFuturesAccountTransferOutLedgerItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts index 0a9f83c8..d9e35377 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_req.ts @@ -39,6 +39,9 @@ export class GetFuturesAccountTransferOutLedgerReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFuturesAccountTransferOutLedgerReq` class. @@ -102,14 +105,21 @@ export class GetFuturesAccountTransferOutLedgerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFuturesAccountTransferOutLedgerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFuturesAccountTransferOutLedgerReq { return plainToClassFromExist(new GetFuturesAccountTransferOutLedgerReq(), jsonObject); } @@ -198,6 +208,9 @@ export class GetFuturesAccountTransferOutLedgerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFuturesAccountTransferOutLedgerReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts index ae1d4d7e..729231bd 100644 --- a/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_get_futures_account_transfer_out_ledger_resp.ts @@ -32,6 +32,9 @@ export class GetFuturesAccountTransferOutLedgerResp implements Response GetFuturesAccountTransferOutLedgerItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetFuturesAccountTransferOutLedgerResp implements Response { */ transferable: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -52,14 +55,21 @@ export class GetTransferQuotasResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTransferQuotasResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTransferQuotasResp { return plainToClassFromExist(new GetTransferQuotasResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts index 47d8010a..4c18ca57 100644 --- a/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_req.ts @@ -39,6 +39,9 @@ export class InnerTransferReq implements Serializable { */ from: InnerTransferReq.FromEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -103,14 +106,21 @@ export class InnerTransferReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): InnerTransferReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): InnerTransferReq { return plainToClassFromExist(new InnerTransferReq(), jsonObject); } @@ -239,6 +249,9 @@ export class InnerTransferReqBuilder { return this; } + /** + * Get the final object. + */ build(): InnerTransferReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts index b223de04..40454e46 100644 --- a/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_inner_transfer_resp.ts @@ -10,6 +10,9 @@ export class InnerTransferResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class InnerTransferResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): InnerTransferResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): InnerTransferResp { return plainToClassFromExist(new InnerTransferResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts index 89d9cdff..0e9278fd 100644 --- a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_req.ts @@ -41,6 +41,9 @@ export class SubAccountTransferReq implements Serializable { */ subUserId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -111,14 +114,21 @@ export class SubAccountTransferReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SubAccountTransferReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SubAccountTransferReq { return plainToClassFromExist(new SubAccountTransferReq(), jsonObject); } @@ -239,6 +249,9 @@ export class SubAccountTransferReqBuilder { return this; } + /** + * Get the final object. + */ build(): SubAccountTransferReq { return this.obj; } diff --git a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts index 8c2cdafe..91ea365b 100644 --- a/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts +++ b/sdk/node/src/generate/account/transfer/model_sub_account_transfer_resp.ts @@ -10,6 +10,9 @@ export class SubAccountTransferResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class SubAccountTransferResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SubAccountTransferResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SubAccountTransferResp { return plainToClassFromExist(new SubAccountTransferResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts index 1539bf09..341e8a74 100644 --- a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_req.ts @@ -11,6 +11,9 @@ export class CancelWithdrawalReq implements Serializable { @Reflect.metadata('path', 'withdrawalId') withdrawalId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelWithdrawalReq` class. @@ -34,14 +37,21 @@ export class CancelWithdrawalReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelWithdrawalReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelWithdrawalReq { return plainToClassFromExist(new CancelWithdrawalReq(), jsonObject); } @@ -59,6 +69,9 @@ export class CancelWithdrawalReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelWithdrawalReq { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts index 878b8109..5bfd566f 100644 --- a/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_cancel_withdrawal_resp.ts @@ -10,6 +10,9 @@ export class CancelWithdrawalResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class CancelWithdrawalResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelWithdrawalResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelWithdrawalResp { return plainToClassFromExist(new CancelWithdrawalResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts index 77989f59..60d67043 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_items.ts @@ -69,15 +69,25 @@ export class GetWithdrawalHistoryItems implements Serializable { */ remark?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryItems { return plainToClassFromExist(new GetWithdrawalHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts index f72aa35f..12345e6d 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_items.ts @@ -39,15 +39,25 @@ export class GetWithdrawalHistoryOldItems implements Serializable { */ status?: GetWithdrawalHistoryOldItems.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryOldItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryOldItems { return plainToClassFromExist(new GetWithdrawalHistoryOldItems(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts index 6c13d3b3..9a2d0029 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_req.ts @@ -34,6 +34,9 @@ export class GetWithdrawalHistoryOldReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetWithdrawalHistoryOldReq` class. @@ -90,14 +93,21 @@ export class GetWithdrawalHistoryOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryOldReq { return plainToClassFromExist(new GetWithdrawalHistoryOldReq(), jsonObject); } @@ -172,6 +182,9 @@ export class GetWithdrawalHistoryOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetWithdrawalHistoryOldReq { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts index b23d6178..34e8415e 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_old_resp.ts @@ -32,6 +32,9 @@ export class GetWithdrawalHistoryOldResp implements Response { @Type(() => GetWithdrawalHistoryOldItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetWithdrawalHistoryOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryOldResp { return plainToClassFromExist(new GetWithdrawalHistoryOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts index ca2195df..2150c655 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_req.ts @@ -34,6 +34,9 @@ export class GetWithdrawalHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetWithdrawalHistoryReq` class. @@ -90,14 +93,21 @@ export class GetWithdrawalHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryReq { return plainToClassFromExist(new GetWithdrawalHistoryReq(), jsonObject); } @@ -176,6 +186,9 @@ export class GetWithdrawalHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetWithdrawalHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts index c3b747d2..b71cdf13 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_history_resp.ts @@ -32,6 +32,9 @@ export class GetWithdrawalHistoryResp implements Response { @Type(() => GetWithdrawalHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetWithdrawalHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalHistoryResp { return plainToClassFromExist(new GetWithdrawalHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts index 01d15f3d..77cca4c5 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_req.ts @@ -14,6 +14,9 @@ export class GetWithdrawalQuotasReq implements Serializable { */ chain?: string = 'eth'; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetWithdrawalQuotasReq` class. @@ -46,14 +49,21 @@ export class GetWithdrawalQuotasReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalQuotasReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalQuotasReq { return plainToClassFromExist(new GetWithdrawalQuotasReq(), jsonObject); } @@ -79,6 +89,9 @@ export class GetWithdrawalQuotasReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetWithdrawalQuotasReq { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts index 38740b79..5e2cbf8c 100644 --- a/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_get_withdrawal_quotas_resp.ts @@ -85,6 +85,9 @@ export class GetWithdrawalQuotasResp implements Response { */ lockedAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -129,14 +132,21 @@ export class GetWithdrawalQuotasResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawalQuotasResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawalQuotasResp { return plainToClassFromExist(new GetWithdrawalQuotasResp(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts index 8528f46f..f44487cb 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_req.ts @@ -44,6 +44,9 @@ export class WithdrawalV1Req implements Serializable { */ feeDeductType?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -117,14 +120,21 @@ export class WithdrawalV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): WithdrawalV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): WithdrawalV1Req { return plainToClassFromExist(new WithdrawalV1Req(), jsonObject); } @@ -198,6 +208,9 @@ export class WithdrawalV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): WithdrawalV1Req { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts index b1ba188d..fadb0a77 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v1_resp.ts @@ -10,6 +10,9 @@ export class WithdrawalV1Resp implements Response { */ withdrawalId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.withdrawalId = null; @@ -24,14 +27,21 @@ export class WithdrawalV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): WithdrawalV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): WithdrawalV1Resp { return plainToClassFromExist(new WithdrawalV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts index 47685895..5facbd4b 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_req.ts @@ -49,6 +49,9 @@ export class WithdrawalV3Req implements Serializable { */ withdrawType: WithdrawalV3Req.WithdrawTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -129,14 +132,21 @@ export class WithdrawalV3Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): WithdrawalV3Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): WithdrawalV3Req { return plainToClassFromExist(new WithdrawalV3Req(), jsonObject); } @@ -239,6 +249,9 @@ export class WithdrawalV3ReqBuilder { return this; } + /** + * Get the final object. + */ build(): WithdrawalV3Req { return this.obj; } diff --git a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts index 060cf60a..ca187689 100644 --- a/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts +++ b/sdk/node/src/generate/account/withdrawal/model_withdrawal_v3_resp.ts @@ -10,6 +10,9 @@ export class WithdrawalV3Resp implements Response { */ withdrawalId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.withdrawalId = null; @@ -24,14 +27,21 @@ export class WithdrawalV3Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): WithdrawalV3Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): WithdrawalV3Resp { return plainToClassFromExist(new WithdrawalV3Resp(), jsonObject); } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts index 6cbbac09..7d105b54 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_ltv.ts @@ -29,6 +29,9 @@ export class GetAccountLtv implements Serializable { */ currentLtv: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.transferLtv = null; @@ -41,14 +44,21 @@ export class GetAccountLtv implements Serializable { // @ts-ignore this.currentLtv = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountLtv { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountLtv { return plainToClassFromExist(new GetAccountLtv(), jsonObject); } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts index 47761f7f..bb9b9703 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_margins.ts @@ -19,6 +19,9 @@ export class GetAccountMargins implements Serializable { */ marginFactor: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.marginCcy = null; @@ -27,14 +30,21 @@ export class GetAccountMargins implements Serializable { // @ts-ignore this.marginFactor = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountMargins { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountMargins { return plainToClassFromExist(new GetAccountMargins(), jsonObject); } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts index 7986f542..d617bc02 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_orders.ts @@ -24,6 +24,9 @@ export class GetAccountOrders implements Serializable { */ interest: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -34,14 +37,21 @@ export class GetAccountOrders implements Serializable { // @ts-ignore this.interest = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountOrders { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountOrders { return plainToClassFromExist(new GetAccountOrders(), jsonObject); } diff --git a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts index 944e6ae8..869fc015 100644 --- a/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts +++ b/sdk/node/src/generate/affiliate/affiliate/model_get_account_resp.ts @@ -41,6 +41,9 @@ export class GetAccountResp implements Response { @Type(() => GetAccountMargins) margins: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.parentUid = null; @@ -65,14 +68,21 @@ export class GetAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountResp { return plainToClassFromExist(new GetAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts index a55ca67e..552102ed 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_req.ts @@ -19,6 +19,9 @@ export class GetRebaseReq implements Serializable { */ tradeType?: GetRebaseReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRebaseReq` class. @@ -52,14 +55,21 @@ export class GetRebaseReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRebaseReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRebaseReq { return plainToClassFromExist(new GetRebaseReq(), jsonObject); } @@ -106,6 +116,9 @@ export class GetRebaseReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRebaseReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts index db99944d..8ba0c149 100644 --- a/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/apibroker/model_get_rebase_resp.ts @@ -10,6 +10,9 @@ export class GetRebaseResp implements Response { */ url: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.url = null; @@ -24,14 +27,21 @@ export class GetRebaseResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRebaseResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRebaseResp { return plainToClassFromExist(new GetRebaseResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts index b3a8d899..fa165136 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_req.ts @@ -29,6 +29,9 @@ export class AddSubAccountApiReq implements Serializable { */ label: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -83,14 +86,21 @@ export class AddSubAccountApiReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountApiReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountApiReq { return plainToClassFromExist(new AddSubAccountApiReq(), jsonObject); } @@ -157,6 +167,9 @@ export class AddSubAccountApiReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddSubAccountApiReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts index a3e2b545..9e843188 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_api_resp.ts @@ -45,6 +45,9 @@ export class AddSubAccountApiResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -73,14 +76,21 @@ export class AddSubAccountApiResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountApiResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountApiResp { return plainToClassFromExist(new AddSubAccountApiResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts index ddf77665..16c139df 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_req.ts @@ -9,6 +9,9 @@ export class AddSubAccountReq implements Serializable { */ accountName: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountName = null; @@ -35,14 +38,21 @@ export class AddSubAccountReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountReq { return plainToClassFromExist(new AddSubAccountReq(), jsonObject); } @@ -60,6 +70,9 @@ export class AddSubAccountReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddSubAccountReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts index 739002c0..c8dee3f1 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_add_sub_account_resp.ts @@ -25,6 +25,9 @@ export class AddSubAccountResp implements Response { */ level: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountName = null; @@ -45,14 +48,21 @@ export class AddSubAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddSubAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddSubAccountResp { return plainToClassFromExist(new AddSubAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts index d3285734..d780ff64 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_req.ts @@ -14,6 +14,9 @@ export class DeleteSubAccountAPIReq implements Serializable { */ apiKey?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `DeleteSubAccountAPIReq` class. @@ -42,14 +45,21 @@ export class DeleteSubAccountAPIReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): DeleteSubAccountAPIReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): DeleteSubAccountAPIReq { return plainToClassFromExist(new DeleteSubAccountAPIReq(), jsonObject); } @@ -75,6 +85,9 @@ export class DeleteSubAccountAPIReqBuilder { return this; } + /** + * Get the final object. + */ build(): DeleteSubAccountAPIReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts index 42bcd34e..36957e2a 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_delete_sub_account_api_resp.ts @@ -10,6 +10,9 @@ export class DeleteSubAccountAPIResp implements Response { */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class DeleteSubAccountAPIResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): DeleteSubAccountAPIResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): DeleteSubAccountAPIResp { return plainToClassFromExist(new DeleteSubAccountAPIResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts index 0701163e..c910783b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_req.ts @@ -19,6 +19,9 @@ export class GetBrokerInfoReq implements Serializable { */ tradeType?: GetBrokerInfoReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetBrokerInfoReq` class. @@ -52,14 +55,21 @@ export class GetBrokerInfoReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBrokerInfoReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBrokerInfoReq { return plainToClassFromExist(new GetBrokerInfoReq(), jsonObject); } @@ -106,6 +116,9 @@ export class GetBrokerInfoReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetBrokerInfoReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts index aaf462ce..cb393a37 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_broker_info_resp.ts @@ -20,6 +20,9 @@ export class GetBrokerInfoResp implements Response { */ level: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountSize = null; @@ -38,14 +41,21 @@ export class GetBrokerInfoResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBrokerInfoResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBrokerInfoResp { return plainToClassFromExist(new GetBrokerInfoResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts index 4b419ce5..c9819eb4 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_req.ts @@ -14,6 +14,9 @@ export class GetDepositDetailReq implements Serializable { */ hash?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositDetailReq` class. @@ -42,14 +45,21 @@ export class GetDepositDetailReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositDetailReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositDetailReq { return plainToClassFromExist(new GetDepositDetailReq(), jsonObject); } @@ -75,6 +85,9 @@ export class GetDepositDetailReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositDetailReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts index 9dabb1cb..3d03921b 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_detail_resp.ts @@ -75,6 +75,9 @@ export class GetDepositDetailResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.chain = null; @@ -115,14 +118,21 @@ export class GetDepositDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositDetailResp { return plainToClassFromExist(new GetDepositDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts index f6e59d35..e1186f23 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_data.ts @@ -74,6 +74,9 @@ export class GetDepositListData implements Serializable { */ updatedAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -104,14 +107,21 @@ export class GetDepositListData implements Serializable { // @ts-ignore this.updatedAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositListData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositListData { return plainToClassFromExist(new GetDepositListData(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts index 652ebb70..d9d679c7 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_req.ts @@ -34,6 +34,9 @@ export class GetDepositListReq implements Serializable { */ limit?: number = 1000; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetDepositListReq` class. @@ -86,14 +89,21 @@ export class GetDepositListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositListReq { return plainToClassFromExist(new GetDepositListReq(), jsonObject); } @@ -151,6 +161,9 @@ export class GetDepositListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetDepositListReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts index 8821c8f2..d958d951 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_deposit_list_resp.ts @@ -12,6 +12,9 @@ export class GetDepositListResp implements Response { @Type(() => GetDepositListData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetDepositListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDepositListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDepositListResp { return plainToClassFromExist(new GetDepositListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts index a55ca67e..552102ed 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_req.ts @@ -19,6 +19,9 @@ export class GetRebaseReq implements Serializable { */ tradeType?: GetRebaseReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRebaseReq` class. @@ -52,14 +55,21 @@ export class GetRebaseReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRebaseReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRebaseReq { return plainToClassFromExist(new GetRebaseReq(), jsonObject); } @@ -106,6 +116,9 @@ export class GetRebaseReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRebaseReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts index db99944d..8ba0c149 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_rebase_resp.ts @@ -10,6 +10,9 @@ export class GetRebaseResp implements Response { */ url: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.url = null; @@ -24,14 +27,21 @@ export class GetRebaseResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRebaseResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRebaseResp { return plainToClassFromExist(new GetRebaseResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts index b8e6d003..a1d033b5 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_data.ts @@ -39,6 +39,9 @@ export class GetSubAccountAPIData implements Serializable { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -55,14 +58,21 @@ export class GetSubAccountAPIData implements Serializable { // @ts-ignore this.createdAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountAPIData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountAPIData { return plainToClassFromExist(new GetSubAccountAPIData(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts index ebe92bf4..9a1197bb 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_req.ts @@ -14,6 +14,9 @@ export class GetSubAccountAPIReq implements Serializable { */ apiKey?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSubAccountAPIReq` class. @@ -42,14 +45,21 @@ export class GetSubAccountAPIReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountAPIReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountAPIReq { return plainToClassFromExist(new GetSubAccountAPIReq(), jsonObject); } @@ -75,6 +85,9 @@ export class GetSubAccountAPIReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSubAccountAPIReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts index b3048580..e36228bd 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_api_resp.ts @@ -12,6 +12,9 @@ export class GetSubAccountAPIResp implements Response { @Type(() => GetSubAccountAPIData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSubAccountAPIResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountAPIResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountAPIResp { return plainToClassFromExist(new GetSubAccountAPIResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts index d82cb96f..adef44a8 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_items.ts @@ -24,6 +24,9 @@ export class GetSubAccountItems implements Serializable { */ level: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.accountName = null; @@ -34,14 +37,21 @@ export class GetSubAccountItems implements Serializable { // @ts-ignore this.level = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountItems { return plainToClassFromExist(new GetSubAccountItems(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts index 785badbf..c736fcc0 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_req.ts @@ -19,6 +19,9 @@ export class GetSubAccountReq implements Serializable { */ pageSize?: number = 20; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSubAccountReq` class. @@ -60,14 +63,21 @@ export class GetSubAccountReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountReq { return plainToClassFromExist(new GetSubAccountReq(), jsonObject); } @@ -101,6 +111,9 @@ export class GetSubAccountReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSubAccountReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts index 2bf332ca..02e8c16c 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_sub_account_resp.ts @@ -32,6 +32,9 @@ export class GetSubAccountResp implements Response { @Type(() => GetSubAccountItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetSubAccountResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSubAccountResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSubAccountResp { return plainToClassFromExist(new GetSubAccountResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts index bc508458..ac451ec2 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_req.ts @@ -9,6 +9,9 @@ export class GetTransferHistoryReq implements Serializable { */ orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTransferHistoryReq` class. @@ -32,14 +35,21 @@ export class GetTransferHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTransferHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTransferHistoryReq { return plainToClassFromExist(new GetTransferHistoryReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetTransferHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTransferHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts index 396b1e8f..3c5568a6 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_transfer_history_resp.ts @@ -65,6 +65,9 @@ export class GetTransferHistoryResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -101,14 +104,21 @@ export class GetTransferHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTransferHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTransferHistoryResp { return plainToClassFromExist(new GetTransferHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts index a384b9bc..23643610 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_req.ts @@ -9,6 +9,9 @@ export class GetWithdrawDetailReq implements Serializable { */ withdrawalId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetWithdrawDetailReq` class. @@ -32,14 +35,21 @@ export class GetWithdrawDetailReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawDetailReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawDetailReq { return plainToClassFromExist(new GetWithdrawDetailReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetWithdrawDetailReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetWithdrawDetailReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts index 5e88f8b8..c9ee23af 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_get_withdraw_detail_resp.ts @@ -75,6 +75,9 @@ export class GetWithdrawDetailResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -115,14 +118,21 @@ export class GetWithdrawDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetWithdrawDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetWithdrawDetailResp { return plainToClassFromExist(new GetWithdrawDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts index 2fb7653f..77a65815 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_req.ts @@ -29,6 +29,9 @@ export class ModifySubAccountApiReq implements Serializable { */ apiKey: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -83,14 +86,21 @@ export class ModifySubAccountApiReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifySubAccountApiReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifySubAccountApiReq { return plainToClassFromExist(new ModifySubAccountApiReq(), jsonObject); } @@ -159,6 +169,9 @@ export class ModifySubAccountApiReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifySubAccountApiReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts index d10d7c43..1426a406 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_modify_sub_account_api_resp.ts @@ -40,6 +40,9 @@ export class ModifySubAccountApiResp implements Response { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -66,14 +69,21 @@ export class ModifySubAccountApiResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifySubAccountApiResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifySubAccountApiResp { return plainToClassFromExist(new ModifySubAccountApiResp(), jsonObject); } diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts index 0eff945e..2c43ed94 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_req.ts @@ -39,6 +39,9 @@ export class TransferReq implements Serializable { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -107,14 +110,21 @@ export class TransferReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TransferReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TransferReq { return plainToClassFromExist(new TransferReq(), jsonObject); } @@ -213,6 +223,9 @@ export class TransferReqBuilder { return this; } + /** + * Get the final object. + */ build(): TransferReq { return this.obj; } diff --git a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts index 2d1b9430..7c54e652 100644 --- a/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts +++ b/sdk/node/src/generate/broker/ndbroker/model_transfer_resp.ts @@ -10,6 +10,9 @@ export class TransferResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class TransferResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TransferResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TransferResp { return plainToClassFromExist(new TransferResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts index d4d5e9a7..4f14b274 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_req.ts @@ -19,6 +19,9 @@ export class AddIsolatedMarginReq implements Serializable { */ bizNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -59,14 +62,21 @@ export class AddIsolatedMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddIsolatedMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddIsolatedMarginReq { return plainToClassFromExist(new AddIsolatedMarginReq(), jsonObject); } @@ -100,6 +110,9 @@ export class AddIsolatedMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddIsolatedMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts index b81d0885..4039cbd9 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_isolated_margin_resp.ts @@ -185,6 +185,9 @@ export class AddIsolatedMarginResp implements Response { */ settleCurrency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -269,14 +272,21 @@ export class AddIsolatedMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddIsolatedMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddIsolatedMarginResp { return plainToClassFromExist(new AddIsolatedMarginResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts index 9ab80b75..5fe688c6 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_req.ts @@ -104,6 +104,9 @@ export class AddOrderReq implements Serializable { */ visibleSize?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -269,14 +272,21 @@ export class AddOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderReq { return plainToClassFromExist(new AddOrderReq(), jsonObject); } @@ -513,6 +523,9 @@ export class AddOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts index 7545d9d8..f05bffb9 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_resp.ts @@ -15,6 +15,9 @@ export class AddOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderResp { return plainToClassFromExist(new AddOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts index bffdee01..15269f7c 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_req.ts @@ -105,6 +105,9 @@ export class AddOrderTestReq implements Serializable { */ visibleSize?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -272,14 +275,21 @@ export class AddOrderTestReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestReq { return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } @@ -516,6 +526,9 @@ export class AddOrderTestReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts index 20e19e9d..a1aa0a09 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_order_test_resp.ts @@ -15,6 +15,9 @@ export class AddOrderTestResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderTestResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestResp { return plainToClassFromExist(new AddOrderTestResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts index d24b21c3..1e4a3286 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_req.ts @@ -105,6 +105,9 @@ export class AddTPSLOrderReq implements Serializable { */ triggerStopDownPrice?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -272,14 +275,21 @@ export class AddTPSLOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddTPSLOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddTPSLOrderReq { return plainToClassFromExist(new AddTPSLOrderReq(), jsonObject); } @@ -506,6 +516,9 @@ export class AddTPSLOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddTPSLOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts index 8e2bc803..84ea3778 100644 --- a/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_add_tpsl_order_resp.ts @@ -15,6 +15,9 @@ export class AddTPSLOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddTPSLOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddTPSLOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddTPSLOrderResp { return plainToClassFromExist(new AddTPSLOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts index f9deb62d..8c351924 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_req.ts @@ -14,6 +14,9 @@ export class CancelOrderByClientOidReq implements Serializable { */ clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. @@ -42,14 +45,21 @@ export class CancelOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidReq { return plainToClassFromExist(new CancelOrderByClientOidReq(), jsonObject); } @@ -75,6 +85,9 @@ export class CancelOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts index 629a3822..2dac7a46 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_client_oid_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByClientOidResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -24,14 +27,21 @@ export class CancelOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidResp { return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts index e1d296ae..775dab8f 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_req.ts @@ -9,6 +9,9 @@ export class CancelOrderByIdReq implements Serializable { */ orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByIdReq` class. @@ -32,14 +35,21 @@ export class CancelOrderByIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByIdReq { return plainToClassFromExist(new CancelOrderByIdReq(), jsonObject); } @@ -57,6 +67,9 @@ export class CancelOrderByIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByIdReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts index e95ecbcc..a2515c8f 100644 --- a/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_cancel_order_by_id_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByIdResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelOrderByIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByIdResp { return plainToClassFromExist(new CancelOrderByIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts index f171e8e2..79388690 100644 --- a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_req.ts @@ -19,6 +19,9 @@ export class GetMaxOpenSizeReq implements Serializable { */ leverage?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMaxOpenSizeReq` class. @@ -52,14 +55,21 @@ export class GetMaxOpenSizeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxOpenSizeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxOpenSizeReq { return plainToClassFromExist(new GetMaxOpenSizeReq(), jsonObject); } @@ -93,6 +103,9 @@ export class GetMaxOpenSizeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMaxOpenSizeReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts index a80ca962..62d48c39 100644 --- a/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_open_size_resp.ts @@ -20,6 +20,9 @@ export class GetMaxOpenSizeResp implements Response { */ maxSellOpenSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -38,14 +41,21 @@ export class GetMaxOpenSizeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxOpenSizeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxOpenSizeResp { return plainToClassFromExist(new GetMaxOpenSizeResp(), jsonObject); } diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts index c542fcc3..75b441f1 100644 --- a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_req.ts @@ -9,6 +9,9 @@ export class GetMaxWithdrawMarginReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMaxWithdrawMarginReq` class. @@ -32,14 +35,21 @@ export class GetMaxWithdrawMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxWithdrawMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxWithdrawMarginReq { return plainToClassFromExist(new GetMaxWithdrawMarginReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetMaxWithdrawMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMaxWithdrawMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts index 481f7032..bf3188d4 100644 --- a/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_get_max_withdraw_margin_resp.ts @@ -10,6 +10,9 @@ export class GetMaxWithdrawMarginResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetMaxWithdrawMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxWithdrawMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxWithdrawMarginResp { return plainToClassFromExist(new GetMaxWithdrawMarginResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts index 98097bd7..35b8ae85 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_req.ts @@ -14,6 +14,9 @@ export class ModifyAutoDepositStatusReq implements Serializable { */ status: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class ModifyAutoDepositStatusReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyAutoDepositStatusReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyAutoDepositStatusReq { return plainToClassFromExist(new ModifyAutoDepositStatusReq(), jsonObject); } @@ -80,6 +90,9 @@ export class ModifyAutoDepositStatusReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyAutoDepositStatusReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts index e85f2b16..8c1b05a3 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_auto_deposit_status_resp.ts @@ -10,6 +10,9 @@ export class ModifyAutoDepositStatusResp implements Response { */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyAutoDepositStatusResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyAutoDepositStatusResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { return plainToClassFromExist(new ModifyAutoDepositStatusResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts index 32341c24..e790a40d 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_req.ts @@ -14,6 +14,9 @@ export class ModifyIsolatedMarginRiskLimtReq implements Serializable { */ level: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class ModifyIsolatedMarginRiskLimtReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtReq(), jsonObject); } @@ -80,6 +90,9 @@ export class ModifyIsolatedMarginRiskLimtReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyIsolatedMarginRiskLimtReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts index 39f9b626..8c4b0edf 100644 --- a/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_modify_isolated_margin_risk_limt_resp.ts @@ -10,6 +10,9 @@ export class ModifyIsolatedMarginRiskLimtResp implements Response */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyIsolatedMarginRiskLimtResp implements Response this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts index a5b97a54..bec03120 100644 --- a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts +++ b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_req.ts @@ -14,6 +14,9 @@ export class RemoveIsolatedMarginReq implements Serializable { */ withdrawAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class RemoveIsolatedMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RemoveIsolatedMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RemoveIsolatedMarginReq { return plainToClassFromExist(new RemoveIsolatedMarginReq(), jsonObject); } @@ -80,6 +90,9 @@ export class RemoveIsolatedMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): RemoveIsolatedMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts index 03cfb0ce..4c8b0424 100644 --- a/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts +++ b/sdk/node/src/generate/copytrading/futures/model_remove_isolated_margin_resp.ts @@ -10,6 +10,9 @@ export class RemoveIsolatedMarginResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class RemoveIsolatedMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RemoveIsolatedMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RemoveIsolatedMarginResp { return plainToClassFromExist(new RemoveIsolatedMarginResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts index 296add20..d9cb46ca 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_items.ts @@ -84,6 +84,9 @@ export class GetAccountHoldingItems implements Serializable { */ earlyRedeemSupported: GetAccountHoldingItems.EarlyRedeemSupportedEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -116,14 +119,21 @@ export class GetAccountHoldingItems implements Serializable { // @ts-ignore this.earlyRedeemSupported = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountHoldingItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountHoldingItems { return plainToClassFromExist(new GetAccountHoldingItems(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts index a9292b62..3c554d44 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_req.ts @@ -29,6 +29,9 @@ export class GetAccountHoldingReq implements Serializable { */ pageSize?: number = 15; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetAccountHoldingReq` class. @@ -80,14 +83,21 @@ export class GetAccountHoldingReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountHoldingReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountHoldingReq { return plainToClassFromExist(new GetAccountHoldingReq(), jsonObject); } @@ -164,6 +174,9 @@ export class GetAccountHoldingReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetAccountHoldingReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts index 00a6646e..711e7078 100644 --- a/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_account_holding_resp.ts @@ -32,6 +32,9 @@ export class GetAccountHoldingResp implements Response { */ totalPage: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.totalNum = null; @@ -54,14 +57,21 @@ export class GetAccountHoldingResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountHoldingResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountHoldingResp { return plainToClassFromExist(new GetAccountHoldingResp(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts index abec85be..97071ced 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_data.ts @@ -119,6 +119,9 @@ export class GetETHStakingProductsData implements Serializable { */ status: GetETHStakingProductsData.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -159,14 +162,21 @@ export class GetETHStakingProductsData implements Serializable { // @ts-ignore this.status = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETHStakingProductsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETHStakingProductsData { return plainToClassFromExist(new GetETHStakingProductsData(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts index 4d439a71..88394e05 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_req.ts @@ -9,6 +9,9 @@ export class GetETHStakingProductsReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetETHStakingProductsReq` class. @@ -32,14 +35,21 @@ export class GetETHStakingProductsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETHStakingProductsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETHStakingProductsReq { return plainToClassFromExist(new GetETHStakingProductsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetETHStakingProductsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetETHStakingProductsReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts index f9d7dd81..86dc5b73 100644 --- a/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_eth_staking_products_resp.ts @@ -12,6 +12,9 @@ export class GetETHStakingProductsResp implements Response { @Type(() => GetETHStakingProductsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetETHStakingProductsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETHStakingProductsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETHStakingProductsResp { return plainToClassFromExist(new GetETHStakingProductsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts index 0d337b76..68b00346 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_data.ts @@ -119,6 +119,9 @@ export class GetKcsStakingProductsData implements Serializable { */ newUserOnly: GetKcsStakingProductsData.NewUserOnlyEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -163,14 +166,21 @@ export class GetKcsStakingProductsData implements Serializable { // @ts-ignore this.newUserOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKcsStakingProductsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKcsStakingProductsData { return plainToClassFromExist(new GetKcsStakingProductsData(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts index 15eb581d..6d68cd00 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_req.ts @@ -9,6 +9,9 @@ export class GetKcsStakingProductsReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetKcsStakingProductsReq` class. @@ -32,14 +35,21 @@ export class GetKcsStakingProductsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKcsStakingProductsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKcsStakingProductsReq { return plainToClassFromExist(new GetKcsStakingProductsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetKcsStakingProductsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetKcsStakingProductsReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts index 730ac115..4dae0868 100644 --- a/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_kcs_staking_products_resp.ts @@ -12,6 +12,9 @@ export class GetKcsStakingProductsResp implements Response { @Type(() => GetKcsStakingProductsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetKcsStakingProductsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKcsStakingProductsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKcsStakingProductsResp { return plainToClassFromExist(new GetKcsStakingProductsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts index ef9b2545..93443937 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_data.ts @@ -119,6 +119,9 @@ export class GetPromotionProductsData implements Serializable { */ newUserOnly: GetPromotionProductsData.NewUserOnlyEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -167,14 +170,21 @@ export class GetPromotionProductsData implements Serializable { // @ts-ignore this.newUserOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPromotionProductsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPromotionProductsData { return plainToClassFromExist(new GetPromotionProductsData(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts index ac7a33bf..57ffc34f 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_req.ts @@ -9,6 +9,9 @@ export class GetPromotionProductsReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPromotionProductsReq` class. @@ -32,14 +35,21 @@ export class GetPromotionProductsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPromotionProductsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPromotionProductsReq { return plainToClassFromExist(new GetPromotionProductsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetPromotionProductsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPromotionProductsReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts index 90babc4c..5577ed5d 100644 --- a/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_promotion_products_resp.ts @@ -12,6 +12,9 @@ export class GetPromotionProductsResp implements Response { @Type(() => GetPromotionProductsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetPromotionProductsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPromotionProductsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPromotionProductsResp { return plainToClassFromExist(new GetPromotionProductsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts index daa4b07e..e32f9064 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_req.ts @@ -14,6 +14,9 @@ export class GetRedeemPreviewReq implements Serializable { */ fromAccountType?: GetRedeemPreviewReq.FromAccountTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRedeemPreviewReq` class. @@ -42,14 +45,21 @@ export class GetRedeemPreviewReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRedeemPreviewReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRedeemPreviewReq { return plainToClassFromExist(new GetRedeemPreviewReq(), jsonObject); } @@ -88,6 +98,9 @@ export class GetRedeemPreviewReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRedeemPreviewReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts index 9a49d829..a22c1818 100644 --- a/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_redeem_preview_resp.ts @@ -40,6 +40,9 @@ export class GetRedeemPreviewResp implements Response { */ redeemAll: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -66,14 +69,21 @@ export class GetRedeemPreviewResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRedeemPreviewResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRedeemPreviewResp { return plainToClassFromExist(new GetRedeemPreviewResp(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts index 9eddabff..fa18f338 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_data.ts @@ -119,6 +119,9 @@ export class GetSavingsProductsData implements Serializable { */ newUserOnly: GetSavingsProductsData.NewUserOnlyEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -167,14 +170,21 @@ export class GetSavingsProductsData implements Serializable { // @ts-ignore this.newUserOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSavingsProductsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSavingsProductsData { return plainToClassFromExist(new GetSavingsProductsData(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts index 022598d9..8750d125 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_req.ts @@ -9,6 +9,9 @@ export class GetSavingsProductsReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSavingsProductsReq` class. @@ -32,14 +35,21 @@ export class GetSavingsProductsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSavingsProductsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSavingsProductsReq { return plainToClassFromExist(new GetSavingsProductsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetSavingsProductsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSavingsProductsReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts index 462d6413..68bb0460 100644 --- a/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_savings_products_resp.ts @@ -12,6 +12,9 @@ export class GetSavingsProductsResp implements Response { @Type(() => GetSavingsProductsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetSavingsProductsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSavingsProductsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSavingsProductsResp { return plainToClassFromExist(new GetSavingsProductsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts index cd55d50c..b37ec4b9 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_data.ts @@ -119,6 +119,9 @@ export class GetStakingProductsData implements Serializable { */ newUserOnly: GetStakingProductsData.NewUserOnlyEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -167,14 +170,21 @@ export class GetStakingProductsData implements Serializable { // @ts-ignore this.newUserOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStakingProductsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStakingProductsData { return plainToClassFromExist(new GetStakingProductsData(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts index 3600980f..740a5687 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_req.ts @@ -9,6 +9,9 @@ export class GetStakingProductsReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetStakingProductsReq` class. @@ -32,14 +35,21 @@ export class GetStakingProductsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStakingProductsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStakingProductsReq { return plainToClassFromExist(new GetStakingProductsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetStakingProductsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetStakingProductsReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts index 301fd8f1..6b86e004 100644 --- a/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_get_staking_products_resp.ts @@ -12,6 +12,9 @@ export class GetStakingProductsResp implements Response { @Type(() => GetStakingProductsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetStakingProductsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStakingProductsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStakingProductsResp { return plainToClassFromExist(new GetStakingProductsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/earn/earn/model_purchase_req.ts b/sdk/node/src/generate/earn/earn/model_purchase_req.ts index 9b51c117..61ca9ee8 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_req.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_req.ts @@ -19,6 +19,9 @@ export class PurchaseReq implements Serializable { */ accountType: PurchaseReq.AccountTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.productId = null; @@ -59,14 +62,21 @@ export class PurchaseReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): PurchaseReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): PurchaseReq { return plainToClassFromExist(new PurchaseReq(), jsonObject); } @@ -113,6 +123,9 @@ export class PurchaseReqBuilder { return this; } + /** + * Get the final object. + */ build(): PurchaseReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts index 6e2b28ac..692b3956 100644 --- a/sdk/node/src/generate/earn/earn/model_purchase_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_purchase_resp.ts @@ -15,6 +15,9 @@ export class PurchaseResp implements Response { */ orderTxId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class PurchaseResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): PurchaseResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): PurchaseResp { return plainToClassFromExist(new PurchaseResp(), jsonObject); } diff --git a/sdk/node/src/generate/earn/earn/model_redeem_req.ts b/sdk/node/src/generate/earn/earn/model_redeem_req.ts index 2025b391..af63d2b9 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_req.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_req.ts @@ -24,6 +24,9 @@ export class RedeemReq implements Serializable { */ confirmPunishRedeem?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `RedeemReq` class. @@ -62,14 +65,21 @@ export class RedeemReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RedeemReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RedeemReq { return plainToClassFromExist(new RedeemReq(), jsonObject); } @@ -124,6 +134,9 @@ export class RedeemReqBuilder { return this; } + /** + * Get the final object. + */ build(): RedeemReq { return this.obj; } diff --git a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts index 3a8b9c10..62488368 100644 --- a/sdk/node/src/generate/earn/earn/model_redeem_resp.ts +++ b/sdk/node/src/generate/earn/earn/model_redeem_resp.ts @@ -25,6 +25,9 @@ export class RedeemResp implements Response { */ amount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderTxId = null; @@ -45,14 +48,21 @@ export class RedeemResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RedeemResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RedeemResp { return plainToClassFromExist(new RedeemResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts index fbf4ec2b..31a92233 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_req.ts @@ -11,6 +11,9 @@ export class GetCurrentFundingRateReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetCurrentFundingRateReq` class. @@ -34,14 +37,21 @@ export class GetCurrentFundingRateReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCurrentFundingRateReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCurrentFundingRateReq { return plainToClassFromExist(new GetCurrentFundingRateReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetCurrentFundingRateReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetCurrentFundingRateReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts index 843856a1..b9f31c4e 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_current_funding_rate_resp.ts @@ -40,6 +40,9 @@ export class GetCurrentFundingRateResp implements Response { */ fundingRateFloor: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -66,14 +69,21 @@ export class GetCurrentFundingRateResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCurrentFundingRateResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCurrentFundingRateResp { return plainToClassFromExist(new GetCurrentFundingRateResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts index 68dcbd92..dc44b007 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_data_list.ts @@ -59,6 +59,9 @@ export class GetPrivateFundingHistoryDataList implements Serializable { */ marginMode: GetPrivateFundingHistoryDataList.MarginModeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -83,14 +86,21 @@ export class GetPrivateFundingHistoryDataList implements Serializable { // @ts-ignore this.marginMode = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateFundingHistoryDataList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateFundingHistoryDataList { return plainToClassFromExist(new GetPrivateFundingHistoryDataList(), jsonObject); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts index 1685b994..90789fc4 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_req.ts @@ -39,6 +39,9 @@ export class GetPrivateFundingHistoryReq implements Serializable { */ maxCount?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPrivateFundingHistoryReq` class. @@ -92,14 +95,21 @@ export class GetPrivateFundingHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateFundingHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateFundingHistoryReq { return plainToClassFromExist(new GetPrivateFundingHistoryReq(), jsonObject); } @@ -165,6 +175,9 @@ export class GetPrivateFundingHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPrivateFundingHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts index ad89178b..0b74ca37 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_private_funding_history_resp.ts @@ -17,6 +17,9 @@ export class GetPrivateFundingHistoryResp implements Response { */ hasMore: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.dataList = null; @@ -33,14 +36,21 @@ export class GetPrivateFundingHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateFundingHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateFundingHistoryResp { return plainToClassFromExist(new GetPrivateFundingHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts index 2d119eee..f6e8c24c 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_data.ts @@ -19,6 +19,9 @@ export class GetPublicFundingHistoryData implements Serializable { */ timepoint: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -27,14 +30,21 @@ export class GetPublicFundingHistoryData implements Serializable { // @ts-ignore this.timepoint = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicFundingHistoryData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicFundingHistoryData { return plainToClassFromExist(new GetPublicFundingHistoryData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts index 3daf093d..f23cbdef 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_req.ts @@ -19,6 +19,9 @@ export class GetPublicFundingHistoryReq implements Serializable { */ to?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPublicFundingHistoryReq` class. @@ -52,14 +55,21 @@ export class GetPublicFundingHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicFundingHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicFundingHistoryReq { return plainToClassFromExist(new GetPublicFundingHistoryReq(), jsonObject); } @@ -93,6 +103,9 @@ export class GetPublicFundingHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPublicFundingHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts index 1669723a..8b416a25 100644 --- a/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts +++ b/sdk/node/src/generate/futures/fundingfees/model_get_public_funding_history_resp.ts @@ -12,6 +12,9 @@ export class GetPublicFundingHistoryResp implements Response { @Type(() => GetPublicFundingHistoryData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetPublicFundingHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicFundingHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicFundingHistoryResp { return plainToClassFromExist(new GetPublicFundingHistoryResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index 9a113e8d..6473fc35 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -135,14 +135,21 @@ export class AllOrderEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AllOrderEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AllOrderEvent { return plainToClassFromExist(new AllOrderEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index d08cc69a..52a79280 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -261,14 +261,21 @@ export class AllPositionEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AllPositionEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AllPositionEvent { return plainToClassFromExist(new AllPositionEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index 6f7649ff..e2dd6546 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -109,14 +109,21 @@ export class BalanceEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BalanceEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BalanceEvent { return plainToClassFromExist(new BalanceEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts index 133104b5..05697d69 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_data_value.ts @@ -13,14 +13,21 @@ export class CrossLeverageDataValue implements Serializable { // @ts-ignore this.leverage = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CrossLeverageDataValue { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CrossLeverageDataValue { return plainToClassFromExist(new CrossLeverageDataValue(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index 5702e0b7..f16bc5be 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -26,14 +26,21 @@ export class CrossLeverageEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CrossLeverageEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CrossLeverageEvent { return plainToClassFromExist(new CrossLeverageEvent(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index 44978322..2beaf5c8 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -25,14 +25,21 @@ export class MarginModeEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarginModeEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarginModeEvent { return plainToClassFromExist(new MarginModeEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index a110fe0f..4d8b868d 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -135,14 +135,21 @@ export class OrderEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderEvent { return plainToClassFromExist(new OrderEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index e3d9b588..d6618421 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -261,14 +261,21 @@ export class PositionEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): PositionEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): PositionEvent { return plainToClassFromExist(new PositionEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index 8da8311d..185b8007 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -97,14 +97,21 @@ export class StopOrdersEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): StopOrdersEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): StopOrdersEvent { return plainToClassFromExist(new StopOrdersEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index b53abdae..b1525c60 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -43,14 +43,21 @@ export class AnnouncementEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AnnouncementEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AnnouncementEvent { return plainToClassFromExist(new AnnouncementEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index 4c35ab26..d9c23e96 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -73,14 +73,21 @@ export class ExecutionEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ExecutionEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ExecutionEvent { return plainToClassFromExist(new ExecutionEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index 53ff30b2..399d7531 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -43,14 +43,21 @@ export class InstrumentEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): InstrumentEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): InstrumentEvent { return plainToClassFromExist(new InstrumentEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index be3d6268..5823a9be 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -37,14 +37,21 @@ export class KlinesEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): KlinesEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): KlinesEvent { return plainToClassFromExist(new KlinesEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index dfbf2728..997c57ad 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -37,14 +37,21 @@ export class OrderbookIncrementEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookIncrementEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookIncrementEvent { return plainToClassFromExist(new OrderbookIncrementEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts index f5e64241..8fdcff80 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -49,14 +49,21 @@ export class OrderbookLevel50Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel50Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel50Event { return plainToClassFromExist(new OrderbookLevel50Event(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts index 22bc8b46..8392ea04 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -49,14 +49,21 @@ export class OrderbookLevel5Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel5Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel5Event { return plainToClassFromExist(new OrderbookLevel5Event(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts index 0087a2cc..38f70ec9 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -79,14 +79,21 @@ export class SymbolSnapshotEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotEvent { return plainToClassFromExist(new SymbolSnapshotEvent(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts index 3f6fb7e6..97543e09 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -85,14 +85,21 @@ export class TickerV1Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TickerV1Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TickerV1Event { return plainToClassFromExist(new TickerV1Event(), jsonObject); } diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index 9f2d0a01..3b8e511f 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -61,14 +61,21 @@ export class TickerV2Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TickerV2Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TickerV2Event { return plainToClassFromExist(new TickerV2Event(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts index 0677e8bd..b3964651 100644 --- a/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get24hr_stats_resp.ts @@ -10,6 +10,9 @@ export class Get24hrStatsResp implements Response { */ turnoverOf24h: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.turnoverOf24h = null; @@ -24,14 +27,21 @@ export class Get24hrStatsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): Get24hrStatsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): Get24hrStatsResp { return plainToClassFromExist(new Get24hrStatsResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts index fca982cb..30a74895 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_data.ts @@ -314,6 +314,9 @@ export class GetAllSymbolsData implements Serializable { */ supportCross: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -436,14 +439,21 @@ export class GetAllSymbolsData implements Serializable { // @ts-ignore this.supportCross = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllSymbolsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllSymbolsData { return plainToClassFromExist(new GetAllSymbolsData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts index ec363361..78aa0207 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_symbols_resp.ts @@ -12,6 +12,9 @@ export class GetAllSymbolsResp implements Response { @Type(() => GetAllSymbolsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetAllSymbolsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllSymbolsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllSymbolsResp { return plainToClassFromExist(new GetAllSymbolsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts index 888da5e4..9106c7a0 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_data.ts @@ -59,6 +59,9 @@ export class GetAllTickersData implements Serializable { */ ts: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -83,14 +86,21 @@ export class GetAllTickersData implements Serializable { // @ts-ignore this.ts = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllTickersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllTickersData { return plainToClassFromExist(new GetAllTickersData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts index 201a8c40..63272833 100644 --- a/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_all_tickers_resp.ts @@ -12,6 +12,9 @@ export class GetAllTickersResp implements Response { @Type(() => GetAllTickersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetAllTickersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllTickersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllTickersResp { return plainToClassFromExist(new GetAllTickersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts index fef5ab0c..6b51b772 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_req.ts @@ -9,6 +9,9 @@ export class GetFullOrderBookReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFullOrderBookReq` class. @@ -32,14 +35,21 @@ export class GetFullOrderBookReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFullOrderBookReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFullOrderBookReq { return plainToClassFromExist(new GetFullOrderBookReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetFullOrderBookReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFullOrderBookReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts index f33a27c9..5694e9c2 100644 --- a/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_full_order_book_resp.ts @@ -30,6 +30,9 @@ export class GetFullOrderBookResp implements Response { */ ts: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -52,14 +55,21 @@ export class GetFullOrderBookResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFullOrderBookResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFullOrderBookResp { return plainToClassFromExist(new GetFullOrderBookResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts index 848cf9de..d0b94f1f 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_data_list.ts @@ -24,6 +24,9 @@ export class GetInterestRateIndexDataList implements Serializable { */ value: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -34,14 +37,21 @@ export class GetInterestRateIndexDataList implements Serializable { // @ts-ignore this.value = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestRateIndexDataList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestRateIndexDataList { return plainToClassFromExist(new GetInterestRateIndexDataList(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts index 191a7a14..3593766e 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_req.ts @@ -39,6 +39,9 @@ export class GetInterestRateIndexReq implements Serializable { */ maxCount?: number = 10; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetInterestRateIndexReq` class. @@ -104,14 +107,21 @@ export class GetInterestRateIndexReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestRateIndexReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestRateIndexReq { return plainToClassFromExist(new GetInterestRateIndexReq(), jsonObject); } @@ -177,6 +187,9 @@ export class GetInterestRateIndexReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetInterestRateIndexReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts index 6e0f020f..7123a8a0 100644 --- a/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_interest_rate_index_resp.ts @@ -17,6 +17,9 @@ export class GetInterestRateIndexResp implements Response { */ hasMore: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.dataList = null; @@ -33,14 +36,21 @@ export class GetInterestRateIndexResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestRateIndexResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestRateIndexResp { return plainToClassFromExist(new GetInterestRateIndexResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_klines_req.ts b/sdk/node/src/generate/futures/market/model_get_klines_req.ts index d95a99a3..22f2b10e 100644 --- a/sdk/node/src/generate/futures/market/model_get_klines_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_klines_req.ts @@ -24,6 +24,9 @@ export class GetKlinesReq implements Serializable { */ to?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetKlinesReq` class. @@ -62,14 +65,21 @@ export class GetKlinesReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKlinesReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKlinesReq { return plainToClassFromExist(new GetKlinesReq(), jsonObject); } @@ -160,6 +170,9 @@ export class GetKlinesReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetKlinesReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts index 6c384251..143cf099 100644 --- a/sdk/node/src/generate/futures/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_klines_resp.ts @@ -10,6 +10,9 @@ export class GetKlinesResp implements Response { */ data: Array>; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetKlinesResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKlinesResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKlinesResp { return plainToClassFromExist(new GetKlinesResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts index 1cc847c7..6c1194dc 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_req.ts @@ -11,6 +11,9 @@ export class GetMarkPriceReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMarkPriceReq` class. @@ -34,14 +37,21 @@ export class GetMarkPriceReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceReq { return plainToClassFromExist(new GetMarkPriceReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetMarkPriceReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMarkPriceReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts index e157cc1f..ef679ebf 100644 --- a/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_mark_price_resp.ts @@ -30,6 +30,9 @@ export class GetMarkPriceResp implements Response { */ indexPrice: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -52,14 +55,21 @@ export class GetMarkPriceResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceResp { return plainToClassFromExist(new GetMarkPriceResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts index 6df3548d..e3c82d8d 100644 --- a/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_req.ts @@ -16,6 +16,9 @@ export class GetPartOrderBookReq implements Serializable { @Reflect.metadata('path', 'size') size?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPartOrderBookReq` class. @@ -44,14 +47,21 @@ export class GetPartOrderBookReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPartOrderBookReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPartOrderBookReq { return plainToClassFromExist(new GetPartOrderBookReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetPartOrderBookReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPartOrderBookReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts index 47e42d95..0a7e85b5 100644 --- a/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_part_order_book_resp.ts @@ -30,6 +30,9 @@ export class GetPartOrderBookResp implements Response { */ ts: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -52,14 +55,21 @@ export class GetPartOrderBookResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPartOrderBookResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPartOrderBookResp { return plainToClassFromExist(new GetPartOrderBookResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts index 1c5f7abe..9b17d084 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_data_list.ts @@ -24,6 +24,9 @@ export class GetPremiumIndexDataList implements Serializable { */ value: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -34,14 +37,21 @@ export class GetPremiumIndexDataList implements Serializable { // @ts-ignore this.value = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPremiumIndexDataList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPremiumIndexDataList { return plainToClassFromExist(new GetPremiumIndexDataList(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts index e7631120..f1d26c0b 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_req.ts @@ -39,6 +39,9 @@ export class GetPremiumIndexReq implements Serializable { */ maxCount?: number = 10; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPremiumIndexReq` class. @@ -104,14 +107,21 @@ export class GetPremiumIndexReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPremiumIndexReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPremiumIndexReq { return plainToClassFromExist(new GetPremiumIndexReq(), jsonObject); } @@ -177,6 +187,9 @@ export class GetPremiumIndexReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPremiumIndexReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts index 14a437b3..d8725924 100644 --- a/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_premium_index_resp.ts @@ -17,6 +17,9 @@ export class GetPremiumIndexResp implements Response { */ hasMore: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.dataList = null; @@ -33,14 +36,21 @@ export class GetPremiumIndexResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPremiumIndexResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPremiumIndexResp { return plainToClassFromExist(new GetPremiumIndexResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts index 71029b7c..03e243fd 100644 --- a/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts +++ b/sdk/node/src/generate/futures/market/model_get_private_token_instance_servers.ts @@ -29,6 +29,9 @@ export class GetPrivateTokenInstanceServers implements Serializable { */ pingTimeout: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.endpoint = null; @@ -41,14 +44,21 @@ export class GetPrivateTokenInstanceServers implements Serializable { // @ts-ignore this.pingTimeout = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateTokenInstanceServers { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { return plainToClassFromExist(new GetPrivateTokenInstanceServers(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts index 30d35009..9e6aebc6 100644 --- a/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_private_token_resp.ts @@ -17,6 +17,9 @@ export class GetPrivateTokenResp implements Response { @Type(() => GetPrivateTokenInstanceServers) instanceServers: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.token = null; @@ -33,14 +36,21 @@ export class GetPrivateTokenResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateTokenResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateTokenResp { return plainToClassFromExist(new GetPrivateTokenResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts index d9cd2340..2abc3132 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_instance_servers.ts @@ -29,6 +29,9 @@ export class GetPublicTokenInstanceServers implements Serializable { */ pingTimeout: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.endpoint = null; @@ -41,14 +44,21 @@ export class GetPublicTokenInstanceServers implements Serializable { // @ts-ignore this.pingTimeout = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicTokenInstanceServers { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicTokenInstanceServers { return plainToClassFromExist(new GetPublicTokenInstanceServers(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts index c6c5da8b..e7d4b332 100644 --- a/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_public_token_resp.ts @@ -17,6 +17,9 @@ export class GetPublicTokenResp implements Response { @Type(() => GetPublicTokenInstanceServers) instanceServers: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.token = null; @@ -33,14 +36,21 @@ export class GetPublicTokenResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicTokenResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicTokenResp { return plainToClassFromExist(new GetPublicTokenResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts index 14a2c1c7..1427322c 100644 --- a/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_server_time_resp.ts @@ -10,6 +10,9 @@ export class GetServerTimeResp implements Response { */ data: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetServerTimeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetServerTimeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetServerTimeResp { return plainToClassFromExist(new GetServerTimeResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts index a29fdff0..ed2d071c 100644 --- a/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_service_status_resp.ts @@ -15,6 +15,9 @@ export class GetServiceStatusResp implements Response { */ status: GetServiceStatusResp.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.msg = null; @@ -31,14 +34,21 @@ export class GetServiceStatusResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetServiceStatusResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetServiceStatusResp { return plainToClassFromExist(new GetServiceStatusResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts index b9f95e00..c45394bb 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list.ts @@ -31,6 +31,9 @@ export class GetSpotIndexPriceDataList implements Serializable { @Type(() => GetSpotIndexPriceDataListDecomposionList) decomposionList: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -43,14 +46,21 @@ export class GetSpotIndexPriceDataList implements Serializable { // @ts-ignore this.decomposionList = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotIndexPriceDataList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotIndexPriceDataList { return plainToClassFromExist(new GetSpotIndexPriceDataList(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts index fc6caca2..5fde62ac 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_data_list_decomposion_list.ts @@ -19,6 +19,9 @@ export class GetSpotIndexPriceDataListDecomposionList implements Serializable { */ weight: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.exchange = null; @@ -27,14 +30,21 @@ export class GetSpotIndexPriceDataListDecomposionList implements Serializable { // @ts-ignore this.weight = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotIndexPriceDataListDecomposionList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotIndexPriceDataListDecomposionList { return plainToClassFromExist(new GetSpotIndexPriceDataListDecomposionList(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts index a7d2035a..c1677318 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_req.ts @@ -39,6 +39,9 @@ export class GetSpotIndexPriceReq implements Serializable { */ maxCount?: number = 10; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSpotIndexPriceReq` class. @@ -104,14 +107,21 @@ export class GetSpotIndexPriceReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotIndexPriceReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotIndexPriceReq { return plainToClassFromExist(new GetSpotIndexPriceReq(), jsonObject); } @@ -177,6 +187,9 @@ export class GetSpotIndexPriceReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSpotIndexPriceReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts index 24684cea..9e31bc65 100644 --- a/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_spot_index_price_resp.ts @@ -17,6 +17,9 @@ export class GetSpotIndexPriceResp implements Response { */ hasMore: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.dataList = null; @@ -33,14 +36,21 @@ export class GetSpotIndexPriceResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSpotIndexPriceResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSpotIndexPriceResp { return plainToClassFromExist(new GetSpotIndexPriceResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_req.ts b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts index d286e70c..ccf0b6ba 100644 --- a/sdk/node/src/generate/futures/market/model_get_symbol_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_symbol_req.ts @@ -11,6 +11,9 @@ export class GetSymbolReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSymbolReq` class. @@ -34,14 +37,21 @@ export class GetSymbolReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolReq { return plainToClassFromExist(new GetSymbolReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetSymbolReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSymbolReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts index de3a70db..d410fe4d 100644 --- a/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_symbol_resp.ts @@ -315,6 +315,9 @@ export class GetSymbolResp implements Response { */ supportCross: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -451,14 +454,21 @@ export class GetSymbolResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolResp { return plainToClassFromExist(new GetSymbolResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts index 1fe51c4a..d843e52e 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_req.ts @@ -9,6 +9,9 @@ export class GetTickerReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTickerReq` class. @@ -32,14 +35,21 @@ export class GetTickerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTickerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTickerReq { return plainToClassFromExist(new GetTickerReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetTickerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTickerReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts index 0e22994f..51930708 100644 --- a/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_ticker_resp.ts @@ -60,6 +60,9 @@ export class GetTickerResp implements Response { */ ts: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -94,14 +97,21 @@ export class GetTickerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTickerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTickerResp { return plainToClassFromExist(new GetTickerResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts index ad395591..f829ea31 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_data.ts @@ -49,6 +49,9 @@ export class GetTradeHistoryData implements Serializable { */ side: GetTradeHistoryData.SideEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -69,14 +72,21 @@ export class GetTradeHistoryData implements Serializable { // @ts-ignore this.side = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryData { return plainToClassFromExist(new GetTradeHistoryData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts index 42b16dad..250b25b2 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_req.ts @@ -9,6 +9,9 @@ export class GetTradeHistoryReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. @@ -32,14 +35,21 @@ export class GetTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryReq { return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts index 198f4e8e..ea363a7d 100644 --- a/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/market/model_get_trade_history_resp.ts @@ -12,6 +12,9 @@ export class GetTradeHistoryResp implements Response { @Type(() => GetTradeHistoryData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryResp { return plainToClassFromExist(new GetTradeHistoryResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/order/model_add_order_req.ts b/sdk/node/src/generate/futures/order/model_add_order_req.ts index 3f2890f0..a2f08766 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_req.ts @@ -119,6 +119,9 @@ export class AddOrderReq implements Serializable { */ valueQty?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -297,14 +300,21 @@ export class AddOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderReq { return plainToClassFromExist(new AddOrderReq(), jsonObject); } @@ -579,6 +589,9 @@ export class AddOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_add_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_resp.ts index 7545d9d8..f05bffb9 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_resp.ts @@ -15,6 +15,9 @@ export class AddOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderResp { return plainToClassFromExist(new AddOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts index ea2fafac..83fb99ca 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_req.ts @@ -120,6 +120,9 @@ export class AddOrderTestReq implements Serializable { */ valueQty?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -300,14 +303,21 @@ export class AddOrderTestReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestReq { return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } @@ -582,6 +592,9 @@ export class AddOrderTestReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts index 20e19e9d..a1aa0a09 100644 --- a/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_order_test_resp.ts @@ -15,6 +15,9 @@ export class AddOrderTestResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderTestResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestResp { return plainToClassFromExist(new AddOrderTestResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts index 35b5cb56..04e4ba63 100644 --- a/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_req.ts @@ -120,6 +120,9 @@ export class AddTPSLOrderReq implements Serializable { */ valueQty?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -300,14 +303,21 @@ export class AddTPSLOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddTPSLOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddTPSLOrderReq { return plainToClassFromExist(new AddTPSLOrderReq(), jsonObject); } @@ -572,6 +582,9 @@ export class AddTPSLOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddTPSLOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts index 8e2bc803..84ea3778 100644 --- a/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts +++ b/sdk/node/src/generate/futures/order/model_add_tpsl_order_resp.ts @@ -15,6 +15,9 @@ export class AddTPSLOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddTPSLOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddTPSLOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddTPSLOrderResp { return plainToClassFromExist(new AddTPSLOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts index 80c687eb..969281c2 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_data.ts @@ -29,6 +29,9 @@ export class BatchAddOrdersData implements Serializable { */ msg: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -41,14 +44,21 @@ export class BatchAddOrdersData implements Serializable { // @ts-ignore this.msg = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersData { return plainToClassFromExist(new BatchAddOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts index deacf2ce..7c42e479 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_item.ts @@ -120,6 +120,9 @@ export class BatchAddOrdersItem implements Serializable { */ valueQty?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -300,14 +303,21 @@ export class BatchAddOrdersItem implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersItem { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersItem { return plainToClassFromExist(new BatchAddOrdersItem(), jsonObject); } @@ -582,6 +592,9 @@ export class BatchAddOrdersItemBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersItem { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts index 9d3f9ca5..b7f4b188 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_req.ts @@ -11,6 +11,9 @@ export class BatchAddOrdersReq implements Serializable { @Type(() => BatchAddOrdersItem) items?: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `BatchAddOrdersReq` class. @@ -34,14 +37,21 @@ export class BatchAddOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.items)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersReq { return plainToClassFromExist(new BatchAddOrdersReq(), { items: jsonObject }); } @@ -59,6 +69,9 @@ export class BatchAddOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts index 41e0771d..8b00afe3 100644 --- a/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_add_orders_resp.ts @@ -12,6 +12,9 @@ export class BatchAddOrdersResp implements Response { @Type(() => BatchAddOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class BatchAddOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersResp { return plainToClassFromExist(new BatchAddOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts index 37a7bf9f..cd05d25e 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_client_oids_list.ts @@ -14,6 +14,9 @@ export class BatchCancelOrdersClientOidsList implements Serializable { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class BatchCancelOrdersClientOidsList implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrdersClientOidsList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrdersClientOidsList { return plainToClassFromExist(new BatchCancelOrdersClientOidsList(), jsonObject); } @@ -80,6 +90,9 @@ export class BatchCancelOrdersClientOidsListBuilder { return this; } + /** + * Get the final object. + */ build(): BatchCancelOrdersClientOidsList { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts index 149d68f6..599bb763 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_data.ts @@ -24,6 +24,9 @@ export class BatchCancelOrdersData implements Serializable { */ msg: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -34,14 +37,21 @@ export class BatchCancelOrdersData implements Serializable { // @ts-ignore this.msg = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrdersData { return plainToClassFromExist(new BatchCancelOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts index e83bb418..eff20165 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_req.ts @@ -16,6 +16,9 @@ export class BatchCancelOrdersReq implements Serializable { @Type(() => BatchCancelOrdersClientOidsList) clientOidsList: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderIdsList = null; @@ -49,14 +52,21 @@ export class BatchCancelOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrdersReq { return plainToClassFromExist(new BatchCancelOrdersReq(), jsonObject); } @@ -82,6 +92,9 @@ export class BatchCancelOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchCancelOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts index 00c0f17a..0fe87c28 100644 --- a/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_batch_cancel_orders_resp.ts @@ -12,6 +12,9 @@ export class BatchCancelOrdersResp implements Response { @Type(() => BatchCancelOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class BatchCancelOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrdersResp { return plainToClassFromExist(new BatchCancelOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts index 281b4e39..3e9c9e1d 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_req.ts @@ -9,6 +9,9 @@ export class CancelAllOrdersV1Req implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelAllOrdersV1Req` class. @@ -32,14 +35,21 @@ export class CancelAllOrdersV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersV1Req { return plainToClassFromExist(new CancelAllOrdersV1Req(), jsonObject); } @@ -57,6 +67,9 @@ export class CancelAllOrdersV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelAllOrdersV1Req { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts index 691fba98..feea49fd 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v1_resp.ts @@ -10,6 +10,9 @@ export class CancelAllOrdersV1Resp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelAllOrdersV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersV1Resp { return plainToClassFromExist(new CancelAllOrdersV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts index 735f3f6d..caefa74d 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_req.ts @@ -9,6 +9,9 @@ export class CancelAllOrdersV3Req implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelAllOrdersV3Req` class. @@ -32,14 +35,21 @@ export class CancelAllOrdersV3Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersV3Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersV3Req { return plainToClassFromExist(new CancelAllOrdersV3Req(), jsonObject); } @@ -57,6 +67,9 @@ export class CancelAllOrdersV3ReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelAllOrdersV3Req { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts index 77794e7c..794c5ce2 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_orders_v3_resp.ts @@ -10,6 +10,9 @@ export class CancelAllOrdersV3Resp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelAllOrdersV3Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersV3Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersV3Resp { return plainToClassFromExist(new CancelAllOrdersV3Resp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts index bbdee0e7..5f00e922 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_req.ts @@ -9,6 +9,9 @@ export class CancelAllStopOrdersReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelAllStopOrdersReq` class. @@ -32,14 +35,21 @@ export class CancelAllStopOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllStopOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllStopOrdersReq { return plainToClassFromExist(new CancelAllStopOrdersReq(), jsonObject); } @@ -57,6 +67,9 @@ export class CancelAllStopOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelAllStopOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts index a5e8b839..f3c288a3 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_all_stop_orders_resp.ts @@ -10,6 +10,9 @@ export class CancelAllStopOrdersResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelAllStopOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllStopOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllStopOrdersResp { return plainToClassFromExist(new CancelAllStopOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts index e7f6b17a..8f589c64 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByClientOidReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidReq { return plainToClassFromExist(new CancelOrderByClientOidReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts index 629a3822..2dac7a46 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_client_oid_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByClientOidResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -24,14 +27,21 @@ export class CancelOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidResp { return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts index f42a9ec1..1305ef83 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_req.ts @@ -11,6 +11,9 @@ export class CancelOrderByIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByIdReq` class. @@ -34,14 +37,21 @@ export class CancelOrderByIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByIdReq { return plainToClassFromExist(new CancelOrderByIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class CancelOrderByIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByIdReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts index e95ecbcc..a2515c8f 100644 --- a/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_cancel_order_by_id_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByIdResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelOrderByIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByIdResp { return plainToClassFromExist(new CancelOrderByIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts index 8dc5143d..38bd410d 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_req.ts @@ -9,6 +9,9 @@ export class GetOpenOrderValueReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOpenOrderValueReq` class. @@ -32,14 +35,21 @@ export class GetOpenOrderValueReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrderValueReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrderValueReq { return plainToClassFromExist(new GetOpenOrderValueReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetOpenOrderValueReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOpenOrderValueReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts index cf856bf3..b14d265b 100644 --- a/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_open_order_value_resp.ts @@ -30,6 +30,9 @@ export class GetOpenOrderValueResp implements Response { */ settleCurrency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.openOrderBuySize = null; @@ -52,14 +55,21 @@ export class GetOpenOrderValueResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrderValueResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrderValueResp { return plainToClassFromExist(new GetOpenOrderValueResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts index ad74bd9f..cd05ed55 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_req.ts @@ -9,6 +9,9 @@ export class GetOrderByClientOidReq implements Serializable { */ clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. @@ -32,14 +35,21 @@ export class GetOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidReq { return plainToClassFromExist(new GetOrderByClientOidReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts index 1271dc57..079b1055 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_client_oid_resp.ts @@ -195,6 +195,9 @@ export class GetOrderByClientOidResp implements Response { */ reduceOnly: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -283,14 +286,21 @@ export class GetOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidResp { return plainToClassFromExist(new GetOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts index 4a077d56..6034de6d 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_req.ts @@ -12,6 +12,9 @@ export class GetOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'order-id') order_id?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. @@ -35,14 +38,21 @@ export class GetOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdReq { return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } @@ -60,6 +70,9 @@ export class GetOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts index 3857e7b3..5e5505dc 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_by_order_id_resp.ts @@ -195,6 +195,9 @@ export class GetOrderByOrderIdResp implements Response { */ reduceOnly: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -281,14 +284,21 @@ export class GetOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdResp { return plainToClassFromExist(new GetOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts index 8f2473e9..83c0078d 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_items.ts @@ -194,6 +194,9 @@ export class GetOrderListItems implements Serializable { */ reduceOnly: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -272,14 +275,21 @@ export class GetOrderListItems implements Serializable { // @ts-ignore this.reduceOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderListItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderListItems { return plainToClassFromExist(new GetOrderListItems(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts index 0ced54d9..6ea9125c 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_req.ts @@ -44,6 +44,9 @@ export class GetOrderListReq implements Serializable { */ pageSize?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderListReq` class. @@ -102,14 +105,21 @@ export class GetOrderListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderListReq { return plainToClassFromExist(new GetOrderListReq(), jsonObject); } @@ -216,6 +226,9 @@ export class GetOrderListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderListReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts index 382eb1a7..2d8dc3d0 100644 --- a/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_order_list_resp.ts @@ -32,6 +32,9 @@ export class GetOrderListResp implements Response { @Type(() => GetOrderListItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetOrderListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderListResp { return plainToClassFromExist(new GetOrderListResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts index d3ed9725..bf885ece 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_data.ts @@ -194,6 +194,9 @@ export class GetRecentClosedOrdersData implements Serializable { */ reduceOnly: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -272,14 +275,21 @@ export class GetRecentClosedOrdersData implements Serializable { // @ts-ignore this.reduceOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentClosedOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentClosedOrdersData { return plainToClassFromExist(new GetRecentClosedOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts index dbd681ec..d17a98c5 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_req.ts @@ -9,6 +9,9 @@ export class GetRecentClosedOrdersReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRecentClosedOrdersReq` class. @@ -32,14 +35,21 @@ export class GetRecentClosedOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentClosedOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentClosedOrdersReq { return plainToClassFromExist(new GetRecentClosedOrdersReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetRecentClosedOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRecentClosedOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts index 82bfda3e..92436d59 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_closed_orders_resp.ts @@ -12,6 +12,9 @@ export class GetRecentClosedOrdersResp implements Response { @Type(() => GetRecentClosedOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetRecentClosedOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentClosedOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentClosedOrdersResp { return plainToClassFromExist(new GetRecentClosedOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts index 6b057fc3..2ac2880e 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_data.ts @@ -124,6 +124,9 @@ export class GetRecentTradeHistoryData implements Serializable { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -174,14 +177,21 @@ export class GetRecentTradeHistoryData implements Serializable { // @ts-ignore this.createdAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryData { return plainToClassFromExist(new GetRecentTradeHistoryData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts index 4a4f4b3f..25f1a815 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_req.ts @@ -9,6 +9,9 @@ export class GetRecentTradeHistoryReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRecentTradeHistoryReq` class. @@ -32,14 +35,21 @@ export class GetRecentTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryReq { return plainToClassFromExist(new GetRecentTradeHistoryReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetRecentTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRecentTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts index 90f7e49b..3ba08e05 100644 --- a/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_recent_trade_history_resp.ts @@ -12,6 +12,9 @@ export class GetRecentTradeHistoryResp implements Response { @Type(() => GetRecentTradeHistoryData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetRecentTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryResp { return plainToClassFromExist(new GetRecentTradeHistoryResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts index 65dba6dd..5cc218d6 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_items.ts @@ -194,6 +194,9 @@ export class GetStopOrderListItems implements Serializable { */ reduceOnly: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -272,14 +275,21 @@ export class GetStopOrderListItems implements Serializable { // @ts-ignore this.reduceOnly = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderListItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderListItems { return plainToClassFromExist(new GetStopOrderListItems(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts index 66c9e049..96177eac 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_req.ts @@ -39,6 +39,9 @@ export class GetStopOrderListReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetStopOrderListReq` class. @@ -96,14 +99,21 @@ export class GetStopOrderListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderListReq { return plainToClassFromExist(new GetStopOrderListReq(), jsonObject); } @@ -192,6 +202,9 @@ export class GetStopOrderListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetStopOrderListReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts index e311d170..0431aee0 100644 --- a/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_stop_order_list_resp.ts @@ -32,6 +32,9 @@ export class GetStopOrderListResp implements Response { @Type(() => GetStopOrderListItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetStopOrderListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderListResp { return plainToClassFromExist(new GetStopOrderListResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts index 7912dbeb..9661c5f3 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_items.ts @@ -124,6 +124,9 @@ export class GetTradeHistoryItems implements Serializable { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -174,14 +177,21 @@ export class GetTradeHistoryItems implements Serializable { // @ts-ignore this.createdAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryItems { return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts index 1a36cf65..c63abadb 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_req.ts @@ -49,6 +49,9 @@ export class GetTradeHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. @@ -120,14 +123,21 @@ export class GetTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryReq { return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } @@ -240,6 +250,9 @@ export class GetTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts index 9855d59c..fed02956 100644 --- a/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/futures/order/model_get_trade_history_resp.ts @@ -32,6 +32,9 @@ export class GetTradeHistoryResp implements Response { @Type(() => GetTradeHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryResp { return plainToClassFromExist(new GetTradeHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts index d4d5e9a7..4f14b274 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_req.ts @@ -19,6 +19,9 @@ export class AddIsolatedMarginReq implements Serializable { */ bizNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -59,14 +62,21 @@ export class AddIsolatedMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddIsolatedMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddIsolatedMarginReq { return plainToClassFromExist(new AddIsolatedMarginReq(), jsonObject); } @@ -100,6 +110,9 @@ export class AddIsolatedMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddIsolatedMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts index 47b33e01..29ffd9ab 100644 --- a/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_add_isolated_margin_resp.ts @@ -190,6 +190,9 @@ export class AddIsolatedMarginResp implements Response { */ settleCurrency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -276,14 +279,21 @@ export class AddIsolatedMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddIsolatedMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddIsolatedMarginResp { return plainToClassFromExist(new AddIsolatedMarginResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts index b9cf6042..15362d8e 100644 --- a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_req.ts @@ -9,6 +9,9 @@ export class GetCrossMarginLeverageReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetCrossMarginLeverageReq` class. @@ -32,14 +35,21 @@ export class GetCrossMarginLeverageReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginLeverageReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginLeverageReq { return plainToClassFromExist(new GetCrossMarginLeverageReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetCrossMarginLeverageReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetCrossMarginLeverageReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts index 83e8f5cc..daea04ea 100644 --- a/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_cross_margin_leverage_resp.ts @@ -15,6 +15,9 @@ export class GetCrossMarginLeverageResp implements Response { */ leverage: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -31,14 +34,21 @@ export class GetCrossMarginLeverageResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginLeverageResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginLeverageResp { return plainToClassFromExist(new GetCrossMarginLeverageResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts index 96dbc79d..3b3ed494 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_data.ts @@ -39,6 +39,9 @@ export class GetIsolatedMarginRiskLimitData implements Serializable { */ maintainMargin: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -55,14 +58,21 @@ export class GetIsolatedMarginRiskLimitData implements Serializable { // @ts-ignore this.maintainMargin = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginRiskLimitData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitData { return plainToClassFromExist(new GetIsolatedMarginRiskLimitData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts index c5ab05d4..f2f5568e 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_req.ts @@ -11,6 +11,9 @@ export class GetIsolatedMarginRiskLimitReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetIsolatedMarginRiskLimitReq` class. @@ -34,14 +37,21 @@ export class GetIsolatedMarginRiskLimitReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginRiskLimitReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitReq { return plainToClassFromExist(new GetIsolatedMarginRiskLimitReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetIsolatedMarginRiskLimitReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetIsolatedMarginRiskLimitReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts index 8098bac6..cd1d968a 100644 --- a/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_isolated_margin_risk_limit_resp.ts @@ -12,6 +12,9 @@ export class GetIsolatedMarginRiskLimitResp implements Response { @Type(() => GetIsolatedMarginRiskLimitData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetIsolatedMarginRiskLimitResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginRiskLimitResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginRiskLimitResp { return plainToClassFromExist(new GetIsolatedMarginRiskLimitResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts index 662b341a..b69d2359 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_req.ts @@ -9,6 +9,9 @@ export class GetMarginModeReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMarginModeReq` class. @@ -32,14 +35,21 @@ export class GetMarginModeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginModeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginModeReq { return plainToClassFromExist(new GetMarginModeReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetMarginModeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMarginModeReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts index d327cb41..95353ddd 100644 --- a/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_margin_mode_resp.ts @@ -15,6 +15,9 @@ export class GetMarginModeResp implements Response { */ marginMode: GetMarginModeResp.MarginModeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -31,14 +34,21 @@ export class GetMarginModeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginModeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginModeResp { return plainToClassFromExist(new GetMarginModeResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts index f171e8e2..79388690 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_req.ts @@ -19,6 +19,9 @@ export class GetMaxOpenSizeReq implements Serializable { */ leverage?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMaxOpenSizeReq` class. @@ -52,14 +55,21 @@ export class GetMaxOpenSizeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxOpenSizeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxOpenSizeReq { return plainToClassFromExist(new GetMaxOpenSizeReq(), jsonObject); } @@ -93,6 +103,9 @@ export class GetMaxOpenSizeReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMaxOpenSizeReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts index 1c971ce6..f89bf71c 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_open_size_resp.ts @@ -20,6 +20,9 @@ export class GetMaxOpenSizeResp implements Response { */ maxSellOpenSize: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -38,14 +41,21 @@ export class GetMaxOpenSizeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxOpenSizeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxOpenSizeResp { return plainToClassFromExist(new GetMaxOpenSizeResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts index c542fcc3..75b441f1 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_req.ts @@ -9,6 +9,9 @@ export class GetMaxWithdrawMarginReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMaxWithdrawMarginReq` class. @@ -32,14 +35,21 @@ export class GetMaxWithdrawMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxWithdrawMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxWithdrawMarginReq { return plainToClassFromExist(new GetMaxWithdrawMarginReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetMaxWithdrawMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMaxWithdrawMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts index 481f7032..bf3188d4 100644 --- a/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_max_withdraw_margin_resp.ts @@ -10,6 +10,9 @@ export class GetMaxWithdrawMarginResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetMaxWithdrawMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMaxWithdrawMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMaxWithdrawMarginResp { return plainToClassFromExist(new GetMaxWithdrawMarginResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts index c34eea76..9d972c40 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_req.ts @@ -9,6 +9,9 @@ export class GetPositionDetailsReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPositionDetailsReq` class. @@ -32,14 +35,21 @@ export class GetPositionDetailsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionDetailsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionDetailsReq { return plainToClassFromExist(new GetPositionDetailsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetPositionDetailsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPositionDetailsReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts index 6c2a8211..8882137c 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_details_resp.ts @@ -225,6 +225,9 @@ export class GetPositionDetailsResp implements Response { */ maintainMargin?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -299,14 +302,21 @@ export class GetPositionDetailsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionDetailsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionDetailsResp { return plainToClassFromExist(new GetPositionDetailsResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts index e2117b75..2efc32db 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_data.ts @@ -224,6 +224,9 @@ export class GetPositionListData implements Serializable { */ maintainMargin?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -288,14 +291,21 @@ export class GetPositionListData implements Serializable { // @ts-ignore this.leverage = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionListData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionListData { return plainToClassFromExist(new GetPositionListData(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts index 03913f7d..fc5f142d 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_req.ts @@ -9,6 +9,9 @@ export class GetPositionListReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPositionListReq` class. @@ -32,14 +35,21 @@ export class GetPositionListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionListReq { return plainToClassFromExist(new GetPositionListReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetPositionListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPositionListReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts index 7febffa9..ddd8b4e4 100644 --- a/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_position_list_resp.ts @@ -12,6 +12,9 @@ export class GetPositionListResp implements Response { @Type(() => GetPositionListData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetPositionListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionListResp { return plainToClassFromExist(new GetPositionListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts index 9ac0eacc..f15a47ec 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_items.ts @@ -84,6 +84,9 @@ export class GetPositionsHistoryItems implements Serializable { */ marginMode: GetPositionsHistoryItems.MarginModeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.closeId = null; @@ -118,14 +121,21 @@ export class GetPositionsHistoryItems implements Serializable { // @ts-ignore this.marginMode = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionsHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionsHistoryItems { return plainToClassFromExist(new GetPositionsHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts index 3565f409..c5d7200a 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_req.ts @@ -29,6 +29,9 @@ export class GetPositionsHistoryReq implements Serializable { */ pageId?: number = 1; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPositionsHistoryReq` class. @@ -80,14 +83,21 @@ export class GetPositionsHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionsHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionsHistoryReq { return plainToClassFromExist(new GetPositionsHistoryReq(), jsonObject); } @@ -137,6 +147,9 @@ export class GetPositionsHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPositionsHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts index f8ab0cbf..764aebed 100644 --- a/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_get_positions_history_resp.ts @@ -32,6 +32,9 @@ export class GetPositionsHistoryResp implements Response { @Type(() => GetPositionsHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetPositionsHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPositionsHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPositionsHistoryResp { return plainToClassFromExist(new GetPositionsHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts index 98097bd7..35b8ae85 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_req.ts @@ -14,6 +14,9 @@ export class ModifyAutoDepositStatusReq implements Serializable { */ status: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class ModifyAutoDepositStatusReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyAutoDepositStatusReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyAutoDepositStatusReq { return plainToClassFromExist(new ModifyAutoDepositStatusReq(), jsonObject); } @@ -80,6 +90,9 @@ export class ModifyAutoDepositStatusReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyAutoDepositStatusReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts index e85f2b16..8c1b05a3 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_auto_deposit_status_resp.ts @@ -10,6 +10,9 @@ export class ModifyAutoDepositStatusResp implements Response { */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyAutoDepositStatusResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyAutoDepositStatusResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyAutoDepositStatusResp { return plainToClassFromExist(new ModifyAutoDepositStatusResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts index 32341c24..e790a40d 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_req.ts @@ -14,6 +14,9 @@ export class ModifyIsolatedMarginRiskLimtReq implements Serializable { */ level: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class ModifyIsolatedMarginRiskLimtReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyIsolatedMarginRiskLimtReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtReq { return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtReq(), jsonObject); } @@ -80,6 +90,9 @@ export class ModifyIsolatedMarginRiskLimtReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyIsolatedMarginRiskLimtReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts index 39f9b626..8c4b0edf 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_isolated_margin_risk_limt_resp.ts @@ -10,6 +10,9 @@ export class ModifyIsolatedMarginRiskLimtResp implements Response */ data: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyIsolatedMarginRiskLimtResp implements Response this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyIsolatedMarginRiskLimtResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyIsolatedMarginRiskLimtResp { return plainToClassFromExist(new ModifyIsolatedMarginRiskLimtResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts index a21c30ae..14c84f51 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_req.ts @@ -14,6 +14,9 @@ export class ModifyMarginLeverageReq implements Serializable { */ leverage: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class ModifyMarginLeverageReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyMarginLeverageReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyMarginLeverageReq { return plainToClassFromExist(new ModifyMarginLeverageReq(), jsonObject); } @@ -80,6 +90,9 @@ export class ModifyMarginLeverageReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyMarginLeverageReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts index 509ff370..0ca7db46 100644 --- a/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_modify_margin_leverage_resp.ts @@ -15,6 +15,9 @@ export class ModifyMarginLeverageResp implements Response { */ leverage: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -31,14 +34,21 @@ export class ModifyMarginLeverageResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyMarginLeverageResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyMarginLeverageResp { return plainToClassFromExist(new ModifyMarginLeverageResp(), jsonObject); } diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts index a5b97a54..bec03120 100644 --- a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_req.ts @@ -14,6 +14,9 @@ export class RemoveIsolatedMarginReq implements Serializable { */ withdrawAmount: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class RemoveIsolatedMarginReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RemoveIsolatedMarginReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RemoveIsolatedMarginReq { return plainToClassFromExist(new RemoveIsolatedMarginReq(), jsonObject); } @@ -80,6 +90,9 @@ export class RemoveIsolatedMarginReqBuilder { return this; } + /** + * Get the final object. + */ build(): RemoveIsolatedMarginReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts index 03cfb0ce..4c8b0424 100644 --- a/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_remove_isolated_margin_resp.ts @@ -10,6 +10,9 @@ export class RemoveIsolatedMarginResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class RemoveIsolatedMarginResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RemoveIsolatedMarginResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RemoveIsolatedMarginResp { return plainToClassFromExist(new RemoveIsolatedMarginResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts index 33c3fd90..865d4b4e 100644 --- a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_req.ts @@ -14,6 +14,9 @@ export class SwitchMarginModeReq implements Serializable { */ marginMode: SwitchMarginModeReq.MarginModeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class SwitchMarginModeReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SwitchMarginModeReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SwitchMarginModeReq { return plainToClassFromExist(new SwitchMarginModeReq(), jsonObject); } @@ -93,6 +103,9 @@ export class SwitchMarginModeReqBuilder { return this; } + /** + * Get the final object. + */ build(): SwitchMarginModeReq { return this.obj; } diff --git a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts index 7bdcb513..881b1444 100644 --- a/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts +++ b/sdk/node/src/generate/futures/positions/model_switch_margin_mode_resp.ts @@ -15,6 +15,9 @@ export class SwitchMarginModeResp implements Response { */ marginMode: SwitchMarginModeResp.MarginModeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -31,14 +34,21 @@ export class SwitchMarginModeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SwitchMarginModeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SwitchMarginModeResp { return plainToClassFromExist(new SwitchMarginModeResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts index a6d2fcd3..df5b55de 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_data.ts @@ -59,15 +59,25 @@ export class GetLoanMarketData implements Serializable { */ autoPurchaseEnable?: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketData { return plainToClassFromExist(new GetLoanMarketData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts index 5ac017f4..87339ebd 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_data.ts @@ -14,20 +14,30 @@ export class GetLoanMarketInterestRateData implements Serializable { */ marketInterestRate: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; // @ts-ignore this.marketInterestRate = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketInterestRateData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketInterestRateData { return plainToClassFromExist(new GetLoanMarketInterestRateData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts index 526ce6d9..a627fd48 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_req.ts @@ -9,6 +9,9 @@ export class GetLoanMarketInterestRateReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetLoanMarketInterestRateReq` class. @@ -32,14 +35,21 @@ export class GetLoanMarketInterestRateReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketInterestRateReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketInterestRateReq { return plainToClassFromExist(new GetLoanMarketInterestRateReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetLoanMarketInterestRateReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetLoanMarketInterestRateReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts index 81cbe50f..4fe74e14 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_interest_rate_resp.ts @@ -12,6 +12,9 @@ export class GetLoanMarketInterestRateResp implements Response { @Type(() => GetLoanMarketInterestRateData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetLoanMarketInterestRateResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketInterestRateResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketInterestRateResp { return plainToClassFromExist(new GetLoanMarketInterestRateResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts index be74e891..ff508c5c 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_req.ts @@ -9,6 +9,9 @@ export class GetLoanMarketReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetLoanMarketReq` class. @@ -32,14 +35,21 @@ export class GetLoanMarketReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketReq { return plainToClassFromExist(new GetLoanMarketReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetLoanMarketReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetLoanMarketReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts index f33b8c0b..0f927eb8 100644 --- a/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_loan_market_resp.ts @@ -12,6 +12,9 @@ export class GetLoanMarketResp implements Response { @Type(() => GetLoanMarketData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetLoanMarketResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetLoanMarketResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetLoanMarketResp { return plainToClassFromExist(new GetLoanMarketResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts index 61f1c9b9..87c563d5 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_items.ts @@ -44,6 +44,9 @@ export class GetPurchaseOrdersItems implements Serializable { */ status: GetPurchaseOrdersItems.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -62,14 +65,21 @@ export class GetPurchaseOrdersItems implements Serializable { // @ts-ignore this.status = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPurchaseOrdersItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPurchaseOrdersItems { return plainToClassFromExist(new GetPurchaseOrdersItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts index 95bab12d..7a4f0614 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_req.ts @@ -29,6 +29,9 @@ export class GetPurchaseOrdersReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPurchaseOrdersReq` class. @@ -80,14 +83,21 @@ export class GetPurchaseOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPurchaseOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPurchaseOrdersReq { return plainToClassFromExist(new GetPurchaseOrdersReq(), jsonObject); } @@ -150,6 +160,9 @@ export class GetPurchaseOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPurchaseOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts index e907f8b4..5af6b1f3 100644 --- a/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_purchase_orders_resp.ts @@ -32,6 +32,9 @@ export class GetPurchaseOrdersResp implements Response { @Type(() => GetPurchaseOrdersItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetPurchaseOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPurchaseOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPurchaseOrdersResp { return plainToClassFromExist(new GetPurchaseOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts index 2ca4895d..519e40cb 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_items.ts @@ -39,6 +39,9 @@ export class GetRedeemOrdersItems implements Serializable { */ status: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -55,14 +58,21 @@ export class GetRedeemOrdersItems implements Serializable { // @ts-ignore this.status = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRedeemOrdersItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRedeemOrdersItems { return plainToClassFromExist(new GetRedeemOrdersItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts index 6e0e164c..0b7e5e7e 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_req.ts @@ -29,6 +29,9 @@ export class GetRedeemOrdersReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRedeemOrdersReq` class. @@ -80,14 +83,21 @@ export class GetRedeemOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRedeemOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRedeemOrdersReq { return plainToClassFromExist(new GetRedeemOrdersReq(), jsonObject); } @@ -150,6 +160,9 @@ export class GetRedeemOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRedeemOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts index 49838130..324b44f9 100644 --- a/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_get_redeem_orders_resp.ts @@ -32,6 +32,9 @@ export class GetRedeemOrdersResp implements Response { @Type(() => GetRedeemOrdersItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetRedeemOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRedeemOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRedeemOrdersResp { return plainToClassFromExist(new GetRedeemOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts index 2bf7aafc..f2ecc19d 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_req.ts @@ -19,6 +19,9 @@ export class ModifyPurchaseReq implements Serializable { */ purchaseOrderNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -59,14 +62,21 @@ export class ModifyPurchaseReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyPurchaseReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyPurchaseReq { return plainToClassFromExist(new ModifyPurchaseReq(), jsonObject); } @@ -100,6 +110,9 @@ export class ModifyPurchaseReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyPurchaseReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts index c01927a5..168e16d7 100644 --- a/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_modify_purchase_resp.ts @@ -10,6 +10,9 @@ export class ModifyPurchaseResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyPurchaseResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyPurchaseResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyPurchaseResp { return plainToClassFromExist(new ModifyPurchaseResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/credit/model_purchase_req.ts b/sdk/node/src/generate/margin/credit/model_purchase_req.ts index df024a7d..33887b77 100644 --- a/sdk/node/src/generate/margin/credit/model_purchase_req.ts +++ b/sdk/node/src/generate/margin/credit/model_purchase_req.ts @@ -19,6 +19,9 @@ export class PurchaseReq implements Serializable { */ interestRate: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -59,14 +62,21 @@ export class PurchaseReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): PurchaseReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): PurchaseReq { return plainToClassFromExist(new PurchaseReq(), jsonObject); } @@ -100,6 +110,9 @@ export class PurchaseReqBuilder { return this; } + /** + * Get the final object. + */ build(): PurchaseReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts index 3cfb25b9..8661afa2 100644 --- a/sdk/node/src/generate/margin/credit/model_purchase_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_purchase_resp.ts @@ -10,6 +10,9 @@ export class PurchaseResp implements Response { */ orderNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderNo = null; @@ -24,14 +27,21 @@ export class PurchaseResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): PurchaseResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): PurchaseResp { return plainToClassFromExist(new PurchaseResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/credit/model_redeem_req.ts b/sdk/node/src/generate/margin/credit/model_redeem_req.ts index 245a645c..adb6d22d 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_req.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_req.ts @@ -19,6 +19,9 @@ export class RedeemReq implements Serializable { */ purchaseOrderNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -59,14 +62,21 @@ export class RedeemReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RedeemReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RedeemReq { return plainToClassFromExist(new RedeemReq(), jsonObject); } @@ -100,6 +110,9 @@ export class RedeemReqBuilder { return this; } + /** + * Get the final object. + */ build(): RedeemReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts index b7045efa..be407a3a 100644 --- a/sdk/node/src/generate/margin/credit/model_redeem_resp.ts +++ b/sdk/node/src/generate/margin/credit/model_redeem_resp.ts @@ -10,6 +10,9 @@ export class RedeemResp implements Response { */ orderNo: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderNo = null; @@ -24,14 +27,21 @@ export class RedeemResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RedeemResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RedeemResp { return plainToClassFromExist(new RedeemResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_borrow_req.ts b/sdk/node/src/generate/margin/debit/model_borrow_req.ts index f69a2d83..9aa5365b 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_req.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_req.ts @@ -34,6 +34,9 @@ export class BorrowReq implements Serializable { */ isHf?: boolean = false; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -97,14 +100,21 @@ export class BorrowReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BorrowReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BorrowReq { return plainToClassFromExist(new BorrowReq(), jsonObject); } @@ -175,6 +185,9 @@ export class BorrowReqBuilder { return this; } + /** + * Get the final object. + */ build(): BorrowReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts index 266fbf79..f8866e8e 100644 --- a/sdk/node/src/generate/margin/debit/model_borrow_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_borrow_resp.ts @@ -15,6 +15,9 @@ export class BorrowResp implements Response { */ actualSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderNo = null; @@ -31,14 +34,21 @@ export class BorrowResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BorrowResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BorrowResp { return plainToClassFromExist(new BorrowResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts index f33dc0cb..9ccd66ae 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_items.ts @@ -39,6 +39,9 @@ export class GetBorrowHistoryItems implements Serializable { */ createdTime: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderNo = null; @@ -55,14 +58,21 @@ export class GetBorrowHistoryItems implements Serializable { // @ts-ignore this.createdTime = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBorrowHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBorrowHistoryItems { return plainToClassFromExist(new GetBorrowHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts index d96fd816..06e9ede9 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_req.ts @@ -44,6 +44,9 @@ export class GetBorrowHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetBorrowHistoryReq` class. @@ -114,14 +117,21 @@ export class GetBorrowHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBorrowHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBorrowHistoryReq { return plainToClassFromExist(new GetBorrowHistoryReq(), jsonObject); } @@ -195,6 +205,9 @@ export class GetBorrowHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetBorrowHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts index fef3a9c0..52655aa5 100644 --- a/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_borrow_history_resp.ts @@ -37,6 +37,9 @@ export class GetBorrowHistoryResp implements Response { @Type(() => GetBorrowHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timestamp = null; @@ -61,14 +64,21 @@ export class GetBorrowHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetBorrowHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetBorrowHistoryResp { return plainToClassFromExist(new GetBorrowHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts index 06f92ee2..08e6d7b6 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_items.ts @@ -24,6 +24,9 @@ export class GetInterestHistoryItems implements Serializable { */ createdTime: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -34,14 +37,21 @@ export class GetInterestHistoryItems implements Serializable { // @ts-ignore this.createdTime = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestHistoryItems { return plainToClassFromExist(new GetInterestHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts index 950a0609..eb5a0171 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_req.ts @@ -39,6 +39,9 @@ export class GetInterestHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetInterestHistoryReq` class. @@ -104,14 +107,21 @@ export class GetInterestHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestHistoryReq { return plainToClassFromExist(new GetInterestHistoryReq(), jsonObject); } @@ -177,6 +187,9 @@ export class GetInterestHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetInterestHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts index 777860d5..728f82bb 100644 --- a/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_interest_history_resp.ts @@ -37,6 +37,9 @@ export class GetInterestHistoryResp implements Response { @Type(() => GetInterestHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timestamp = null; @@ -61,14 +64,21 @@ export class GetInterestHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetInterestHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetInterestHistoryResp { return plainToClassFromExist(new GetInterestHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts index 90749641..c06a35c7 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_items.ts @@ -44,6 +44,9 @@ export class GetRepayHistoryItems implements Serializable { */ createdTime: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderNo = null; @@ -62,14 +65,21 @@ export class GetRepayHistoryItems implements Serializable { // @ts-ignore this.createdTime = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRepayHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRepayHistoryItems { return plainToClassFromExist(new GetRepayHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts index ca2992fd..8b640c30 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_req.ts @@ -44,6 +44,9 @@ export class GetRepayHistoryReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRepayHistoryReq` class. @@ -114,14 +117,21 @@ export class GetRepayHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRepayHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRepayHistoryReq { return plainToClassFromExist(new GetRepayHistoryReq(), jsonObject); } @@ -195,6 +205,9 @@ export class GetRepayHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRepayHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts index 26c471f3..69a0c371 100644 --- a/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_get_repay_history_resp.ts @@ -37,6 +37,9 @@ export class GetRepayHistoryResp implements Response { @Type(() => GetRepayHistoryItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timestamp = null; @@ -61,14 +64,21 @@ export class GetRepayHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRepayHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRepayHistoryResp { return plainToClassFromExist(new GetRepayHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts index 01e510dc..fd18cbba 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_req.ts @@ -19,6 +19,9 @@ export class ModifyLeverageReq implements Serializable { */ leverage: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.leverage = null; @@ -59,14 +62,21 @@ export class ModifyLeverageReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyLeverageReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyLeverageReq { return plainToClassFromExist(new ModifyLeverageReq(), jsonObject); } @@ -100,6 +110,9 @@ export class ModifyLeverageReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyLeverageReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts index 09679abc..d3298e91 100644 --- a/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_modify_leverage_resp.ts @@ -10,6 +10,9 @@ export class ModifyLeverageResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class ModifyLeverageResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyLeverageResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyLeverageResp { return plainToClassFromExist(new ModifyLeverageResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/debit/model_repay_req.ts b/sdk/node/src/generate/margin/debit/model_repay_req.ts index 7e336fc8..c590e537 100644 --- a/sdk/node/src/generate/margin/debit/model_repay_req.ts +++ b/sdk/node/src/generate/margin/debit/model_repay_req.ts @@ -29,6 +29,9 @@ export class RepayReq implements Serializable { */ isHf?: boolean = false; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -85,14 +88,21 @@ export class RepayReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RepayReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RepayReq { return plainToClassFromExist(new RepayReq(), jsonObject); } @@ -142,6 +152,9 @@ export class RepayReqBuilder { return this; } + /** + * Get the final object. + */ build(): RepayReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/debit/model_repay_resp.ts b/sdk/node/src/generate/margin/debit/model_repay_resp.ts index 40496fed..bd6f41ea 100644 --- a/sdk/node/src/generate/margin/debit/model_repay_resp.ts +++ b/sdk/node/src/generate/margin/debit/model_repay_resp.ts @@ -20,6 +20,9 @@ export class RepayResp implements Response { */ actualSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timestamp = null; @@ -38,14 +41,21 @@ export class RepayResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): RepayResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): RepayResp { return plainToClassFromExist(new RepayResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts index 4887d234..244312d1 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_asset_list_value.ts @@ -25,14 +25,21 @@ export class CrossMarginPositionAssetListValue implements Serializable { // @ts-ignore this.hold = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CrossMarginPositionAssetListValue { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CrossMarginPositionAssetListValue { return plainToClassFromExist(new CrossMarginPositionAssetListValue(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index c527b93d..bfb921b5 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -68,14 +68,21 @@ export class CrossMarginPositionEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CrossMarginPositionEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CrossMarginPositionEvent { return plainToClassFromExist(new CrossMarginPositionEvent(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts index 1f8dc86e..84c2ef13 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_change_assets_value.ts @@ -31,14 +31,21 @@ export class IsolatedMarginPositionChangeAssetsValue implements Serializable { // @ts-ignore this.liabilityInterest = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): IsolatedMarginPositionChangeAssetsValue { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): IsolatedMarginPositionChangeAssetsValue { return plainToClassFromExist(new IsolatedMarginPositionChangeAssetsValue(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index a9dd5f4f..2761f09b 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -56,14 +56,21 @@ export class IsolatedMarginPositionEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): IsolatedMarginPositionEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): IsolatedMarginPositionEvent { return plainToClassFromExist(new IsolatedMarginPositionEvent(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index ecc44f35..9fdc12bc 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -43,14 +43,21 @@ export class IndexPriceEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): IndexPriceEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): IndexPriceEvent { return plainToClassFromExist(new IndexPriceEvent(), jsonObject); } diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index e64c574c..407db0f6 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -43,14 +43,21 @@ export class MarkPriceEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarkPriceEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarkPriceEvent { return plainToClassFromExist(new MarkPriceEvent(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts index 3a9fb198..849aefa3 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_items.ts @@ -84,6 +84,9 @@ export class GetCrossMarginSymbolsItems implements Serializable { */ minFunds: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -118,14 +121,21 @@ export class GetCrossMarginSymbolsItems implements Serializable { // @ts-ignore this.minFunds = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginSymbolsItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginSymbolsItems { return plainToClassFromExist(new GetCrossMarginSymbolsItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts index 1f0aef24..c2b8196c 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_req.ts @@ -9,6 +9,9 @@ export class GetCrossMarginSymbolsReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetCrossMarginSymbolsReq` class. @@ -32,14 +35,21 @@ export class GetCrossMarginSymbolsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginSymbolsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginSymbolsReq { return plainToClassFromExist(new GetCrossMarginSymbolsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetCrossMarginSymbolsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetCrossMarginSymbolsReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts index cdcf6d48..ab987e72 100644 --- a/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_cross_margin_symbols_resp.ts @@ -17,6 +17,9 @@ export class GetCrossMarginSymbolsResp implements Response { @Type(() => GetCrossMarginSymbolsItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timestamp = null; @@ -33,14 +36,21 @@ export class GetCrossMarginSymbolsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCrossMarginSymbolsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCrossMarginSymbolsResp { return plainToClassFromExist(new GetCrossMarginSymbolsResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts index c40a094b..234d2f5c 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_data.ts @@ -34,6 +34,9 @@ export class GetETFInfoData implements Serializable { */ basket: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -48,14 +51,21 @@ export class GetETFInfoData implements Serializable { // @ts-ignore this.basket = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETFInfoData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETFInfoData { return plainToClassFromExist(new GetETFInfoData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts index c104f7e8..384b2b06 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_req.ts @@ -9,6 +9,9 @@ export class GetETFInfoReq implements Serializable { */ currency?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetETFInfoReq` class. @@ -32,14 +35,21 @@ export class GetETFInfoReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETFInfoReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETFInfoReq { return plainToClassFromExist(new GetETFInfoReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetETFInfoReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetETFInfoReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts index 1a4ff3a5..7d8bf6ec 100644 --- a/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_etf_info_resp.ts @@ -12,6 +12,9 @@ export class GetETFInfoResp implements Response { @Type(() => GetETFInfoData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetETFInfoResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetETFInfoResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetETFInfoResp { return plainToClassFromExist(new GetETFInfoResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts index 61f1ff0c..0adeb910 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_data.ts @@ -74,6 +74,9 @@ export class GetIsolatedMarginSymbolsData implements Serializable { */ quoteBorrowCoefficient: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -104,14 +107,21 @@ export class GetIsolatedMarginSymbolsData implements Serializable { // @ts-ignore this.quoteBorrowCoefficient = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginSymbolsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginSymbolsData { return plainToClassFromExist(new GetIsolatedMarginSymbolsData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts index 8988fb0e..abde5f4a 100644 --- a/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_isolated_margin_symbols_resp.ts @@ -12,6 +12,9 @@ export class GetIsolatedMarginSymbolsResp implements Response { @Type(() => GetIsolatedMarginSymbolsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetIsolatedMarginSymbolsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetIsolatedMarginSymbolsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetIsolatedMarginSymbolsResp { return plainToClassFromExist(new GetIsolatedMarginSymbolsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts index 84fc2f27..3ef26489 100644 --- a/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_margin_config_resp.ts @@ -25,6 +25,9 @@ export class GetMarginConfigResp implements Response { */ liqDebtRatio: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currencyList = null; @@ -45,14 +48,21 @@ export class GetMarginConfigResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginConfigResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginConfigResp { return plainToClassFromExist(new GetMarginConfigResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts index 20ecb42a..a013eaf3 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_req.ts @@ -11,6 +11,9 @@ export class GetMarkPriceDetailReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMarkPriceDetailReq` class. @@ -34,14 +37,21 @@ export class GetMarkPriceDetailReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceDetailReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceDetailReq { return plainToClassFromExist(new GetMarkPriceDetailReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetMarkPriceDetailReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMarkPriceDetailReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts index 79e9a31d..34f6f2ab 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_detail_resp.ts @@ -20,6 +20,9 @@ export class GetMarkPriceDetailResp implements Response { */ value: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -38,14 +41,21 @@ export class GetMarkPriceDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceDetailResp { return plainToClassFromExist(new GetMarkPriceDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts index 4d20c2f5..b311d49b 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_data.ts @@ -19,6 +19,9 @@ export class GetMarkPriceListData implements Serializable { */ value: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -27,14 +30,21 @@ export class GetMarkPriceListData implements Serializable { // @ts-ignore this.value = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceListData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceListData { return plainToClassFromExist(new GetMarkPriceListData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts index b6a45680..e7d36be6 100644 --- a/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts +++ b/sdk/node/src/generate/margin/market/model_get_mark_price_list_resp.ts @@ -12,6 +12,9 @@ export class GetMarkPriceListResp implements Response { @Type(() => GetMarkPriceListData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetMarkPriceListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarkPriceListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarkPriceListResp { return plainToClassFromExist(new GetMarkPriceListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/order/model_add_order_req.ts b/sdk/node/src/generate/margin/order/model_add_order_req.ts index 31048232..0f1bfb4a 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_req.ts @@ -89,6 +89,9 @@ export class AddOrderReq implements Serializable { */ autoRepay?: boolean = false; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -231,14 +234,21 @@ export class AddOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderReq { return plainToClassFromExist(new AddOrderReq(), jsonObject); } @@ -443,6 +453,9 @@ export class AddOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_add_order_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_resp.ts index 94fac442..7032ff23 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_resp.ts @@ -25,6 +25,9 @@ export class AddOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -45,14 +48,21 @@ export class AddOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderResp { return plainToClassFromExist(new AddOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts index 57006b90..4a0a3374 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_req.ts @@ -89,6 +89,9 @@ export class AddOrderTestReq implements Serializable { */ autoRepay?: boolean = false; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -231,14 +234,21 @@ export class AddOrderTestReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestReq { return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } @@ -443,6 +453,9 @@ export class AddOrderTestReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts index 38f6b58b..c8892b9e 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_resp.ts @@ -25,6 +25,9 @@ export class AddOrderTestResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -45,14 +48,21 @@ export class AddOrderTestResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestResp { return plainToClassFromExist(new AddOrderTestResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts index 5de80ef6..fcd62fc8 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_req.ts @@ -89,6 +89,9 @@ export class AddOrderTestV1Req implements Serializable { */ marginModel?: AddOrderTestV1Req.MarginModelEnum = AddOrderTestV1Req.MarginModelEnum.CROSS; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -231,14 +234,21 @@ export class AddOrderTestV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestV1Req { return plainToClassFromExist(new AddOrderTestV1Req(), jsonObject); } @@ -453,6 +463,9 @@ export class AddOrderTestV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestV1Req { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts index 47554a27..9385bff0 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_test_v1_resp.ts @@ -25,6 +25,9 @@ export class AddOrderTestV1Resp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -45,14 +48,21 @@ export class AddOrderTestV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestV1Resp { return plainToClassFromExist(new AddOrderTestV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts index 29b38437..36147a59 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_req.ts @@ -89,6 +89,9 @@ export class AddOrderV1Req implements Serializable { */ marginModel?: AddOrderV1Req.MarginModelEnum = AddOrderV1Req.MarginModelEnum.CROSS; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -231,14 +234,21 @@ export class AddOrderV1Req implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderV1Req { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderV1Req { return plainToClassFromExist(new AddOrderV1Req(), jsonObject); } @@ -453,6 +463,9 @@ export class AddOrderV1ReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderV1Req { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts index ceecdde6..fd9d1f00 100644 --- a/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts +++ b/sdk/node/src/generate/margin/order/model_add_order_v1_resp.ts @@ -25,6 +25,9 @@ export class AddOrderV1Resp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -45,14 +48,21 @@ export class AddOrderV1Resp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderV1Resp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderV1Resp { return plainToClassFromExist(new AddOrderV1Resp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts index c5a48c3d..2722344e 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_req.ts @@ -14,6 +14,9 @@ export class CancelAllOrdersBySymbolReq implements Serializable { */ tradeType?: CancelAllOrdersBySymbolReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. @@ -42,14 +45,21 @@ export class CancelAllOrdersBySymbolReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersBySymbolReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersBySymbolReq { return plainToClassFromExist(new CancelAllOrdersBySymbolReq(), jsonObject); } @@ -90,6 +100,9 @@ export class CancelAllOrdersBySymbolReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelAllOrdersBySymbolReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts index d2610bf4..6fdc282b 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_all_orders_by_symbol_resp.ts @@ -10,6 +10,9 @@ export class CancelAllOrdersBySymbolResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class CancelAllOrdersBySymbolResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersBySymbolResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { return plainToClassFromExist(new CancelAllOrdersBySymbolResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts index 93adba79..2f6a0e8c 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByClientOidReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidReq { return plainToClassFromExist(new CancelOrderByClientOidReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts index c1e2d16f..a624c3bd 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_client_oid_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByClientOidResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -24,14 +27,21 @@ export class CancelOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidResp { return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts index 50e79618..18ab4fc6 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByOrderIdReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdReq { return plainToClassFromExist(new CancelOrderByOrderIdReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts index 6babdc05..a6f086af 100644 --- a/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_cancel_order_by_order_id_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByOrderIdResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class CancelOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdResp { return plainToClassFromExist(new CancelOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts index af419a58..5b10596c 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_items.ts @@ -189,6 +189,9 @@ export class GetClosedOrdersItems implements Serializable { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -257,14 +260,21 @@ export class GetClosedOrdersItems implements Serializable { // @ts-ignore this.active = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersItems { return plainToClassFromExist(new GetClosedOrdersItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts index 612ed623..e6081c4e 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_req.ts @@ -44,6 +44,9 @@ export class GetClosedOrdersReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetClosedOrdersReq` class. @@ -106,14 +109,21 @@ export class GetClosedOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersReq { return plainToClassFromExist(new GetClosedOrdersReq(), jsonObject); } @@ -220,6 +230,9 @@ export class GetClosedOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetClosedOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts index 87acd142..c3b60e26 100644 --- a/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_closed_orders_resp.ts @@ -17,6 +17,9 @@ export class GetClosedOrdersResp implements Response { @Type(() => GetClosedOrdersItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.lastId = null; @@ -33,14 +36,21 @@ export class GetClosedOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersResp { return plainToClassFromExist(new GetClosedOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts index d61eb9ef..a4de11d4 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_data.ts @@ -189,6 +189,9 @@ export class GetOpenOrdersData implements Serializable { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -257,14 +260,21 @@ export class GetOpenOrdersData implements Serializable { // @ts-ignore this.active = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersData { return plainToClassFromExist(new GetOpenOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts index 74fe2e7f..7b1ea920 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_req.ts @@ -14,6 +14,9 @@ export class GetOpenOrdersReq implements Serializable { */ tradeType?: GetOpenOrdersReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOpenOrdersReq` class. @@ -42,14 +45,21 @@ export class GetOpenOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersReq { return plainToClassFromExist(new GetOpenOrdersReq(), jsonObject); } @@ -88,6 +98,9 @@ export class GetOpenOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOpenOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts index 4c955bed..3b724a84 100644 --- a/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_open_orders_resp.ts @@ -12,6 +12,9 @@ export class GetOpenOrdersResp implements Response { @Type(() => GetOpenOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetOpenOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersResp { return plainToClassFromExist(new GetOpenOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts index db2e27e3..fb9a0ebc 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_req.ts @@ -16,6 +16,9 @@ export class GetOrderByClientOidReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. @@ -44,14 +47,21 @@ export class GetOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidReq { return plainToClassFromExist(new GetOrderByClientOidReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts index 721b0070..201152ba 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_client_oid_resp.ts @@ -190,6 +190,9 @@ export class GetOrderByClientOidResp implements Response { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -268,14 +271,21 @@ export class GetOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidResp { return plainToClassFromExist(new GetOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts index e4141076..34a0759f 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_req.ts @@ -16,6 +16,9 @@ export class GetOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. @@ -44,14 +47,21 @@ export class GetOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdReq { return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts index aef6d50f..7282eac5 100644 --- a/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_order_by_order_id_resp.ts @@ -190,6 +190,9 @@ export class GetOrderByOrderIdResp implements Response { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -270,14 +273,21 @@ export class GetOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdResp { return plainToClassFromExist(new GetOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts index 4b6a5ba3..4b28ec25 100644 --- a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_req.ts @@ -9,6 +9,9 @@ export class GetSymbolsWithOpenOrderReq implements Serializable { */ tradeType?: GetSymbolsWithOpenOrderReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSymbolsWithOpenOrderReq` class. @@ -32,14 +35,21 @@ export class GetSymbolsWithOpenOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolsWithOpenOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolsWithOpenOrderReq { return plainToClassFromExist(new GetSymbolsWithOpenOrderReq(), jsonObject); } @@ -72,6 +82,9 @@ export class GetSymbolsWithOpenOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSymbolsWithOpenOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts index 73b9e36c..49f57367 100644 --- a/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_symbols_with_open_order_resp.ts @@ -15,6 +15,9 @@ export class GetSymbolsWithOpenOrderResp implements Response { */ symbols: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbolSize = null; @@ -31,14 +34,21 @@ export class GetSymbolsWithOpenOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolsWithOpenOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { return plainToClassFromExist(new GetSymbolsWithOpenOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts index 6c7832ec..d1e1f17b 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_items.ts @@ -104,6 +104,9 @@ export class GetTradeHistoryItems implements Serializable { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -146,14 +149,21 @@ export class GetTradeHistoryItems implements Serializable { // @ts-ignore this.createdAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryItems { return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts index de217296..5de76f66 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_req.ts @@ -49,6 +49,9 @@ export class GetTradeHistoryReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. @@ -116,14 +119,21 @@ export class GetTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryReq { return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } @@ -238,6 +248,9 @@ export class GetTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts index 641f94ab..9942d242 100644 --- a/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/margin/order/model_get_trade_history_resp.ts @@ -17,6 +17,9 @@ export class GetTradeHistoryResp implements Response { */ lastId: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.items = null; @@ -33,14 +36,21 @@ export class GetTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryResp { return plainToClassFromExist(new GetTradeHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts index 9896b4e6..8f8bdbb9 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_data.ts @@ -154,15 +154,25 @@ export class GetMarginRiskLimitData implements Serializable { */ quoteMarginCoefficient?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginRiskLimitData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginRiskLimitData { return plainToClassFromExist(new GetMarginRiskLimitData(), jsonObject); } diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts index 994056a4..18100143 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_req.ts @@ -19,6 +19,9 @@ export class GetMarginRiskLimitReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetMarginRiskLimitReq` class. @@ -52,14 +55,21 @@ export class GetMarginRiskLimitReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginRiskLimitReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginRiskLimitReq { return plainToClassFromExist(new GetMarginRiskLimitReq(), jsonObject); } @@ -93,6 +103,9 @@ export class GetMarginRiskLimitReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetMarginRiskLimitReq { return this.obj; } diff --git a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts index 76d9bc01..370b56e0 100644 --- a/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts +++ b/sdk/node/src/generate/margin/risklimit/model_get_margin_risk_limit_resp.ts @@ -12,6 +12,9 @@ export class GetMarginRiskLimitResp implements Response { @Type(() => GetMarginRiskLimitData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetMarginRiskLimitResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarginRiskLimitResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarginRiskLimitResp { return plainToClassFromExist(new GetMarginRiskLimitResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts index bf2b847c..49baa1ca 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_req.ts @@ -9,6 +9,9 @@ export class Get24hrStatsReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `Get24hrStatsReq` class. @@ -32,14 +35,21 @@ export class Get24hrStatsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): Get24hrStatsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): Get24hrStatsReq { return plainToClassFromExist(new Get24hrStatsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class Get24hrStatsReqBuilder { return this; } + /** + * Get the final object. + */ build(): Get24hrStatsReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts index 46649e62..1e8f721e 100644 --- a/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get24hr_stats_resp.ts @@ -85,6 +85,9 @@ export class Get24hrStatsResp implements Response { */ makerCoefficient: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -129,14 +132,21 @@ export class Get24hrStatsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): Get24hrStatsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): Get24hrStatsResp { return plainToClassFromExist(new Get24hrStatsResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts index 50344f15..74bea19d 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data.ts @@ -51,6 +51,9 @@ export class GetAllCurrenciesData implements Serializable { @Type(() => GetAllCurrenciesDataChains) chains: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -71,14 +74,21 @@ export class GetAllCurrenciesData implements Serializable { // @ts-ignore this.chains = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllCurrenciesData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllCurrenciesData { return plainToClassFromExist(new GetAllCurrenciesData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts index 368f55d7..72163028 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_data_chains.ts @@ -94,6 +94,9 @@ export class GetAllCurrenciesDataChains implements Serializable { */ depositTierFee?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.chainName = null; @@ -126,14 +129,21 @@ export class GetAllCurrenciesDataChains implements Serializable { // @ts-ignore this.chainId = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllCurrenciesDataChains { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllCurrenciesDataChains { return plainToClassFromExist(new GetAllCurrenciesDataChains(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts index e5e99f90..a83947ae 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_currencies_resp.ts @@ -12,6 +12,9 @@ export class GetAllCurrenciesResp implements Response { @Type(() => GetAllCurrenciesData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetAllCurrenciesResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllCurrenciesResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllCurrenciesResp { return plainToClassFromExist(new GetAllCurrenciesResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts index ebaaaf6f..b51786e1 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_data.ts @@ -109,6 +109,9 @@ export class GetAllSymbolsData implements Serializable { */ st: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -153,14 +156,21 @@ export class GetAllSymbolsData implements Serializable { // @ts-ignore this.st = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllSymbolsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllSymbolsData { return plainToClassFromExist(new GetAllSymbolsData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts index 258a86ff..7ddb423d 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_req.ts @@ -9,6 +9,9 @@ export class GetAllSymbolsReq implements Serializable { */ market?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetAllSymbolsReq` class. @@ -32,14 +35,21 @@ export class GetAllSymbolsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllSymbolsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllSymbolsReq { return plainToClassFromExist(new GetAllSymbolsReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetAllSymbolsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetAllSymbolsReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts index 9c443b60..7dbb100b 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_symbols_resp.ts @@ -12,6 +12,9 @@ export class GetAllSymbolsResp implements Response { @Type(() => GetAllSymbolsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetAllSymbolsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllSymbolsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllSymbolsResp { return plainToClassFromExist(new GetAllSymbolsResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts index f6255a4e..a691b45d 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_resp.ts @@ -17,6 +17,9 @@ export class GetAllTickersResp implements Response { @Type(() => GetAllTickersTicker) ticker: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -33,14 +36,21 @@ export class GetAllTickersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllTickersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllTickersResp { return plainToClassFromExist(new GetAllTickersResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts index eddc8b02..e7e00f0c 100644 --- a/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts +++ b/sdk/node/src/generate/spot/market/model_get_all_tickers_ticker.ts @@ -94,6 +94,9 @@ export class GetAllTickersTicker implements Serializable { */ makerCoefficient: GetAllTickersTicker.MakerCoefficientEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -132,14 +135,21 @@ export class GetAllTickersTicker implements Serializable { // @ts-ignore this.makerCoefficient = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAllTickersTicker { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAllTickersTicker { return plainToClassFromExist(new GetAllTickersTicker(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts index 71284de2..8c1aa330 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_items.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_items.ts @@ -39,6 +39,9 @@ export class GetAnnouncementsItems implements Serializable { */ annUrl: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.annId = null; @@ -55,14 +58,21 @@ export class GetAnnouncementsItems implements Serializable { // @ts-ignore this.annUrl = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAnnouncementsItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAnnouncementsItems { return plainToClassFromExist(new GetAnnouncementsItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts index 09e50886..7e051025 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_req.ts @@ -35,6 +35,9 @@ export class GetAnnouncementsReq implements Serializable { */ endTime?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetAnnouncementsReq` class. @@ -91,14 +94,21 @@ export class GetAnnouncementsReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAnnouncementsReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAnnouncementsReq { return plainToClassFromExist(new GetAnnouncementsReq(), jsonObject); } @@ -287,6 +297,9 @@ export class GetAnnouncementsReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetAnnouncementsReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts index a4a3e944..c837c4ad 100644 --- a/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_announcements_resp.ts @@ -32,6 +32,9 @@ export class GetAnnouncementsResp implements Response { */ totalPage: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.totalNum = null; @@ -54,14 +57,21 @@ export class GetAnnouncementsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAnnouncementsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAnnouncementsResp { return plainToClassFromExist(new GetAnnouncementsResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_currency_chains.ts b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts index c9f8d0a0..1bbe3455 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_chains.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_chains.ts @@ -79,6 +79,9 @@ export class GetCurrencyChains implements Serializable { */ chainId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.chainName = null; @@ -111,14 +114,21 @@ export class GetCurrencyChains implements Serializable { // @ts-ignore this.chainId = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCurrencyChains { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCurrencyChains { return plainToClassFromExist(new GetCurrencyChains(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_currency_req.ts b/sdk/node/src/generate/spot/market/model_get_currency_req.ts index 02b761e8..1166dd47 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_req.ts @@ -16,6 +16,9 @@ export class GetCurrencyReq implements Serializable { */ chain?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetCurrencyReq` class. @@ -44,14 +47,21 @@ export class GetCurrencyReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCurrencyReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCurrencyReq { return plainToClassFromExist(new GetCurrencyReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetCurrencyReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetCurrencyReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts index 489dff2b..9d8e2cde 100644 --- a/sdk/node/src/generate/spot/market/model_get_currency_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_currency_resp.ts @@ -52,6 +52,9 @@ export class GetCurrencyResp implements Response { @Type(() => GetCurrencyChains) chains: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currency = null; @@ -82,14 +85,21 @@ export class GetCurrencyResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetCurrencyResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetCurrencyResp { return plainToClassFromExist(new GetCurrencyResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts index f96fe967..d6445d61 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_req.ts @@ -14,6 +14,9 @@ export class GetFiatPriceReq implements Serializable { */ currencies?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFiatPriceReq` class. @@ -46,14 +49,21 @@ export class GetFiatPriceReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFiatPriceReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFiatPriceReq { return plainToClassFromExist(new GetFiatPriceReq(), jsonObject); } @@ -79,6 +89,9 @@ export class GetFiatPriceReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFiatPriceReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts index eb606c79..dcaa770b 100644 --- a/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_fiat_price_resp.ts @@ -4487,6 +4487,9 @@ export class GetFiatPriceResp implements Response { */ COTI: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.AGLD = null; @@ -6291,14 +6294,21 @@ export class GetFiatPriceResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFiatPriceResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFiatPriceResp { return plainToClassFromExist(new GetFiatPriceResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts index 1b57bab0..2283eac9 100644 --- a/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_req.ts @@ -9,6 +9,9 @@ export class GetFullOrderBookReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetFullOrderBookReq` class. @@ -32,14 +35,21 @@ export class GetFullOrderBookReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFullOrderBookReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFullOrderBookReq { return plainToClassFromExist(new GetFullOrderBookReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetFullOrderBookReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetFullOrderBookReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts index 52fd8755..1314ecab 100644 --- a/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_full_order_book_resp.ts @@ -25,6 +25,9 @@ export class GetFullOrderBookResp implements Response { */ asks: Array>; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -45,14 +48,21 @@ export class GetFullOrderBookResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetFullOrderBookResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetFullOrderBookResp { return plainToClassFromExist(new GetFullOrderBookResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_klines_req.ts b/sdk/node/src/generate/spot/market/model_get_klines_req.ts index 6481f046..522911c7 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_req.ts @@ -24,6 +24,9 @@ export class GetKlinesReq implements Serializable { */ endAt?: number = 0; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetKlinesReq` class. @@ -70,14 +73,21 @@ export class GetKlinesReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKlinesReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKlinesReq { return plainToClassFromExist(new GetKlinesReq(), jsonObject); } @@ -180,6 +190,9 @@ export class GetKlinesReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetKlinesReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts index 3013967d..8ab00fff 100644 --- a/sdk/node/src/generate/spot/market/model_get_klines_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_klines_resp.ts @@ -10,6 +10,9 @@ export class GetKlinesResp implements Response { */ data: Array>; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetKlinesResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetKlinesResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetKlinesResp { return plainToClassFromExist(new GetKlinesResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts index 94f83a4b..bd0fe9ec 100644 --- a/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_market_list_resp.ts @@ -10,6 +10,9 @@ export class GetMarketListResp implements Response { */ data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetMarketListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetMarketListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetMarketListResp { return plainToClassFromExist(new GetMarketListResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts index 97d07c09..fc10ded6 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_req.ts @@ -16,6 +16,9 @@ export class GetPartOrderBookReq implements Serializable { @Reflect.metadata('path', 'size') size?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetPartOrderBookReq` class. @@ -44,14 +47,21 @@ export class GetPartOrderBookReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPartOrderBookReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPartOrderBookReq { return plainToClassFromExist(new GetPartOrderBookReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetPartOrderBookReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetPartOrderBookReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts index bb3df7da..9f7bf3d0 100644 --- a/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_part_order_book_resp.ts @@ -25,6 +25,9 @@ export class GetPartOrderBookResp implements Response { */ asks: Array>; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -45,14 +48,21 @@ export class GetPartOrderBookResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPartOrderBookResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPartOrderBookResp { return plainToClassFromExist(new GetPartOrderBookResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts index 71029b7c..03e243fd 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_instance_servers.ts @@ -29,6 +29,9 @@ export class GetPrivateTokenInstanceServers implements Serializable { */ pingTimeout: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.endpoint = null; @@ -41,14 +44,21 @@ export class GetPrivateTokenInstanceServers implements Serializable { // @ts-ignore this.pingTimeout = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateTokenInstanceServers { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateTokenInstanceServers { return plainToClassFromExist(new GetPrivateTokenInstanceServers(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts index 30d35009..9e6aebc6 100644 --- a/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_private_token_resp.ts @@ -17,6 +17,9 @@ export class GetPrivateTokenResp implements Response { @Type(() => GetPrivateTokenInstanceServers) instanceServers: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.token = null; @@ -33,14 +36,21 @@ export class GetPrivateTokenResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPrivateTokenResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPrivateTokenResp { return plainToClassFromExist(new GetPrivateTokenResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts index d9cd2340..2abc3132 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_instance_servers.ts @@ -29,6 +29,9 @@ export class GetPublicTokenInstanceServers implements Serializable { */ pingTimeout: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.endpoint = null; @@ -41,14 +44,21 @@ export class GetPublicTokenInstanceServers implements Serializable { // @ts-ignore this.pingTimeout = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicTokenInstanceServers { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicTokenInstanceServers { return plainToClassFromExist(new GetPublicTokenInstanceServers(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts index c6c5da8b..e7d4b332 100644 --- a/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_public_token_resp.ts @@ -17,6 +17,9 @@ export class GetPublicTokenResp implements Response { @Type(() => GetPublicTokenInstanceServers) instanceServers: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.token = null; @@ -33,14 +36,21 @@ export class GetPublicTokenResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetPublicTokenResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetPublicTokenResp { return plainToClassFromExist(new GetPublicTokenResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts index 14a2c1c7..1427322c 100644 --- a/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_server_time_resp.ts @@ -10,6 +10,9 @@ export class GetServerTimeResp implements Response { */ data: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class GetServerTimeResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetServerTimeResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetServerTimeResp { return plainToClassFromExist(new GetServerTimeResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts index 4a11ebae..6a094a61 100644 --- a/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_service_status_resp.ts @@ -15,6 +15,9 @@ export class GetServiceStatusResp implements Response { */ msg: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.status = null; @@ -31,14 +34,21 @@ export class GetServiceStatusResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetServiceStatusResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetServiceStatusResp { return plainToClassFromExist(new GetServiceStatusResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_req.ts b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts index 074c1da5..d2f3c4df 100644 --- a/sdk/node/src/generate/spot/market/model_get_symbol_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_symbol_req.ts @@ -11,6 +11,9 @@ export class GetSymbolReq implements Serializable { @Reflect.metadata('path', 'symbol') symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetSymbolReq` class. @@ -34,14 +37,21 @@ export class GetSymbolReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolReq { return plainToClassFromExist(new GetSymbolReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetSymbolReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetSymbolReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts index 11823c20..831c6684 100644 --- a/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_symbol_resp.ts @@ -110,6 +110,9 @@ export class GetSymbolResp implements Response { */ st: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -164,14 +167,21 @@ export class GetSymbolResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolResp { return plainToClassFromExist(new GetSymbolResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts index dc88ebc4..4f30a27d 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_req.ts @@ -9,6 +9,9 @@ export class GetTickerReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTickerReq` class. @@ -32,14 +35,21 @@ export class GetTickerReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTickerReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTickerReq { return plainToClassFromExist(new GetTickerReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetTickerReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTickerReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts index 66211745..a82ac02e 100644 --- a/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_ticker_resp.ts @@ -45,6 +45,9 @@ export class GetTickerResp implements Response { */ bestAskSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.time = null; @@ -73,14 +76,21 @@ export class GetTickerResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTickerResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTickerResp { return plainToClassFromExist(new GetTickerResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts index 0106e185..9236f359 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_data.ts @@ -29,6 +29,9 @@ export class GetTradeHistoryData implements Serializable { */ time: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.sequence = null; @@ -41,14 +44,21 @@ export class GetTradeHistoryData implements Serializable { // @ts-ignore this.time = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryData { return plainToClassFromExist(new GetTradeHistoryData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts index f138ff35..096f20da 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_req.ts @@ -9,6 +9,9 @@ export class GetTradeHistoryReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. @@ -32,14 +35,21 @@ export class GetTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryReq { return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts index 198f4e8e..ea363a7d 100644 --- a/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/market/model_get_trade_history_resp.ts @@ -12,6 +12,9 @@ export class GetTradeHistoryResp implements Response { @Type(() => GetTradeHistoryData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryResp { return plainToClassFromExist(new GetTradeHistoryResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts index 37d963b2..fd0604c3 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_req.ts @@ -49,6 +49,9 @@ export class AddOcoOrderReq implements Serializable { */ tradeType?: AddOcoOrderReq.TradeTypeEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -127,14 +130,21 @@ export class AddOcoOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOcoOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOcoOrderReq { return plainToClassFromExist(new AddOcoOrderReq(), jsonObject); } @@ -235,6 +245,9 @@ export class AddOcoOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOcoOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts index 6754fc12..5effe994 100644 --- a/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_oco_order_resp.ts @@ -10,6 +10,9 @@ export class AddOcoOrderResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class AddOcoOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOcoOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOcoOrderResp { return plainToClassFromExist(new AddOcoOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts index cb07f954..279639b9 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_req.ts @@ -84,6 +84,9 @@ export class AddOrderOldReq implements Serializable { */ tradeType?: AddOrderOldReq.TradeTypeEnum = AddOrderOldReq.TradeTypeEnum.TRADE; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -213,14 +216,21 @@ export class AddOrderOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderOldReq { return plainToClassFromExist(new AddOrderOldReq(), jsonObject); } @@ -427,6 +437,9 @@ export class AddOrderOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts index 3b9e53f7..e9779814 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_old_resp.ts @@ -10,6 +10,9 @@ export class AddOrderOldResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class AddOrderOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderOldResp { return plainToClassFromExist(new AddOrderOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_order_req.ts b/sdk/node/src/generate/spot/order/model_add_order_req.ts index fa597588..6632a8f6 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_req.ts @@ -84,6 +84,9 @@ export class AddOrderReq implements Serializable { */ funds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.side = null; @@ -205,14 +208,21 @@ export class AddOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderReq { return plainToClassFromExist(new AddOrderReq(), jsonObject); } @@ -409,6 +419,9 @@ export class AddOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_resp.ts index 7545d9d8..f05bffb9 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_resp.ts @@ -15,6 +15,9 @@ export class AddOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderResp { return plainToClassFromExist(new AddOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts index c0abaa25..0f6544d0 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_req.ts @@ -84,6 +84,9 @@ export class AddOrderSyncReq implements Serializable { */ funds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.side = null; @@ -205,14 +208,21 @@ export class AddOrderSyncReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderSyncReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderSyncReq { return plainToClassFromExist(new AddOrderSyncReq(), jsonObject); } @@ -409,6 +419,9 @@ export class AddOrderSyncReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderSyncReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts index 60f9e167..58451051 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_sync_resp.ts @@ -50,6 +50,9 @@ export class AddOrderSyncResp implements Response { */ matchTime: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -80,14 +83,21 @@ export class AddOrderSyncResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderSyncResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderSyncResp { return plainToClassFromExist(new AddOrderSyncResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts index 7ea44182..4d81a777 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_req.ts @@ -84,6 +84,9 @@ export class AddOrderTestOldReq implements Serializable { */ tradeType?: AddOrderTestOldReq.TradeTypeEnum = AddOrderTestOldReq.TradeTypeEnum.TRADE; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -213,14 +216,21 @@ export class AddOrderTestOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestOldReq { return plainToClassFromExist(new AddOrderTestOldReq(), jsonObject); } @@ -427,6 +437,9 @@ export class AddOrderTestOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts index 3f3ecbc1..0131ca7d 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_old_resp.ts @@ -10,6 +10,9 @@ export class AddOrderTestOldResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class AddOrderTestOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestOldResp { return plainToClassFromExist(new AddOrderTestOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_req.ts b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts index 4f36dc2c..fb0c8bea 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_req.ts @@ -84,6 +84,9 @@ export class AddOrderTestReq implements Serializable { */ funds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.side = null; @@ -205,14 +208,21 @@ export class AddOrderTestReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestReq { return plainToClassFromExist(new AddOrderTestReq(), jsonObject); } @@ -409,6 +419,9 @@ export class AddOrderTestReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddOrderTestReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts index 20e19e9d..a1aa0a09 100644 --- a/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_order_test_resp.ts @@ -15,6 +15,9 @@ export class AddOrderTestResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddOrderTestResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddOrderTestResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddOrderTestResp { return plainToClassFromExist(new AddOrderTestResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts index 1b3a396c..7058bf52 100644 --- a/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_req.ts @@ -89,6 +89,9 @@ export class AddStopOrderReq implements Serializable { */ tradeType?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.side = null; @@ -217,14 +220,21 @@ export class AddStopOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddStopOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddStopOrderReq { return plainToClassFromExist(new AddStopOrderReq(), jsonObject); } @@ -429,6 +439,9 @@ export class AddStopOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): AddStopOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts index d3db6ea0..2ef177e7 100644 --- a/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_add_stop_order_resp.ts @@ -15,6 +15,9 @@ export class AddStopOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class AddStopOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AddStopOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AddStopOrderResp { return plainToClassFromExist(new AddStopOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts index 4c020912..fad22242 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_data.ts @@ -24,18 +24,28 @@ export class BatchAddOrdersData implements Serializable { */ failMsg?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.success = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersData { return plainToClassFromExist(new BatchAddOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts index fc0b4e7a..d3a2873d 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_data.ts @@ -109,6 +109,9 @@ export class BatchAddOrdersOldData implements Serializable { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -153,14 +156,21 @@ export class BatchAddOrdersOldData implements Serializable { // @ts-ignore this.clientOid = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersOldData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersOldData { return plainToClassFromExist(new BatchAddOrdersOldData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts index 9502fbfa..b4321a64 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_order_list.ts @@ -91,6 +91,9 @@ export class BatchAddOrdersOldOrderList implements Serializable { */ stopPrice?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -229,14 +232,21 @@ export class BatchAddOrdersOldOrderList implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersOldOrderList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersOldOrderList { return plainToClassFromExist(new BatchAddOrdersOldOrderList(), jsonObject); } @@ -457,6 +467,9 @@ export class BatchAddOrdersOldOrderListBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersOldOrderList { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts index acfc7e64..a417f89a 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_req.ts @@ -16,6 +16,9 @@ export class BatchAddOrdersOldReq implements Serializable { */ symbol: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -47,14 +50,21 @@ export class BatchAddOrdersOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersOldReq { return plainToClassFromExist(new BatchAddOrdersOldReq(), jsonObject); } @@ -80,6 +90,9 @@ export class BatchAddOrdersOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts index 3004ee97..c6d9cf63 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_old_resp.ts @@ -12,6 +12,9 @@ export class BatchAddOrdersOldResp implements Response { @Type(() => BatchAddOrdersOldData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class BatchAddOrdersOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersOldResp { return plainToClassFromExist(new BatchAddOrdersOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts index 9b21f6b9..e57ddb23 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_order_list.ts @@ -85,6 +85,9 @@ export class BatchAddOrdersOrderList implements Serializable { */ funds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -208,14 +211,21 @@ export class BatchAddOrdersOrderList implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersOrderList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersOrderList { return plainToClassFromExist(new BatchAddOrdersOrderList(), jsonObject); } @@ -408,6 +418,9 @@ export class BatchAddOrdersOrderListBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersOrderList { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts index 1f559acf..bd1b027b 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_req.ts @@ -11,6 +11,9 @@ export class BatchAddOrdersReq implements Serializable { @Type(() => BatchAddOrdersOrderList) orderList: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderList = null; @@ -37,14 +40,21 @@ export class BatchAddOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersReq { return plainToClassFromExist(new BatchAddOrdersReq(), jsonObject); } @@ -62,6 +72,9 @@ export class BatchAddOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts index 41e0771d..8b00afe3 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_resp.ts @@ -12,6 +12,9 @@ export class BatchAddOrdersResp implements Response { @Type(() => BatchAddOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class BatchAddOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersResp { return plainToClassFromExist(new BatchAddOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts index fd33cab8..d2ed6ce7 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_data.ts @@ -59,18 +59,28 @@ export class BatchAddOrdersSyncData implements Serializable { */ failMsg?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.success = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersSyncData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersSyncData { return plainToClassFromExist(new BatchAddOrdersSyncData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts index 5f714e5f..aa72b516 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_order_list.ts @@ -85,6 +85,9 @@ export class BatchAddOrdersSyncOrderList implements Serializable { */ funds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -208,14 +211,21 @@ export class BatchAddOrdersSyncOrderList implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersSyncOrderList { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersSyncOrderList { return plainToClassFromExist(new BatchAddOrdersSyncOrderList(), jsonObject); } @@ -410,6 +420,9 @@ export class BatchAddOrdersSyncOrderListBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersSyncOrderList { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts index 2da5f4a6..b488dba7 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_req.ts @@ -11,6 +11,9 @@ export class BatchAddOrdersSyncReq implements Serializable { @Type(() => BatchAddOrdersSyncOrderList) orderList: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderList = null; @@ -37,14 +40,21 @@ export class BatchAddOrdersSyncReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersSyncReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersSyncReq { return plainToClassFromExist(new BatchAddOrdersSyncReq(), jsonObject); } @@ -62,6 +72,9 @@ export class BatchAddOrdersSyncReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchAddOrdersSyncReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts index b58c942d..a3b5ada1 100644 --- a/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_add_orders_sync_resp.ts @@ -12,6 +12,9 @@ export class BatchAddOrdersSyncResp implements Response { @Type(() => BatchAddOrdersSyncData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class BatchAddOrdersSyncResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchAddOrdersSyncResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchAddOrdersSyncResp { return plainToClassFromExist(new BatchAddOrdersSyncResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts index 61ca12ee..602a5109 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_req.ts @@ -14,6 +14,9 @@ export class BatchCancelOcoOrdersReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `BatchCancelOcoOrdersReq` class. @@ -42,14 +45,21 @@ export class BatchCancelOcoOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOcoOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOcoOrdersReq { return plainToClassFromExist(new BatchCancelOcoOrdersReq(), jsonObject); } @@ -75,6 +85,9 @@ export class BatchCancelOcoOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchCancelOcoOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts index 159ea61f..4cfa4a8f 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_oco_orders_resp.ts @@ -10,6 +10,9 @@ export class BatchCancelOcoOrdersResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class BatchCancelOcoOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOcoOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOcoOrdersResp { return plainToClassFromExist(new BatchCancelOcoOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts index 405bf63d..438266d1 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_req.ts @@ -14,6 +14,9 @@ export class BatchCancelOrderOldReq implements Serializable { */ tradeType?: BatchCancelOrderOldReq.TradeTypeEnum = BatchCancelOrderOldReq.TradeTypeEnum.TRADE; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `BatchCancelOrderOldReq` class. @@ -46,14 +49,21 @@ export class BatchCancelOrderOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrderOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrderOldReq { return plainToClassFromExist(new BatchCancelOrderOldReq(), jsonObject); } @@ -96,6 +106,9 @@ export class BatchCancelOrderOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchCancelOrderOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts index b99ddb0f..8f346c05 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_order_old_resp.ts @@ -10,6 +10,9 @@ export class BatchCancelOrderOldResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class BatchCancelOrderOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelOrderOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelOrderOldResp { return plainToClassFromExist(new BatchCancelOrderOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts index b50f8c9b..5ab4a4c9 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_req.ts @@ -19,6 +19,9 @@ export class BatchCancelStopOrderReq implements Serializable { */ orderIds?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `BatchCancelStopOrderReq` class. @@ -52,14 +55,21 @@ export class BatchCancelStopOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelStopOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelStopOrderReq { return plainToClassFromExist(new BatchCancelStopOrderReq(), jsonObject); } @@ -93,6 +103,9 @@ export class BatchCancelStopOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): BatchCancelStopOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts index be9a782b..a02b5b62 100644 --- a/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_batch_cancel_stop_order_resp.ts @@ -10,6 +10,9 @@ export class BatchCancelStopOrderResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class BatchCancelStopOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): BatchCancelStopOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): BatchCancelStopOrderResp { return plainToClassFromExist(new BatchCancelStopOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts index c6e37869..b6d8df5b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_req.ts @@ -9,6 +9,9 @@ export class CancelAllOrdersBySymbolReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelAllOrdersBySymbolReq` class. @@ -32,14 +35,21 @@ export class CancelAllOrdersBySymbolReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersBySymbolReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersBySymbolReq { return plainToClassFromExist(new CancelAllOrdersBySymbolReq(), jsonObject); } @@ -57,6 +67,9 @@ export class CancelAllOrdersBySymbolReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelAllOrdersBySymbolReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts index d2610bf4..6fdc282b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_by_symbol_resp.ts @@ -10,6 +10,9 @@ export class CancelAllOrdersBySymbolResp implements Response { */ data: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -24,14 +27,21 @@ export class CancelAllOrdersBySymbolResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersBySymbolResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersBySymbolResp { return plainToClassFromExist(new CancelAllOrdersBySymbolResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts index 1e9d7a63..b2d993b5 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_failed_symbols.ts @@ -14,15 +14,25 @@ export class CancelAllOrdersFailedSymbols implements Serializable { */ error?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersFailedSymbols { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersFailedSymbols { return plainToClassFromExist(new CancelAllOrdersFailedSymbols(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts index c7cde64b..12f59e7d 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_all_orders_resp.ts @@ -17,6 +17,9 @@ export class CancelAllOrdersResp implements Response { @Type(() => CancelAllOrdersFailedSymbols) failedSymbols: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.succeedSymbols = null; @@ -33,14 +36,21 @@ export class CancelAllOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelAllOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelAllOrdersResp { return plainToClassFromExist(new CancelAllOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts index cd656625..a660bc6b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_req.ts @@ -11,6 +11,9 @@ export class CancelOcoOrderByClientOidReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOcoOrderByClientOidReq` class. @@ -34,14 +37,21 @@ export class CancelOcoOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOcoOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOcoOrderByClientOidReq { return plainToClassFromExist(new CancelOcoOrderByClientOidReq(), jsonObject); } @@ -59,6 +69,9 @@ export class CancelOcoOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOcoOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts index a1f0514c..da8a1ca6 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_client_oid_resp.ts @@ -10,6 +10,9 @@ export class CancelOcoOrderByClientOidResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelOcoOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOcoOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOcoOrderByClientOidResp { return plainToClassFromExist(new CancelOcoOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts index 35c5c34c..89f83057 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_req.ts @@ -11,6 +11,9 @@ export class CancelOcoOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOcoOrderByOrderIdReq` class. @@ -34,14 +37,21 @@ export class CancelOcoOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOcoOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOcoOrderByOrderIdReq { return plainToClassFromExist(new CancelOcoOrderByOrderIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class CancelOcoOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOcoOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts index 2f5bc2a9..8a5be8a9 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_oco_order_by_order_id_resp.ts @@ -10,6 +10,9 @@ export class CancelOcoOrderByOrderIdResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelOcoOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOcoOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOcoOrderByOrderIdResp { return plainToClassFromExist(new CancelOcoOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts index 799b5b37..94e672c0 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByClientOidOldReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidOldReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByClientOidOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidOldReq { return plainToClassFromExist(new CancelOrderByClientOidOldReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByClientOidOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts index 0cb18b23..a0345d9a 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_old_resp.ts @@ -20,6 +20,9 @@ export class CancelOrderByClientOidOldResp implements Response { */ cancelledOcoOrderIds: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -38,14 +41,21 @@ export class CancelOrderByClientOidOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidOldResp { return plainToClassFromExist(new CancelOrderByClientOidOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts index 93adba79..2f6a0e8c 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByClientOidReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidReq { return plainToClassFromExist(new CancelOrderByClientOidReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts index c1e2d16f..a624c3bd 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByClientOidResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -24,14 +27,21 @@ export class CancelOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidResp { return plainToClassFromExist(new CancelOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts index ec2ad208..d48e1efa 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByClientOidSyncReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByClientOidSyncReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByClientOidSyncReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidSyncReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidSyncReq { return plainToClassFromExist(new CancelOrderByClientOidSyncReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByClientOidSyncReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByClientOidSyncReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts index 176395bf..af320ad2 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_client_oid_sync_resp.ts @@ -35,6 +35,9 @@ export class CancelOrderByClientOidSyncResp implements Response { */ status: CancelOrderByClientOidSyncResp.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -59,14 +62,21 @@ export class CancelOrderByClientOidSyncResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByClientOidSyncResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByClientOidSyncResp { return plainToClassFromExist(new CancelOrderByClientOidSyncResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts index 9f898589..10e71c8f 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByOrderIdOldReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdOldReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByOrderIdOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdOldReq { return plainToClassFromExist(new CancelOrderByOrderIdOldReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByOrderIdOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByOrderIdOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts index 77633a91..033c84ac 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_old_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByOrderIdOldResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelOrderByOrderIdOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdOldResp { return plainToClassFromExist(new CancelOrderByOrderIdOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts index 50e79618..18ab4fc6 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByOrderIdReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdReq { return plainToClassFromExist(new CancelOrderByOrderIdReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts index 6babdc05..a6f086af 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_resp.ts @@ -10,6 +10,9 @@ export class CancelOrderByOrderIdResp implements Response { */ orderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -24,14 +27,21 @@ export class CancelOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdResp { return plainToClassFromExist(new CancelOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts index e95e75e3..10c1df38 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_req.ts @@ -16,6 +16,9 @@ export class CancelOrderByOrderIdSyncReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelOrderByOrderIdSyncReq` class. @@ -44,14 +47,21 @@ export class CancelOrderByOrderIdSyncReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdSyncReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdSyncReq { return plainToClassFromExist(new CancelOrderByOrderIdSyncReq(), jsonObject); } @@ -77,6 +87,9 @@ export class CancelOrderByOrderIdSyncReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelOrderByOrderIdSyncReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts index 0e7e1b71..488a6766 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_order_by_order_id_sync_resp.ts @@ -35,6 +35,9 @@ export class CancelOrderByOrderIdSyncResp implements Response { */ status: CancelOrderByOrderIdSyncResp.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -59,14 +62,21 @@ export class CancelOrderByOrderIdSyncResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelOrderByOrderIdSyncResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelOrderByOrderIdSyncResp { return plainToClassFromExist(new CancelOrderByOrderIdSyncResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts index 80074a6a..5dbe2263 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_req.ts @@ -21,6 +21,9 @@ export class CancelPartialOrderReq implements Serializable { */ cancelSize?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelPartialOrderReq` class. @@ -54,14 +57,21 @@ export class CancelPartialOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelPartialOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelPartialOrderReq { return plainToClassFromExist(new CancelPartialOrderReq(), jsonObject); } @@ -95,6 +105,9 @@ export class CancelPartialOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelPartialOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts index 9b5798f8..3cf40122 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_partial_order_resp.ts @@ -15,6 +15,9 @@ export class CancelPartialOrderResp implements Response { */ cancelSize: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -31,14 +34,21 @@ export class CancelPartialOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelPartialOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelPartialOrderResp { return plainToClassFromExist(new CancelPartialOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts index d7dace14..06d1981b 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_req.ts @@ -14,6 +14,9 @@ export class CancelStopOrderByClientOidReq implements Serializable { */ clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelStopOrderByClientOidReq` class. @@ -42,14 +45,21 @@ export class CancelStopOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelStopOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelStopOrderByClientOidReq { return plainToClassFromExist(new CancelStopOrderByClientOidReq(), jsonObject); } @@ -75,6 +85,9 @@ export class CancelStopOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelStopOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts index 708c47e9..e09d035a 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_client_oid_resp.ts @@ -15,6 +15,9 @@ export class CancelStopOrderByClientOidResp implements Response { */ cancelledOrderId: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.clientOid = null; @@ -31,14 +34,21 @@ export class CancelStopOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelStopOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelStopOrderByClientOidResp { return plainToClassFromExist(new CancelStopOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts index 52ff5f7b..ca1753bf 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_req.ts @@ -11,6 +11,9 @@ export class CancelStopOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `CancelStopOrderByOrderIdReq` class. @@ -34,14 +37,21 @@ export class CancelStopOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelStopOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelStopOrderByOrderIdReq { return plainToClassFromExist(new CancelStopOrderByOrderIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class CancelStopOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): CancelStopOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts index bb5d70a5..226cd704 100644 --- a/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_cancel_stop_order_by_order_id_resp.ts @@ -10,6 +10,9 @@ export class CancelStopOrderByOrderIdResp implements Response { */ cancelledOrderIds: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.cancelledOrderIds = null; @@ -24,14 +27,21 @@ export class CancelStopOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): CancelStopOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): CancelStopOrderByOrderIdResp { return plainToClassFromExist(new CancelStopOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts index 8be86830..e44121f5 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_items.ts @@ -174,6 +174,9 @@ export class GetClosedOrdersItems implements Serializable { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -238,14 +241,21 @@ export class GetClosedOrdersItems implements Serializable { // @ts-ignore this.active = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersItems { return plainToClassFromExist(new GetClosedOrdersItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts index 9f8cfadd..1080748f 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_req.ts @@ -39,6 +39,9 @@ export class GetClosedOrdersReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetClosedOrdersReq` class. @@ -96,14 +99,21 @@ export class GetClosedOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersReq { return plainToClassFromExist(new GetClosedOrdersReq(), jsonObject); } @@ -192,6 +202,9 @@ export class GetClosedOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetClosedOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts index 87acd142..c3b60e26 100644 --- a/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_closed_orders_resp.ts @@ -17,6 +17,9 @@ export class GetClosedOrdersResp implements Response { @Type(() => GetClosedOrdersItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.lastId = null; @@ -33,14 +36,21 @@ export class GetClosedOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetClosedOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetClosedOrdersResp { return plainToClassFromExist(new GetClosedOrdersResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts index 5dfb0bf2..d6a8374a 100644 --- a/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_dcp_resp.ts @@ -25,6 +25,9 @@ export class GetDCPResp implements Response { */ triggerTime?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * common response @@ -36,14 +39,21 @@ export class GetDCPResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetDCPResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetDCPResp { return plainToClassFromExist(new GetDCPResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts index f146ee4b..dbe743ab 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_req.ts @@ -11,6 +11,9 @@ export class GetOcoOrderByClientOidReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOcoOrderByClientOidReq` class. @@ -34,14 +37,21 @@ export class GetOcoOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderByClientOidReq { return plainToClassFromExist(new GetOcoOrderByClientOidReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetOcoOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOcoOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts index 08184369..763ac759 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_client_oid_resp.ts @@ -30,6 +30,9 @@ export class GetOcoOrderByClientOidResp implements Response { */ status: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -52,14 +55,21 @@ export class GetOcoOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderByClientOidResp { return plainToClassFromExist(new GetOcoOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts index edae8848..b79617cb 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_req.ts @@ -11,6 +11,9 @@ export class GetOcoOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOcoOrderByOrderIdReq` class. @@ -34,14 +37,21 @@ export class GetOcoOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderByOrderIdReq { return plainToClassFromExist(new GetOcoOrderByOrderIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetOcoOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOcoOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts index ad8a7e81..468c306b 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_by_order_id_resp.ts @@ -30,6 +30,9 @@ export class GetOcoOrderByOrderIdResp implements Response { */ status: GetOcoOrderByOrderIdResp.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -52,14 +55,21 @@ export class GetOcoOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderByOrderIdResp { return plainToClassFromExist(new GetOcoOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts index e7412459..b4f5446c 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_orders.ts @@ -39,6 +39,9 @@ export class GetOcoOrderDetailByOrderIdOrders implements Serializable { */ status: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -55,14 +58,21 @@ export class GetOcoOrderDetailByOrderIdOrders implements Serializable { // @ts-ignore this.status = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderDetailByOrderIdOrders { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdOrders { return plainToClassFromExist(new GetOcoOrderDetailByOrderIdOrders(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts index 92a6504a..8b104602 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_req.ts @@ -11,6 +11,9 @@ export class GetOcoOrderDetailByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOcoOrderDetailByOrderIdReq` class. @@ -34,14 +37,21 @@ export class GetOcoOrderDetailByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderDetailByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdReq { return plainToClassFromExist(new GetOcoOrderDetailByOrderIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetOcoOrderDetailByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOcoOrderDetailByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts index f1b017fc..34e63869 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_detail_by_order_id_resp.ts @@ -37,6 +37,9 @@ export class GetOcoOrderDetailByOrderIdResp implements Response { @Type(() => GetOcoOrderDetailByOrderIdOrders) orders: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -61,14 +64,21 @@ export class GetOcoOrderDetailByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderDetailByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderDetailByOrderIdResp { return plainToClassFromExist(new GetOcoOrderDetailByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts index 31ce5736..c50a40a6 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_items.ts @@ -29,6 +29,9 @@ export class GetOcoOrderListItems implements Serializable { */ status: GetOcoOrderListItems.StatusEnum; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -41,14 +44,21 @@ export class GetOcoOrderListItems implements Serializable { // @ts-ignore this.status = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderListItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderListItems { return plainToClassFromExist(new GetOcoOrderListItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts index 1dfb0fba..740bd380 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_req.ts @@ -34,6 +34,9 @@ export class GetOcoOrderListReq implements Serializable { */ currentPage?: number = 1; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOcoOrderListReq` class. @@ -90,14 +93,21 @@ export class GetOcoOrderListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderListReq { return plainToClassFromExist(new GetOcoOrderListReq(), jsonObject); } @@ -155,6 +165,9 @@ export class GetOcoOrderListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOcoOrderListReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts index 6d015b09..eecec0ca 100644 --- a/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_oco_order_list_resp.ts @@ -32,6 +32,9 @@ export class GetOcoOrderListResp implements Response { @Type(() => GetOcoOrderListItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetOcoOrderListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOcoOrderListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOcoOrderListResp { return plainToClassFromExist(new GetOcoOrderListResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts index 2aef49c8..2479183f 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_data.ts @@ -174,6 +174,9 @@ export class GetOpenOrdersData implements Serializable { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -238,14 +241,21 @@ export class GetOpenOrdersData implements Serializable { // @ts-ignore this.active = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersData { return plainToClassFromExist(new GetOpenOrdersData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts index 1bd237da..bf49d8fe 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_req.ts @@ -9,6 +9,9 @@ export class GetOpenOrdersReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOpenOrdersReq` class. @@ -32,14 +35,21 @@ export class GetOpenOrdersReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersReq { return plainToClassFromExist(new GetOpenOrdersReq(), jsonObject); } @@ -57,6 +67,9 @@ export class GetOpenOrdersReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOpenOrdersReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts index 4c955bed..3b724a84 100644 --- a/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_open_orders_resp.ts @@ -12,6 +12,9 @@ export class GetOpenOrdersResp implements Response { @Type(() => GetOpenOrdersData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetOpenOrdersResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOpenOrdersResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOpenOrdersResp { return plainToClassFromExist(new GetOpenOrdersResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts index 2a5bd830..9c907f7b 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_req.ts @@ -11,6 +11,9 @@ export class GetOrderByClientOidOldReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidOldReq` class. @@ -34,14 +37,21 @@ export class GetOrderByClientOidOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidOldReq { return plainToClassFromExist(new GetOrderByClientOidOldReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetOrderByClientOidOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByClientOidOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts index 55ccdcf0..8626cc05 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_old_resp.ts @@ -155,6 +155,9 @@ export class GetOrderByClientOidOldResp implements Response { */ tradeType: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -227,14 +230,21 @@ export class GetOrderByClientOidOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidOldResp { return plainToClassFromExist(new GetOrderByClientOidOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts index db2e27e3..fb9a0ebc 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_req.ts @@ -16,6 +16,9 @@ export class GetOrderByClientOidReq implements Serializable { @Reflect.metadata('path', 'clientOid') clientOid?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByClientOidReq` class. @@ -44,14 +47,21 @@ export class GetOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidReq { return plainToClassFromExist(new GetOrderByClientOidReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts index 89dd27f0..fd682841 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_client_oid_resp.ts @@ -175,6 +175,9 @@ export class GetOrderByClientOidResp implements Response { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -249,14 +252,21 @@ export class GetOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByClientOidResp { return plainToClassFromExist(new GetOrderByClientOidResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts index 352a7b7d..6c1edc5c 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_req.ts @@ -11,6 +11,9 @@ export class GetOrderByOrderIdOldReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdOldReq` class. @@ -34,14 +37,21 @@ export class GetOrderByOrderIdOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdOldReq { return plainToClassFromExist(new GetOrderByOrderIdOldReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetOrderByOrderIdOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByOrderIdOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts index 685fd517..ca9fafb8 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_old_resp.ts @@ -155,6 +155,9 @@ export class GetOrderByOrderIdOldResp implements Response { */ tradeType: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -227,14 +230,21 @@ export class GetOrderByOrderIdOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdOldResp { return plainToClassFromExist(new GetOrderByOrderIdOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts index e4141076..34a0759f 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_req.ts @@ -16,6 +16,9 @@ export class GetOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrderByOrderIdReq` class. @@ -44,14 +47,21 @@ export class GetOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdReq { return plainToClassFromExist(new GetOrderByOrderIdReq(), jsonObject); } @@ -77,6 +87,9 @@ export class GetOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts index 9a66291b..db0f5296 100644 --- a/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_order_by_order_id_resp.ts @@ -175,6 +175,9 @@ export class GetOrderByOrderIdResp implements Response { */ active: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -249,14 +252,21 @@ export class GetOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrderByOrderIdResp { return plainToClassFromExist(new GetOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts index 60c9f0ac..d1a424c3 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_items.ts @@ -154,6 +154,9 @@ export class GetOrdersListOldItems implements Serializable { */ tradeType: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -216,14 +219,21 @@ export class GetOrdersListOldItems implements Serializable { // @ts-ignore this.tradeType = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrdersListOldItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrdersListOldItems { return plainToClassFromExist(new GetOrdersListOldItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts index f45e814b..64150279 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_req.ts @@ -49,6 +49,9 @@ export class GetOrdersListOldReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetOrdersListOldReq` class. @@ -128,14 +131,21 @@ export class GetOrdersListOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrdersListOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrdersListOldReq { return plainToClassFromExist(new GetOrdersListOldReq(), jsonObject); } @@ -272,6 +282,9 @@ export class GetOrdersListOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetOrdersListOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts index a8ad1d61..243d8114 100644 --- a/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_orders_list_old_resp.ts @@ -32,6 +32,9 @@ export class GetOrdersListOldResp implements Response { @Type(() => GetOrdersListOldItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetOrdersListOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetOrdersListOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetOrdersListOldResp { return plainToClassFromExist(new GetOrdersListOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts index 46850d0b..9b044f36 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_data.ts @@ -154,6 +154,9 @@ export class GetRecentOrdersListOldData implements Serializable { */ tradeType: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -216,14 +219,21 @@ export class GetRecentOrdersListOldData implements Serializable { // @ts-ignore this.tradeType = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentOrdersListOldData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentOrdersListOldData { return plainToClassFromExist(new GetRecentOrdersListOldData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts index 23b1b29f..8b5096f3 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_req.ts @@ -14,6 +14,9 @@ export class GetRecentOrdersListOldReq implements Serializable { */ pageSize?: number = 50; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRecentOrdersListOldReq` class. @@ -50,14 +53,21 @@ export class GetRecentOrdersListOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentOrdersListOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentOrdersListOldReq { return plainToClassFromExist(new GetRecentOrdersListOldReq(), jsonObject); } @@ -83,6 +93,9 @@ export class GetRecentOrdersListOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRecentOrdersListOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts index 2e81a54c..933e4061 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_orders_list_old_resp.ts @@ -12,6 +12,9 @@ export class GetRecentOrdersListOldResp implements Response { @Type(() => GetRecentOrdersListOldData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetRecentOrdersListOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentOrdersListOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentOrdersListOldResp { return plainToClassFromExist(new GetRecentOrdersListOldResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts index b2303d47..9dad07d2 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_data.ts @@ -89,15 +89,25 @@ export class GetRecentTradeHistoryOldData implements Serializable { */ createdAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryOldData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryOldData { return plainToClassFromExist(new GetRecentTradeHistoryOldData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts index fc37c617..14f108a0 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_req.ts @@ -14,6 +14,9 @@ export class GetRecentTradeHistoryOldReq implements Serializable { */ pageSize?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetRecentTradeHistoryOldReq` class. @@ -46,14 +49,21 @@ export class GetRecentTradeHistoryOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryOldReq { return plainToClassFromExist(new GetRecentTradeHistoryOldReq(), jsonObject); } @@ -79,6 +89,9 @@ export class GetRecentTradeHistoryOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetRecentTradeHistoryOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts index 9570c12a..6d74ec49 100644 --- a/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_recent_trade_history_old_resp.ts @@ -12,6 +12,9 @@ export class GetRecentTradeHistoryOldResp implements Response { @Type(() => GetRecentTradeHistoryOldData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetRecentTradeHistoryOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetRecentTradeHistoryOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetRecentTradeHistoryOldResp { return plainToClassFromExist(new GetRecentTradeHistoryOldResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts index 1a0bc86f..ba232972 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_data.ts @@ -159,15 +159,25 @@ export class GetStopOrderByClientOidData implements Serializable { */ orderTime?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderByClientOidData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderByClientOidData { return plainToClassFromExist(new GetStopOrderByClientOidData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts index 5501f257..d4c88691 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_req.ts @@ -14,6 +14,9 @@ export class GetStopOrderByClientOidReq implements Serializable { */ symbol?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetStopOrderByClientOidReq` class. @@ -42,14 +45,21 @@ export class GetStopOrderByClientOidReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderByClientOidReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderByClientOidReq { return plainToClassFromExist(new GetStopOrderByClientOidReq(), jsonObject); } @@ -75,6 +85,9 @@ export class GetStopOrderByClientOidReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetStopOrderByClientOidReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts index 5c9fb72f..87b3aa82 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_client_oid_resp.ts @@ -12,6 +12,9 @@ export class GetStopOrderByClientOidResp implements Response { @Type(() => GetStopOrderByClientOidData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetStopOrderByClientOidResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderByClientOidResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderByClientOidResp { return plainToClassFromExist(new GetStopOrderByClientOidResp(), { data: jsonObject }); } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts index 98c31854..2247daf5 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_req.ts @@ -11,6 +11,9 @@ export class GetStopOrderByOrderIdReq implements Serializable { @Reflect.metadata('path', 'orderId') orderId?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetStopOrderByOrderIdReq` class. @@ -34,14 +37,21 @@ export class GetStopOrderByOrderIdReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderByOrderIdReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderByOrderIdReq { return plainToClassFromExist(new GetStopOrderByOrderIdReq(), jsonObject); } @@ -59,6 +69,9 @@ export class GetStopOrderByOrderIdReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetStopOrderByOrderIdReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts index e83e849e..b5978088 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_order_by_order_id_resp.ts @@ -160,6 +160,9 @@ export class GetStopOrderByOrderIdResp implements Response { */ orderTime?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * common response @@ -171,14 +174,21 @@ export class GetStopOrderByOrderIdResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrderByOrderIdResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrderByOrderIdResp { return plainToClassFromExist(new GetStopOrderByOrderIdResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts index a246c11c..fcbf9171 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_items.ts @@ -159,15 +159,25 @@ export class GetStopOrdersListItems implements Serializable { */ stopPrice?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrdersListItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrdersListItems { return plainToClassFromExist(new GetStopOrdersListItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts index a68d1b14..f557397c 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_req.ts @@ -54,6 +54,9 @@ export class GetStopOrdersListReq implements Serializable { */ stop?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetStopOrdersListReq` class. @@ -122,14 +125,21 @@ export class GetStopOrdersListReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrdersListReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrdersListReq { return plainToClassFromExist(new GetStopOrdersListReq(), jsonObject); } @@ -264,6 +274,9 @@ export class GetStopOrdersListReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetStopOrdersListReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts index 40025ee3..235b7545 100644 --- a/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_stop_orders_list_resp.ts @@ -32,6 +32,9 @@ export class GetStopOrdersListResp implements Response { @Type(() => GetStopOrdersListItems) items?: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * common response @@ -43,14 +46,21 @@ export class GetStopOrdersListResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetStopOrdersListResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetStopOrdersListResp { return plainToClassFromExist(new GetStopOrdersListResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts index 09449625..d843d941 100644 --- a/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_symbols_with_open_order_resp.ts @@ -10,6 +10,9 @@ export class GetSymbolsWithOpenOrderResp implements Response { */ symbols: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbols = null; @@ -24,14 +27,21 @@ export class GetSymbolsWithOpenOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetSymbolsWithOpenOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetSymbolsWithOpenOrderResp { return plainToClassFromExist(new GetSymbolsWithOpenOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts index 143bc32e..a80f2393 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_items.ts @@ -104,6 +104,9 @@ export class GetTradeHistoryItems implements Serializable { */ createdAt: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.id = null; @@ -146,14 +149,21 @@ export class GetTradeHistoryItems implements Serializable { // @ts-ignore this.createdAt = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryItems { return plainToClassFromExist(new GetTradeHistoryItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts index 6badea5d..d3cb6a72 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_items.ts @@ -89,15 +89,25 @@ export class GetTradeHistoryOldItems implements Serializable { */ createdAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryOldItems { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryOldItems { return plainToClassFromExist(new GetTradeHistoryOldItems(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts index e0383e3a..44974550 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_req.ts @@ -49,6 +49,9 @@ export class GetTradeHistoryOldReq implements Serializable { */ pageSize?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryOldReq` class. @@ -120,14 +123,21 @@ export class GetTradeHistoryOldReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryOldReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryOldReq { return plainToClassFromExist(new GetTradeHistoryOldReq(), jsonObject); } @@ -254,6 +264,9 @@ export class GetTradeHistoryOldReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryOldReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts index 81481ead..4a42572a 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_old_resp.ts @@ -32,6 +32,9 @@ export class GetTradeHistoryOldResp implements Response { @Type(() => GetTradeHistoryOldItems) items: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentPage = null; @@ -54,14 +57,21 @@ export class GetTradeHistoryOldResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryOldResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryOldResp { return plainToClassFromExist(new GetTradeHistoryOldResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts index 7644115f..30df3136 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_req.ts @@ -44,6 +44,9 @@ export class GetTradeHistoryReq implements Serializable { */ endAt?: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() {} /** * Creates a new instance of the `GetTradeHistoryReq` class. @@ -106,14 +109,21 @@ export class GetTradeHistoryReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryReq { return plainToClassFromExist(new GetTradeHistoryReq(), jsonObject); } @@ -210,6 +220,9 @@ export class GetTradeHistoryReqBuilder { return this; } + /** + * Get the final object. + */ build(): GetTradeHistoryReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts index 641f94ab..9942d242 100644 --- a/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts +++ b/sdk/node/src/generate/spot/order/model_get_trade_history_resp.ts @@ -17,6 +17,9 @@ export class GetTradeHistoryResp implements Response { */ lastId: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.items = null; @@ -33,14 +36,21 @@ export class GetTradeHistoryResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetTradeHistoryResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetTradeHistoryResp { return plainToClassFromExist(new GetTradeHistoryResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_modify_order_req.ts b/sdk/node/src/generate/spot/order/model_modify_order_req.ts index beeae2bb..9f93b811 100644 --- a/sdk/node/src/generate/spot/order/model_modify_order_req.ts +++ b/sdk/node/src/generate/spot/order/model_modify_order_req.ts @@ -29,6 +29,9 @@ export class ModifyOrderReq implements Serializable { */ newSize?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.symbol = null; @@ -75,14 +78,21 @@ export class ModifyOrderReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyOrderReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyOrderReq { return plainToClassFromExist(new ModifyOrderReq(), jsonObject); } @@ -132,6 +142,9 @@ export class ModifyOrderReqBuilder { return this; } + /** + * Get the final object. + */ build(): ModifyOrderReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts index 55d658fb..064e03fa 100644 --- a/sdk/node/src/generate/spot/order/model_modify_order_resp.ts +++ b/sdk/node/src/generate/spot/order/model_modify_order_resp.ts @@ -15,6 +15,9 @@ export class ModifyOrderResp implements Response { */ clientOid: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.newOrderId = null; @@ -31,14 +34,21 @@ export class ModifyOrderResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): ModifyOrderResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): ModifyOrderResp { return plainToClassFromExist(new ModifyOrderResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts index 5d125b7b..c32a722a 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_req.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_req.ts @@ -14,6 +14,9 @@ export class SetDCPReq implements Serializable { */ symbols?: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.timeout = null; @@ -45,14 +48,21 @@ export class SetDCPReq implements Serializable { return obj; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SetDCPReq { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SetDCPReq { return plainToClassFromExist(new SetDCPReq(), jsonObject); } @@ -78,6 +88,9 @@ export class SetDCPReqBuilder { return this; } + /** + * Get the final object. + */ build(): SetDCPReq { return this.obj; } diff --git a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts index 6af83f95..e0ef2090 100644 --- a/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts +++ b/sdk/node/src/generate/spot/order/model_set_dcp_resp.ts @@ -15,6 +15,9 @@ export class SetDCPResp implements Response { */ triggerTime: number; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.currentTime = null; @@ -31,14 +34,21 @@ export class SetDCPResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SetDCPResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SetDCPResp { return plainToClassFromExist(new SetDCPResp(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 290f293c..6c6208a2 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -86,14 +86,21 @@ export class AccountEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AccountEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AccountEvent { return plainToClassFromExist(new AccountEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts index 65ab0ed9..6a358c5b 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_relation_context.ts @@ -19,14 +19,21 @@ export class AccountRelationContext implements Serializable { // @ts-ignore this.orderId = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AccountRelationContext { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AccountRelationContext { return plainToClassFromExist(new AccountRelationContext(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts index 56eb0d97..527b8534 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -127,14 +127,21 @@ export class OrderV1Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderV1Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderV1Event { return plainToClassFromExist(new OrderV1Event(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index f2095bce..770add73 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -127,14 +127,21 @@ export class OrderV2Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderV2Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderV2Event { return plainToClassFromExist(new OrderV2Event(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index f2cf715d..359aec42 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -67,14 +67,21 @@ export class AllTickersEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): AllTickersEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): AllTickersEvent { return plainToClassFromExist(new AllTickersEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index 52ed59dc..b6a2d366 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -37,14 +37,21 @@ export class KlinesEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): KlinesEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): KlinesEvent { return plainToClassFromExist(new KlinesEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts index cc0ca315..a206cea7 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data.ts @@ -214,14 +214,21 @@ export class MarketSnapshotData implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarketSnapshotData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarketSnapshotData { return plainToClassFromExist(new MarketSnapshotData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts index d786df02..c788ab9e 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change1h.ts @@ -49,14 +49,21 @@ export class MarketSnapshotDataMarketChange1h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarketSnapshotDataMarketChange1h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange1h { return plainToClassFromExist(new MarketSnapshotDataMarketChange1h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts index f240bcd8..ce673db0 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change24h.ts @@ -49,14 +49,21 @@ export class MarketSnapshotDataMarketChange24h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarketSnapshotDataMarketChange24h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange24h { return plainToClassFromExist(new MarketSnapshotDataMarketChange24h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts index 14f7e27b..9ef4c0ab 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_data_market_change4h.ts @@ -49,14 +49,21 @@ export class MarketSnapshotDataMarketChange4h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarketSnapshotDataMarketChange4h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarketSnapshotDataMarketChange4h { return plainToClassFromExist(new MarketSnapshotDataMarketChange4h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index 229c532e..792f468f 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -32,14 +32,21 @@ export class MarketSnapshotEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): MarketSnapshotEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): MarketSnapshotEvent { return plainToClassFromExist(new MarketSnapshotEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts index 363e373b..22eb63d2 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_changes.ts @@ -19,14 +19,21 @@ export class OrderbookIncrementChanges implements Serializable { // @ts-ignore this.bids = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookIncrementChanges { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookIncrementChanges { return plainToClassFromExist(new OrderbookIncrementChanges(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index 7c5589b5..d6afd823 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -50,14 +50,21 @@ export class OrderbookIncrementEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookIncrementEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookIncrementEvent { return plainToClassFromExist(new OrderbookIncrementEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts index 1d6dc566..1dd1b664 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -37,14 +37,21 @@ export class OrderbookLevel1Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel1Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel1Event { return plainToClassFromExist(new OrderbookLevel1Event(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts index 5539a881..4b5b02a9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_changes.ts @@ -19,14 +19,21 @@ export class OrderbookLevel50Changes implements Serializable { // @ts-ignore this.bids = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel50Changes { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel50Changes { return plainToClassFromExist(new OrderbookLevel50Changes(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index 39cd70fa..57dc6306 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -50,14 +50,21 @@ export class OrderbookLevel50Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel50Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel50Event { return plainToClassFromExist(new OrderbookLevel50Event(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts index 1d83b255..023fcddb 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -37,14 +37,21 @@ export class OrderbookLevel5Event implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): OrderbookLevel5Event { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): OrderbookLevel5Event { return plainToClassFromExist(new OrderbookLevel5Event(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts index e93ad284..fb2410d7 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data.ts @@ -214,14 +214,21 @@ export class SymbolSnapshotData implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotData { return plainToClassFromExist(new SymbolSnapshotData(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts index a37d91b9..a6ae6e3b 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change1h.ts @@ -49,14 +49,21 @@ export class SymbolSnapshotDataMarketChange1h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotDataMarketChange1h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange1h { return plainToClassFromExist(new SymbolSnapshotDataMarketChange1h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts index d9e37520..97bffba8 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change24h.ts @@ -49,14 +49,21 @@ export class SymbolSnapshotDataMarketChange24h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotDataMarketChange24h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange24h { return plainToClassFromExist(new SymbolSnapshotDataMarketChange24h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts index d4d7fdc9..54aed780 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_data_market_change4h.ts @@ -49,14 +49,21 @@ export class SymbolSnapshotDataMarketChange4h implements Serializable { // @ts-ignore this.volValue = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotDataMarketChange4h { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotDataMarketChange4h { return plainToClassFromExist(new SymbolSnapshotDataMarketChange4h(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index c9de7aac..5d23f7a9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -32,14 +32,21 @@ export class SymbolSnapshotEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): SymbolSnapshotEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): SymbolSnapshotEvent { return plainToClassFromExist(new SymbolSnapshotEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts index 31b6d45c..2d083903 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -67,14 +67,21 @@ export class TickerEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TickerEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TickerEvent { return plainToClassFromExist(new TickerEvent(), jsonObject); } diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index 28f43c3f..e78a40d0 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -79,14 +79,21 @@ export class TradeEvent implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): TradeEvent { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): TradeEvent { return plainToClassFromExist(new TradeEvent(), jsonObject); } diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index eedbcf00..b4bfb1d1 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-20'; +export const SdkGenerateDate = '2025-01-21'; diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts index 4dad8609..468d11b8 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_ltv.ts @@ -29,6 +29,9 @@ export class GetAccountDetailLtv implements Serializable { */ currentLtv: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.transferLtv = null; @@ -41,14 +44,21 @@ export class GetAccountDetailLtv implements Serializable { // @ts-ignore this.currentLtv = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountDetailLtv { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountDetailLtv { return plainToClassFromExist(new GetAccountDetailLtv(), jsonObject); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts index e9fa4287..80ed8e50 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_margins.ts @@ -19,6 +19,9 @@ export class GetAccountDetailMargins implements Serializable { */ marginFactor: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.marginCcy = null; @@ -27,14 +30,21 @@ export class GetAccountDetailMargins implements Serializable { // @ts-ignore this.marginFactor = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountDetailMargins { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountDetailMargins { return plainToClassFromExist(new GetAccountDetailMargins(), jsonObject); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts index 43d81577..6116ee72 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_orders.ts @@ -24,6 +24,9 @@ export class GetAccountDetailOrders implements Serializable { */ currency: string; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.orderId = null; @@ -34,14 +37,21 @@ export class GetAccountDetailOrders implements Serializable { // @ts-ignore this.currency = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountDetailOrders { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountDetailOrders { return plainToClassFromExist(new GetAccountDetailOrders(), jsonObject); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts index da48fa5f..64b86225 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_account_detail_resp.ts @@ -41,6 +41,9 @@ export class GetAccountDetailResp implements Response { @Type(() => GetAccountDetailMargins) margins: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.parentUid = null; @@ -65,14 +68,21 @@ export class GetAccountDetailResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountDetailResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountDetailResp { return plainToClassFromExist(new GetAccountDetailResp(), jsonObject); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts index 42966f94..f3fed955 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_data.ts @@ -34,6 +34,9 @@ export class GetAccountsData implements Serializable { */ isParent: boolean; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.uid = null; @@ -48,14 +51,21 @@ export class GetAccountsData implements Serializable { // @ts-ignore this.isParent = null; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountsData { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountsData { return plainToClassFromExist(new GetAccountsData(), jsonObject); } diff --git a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts index 8a2ce550..ae4943e0 100644 --- a/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts +++ b/sdk/node/src/generate/viplending/viplending/model_get_accounts_resp.ts @@ -12,6 +12,9 @@ export class GetAccountsResp implements Response { @Type(() => GetAccountsData) data: Array; + /** + * Private constructor, please use the corresponding static methods to construct the object. + */ private constructor() { // @ts-ignore this.data = null; @@ -26,14 +29,21 @@ export class GetAccountsResp implements Response { this.commonResponse = response; } + /** + * Convert the object to a JSON string. + */ toJson(): string { return JSON.stringify(instanceToPlain(this.data)); } - + /** + * Create an object from a JSON string. + */ static fromJson(input: string): GetAccountsResp { return this.fromObject(JSON.parse(input)); } - + /** + * Create an object from Js Object. + */ static fromObject(jsonObject: Object): GetAccountsResp { return plainToClassFromExist(new GetAccountsResp(), { data: jsonObject }); } From 701d9af36df7e2df76509c23ae534fe531ade0f5 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 22 Jan 2025 15:58:09 +0800 Subject: [PATCH 058/106] feat(nodejs): add restful test & fix interceptor --- .../internal/infra/default_transport.test.ts | 211 ++++++++++++++++++ .../src/internal/infra/default_transport.ts | 90 +++----- sdk/node/src/model/transport_option.ts | 39 +++- 3 files changed, 277 insertions(+), 63 deletions(-) create mode 100644 sdk/node/src/internal/infra/default_transport.test.ts diff --git a/sdk/node/src/internal/infra/default_transport.test.ts b/sdk/node/src/internal/infra/default_transport.test.ts new file mode 100644 index 00000000..74ea9010 --- /dev/null +++ b/sdk/node/src/internal/infra/default_transport.test.ts @@ -0,0 +1,211 @@ +import { DefaultTransport } from '@internal/infra/default_transport'; +import { ClientOptionBuilder, Interceptor, RestResponse, TransportOptionBuilder } from '@src/model'; +import { AddressInfo } from 'net'; +import * as http from 'node:http'; +import { Exclude, instanceToPlain, plainToClassFromExist } from 'class-transformer'; +import { Response, Serializable } from '@internal/interfaces/serializable'; + +class TestModel implements Serializable { + @Reflect.metadata('path', 'orderId') + orderId?: string; + + @Reflect.metadata('path', 'orderId1') + orderId1?: string; + + v?: string; + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } +} + +class ResponseModel implements Response { + result?: string; + + static fromJson(input: string): ResponseModel { + return this.fromObject(JSON.parse(input)); + } + + static fromObject(jsonObject: Object): ResponseModel { + return plainToClassFromExist(new ResponseModel(), jsonObject); + } + + toJson(): string { + return JSON.stringify(instanceToPlain(this)); + } + + @Exclude() + commonResponse?: RestResponse; + + setCommonResponse(response: RestResponse): void { + this.commonResponse = response; + } +} + +describe('Transport Test', () => { + let server: http.Server; + let baseUrl: string; + let transport: DefaultTransport; + + beforeAll((done) => { + server = http.createServer((req, res) => { + if (req.url!.startsWith('/no-obj')) { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({})); + } else if (req.url!.startsWith('/no-obj2')) { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ data: null, code: 20000 })); + } else if (req.url!.startsWith('/normal-obj')) { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ data: { result: req.url }, code: 20000 })); + } else if (req.url!.startsWith('/path')) { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ data: { result: req.url }, code: 20000 })); + } else if (req.url!.startsWith('/post-body')) { + res.writeHead(200, { 'Content-Type': 'application/json' }); + let body = ''; + + req.on('data', (chunk) => { + body += chunk; + }); + + req.on('end', () => { + try { + const parsedBody = JSON.parse(body); + console.log('Received body:', parsedBody); + + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end( + JSON.stringify({ + data: { result: parsedBody }, + code: 20000, + }), + ); + } catch (err) { + console.error('Failed to parse body:', err); + res.writeHead(400, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ error: 'Invalid JSON' })); + } + }); + } else { + res.writeHead(404); + res.end(); + } + }); + + server.listen(() => { + const { port } = server.address() as AddressInfo; + baseUrl = `http://localhost:${port}`; + console.log(`Server listening on port ${port}`); + + let interceptors: Array = [ + { + before: { + onFulfilled: (config) => { + console.log('debug: ', config.url); + return config; + }, + }, + after: {}, + }, + ]; + + transport = new DefaultTransport( + new ClientOptionBuilder() + .setSpotEndpoint(baseUrl) + .setTransportOption( + new TransportOptionBuilder().setInterceptors(interceptors).build(), + ) + .build(), + '', + ); + done(); + }); + + server.on('error', (err) => { + console.error('Server error:', err); + }); + }); + + afterAll((done) => { + transport.close(); + server.close(done); + }); + + test('test response', async () => { + await transport + .call('spot', false, 'get', '/no-obj', null, ResponseModel, false) + .then((result: ResponseModel) => {}); + await transport + .call('spot', false, 'get', '/no-obj2', null, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toBeUndefined(); + }); + await transport + .call('spot', false, 'get', '/normal-obj', null, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/normal-obj'); + }); + }); + + test('test path', async () => { + await transport + .call('spot', false, 'get', '/path/test', null, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/path/test'); + }); + + await transport + .call('spot', false, 'get', '/path/test', new TestModel(), ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/path/test'); + }); + + let m = new TestModel(); + m.orderId = '123'; + await transport + .call('spot', false, 'get', '/path/test/{orderId}', m, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/path/test/123'); + }); + + m.orderId1 = '234'; + await transport + .call('spot', false, 'get', '/path/test/{orderId}/{orderId1}', m, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/path/test/123/234'); + }); + + m.v = 'value'; + await transport + .call('spot', false, 'get', '/path/test/{orderId}/{orderId1}', m, ResponseModel, false) + .then((result: ResponseModel) => { + expect(result.result).toEqual('/path/test/123/234?v=value'); + }); + }); + + test('send post', async () => { + let m = new TestModel(); + m.orderId = '123'; + m.orderId1 = '234'; + m.v = 'value'; + + await transport + .call('spot', false, 'post', '/post-body', m, ResponseModel, false) + .then((result: ResponseModel) => { + let rest: any = result.result; + expect(rest.orderId).toEqual('123'); + expect(rest.orderId1).toEqual('234'); + expect(rest.v).toEqual('value'); + }); + + await transport + .call('spot', false, 'get', '/post-body', m, ResponseModel, true) + .then((result: ResponseModel) => { + let rest: any = result.result; + expect(rest.orderId).toEqual('123'); + expect(rest.orderId1).toEqual('234'); + expect(rest.v).toEqual('value'); + }); + }); +}); diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index c003cab1..b22c2ebf 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -5,8 +5,12 @@ import { RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { DEFAULT_TRANSPORT_OPTION, TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; -import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from 'axios'; -import axios from 'axios'; +import axios, { + AxiosInstance, + AxiosRequestConfig, + AxiosResponse, + CreateAxiosDefaults, +} from 'axios'; import 'reflect-metadata'; import axiosRetry from 'axios-retry'; import { Agent as HttpAgent } from 'http'; @@ -45,20 +49,28 @@ export class DefaultTransport implements Transport { }, httpAgent: trans_option.keepAlive ? new HttpAgent({ - maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, - maxFreeSockets: trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + maxSockets: + trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: + trans_option.maxIdleConnsPerHost || + DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, keepAlive: true, - keepAliveMsecs: trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, + keepAliveMsecs: + trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, }) : undefined, httpsAgent: trans_option.keepAlive ? new HttpsAgent({ - maxSockets: trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, - maxFreeSockets: trans_option.maxIdleConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, + maxSockets: + trans_option.maxConnsPerHost || DEFAULT_TRANSPORT_OPTION.maxConnsPerHost, + maxFreeSockets: + trans_option.maxIdleConnsPerHost || + DEFAULT_TRANSPORT_OPTION.maxIdleConnsPerHost, timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, keepAlive: true, - keepAliveMsecs: trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, + keepAliveMsecs: + trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, }) : undefined, } as CreateAxiosDefaults); @@ -86,40 +98,17 @@ export class DefaultTransport implements Transport { }, }); - // todo: Use user interceptors, avoid defaults. - instance.interceptors.request.use( - (config) => { - console.log('[REQUEST]', { - method: config.method?.toUpperCase(), - url: config.url, - }); - return config; - }, - (error) => { - console.error('[REQUEST ERROR]', error.message); - return Promise.reject(error); - }, - ); - - instance.interceptors.response.use( - (response) => { - if (response.status >= 400) { - console.error('[RESPONSE ERROR]', { - status: response.status, - data: response.data, - }); - } - return response; - }, - (error) => { - console.error('[RESPONSE ERROR]', { - message: error.message, - status: error.response?.status, - data: error.response?.data, - }); - return Promise.reject(error); - }, - ); + this.transportOption.interceptors?.forEach((interceptor) => { + instance.interceptors.request.use( + interceptor.before.onFulfilled, + interceptor.before.onRejected, + interceptor.before.options, + ); + instance.interceptors.response.use( + interceptor.after.onFulfilled, + interceptor.after.onRejected, + ); + }); return instance; } @@ -207,7 +196,7 @@ export class DefaultTransport implements Transport { if (requestObj) { // create a new object for query parameters const queryObj: Record = { ...requestObj }; - + // check path variables and remove from query const pathVarPattern = /{([^}]+)}/g; let match; @@ -272,24 +261,16 @@ export class DefaultTransport implements Transport { response: AxiosResponse, responseCls: StaticDeserializable, ): Response { - // Initialize response object first - let responseObj = responseCls.fromObject({}); - const commonResponse = RestResponse.fromJson(JSON.stringify(response.data)); - commonResponse.rateLimit = this.processLimit(response.headers); - if (commonResponse.data === null) { + if (commonResponse.data == null) { + let responseObj = responseCls.fromObject({}); responseObj.setCommonResponse(commonResponse); return responseObj; } - try{ - responseObj = responseCls.fromObject(commonResponse.data); - }catch(e){ - throw e; - } - + let responseObj = responseCls.fromObject(commonResponse.data); responseObj.setCommonResponse(commonResponse); return responseObj; @@ -305,6 +286,7 @@ export class DefaultTransport implements Transport { requestJson: boolean, args?: any, ): Promise { + method = method.toUpperCase(); return Promise.resolve() .then((): AxiosRequestConfig => { const endpoint = this.getEndpoint(domain); diff --git a/sdk/node/src/model/transport_option.ts b/sdk/node/src/model/transport_option.ts index b96fa94e..0527d222 100644 --- a/sdk/node/src/model/transport_option.ts +++ b/sdk/node/src/model/transport_option.ts @@ -1,20 +1,41 @@ +import { AxiosInterceptorOptions, AxiosResponse, InternalAxiosRequestConfig } from 'axios'; + +/** + * Describes the structure for Axios request interceptors. + * @template T - The type of the request configuration. + */ +export interface AxiosRequestInterceptor { + onFulfilled?: + | (( + value: InternalAxiosRequestConfig, + ) => InternalAxiosRequestConfig | Promise) + | null; + onRejected?: ((error: any) => any) | null; + options?: AxiosInterceptorOptions; +} + +/** + * Describes the structure for Axios response interceptors. + * @template T - The type of the response. + */ +export interface AxiosResponseInterceptor { + onFulfilled?: ((value: AxiosResponse) => AxiosResponse | Promise) | null; + onRejected?: ((error: any) => any) | null; +} + /** - * Interceptor interface for defining HTTP request interceptors + * Represents HTTP interceptors for requests and responses. */ export interface Interceptor { /** - * Before the request is sent. Allows modification of the request before sending + * Handles modifications to the request before sending. */ - before(req: Request): Promise | Request; + before: AxiosRequestInterceptor; /** - * After the request is completed. Allows processing of the response or error. + * Handles processing of the response or errors. */ - after( - req: Request, - resp: Response | null, - err?: Error, - ): Promise | Response | null; + after: AxiosResponseInterceptor; } /** From 3616311fd246080b9ea46bf90ecb43bbe174c4b3 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 22 Jan 2025 17:16:13 +0800 Subject: [PATCH 059/106] feat(nodejs): wrap error --- .../src/internal/infra/default_transport.ts | 14 ++++- sdk/node/src/model/common.ts | 46 +++++++++----- .../e2e/rest/account_test/account_api.test.ts | 60 ++++++++++++------- 3 files changed, 83 insertions(+), 37 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index b22c2ebf..f0f26902 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -1,7 +1,7 @@ import { Transport } from '@internal/interfaces/transport'; import { Response, Serializable, StaticDeserializable } from '@internal/interfaces/serializable'; import { ClientOption } from '@model/client_option'; -import { RestRateLimit, RestResponse } from '@model/common'; +import { RestError, RestRateLimit, RestResponse } from '@model/common'; import { DomainType } from '@model/constant'; import { DEFAULT_TRANSPORT_OPTION, TransportOption } from '@model/transport_option'; import { KcSigner } from './default_signer'; @@ -261,8 +261,13 @@ export class DefaultTransport implements Transport { response: AxiosResponse, responseCls: StaticDeserializable, ): Response { + if (response.status != 200) { + throw new Error(`Invalid status code: ${response.status}, msg: ${response.data}`); + } + const commonResponse = RestResponse.fromJson(JSON.stringify(response.data)); commonResponse.rateLimit = this.processLimit(response.headers); + commonResponse.checkRestResponseError(); if (commonResponse.data == null) { let responseObj = responseCls.fromObject({}); @@ -272,7 +277,6 @@ export class DefaultTransport implements Transport { let responseObj = responseCls.fromObject(commonResponse.data); responseObj.setCommonResponse(commonResponse); - return responseObj; } @@ -309,7 +313,11 @@ export class DefaultTransport implements Transport { return this.processResponse(response, responseCls); }) .catch((err: any) => { - throw err; + if (err instanceof RestError) { + throw err; + } else { + throw new RestError(null, err.message); + } }); } diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index 74f3d0ab..23058527 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -37,27 +37,45 @@ export class RestResponse { /** * Optional response message */ - message?: string; + msg?: string; static fromJson(json: string): RestResponse { return plainToInstance(RestResponse, JSON.parse(json)); } + + checkRestResponseError() { + /** + * Code for success + */ + const CodeSuccess = '200000'; + if (this.code === CodeSuccess) { + return; + } + throw new RestError( + this, + `Server returned error, code: {${this.code}}, message: {${this.msg || 'unknown'}}`, + ); + } } -/** - * Function to check if a RestResponse indicates an error. - */ -export function checkRestResponseError(resp: RestResponse): Error | null { - /** - * Code for success - */ - const CodeSuccess = '200000'; - if (resp.code === CodeSuccess) { - return null; +export class RestError extends Error { + constructor( + private response: RestResponse | null, + private msg?: string, + ) { + super(msg); + } + + toString() { + if (this.response) { + return `request error, server code: ${this.response.code}, server msg: ${this.response.msg}, context msg: ${this.msg}`; + } + return `request error, context msg: ${this.msg}`; + } + + getCommonResponse() { + return this.response; } - return new Error( - `Server returned error, code: {${resp.code}}, message: {${resp.message || 'unknown'}}`, - ); } /** diff --git a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts index 870b0a24..322cdf56 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts @@ -93,7 +93,6 @@ describe('Auto Test', () => { expect(result.createdAt).toEqual(expect.anything()); expect(result.uid).toEqual(expect.anything()); expect(result.isMaster).toEqual(expect.anything()); - expect(result.subName).toEqual(expect.anything()); console.log(result); }); }); @@ -121,12 +120,20 @@ describe('Auto Test', () => { builder.setType(GetSpotAccountListReq.TypeEnum.MAIN); let req = builder.build(); let resp = api.getSpotAccountList(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach(item => { + expect(item.available).toEqual(expect.anything()); + expect(item.balance).toEqual(expect.anything()); + expect(item.currency).toEqual(expect.anything()); + expect(item.holds).toEqual(expect.anything()); + expect(item.id).toEqual(expect.anything()); + expect(item.type).toEqual(expect.anything()); + }) console.log(result); }); }); + // TODO test('getSpotAccountDetail request test', () => { /** * getSpotAccountDetail @@ -137,7 +144,7 @@ describe('Auto Test', () => { builder.setAccountId('671badb050647f0007d94011'); let req = builder.build(); let resp = api.getSpotAccountDetail(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currency).toEqual(expect.anything()); expect(result.balance).toEqual(expect.anything()); expect(result.available).toEqual(expect.anything()); @@ -153,10 +160,12 @@ describe('Auto Test', () => { * /api/v3/margin/accounts */ let builder = GetCrossMarginAccountReq.builder(); - builder.setQuoteCurrency(GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT).setQueryType(GetCrossMarginAccountReq.QueryTypeEnum.MARGIN); + builder + .setQuoteCurrency(GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT) + .setQueryType(GetCrossMarginAccountReq.QueryTypeEnum.MARGIN); let req = builder.build(); let resp = api.getCrossMarginAccount(req); - return resp.then(result => { + return resp.then((result) => { expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); expect(result.debtRatio).toEqual(expect.anything()); @@ -173,10 +182,13 @@ describe('Auto Test', () => { * /api/v3/isolated/accounts */ let builder = GetIsolatedMarginAccountReq.builder(); - builder.setSymbol('BTC-USDT').setQuoteCurrency(GetIsolatedMarginAccountReq.QuoteCurrencyEnum.USDT).setQueryType(GetIsolatedMarginAccountReq.QueryTypeEnum.ISOLATED); + builder + .setSymbol('BTC-USDT') + .setQuoteCurrency(GetIsolatedMarginAccountReq.QuoteCurrencyEnum.USDT) + .setQueryType(GetIsolatedMarginAccountReq.QueryTypeEnum.ISOLATED); let req = builder.build(); let resp = api.getIsolatedMarginAccount(req); - return resp.then(result => { + return resp.then((result) => { expect(result.totalAssetOfQuoteCurrency).toEqual(expect.anything()); expect(result.totalLiabilityOfQuoteCurrency).toEqual(expect.anything()); expect(result.timestamp).toEqual(expect.anything()); @@ -195,7 +207,7 @@ describe('Auto Test', () => { builder.setCurrency('XBT'); let req = builder.build(); let resp = api.getFuturesAccount(req); - return resp.then(result => { + return resp.then((result) => { expect(result.accountEquity).toEqual(expect.anything()); expect(result.unrealisedPNL).toEqual(expect.anything()); expect(result.marginBalance).toEqual(expect.anything()); @@ -216,10 +228,15 @@ describe('Auto Test', () => { * /api/v1/accounts/ledgers */ let builder = GetSpotLedgerReq.builder(); - builder.setCurrency('USDT').setStartAt(1732032000000).setEndAt(1732118400000).setCurrentPage(1).setPageSize(100); + builder + .setCurrency('USDT') + .setStartAt(1732032000000) + .setEndAt(1732118400000) + .setCurrentPage(1) + .setPageSize(100); let req = builder.build(); let resp = api.getSpotLedger(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); @@ -236,10 +253,13 @@ describe('Auto Test', () => { * /api/v1/hf/accounts/ledgers */ let builder = GetSpotHFLedgerReq.builder(); - builder.setCurrency('USDT').setDirection(GetSpotHFLedgerReq.DirectionEnum.OUT).setBizType(GetSpotHFLedgerReq.BizTypeEnum.TRANSFER) + builder + .setCurrency('USDT') + .setDirection(GetSpotHFLedgerReq.DirectionEnum.OUT) + .setBizType(GetSpotHFLedgerReq.BizTypeEnum.TRANSFER); let req = builder.build(); let resp = api.getSpotHFLedger(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(result); }); @@ -252,10 +272,10 @@ describe('Auto Test', () => { * /api/v3/hf/margin/account/ledgers */ let builder = GetMarginHFLedgerReq.builder(); - builder.setCurrency('USDT') + builder.setCurrency('USDT'); let req = builder.build(); let resp = api.getMarginHFLedger(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(result); }); @@ -268,10 +288,10 @@ describe('Auto Test', () => { * /api/v1/transaction-history */ let builder = GetFuturesLedgerReq.builder(); - builder.setCurrency('DOT').setType('RealisedPNL') + builder.setCurrency('DOT').setType('RealisedPNL'); let req = builder.build(); let resp = api.getFuturesLedger(req); - return resp.then(result => { + return resp.then((result) => { expect(result.dataList).toEqual(expect.anything()); expect(result.hasMore).toEqual(expect.anything()); console.log(result); @@ -285,7 +305,7 @@ describe('Auto Test', () => { * /api/v1/margin/account */ let resp = api.getMarginAccountDetail(); - return resp.then(result => { + return resp.then((result) => { expect(result.debtRatio).toEqual(expect.anything()); expect(result.accounts).toEqual(expect.anything()); console.log(result); @@ -302,7 +322,7 @@ describe('Auto Test', () => { builder.setBalanceCurrency(GetIsolatedMarginAccountListV1Req.BalanceCurrencyEnum.BTC); let req = builder.build(); let resp = api.getIsolatedMarginAccountListV1(req); - return resp.then(result => { + return resp.then((result) => { expect(result.totalConversionBalance).toEqual(expect.anything()); expect(result.liabilityConversionBalance).toEqual(expect.anything()); expect(result.assets).toEqual(expect.anything()); @@ -320,7 +340,7 @@ describe('Auto Test', () => { builder.setSymbol('BTC-USDT'); let req = builder.build(); let resp = api.getIsolatedMarginAccountDetailV1(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.debtRatio).toEqual(expect.anything()); From 9e386d3b8f4b8ea328a9f67e669df7c081d2a913 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 23 Jan 2025 16:35:23 +0800 Subject: [PATCH 060/106] feat(nodejs): update tests --- .../internal/infra/default_transport.test.ts | 28 ++++++++++++------- .../e2e/rest/account_test/account_api.test.ts | 8 ++++-- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.test.ts b/sdk/node/src/internal/infra/default_transport.test.ts index 74ea9010..817b8509 100644 --- a/sdk/node/src/internal/infra/default_transport.test.ts +++ b/sdk/node/src/internal/infra/default_transport.test.ts @@ -1,5 +1,11 @@ import { DefaultTransport } from '@internal/infra/default_transport'; -import { ClientOptionBuilder, Interceptor, RestResponse, TransportOptionBuilder } from '@src/model'; +import { + ClientOptionBuilder, + Interceptor, + RestError, + RestResponse, + TransportOptionBuilder, +} from '@src/model'; import { AddressInfo } from 'net'; import * as http from 'node:http'; import { Exclude, instanceToPlain, plainToClassFromExist } from 'class-transformer'; @@ -54,13 +60,13 @@ describe('Transport Test', () => { res.end(JSON.stringify({})); } else if (req.url!.startsWith('/no-obj2')) { res.writeHead(200, { 'Content-Type': 'application/json' }); - res.end(JSON.stringify({ data: null, code: 20000 })); + res.end(JSON.stringify({ data: null, code: '200000' })); } else if (req.url!.startsWith('/normal-obj')) { res.writeHead(200, { 'Content-Type': 'application/json' }); - res.end(JSON.stringify({ data: { result: req.url }, code: 20000 })); + res.end(JSON.stringify({ data: { result: req.url }, code: '200000' })); } else if (req.url!.startsWith('/path')) { res.writeHead(200, { 'Content-Type': 'application/json' }); - res.end(JSON.stringify({ data: { result: req.url }, code: 20000 })); + res.end(JSON.stringify({ data: { result: req.url }, code: '200000' })); } else if (req.url!.startsWith('/post-body')) { res.writeHead(200, { 'Content-Type': 'application/json' }); let body = ''; @@ -78,7 +84,7 @@ describe('Transport Test', () => { res.end( JSON.stringify({ data: { result: parsedBody }, - code: 20000, + code: '200000', }), ); } catch (err) { @@ -135,16 +141,18 @@ describe('Transport Test', () => { test('test response', async () => { await transport .call('spot', false, 'get', '/no-obj', null, ResponseModel, false) - .then((result: ResponseModel) => {}); + .catch((err) => { + expect(err).toBeInstanceOf(RestError); + }); await transport .call('spot', false, 'get', '/no-obj2', null, ResponseModel, false) - .then((result: ResponseModel) => { - expect(result.result).toBeUndefined(); + .catch((err) => { + expect(err).toBeInstanceOf(RestError); }); await transport .call('spot', false, 'get', '/normal-obj', null, ResponseModel, false) - .then((result: ResponseModel) => { - expect(result.result).toEqual('/normal-obj'); + .catch((err) => { + expect(err).toBeInstanceOf(RestError); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts index 322cdf56..8baccb9c 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts @@ -121,14 +121,14 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getSpotAccountList(req); return resp.then((result) => { - result.data.forEach(item => { + result.data.forEach((item) => { expect(item.available).toEqual(expect.anything()); expect(item.balance).toEqual(expect.anything()); expect(item.currency).toEqual(expect.anything()); expect(item.holds).toEqual(expect.anything()); expect(item.id).toEqual(expect.anything()); expect(item.type).toEqual(expect.anything()); - }) + }); console.log(result); }); }); @@ -221,6 +221,7 @@ describe('Auto Test', () => { }); }); + // todo empty test('getSpotLedger request test', () => { /** * getSpotLedger @@ -246,6 +247,7 @@ describe('Auto Test', () => { }); }); + // todo empty test('getSpotHFLedger request test', () => { /** * getSpotHFLedger @@ -265,6 +267,7 @@ describe('Auto Test', () => { }); }); + // todo empty test('getMarginHFLedger request test', () => { /** * getMarginHFLedger @@ -281,6 +284,7 @@ describe('Auto Test', () => { }); }); + // todo empyty test('getFuturesLedger request test', () => { /** * getFuturesLedger From 2db3b0c5748fae6aa14b1bf5509b9f2b2282e227 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 10 Feb 2025 16:38:14 +0800 Subject: [PATCH 061/106] feat(nodejs): update websocket examples --- sdk/node/example/src/ts/example_ws.ts | 597 ++++++++++++++++++++++++++ 1 file changed, 597 insertions(+) create mode 100644 sdk/node/example/src/ts/example_ws.ts diff --git a/sdk/node/example/src/ts/example_ws.ts b/sdk/node/example/src/ts/example_ws.ts new file mode 100644 index 00000000..22721802 --- /dev/null +++ b/sdk/node/example/src/ts/example_ws.ts @@ -0,0 +1,597 @@ +import 'reflect-metadata'; +import { EventEmitter } from 'events'; +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, + WebSocketEvent, + SpotPublicWS, + TransportOptionBuilder +} from 'kucoin-universal-sdk'; + +// Create a custom event handler class +class WebSocketEventHandler extends EventEmitter { + constructor() { + super(); + this.setupEventHandlers(); + } + + private setupEventHandlers() { + // Connection related events + this.on('ws_event', (event: WebSocketEvent, msg: string) => { + switch (event) { + case WebSocketEvent.EventConnected: + console.log('WebSocket Connected'); + break; + case WebSocketEvent.EventDisconnected: + console.log('WebSocket Disconnected:', msg); + break; + case WebSocketEvent.EventTryReconnect: + console.log('Attempting to reconnect:', msg); + break; + case WebSocketEvent.EventReSubscribeOK: + console.log('Resubscription successful'); + break; + case WebSocketEvent.EventReSubscribeError: + console.log('Resubscription failed:', msg); + break; + case WebSocketEvent.EventErrorReceived: + console.log('Error occurred:', msg); + break; + case WebSocketEvent.EventClientFail: + console.log('Client failure:', msg); + break; + case WebSocketEvent.EventMessageReceived: + // Skip logging for regular message events + break; + default: + console.log(`Other event - ${event}:`, msg); + } + }); + + // Ticker event handler + this.on('ticker_update', (topic: string, data: TickerEvent) => { + const symbol = topic.split(':')[1]; + console.log(`Price Update: ${symbol} = ${data.price} (${data.size})`); + }); + + // AllTickers event handler + this.on('all_tickers_update', (topic: string, data: AllTickersEvent) => { + console.log(`Market-wide Update: ${data.time}`); + console.log(` Symbol: ${topic.split(':')[1]}`); + console.log(` Latest Price: ${data.price}`); + console.log(` Best Bid: ${data.bestBid} (${data.bestBidSize})`); + console.log(` Best Ask: ${data.bestAsk} (${data.bestAskSize})`); + }); + + // OrderbookLevel1 event handler + this.on('level1_update', (topic: string, data: OrderbookLevel1Event) => { + const symbol = topic.split(':')[1]; + console.log(`Level1 Depth Update: ${symbol}`); + if (data.bids && data.bids.length >= 2) { + console.log(` Best Bid: ${data.bids[0]} (${data.bids[1]})`); + } + if (data.asks && data.asks.length >= 2) { + console.log(` Best Ask: ${data.asks[0]} (${data.asks[1]})`); + } + console.log(` Update Time: ${data.timestamp}`); + console.log(' ----------------'); + }); + + // OrderbookLevel5 event handler + this.on('level5_update', (topic: string, data: OrderbookLevel5Event) => { + const symbol = topic.split(':')[1]; + console.log(`Level5 Depth Update: ${symbol}`); + console.log(` Top 5 Bids:`); + data.bids.slice(0, 5).forEach((bid, index) => { + console.log(` ${index + 1}. Price: ${bid[0]}, Size: ${bid[1]}`); + }); + console.log(` Top 5 Asks:`); + data.asks.slice(0, 5).forEach((ask, index) => { + console.log(` ${index + 1}. Price: ${ask[0]}, Size: ${ask[1]}`); + }); + console.log(` Update Time: ${data.timestamp}`); + }); + + // Level2/Level50 depth update handler + this.on('level50_update', (topic: string, data: OrderbookLevel50Event) => { + const symbol = topic.split(':')[1]; + console.log(`Depth Data Update: ${symbol}`); + try { + if (data && typeof data === 'object') { + if ('changes' in data) { + console.log(` ===== Incremental Depth Update =====`); + const changes = data.changes; + if (changes.asks && changes.asks.length > 0) { + console.log(' Ask Updates:'); + changes.asks.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + if (changes.bids && changes.bids.length > 0) { + console.log(' Bid Updates:'); + changes.bids.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + console.log(` Sequence: ${data.sequenceStart} - ${data.sequenceEnd}`); + console.log(` Time: ${new Date(data.time).toLocaleString()}`); + } else { + // Full depth data (if available) + console.log(` Bid Count: ${data?.bids?.length || 0}`); + console.log(` Ask Count: ${data?.asks?.length || 0}`); + console.log(` Update Time: ${data?.timestamp ? new Date(data.timestamp).toLocaleString() : 'N/A'}`); + } + } + } catch (error) { + console.error(' Data Processing Error:', error); + } + }); + + // OrderbookIncrement event handler + this.on('increment_update', (topic: string, data: OrderbookIncrementEvent) => { + try { + const symbol = topic.split(':')[1]; + console.log(`Incremental Depth Update: ${symbol}`); + + if (data.changes) { + if (data.changes.asks && data.changes.asks.length > 0) { + console.log(' Ask Changes:'); + data.changes.asks.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + if (data.changes.bids && data.changes.bids.length > 0) { + console.log(' Bid Changes:'); + data.changes.bids.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + } + + console.log(` Change Summary - Asks: ${data.changes?.asks?.length || 0}, Bids: ${data.changes?.bids?.length || 0}`); + if (data.sequence) { + console.log(` Sequence: ${data.sequence}`); + } + console.log(` Event: ${topic}`); + console.log(' ----------------'); + + // Emit event after successful processing + this.eventHandler.emit('increment_update', topic, data); + } catch (error) { + console.error('Error processing increment update:', error); + } + }); + + // Trade event handler + this.on('trade_update', (topic: string, data: TradeEvent) => { + const symbol = topic.split(':')[1]; + console.log(`Trade Update: ${symbol}`); + console.log(` Price: ${data.price}, Size: ${data.size}, Side: ${data.side}`); + }); + + // Klines event handler + this.on('klines_update', (topic: string, data: KlinesEvent) => { + const [startTime, open, close, high, low, volume, amount] = data.candles; + console.log(`Kline Update: ${data.symbol}`); + console.log(` Time: ${startTime}`); + console.log(` Open: ${open}`); + console.log(` Close: ${close}`); + console.log(` High: ${high}`); + console.log(` Low: ${low}`); + console.log(` Volume: ${volume}`); + console.log(` Amount: ${amount}`); + }); + + // Symbol snapshot event handler + this.on('symbol_snapshot_update', (topic: string, data: SymbolSnapshotEvent) => { + console.log(`Symbol Snapshot: ${data.data.symbol}`); + console.log(` Latest Price: ${data.data.close}`); + console.log(` 24h High: ${data.data.high}`); + console.log(` 24h Low: ${data.data.low}`); + console.log(` 24h Volume: ${data.data.vol}`); + console.log(` 24h Amount: ${data.data.volValue}`); + console.log(` Update Time: ${data.data.datetime}`); + }); + } + + // Add a method to handle WebSocket events + handleWebSocketEvent(event: WebSocketEvent, msg: string) { + this.emit('ws_event', event, msg); + } +} + +// Interface configuration type +interface WebSocketConfig { + ticker: boolean; + allTickers: boolean; + depth: { + level1: boolean; + level5: boolean; + level50: boolean; + increment: boolean; + }; + trade: boolean; + klines: boolean; + snapshot: boolean; + symbols: string[]; + waitTime: number; +} + +// Default configuration +const defaultConfig: WebSocketConfig = { + ticker: false, + allTickers: false, + depth: { + level1: false, + level5: false, + level50: false, + increment: false + }, + trade: false, + klines: false, + snapshot: false, + symbols: ["BTC-USDT"], + waitTime: 30000 +}; + +// Callback handlers for different types of market data +class MarketDataHandlers { + constructor(private eventHandler: WebSocketEventHandler) {} + + // Ticker handlers + tickerCallback = (topic: string, subject: string, data: TickerEvent) => { + this.eventHandler.emit('ticker_update', topic, data); + console.log(`Received ticker event topic:${topic} subject:${subject} sequence:${data.sequence} price:${data.price} time:${data.time} size:${data.size}`); + }; + + allTickersCallback = (topic: string, subject: string, data: AllTickersEvent) => { + this.eventHandler.emit('all_tickers_update', topic, data); + console.log(`Received all tickers event topic:${topic} subject:${subject} time:${data.time}`); + }; + + // Depth handlers + level1Callback = (topic: string, subject: string, data: OrderbookLevel1Event) => { + this.eventHandler.emit('level1_update', topic, data); + const symbol = topic.split(':')[1]; + console.log(`Level1 Depth Update: ${symbol}`); + if (data.bids && data.bids.length >= 2) { + console.log(` Best Bid: ${data.bids[0]} (${data.bids[1]})`); + } + if (data.asks && data.asks.length >= 2) { + console.log(` Best Ask: ${data.asks[0]} (${data.asks[1]})`); + } + console.log(` Update Time: ${data.timestamp}`); + console.log(' ----------------'); + }; + + level5Callback = (topic: string, subject: string, data: OrderbookLevel5Event) => { + this.eventHandler.emit('level5_update', topic, data); + console.log(`Received level5 event topic:${topic} subject:${subject}`); + }; + + level50Callback = (topic: string, subject: string, data: OrderbookLevel50Event) => { + this.eventHandler.emit('level50_update', topic, data); + console.log(`Received level50 event topic:${topic} subject:${subject}`); + }; + + incrementCallback = (topic: string, subject: string, data: OrderbookIncrementEvent) => { + try { + const symbol = topic.split(':')[1]; + console.log(`Incremental Depth Update: ${symbol}`); + + if (data.changes) { + if (data.changes.asks && data.changes.asks.length > 0) { + console.log(' Ask Changes:'); + data.changes.asks.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + if (data.changes.bids && data.changes.bids.length > 0) { + console.log(' Bid Changes:'); + data.changes.bids.forEach(([price, size, sequence]) => { + const sizeNum = parseFloat(size); + const action = sizeNum === 0 ? 'Remove' : 'Update'; + console.log(` ${action} - Price: ${price}, Size: ${size}`); + }); + } + } + + console.log(` Change Summary - Asks: ${data.changes?.asks?.length || 0}, Bids: ${data.changes?.bids?.length || 0}`); + if (data.sequence) { + console.log(` Sequence: ${data.sequence}`); + } + if (subject) { + console.log(` Event: ${subject}`); + } + console.log(' ----------------'); + + // Emit event after successful processing + this.eventHandler.emit('increment_update', topic, data); + } catch (error) { + console.error('Error processing increment update:', error); + } + }; + + // Other market data handlers + tradeCallback = (topic: string, subject: string, data: TradeEvent) => { + this.eventHandler.emit('trade_update', topic, data); + console.log(`Received trade event topic:${topic} subject:${subject} sequence:${data.sequence}`); + }; + + klinesCallback = (topic: string, subject: string, data: KlinesEvent) => { + this.eventHandler.emit('klines_update', topic, data); + console.log(`Received klines event topic:${topic} subject:${subject}`); + }; + + symbolSnapshotCallback = (topic: string, subject: string, data: SymbolSnapshotEvent) => { + this.eventHandler.emit('symbol_snapshot_update', topic, data); + console.log(`Received symbol snapshot event topic:${topic} subject:${subject}`); + }; +} + +async function spotWsExample(spotPublicWs: SpotPublicWS, eventHandler: WebSocketEventHandler, config: Partial = {}) { + try { + // Merge with default config + const finalConfig: WebSocketConfig = { ...defaultConfig, ...config }; + const handlers = new MarketDataHandlers(eventHandler); + + // Start WebSocket service + await spotPublicWs.start(); + console.log('Starting to subscribe to interfaces...'); + + // Subscribe to market data based on configuration + if (finalConfig.ticker) { + await spotPublicWs.ticker(finalConfig.symbols, handlers.tickerCallback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} ticker`); + } + + if (finalConfig.allTickers) { + await spotPublicWs.allTickers(handlers.allTickersCallback); + console.log('Subscribed to all market tickers'); + } + + // Depth data subscription + if (finalConfig.depth.level1) { + await spotPublicWs.orderbookLevel1(finalConfig.symbols, handlers.level1Callback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level1 depth`); + } + + if (finalConfig.depth.level5) { + await spotPublicWs.orderbookLevel5(finalConfig.symbols, handlers.level5Callback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level5 depth`); + } + + if (finalConfig.depth.level50) { + await spotPublicWs.orderbookLevel50(finalConfig.symbols, handlers.level50Callback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level50 depth`); + } + + if (finalConfig.depth.increment) { + await spotPublicWs.orderbookIncrement(finalConfig.symbols, handlers.incrementCallback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} incremental depth`); + } + + if (finalConfig.trade) { + await spotPublicWs.trade(finalConfig.symbols, handlers.tradeCallback); + console.log(`Subscribed to ${finalConfig.symbols.join(', ')} trade data`); + } + + if (finalConfig.klines) { + for (const symbol of finalConfig.symbols) { + await spotPublicWs.klines(symbol, "1min", handlers.klinesCallback); + console.log(`Subscribed to ${symbol} 1min klines`); + } + } + + if (finalConfig.snapshot) { + for (const symbol of finalConfig.symbols) { + await spotPublicWs.symbolSnapshot(symbol, handlers.symbolSnapshotCallback); + console.log(`Subscribed to ${symbol} market snapshot`); + } + } + + // Wait for specified time + console.log(`Waiting ${finalConfig.waitTime/1000} seconds to receive data...`); + await new Promise(resolve => setTimeout(resolve, finalConfig.waitTime)); + + // Unsubscribe from all + console.log('Starting to unsubscribe...'); + try { + // For single symbol tickers + if (finalConfig.ticker) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/ticker@@${symbol}`); + console.log(`Unsubscribed from ticker:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from ticker:${symbol}`, e); + } + } + } + + // For all tickers - skip unsubscribe as it's handled automatically on disconnect + if (finalConfig.allTickers) { + console.log('All tickers subscription will be cleared on disconnect'); + } + + // Depth data unsubscription + if (finalConfig.depth.level1) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/level1@@${symbol}`); + console.log(`Unsubscribed from level1:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from level1:${symbol}`, e); + } + } + } + + if (finalConfig.depth.level5) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/level2Depth5@@${symbol}`); + console.log(`Unsubscribed from level5:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from level5:${symbol}`, e); + } + } + } + + if (finalConfig.depth.level50) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/level2Depth50@@${symbol}`); + console.log(`Unsubscribed from level50:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from level50:${symbol}`, e); + } + } + } + + if (finalConfig.depth.increment) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/level2@@${symbol}`); + console.log(`Unsubscribed from increment:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from increment:${symbol}`, e); + } + } + } + + if (finalConfig.trade) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/match@@${symbol}`); + console.log(`Unsubscribed from trade:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from trade:${symbol}`, e); + } + } + } + + if (finalConfig.klines) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/candles@@${symbol}_1min`); + console.log(`Unsubscribed from klines:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from klines:${symbol}`, e); + } + } + } + + if (finalConfig.snapshot) { + for (const symbol of finalConfig.symbols) { + try { + await spotPublicWs.unSubscribe(`/market/snapshot@@${symbol}`); + console.log(`Unsubscribed from snapshot:${symbol}`); + } catch (e) { + console.log(`Failed to unsubscribe from snapshot:${symbol}`, e); + } + } + } + + console.log('Unsubscribe process completed'); + } catch (unsubError) { + console.log('[DEBUG] unsubscribe error:', unsubError); + } + + } catch (e) { + console.error("Error occurred:", e); + } finally { + // Stop the WebSocket service which will clear all subscriptions + console.log('Stopping WebSocket service...'); + await spotPublicWs.stop(); + console.log('WebSocket service stopped'); + } +} + +// Example usage: +async function main() { + const eventHandler = new WebSocketEventHandler(); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // WebSocket client options + const wsClientOption = new WebSocketClientOptionBuilder() + .withDialTimeout(10000) + .withReconnect(true) + .withReconnectAttempts(20) + .withReconnectInterval(3000) + .withWriteTimeout(5000) + .withReadMessageBuffer(100) + .withWriteMessageBuffer(100) + .withEventCallback((event, msg) => { + eventHandler.handleWebSocketEvent(event, msg); + }) + .build(); + + // Transport options + const transportOption = new TransportOptionBuilder() + .setTimeout(5000) + .setKeepAlive(true) + .build(); + + // Client options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setWebSocketClientOption(wsClientOption) + .setTransportOption(transportOption) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .build(); + + const client = new DefaultClient(clientOption); + const kucoinWsService = client.wsService(); + + // Example configuration with all available options + const config: Partial = { + // Market ticker options + ticker: false, // Single symbol ticker + allTickers: false, // All market tickers + + // Depth data options + depth: { + level1: false, // Level 1 depth (best bid/ask) + level5: false, // Level 5 depth (top 5 bids/asks) + level50: false, // Level 50 depth (top 50 bids/asks) + increment: false // Incremental depth updates + }, + + // Other market data options + trade: false, // Trade execution data + klines: false, // Kline/Candlestick data + snapshot: true, // Market snapshot data + + // General settings + symbols: ["BTC-USDT"], // Trading pairs to subscribe + waitTime: 10000 // How long to wait for data (in milliseconds) + }; + + // Run example with configuration + await spotWsExample(kucoinWsService.newSpotPublicWS(), eventHandler, config); +} + +// Run example +main().catch(console.error); \ No newline at end of file From 78c6b37e0b843150d0c8a261fc154f28ddb47325 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 10 Feb 2025 16:41:31 +0800 Subject: [PATCH 062/106] test(nodejs): add more tests --- .../e2e/rest/broker_test/api_broker.test.ts | 59 ++ .../e2e/rest/broker_test/nd_broker.test.ts | 346 ++++++++++++ .../e2e/rest/copytrading_test/futures.test.ts | 309 +++++++++++ .../tests/e2e/rest/earn_test/earn.test.ts | 224 ++++++++ .../e2e/rest/futures_test/funding_fee.test.ts | 108 ++++ .../e2e/rest/futures_test/market.test.ts | 403 ++++++++++++++ .../tests/e2e/rest/futures_test/order.test.ts | 508 ++++++++++++++++++ .../e2e/rest/futures_test/positions.test.ts | 373 +++++++++++++ .../tests/e2e/rest/margin_test/credit.test.ts | 175 ++++++ .../tests/e2e/rest/margin_test/debit.test.ts | 176 ++++++ .../tests/e2e/rest/margin_test/market.test.ts | 43 ++ 11 files changed, 2724 insertions(+) create mode 100644 sdk/node/tests/e2e/rest/broker_test/api_broker.test.ts create mode 100644 sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts create mode 100644 sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts create mode 100644 sdk/node/tests/e2e/rest/earn_test/earn.test.ts create mode 100644 sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts create mode 100644 sdk/node/tests/e2e/rest/futures_test/market.test.ts create mode 100644 sdk/node/tests/e2e/rest/futures_test/order.test.ts create mode 100644 sdk/node/tests/e2e/rest/futures_test/positions.test.ts create mode 100644 sdk/node/tests/e2e/rest/margin_test/credit.test.ts create mode 100644 sdk/node/tests/e2e/rest/margin_test/debit.test.ts create mode 100644 sdk/node/tests/e2e/rest/margin_test/market.test.ts diff --git a/sdk/node/tests/e2e/rest/broker_test/api_broker.test.ts b/sdk/node/tests/e2e/rest/broker_test/api_broker.test.ts new file mode 100644 index 00000000..b3873cea --- /dev/null +++ b/sdk/node/tests/e2e/rest/broker_test/api_broker.test.ts @@ -0,0 +1,59 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { APIBrokerAPI, GetRebaseReq } from '@src/generate/broker/apibroker'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: APIBrokerAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getBrokerService().getAPIBrokerApi(); + }); + + test('getRebase request test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/api/rebase/download + */ + let builder = GetRebaseReq.builder(); + builder.setBegin('20240610').setEnd('20241010').setTradeType(GetRebaseReq.TradeTypeEnum._1); + let req = builder.build(); + let resp = api.getRebase(req); + return resp.then((result) => { + expect(result.url).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts b/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts new file mode 100644 index 00000000..5acee4a2 --- /dev/null +++ b/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts @@ -0,0 +1,346 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddSubAccountApiReq, + AddSubAccountReq, + DeleteSubAccountAPIReq, + GetBrokerInfoReq, + GetDepositDetailReq, + GetDepositListReq, + GetRebaseReq, + GetSubAccountAPIReq, + GetSubAccountReq, + GetTransferHistoryReq, + GetWithdrawDetailReq, + ModifySubAccountApiReq, + NDBrokerAPI, + TransferReq, +} from '@src/generate/broker/ndbroker'; +import { DefaultClient } from '@api/index'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: NDBrokerAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getBrokerService().getNDBrokerApi(); + }); + + test('getBrokerInfo request test', () => { + /** + * getBrokerInfo + * Get Broker Info + * /api/v1/broker/nd/info + */ + let builder = GetBrokerInfoReq.builder(); + builder.setTradeType(GetBrokerInfoReq.TradeTypeEnum._1); + let req = builder.build(); + let resp = api.getBrokerInfo(req); + return resp.then((result) => { + expect(result.accountSize).toEqual(expect.anything()); + expect(result.maxAccountSize).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addSubAccount request test', () => { + /** + * addSubAccount + * Add SubAccount + * /api/v1/broker/nd/account + */ + let builder = AddSubAccountReq.builder(); + builder.setAccountName('sdk_test'); + let req = builder.build(); + let resp = api.addSubAccount(req); + return resp.then((result) => { + expect(result.accountName).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.level).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSubAccount request test', () => { + /** + * getSubAccount + * Get SubAccount + * /api/v1/broker/nd/account + */ + let builder = GetSubAccountReq.builder(); + builder.setUid('229317507'); + let req = builder.build(); + let resp = api.getSubAccount(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addSubAccountApi request test', () => { + /** + * addSubAccountApi + * Add SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = AddSubAccountApiReq.builder(); + builder + .setUid('229317507') + .setPassphrase('11223344') + .setIpWhitelist(['127.0.0.1', '192.168.1.1']) + .setPermissions([ + AddSubAccountApiReq.PermissionsEnum.GENERAL, + AddSubAccountApiReq.PermissionsEnum.SPOT, + ]) + .setLabel('This is remarks'); + let req = builder.build(); + let resp = api.addSubAccountApi(req); + return resp.then((result) => { + expect(result.uid).toEqual(expect.anything()); + expect(result.label).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.secretKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permissions).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSubAccountAPI request test', () => { + /** + * getSubAccountAPI + * Get SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = GetSubAccountAPIReq.builder(); + builder.setUid('226383154').setApiKey('67446f679d8f66000107eb6d'); + let req = builder.build(); + let resp = api.getSubAccountAPI(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifySubAccountApi request test', () => { + /** + * modifySubAccountApi + * Modify SubAccount API + * /api/v1/broker/nd/account/update-apikey + */ + let builder = ModifySubAccountApiReq.builder(); + builder + .setUid('229317507') + .setIpWhitelist(['127.0.0.1']) + .setPermissions([ModifySubAccountApiReq.PermissionsEnum.GENERAL]) + .setLabel('label') + .setApiKey('67447006890ba200018d2722'); + let req = builder.build(); + let resp = api.modifySubAccountApi(req); + return resp.then((result) => { + expect(result.uid).toEqual(expect.anything()); + expect(result.label).toEqual(expect.anything()); + expect(result.apiKey).toEqual(expect.anything()); + expect(result.apiVersion).toEqual(expect.anything()); + expect(result.permissions).toEqual(expect.anything()); + expect(result.ipWhitelist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('deleteSubAccountAPI request test', () => { + /** + * deleteSubAccountAPI + * Delete SubAccount API + * /api/v1/broker/nd/account/apikey + */ + let builder = DeleteSubAccountAPIReq.builder(); + builder.setUid('229317507').setApiKey('67447006890ba200018d2722'); + let req = builder.build(); + let resp = api.deleteSubAccountAPI(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('transfer request test', () => { + /** + * transfer + * Transfer + * /api/v1/broker/nd/transfer + */ + let builder = TransferReq.builder(); + builder + .setCurrency('USDT') + .setAmount('0.01') + .setDirection(TransferReq.DirectionEnum.OUT) + .setAccountType(TransferReq.AccountTypeEnum.TRADE) + .setSpecialUid('229317507') + .setSpecialAccountType(TransferReq.SpecialAccountTypeEnum.MAIN) + .setClientOid(randomUUID()); + let req = builder.build(); + let resp = api.transfer(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTransferHistory request test', () => { + /** + * getTransferHistory + * Get Transfer History + * /api/v3/broker/nd/transfer/detail + */ + let builder = GetTransferHistoryReq.builder(); + builder.setOrderId('11111'); + let req = builder.build(); + let resp = api.getTransferHistory(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.fromUid).toEqual(expect.anything()); + expect(result.fromAccountType).toEqual(expect.anything()); + expect(result.fromAccountTag).toEqual(expect.anything()); + expect(result.toUid).toEqual(expect.anything()); + expect(result.toAccountType).toEqual(expect.anything()); + expect(result.toAccountTag).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reason).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositList request test', () => { + /** + * getDepositList + * Get Deposit List + * /api/v1/asset/ndbroker/deposit/list + */ + let builder = GetDepositListReq.builder(); + builder.setCurrency('USDT'); + let req = builder.build(); + let resp = api.getDepositList(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDepositDetail request test', () => { + /** + * getDepositDetail + * Get Deposit Detail + * /api/v3/broker/nd/deposit/detail + */ + let builder = GetDepositDetailReq.builder(); + builder.setCurrency('USDT').setHash('6724e363a492800007ec602b'); + let req = builder.build(); + let resp = api.getDepositDetail(req); + return resp.then((result) => { + expect(result.chain).toEqual(expect.anything()); + expect(result.hash).toEqual(expect.anything()); + expect(result.walletTxId).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.address).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.isInner).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getWithdrawDetail request test', () => { + /** + * getWithdrawDetail + * Get Withdraw Detail + * /api/v3/broker/nd/withdraw/detail + */ + let builder = GetWithdrawDetailReq.builder(); + builder.setWithdrawalId('674686fa1ac01f0007b25768'); + let req = builder.build(); + let resp = api.getWithdrawDetail(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.chain).toEqual(expect.anything()); + expect(result.walletTxId).toEqual(expect.anything()); + expect(result.uid).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + expect(result.memo).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.address).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.isInner).toEqual(expect.anything()); + expect(result.currency).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRebase request test', () => { + /** + * getRebase + * Get Broker Rebate + * /api/v1/broker/nd/rebase/download + */ + let builder = GetRebaseReq.builder(); + builder.setBegin('20240610').setEnd('20241010').setTradeType(GetRebaseReq.TradeTypeEnum._1); + let req = builder.build(); + let resp = api.getRebase(req); + return resp.then((result) => { + expect(result.url).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts b/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts new file mode 100644 index 00000000..0aa0f327 --- /dev/null +++ b/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts @@ -0,0 +1,309 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddIsolatedMarginReq, + AddOrderReq, + AddOrderTestReq, + AddTPSLOrderReq, + CancelOrderByClientOidReq, + CancelOrderByIdReq, + FuturesAPI, + GetMaxOpenSizeReq, + GetMaxWithdrawMarginReq, + ModifyAutoDepositStatusReq, + ModifyIsolatedMarginRiskLimtReq, + RemoveIsolatedMarginReq, +} from '@src/generate/copytrading/futures'; +import { DefaultClient } from '@api/index'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: FuturesAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getCopyTradingService().getFuturesApi(); + }); + + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/copy-trade/futures/orders + */ + let builder = AddOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3) + .setType(AddOrderReq.TypeEnum.LIMIT) + .setRemark('order remarks"') + .setReduceOnly(false) + .setMarginMode(AddOrderReq.MarginModeEnum.ISOLATED) + .setPrice('0.1') + .setSize(1) + .setTimeInForce(AddOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/copy-trade/futures/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3) + .setType(AddOrderTestReq.TypeEnum.LIMIT) + .setRemark('order remarks"') + .setReduceOnly(false) + .setMarginMode(AddOrderTestReq.MarginModeEnum.ISOLATED) + .setPrice('0.1') + .setSize(1) + .setTimeInForce(AddOrderTestReq.TimeInForceEnum.GOOD_TILL_CANCELED); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addTPSLOrder request test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/copy-trade/futures/st-orders + */ + let builder = AddTPSLOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddTPSLOrderReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3) + .setType(AddTPSLOrderReq.TypeEnum.LIMIT) + .setRemark('order remarks"') + .setReduceOnly(false) + .setMarginMode(AddTPSLOrderReq.MarginModeEnum.ISOLATED) + .setPrice('0.1') + .setSize(1) + .setTimeInForce(AddTPSLOrderReq.TimeInForceEnum.GOOD_TILL_CANCELED) + .setTriggerStopUpPrice('0.3') + .setTriggerStopDownPrice('0.1') + .setStopPriceType(AddTPSLOrderReq.StopPriceTypeEnum.TRADE_PRICE); + let req = builder.build(); + let resp = api.addTPSLOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderById request test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/copy-trade/futures/orders + */ + let builder = CancelOrderByIdReq.builder(); + builder.setOrderId(''); + let req = builder.build(); + let resp = api.cancelOrderById(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/copy-trade/futures/orders/client-order + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setSymbol('').setClientOid(''); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMaxOpenSize request test', () => { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v1/copy-trade/futures/get-max-open-size + */ + let builder = GetMaxOpenSizeReq.builder(); + builder.setSymbol('XBTUSDTM').setPrice('0.1').setLeverage(10); + let req = builder.build(); + let resp = api.getMaxOpenSize(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.maxBuyOpenSize).toEqual(expect.anything()); + expect(result.maxSellOpenSize).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMaxWithdrawMargin request test', () => { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/copy-trade/futures/position/margin/max-withdraw-margin + */ + let builder = GetMaxWithdrawMarginReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getMaxWithdrawMargin(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addIsolatedMargin request test', () => { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/copy-trade/futures/position/margin/deposit-margin + */ + let builder = AddIsolatedMarginReq.builder(); + builder.setSymbol('XBTUSDTM').setMargin(3).setBizNo(randomUUID()); + let req = builder.build(); + let resp = api.addIsolatedMargin(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('removeIsolatedMargin request test', () => { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/copy-trade/futures/position/margin/withdraw-margin + */ + let builder = RemoveIsolatedMarginReq.builder(); + builder.setSymbol('XBTUSDTM').setWithdrawAmount('0.0000001'); + let req = builder.build(); + let resp = api.removeIsolatedMargin(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifyIsolatedMarginRiskLimt request test', () => { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/copy-trade/futures/position/risk-limit-level/change + */ + let builder = ModifyIsolatedMarginRiskLimtReq.builder(); + builder.setSymbol('XBTUSDTM').setLevel(1); + let req = builder.build(); + let resp = api.modifyIsolatedMarginRiskLimt(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifyAutoDepositStatus request test', () => { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/copy-trade/futures/position/margin/auto-deposit-status + */ + let builder = ModifyAutoDepositStatusReq.builder(); + builder.setSymbol('XBTUSDTM').setStatus(true); + let req = builder.build(); + let resp = api.modifyAutoDepositStatus(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/earn_test/earn.test.ts b/sdk/node/tests/e2e/rest/earn_test/earn.test.ts new file mode 100644 index 00000000..8bbf143e --- /dev/null +++ b/sdk/node/tests/e2e/rest/earn_test/earn.test.ts @@ -0,0 +1,224 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + EarnAPI, + GetAccountHoldingReq, + GetETHStakingProductsReq, + GetKcsStakingProductsReq, + GetPromotionProductsReq, + GetRedeemPreviewReq, + GetSavingsProductsReq, + GetStakingProductsReq, + PurchaseReq, + RedeemReq, +} from '@src/generate/earn/earn'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: EarnAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getEarnService().getEarnApi(); + }); + + test('purchase request test', () => { + /** + * purchase + * purchase + * /api/v1/earn/orders + */ + let builder = PurchaseReq.builder(); + builder + .setProductId('2152') + .setAmount('10.0') + .setAccountType(PurchaseReq.AccountTypeEnum.MAIN); + let req = builder.build(); + let resp = api.purchase(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTxId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRedeemPreview request test', () => { + /** + * getRedeemPreview + * Get Redeem Preview + * /api/v1/earn/redeem-preview + */ + let builder = GetRedeemPreviewReq.builder(); + builder + .setOrderId('2849600') + .setFromAccountType(GetRedeemPreviewReq.FromAccountTypeEnum.MAIN); + let req = builder.build(); + let resp = api.getRedeemPreview(req); + return resp.then((result) => { + expect(result.currency).toEqual(expect.anything()); + expect(result.redeemAmount).toEqual(expect.anything()); + expect(result.penaltyInterestAmount).toEqual(expect.anything()); + expect(result.redeemPeriod).toEqual(expect.anything()); + expect(result.deliverTime).toEqual(expect.anything()); + expect(result.manualRedeemable).toEqual(expect.anything()); + expect(result.redeemAll).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('redeem request test', () => { + /** + * redeem + * Redeem + * /api/v1/earn/orders + */ + let builder = RedeemReq.builder(); + builder + .setOrderId('2849600') + .setAmount('10.0') + .setFromAccountType(RedeemReq.FromAccountTypeEnum.MAIN) + .setConfirmPunishRedeem('1'); + let req = builder.build(); + let resp = api.redeem(req); + return resp.then((result) => { + expect(result.orderTxId).toEqual(expect.anything()); + expect(result.deliverTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.amount).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSavingsProducts request test', () => { + /** + * getSavingsProducts + * Get Savings Products + * /api/v1/earn/saving/products + */ + let builder = GetSavingsProductsReq.builder(); + builder.setCurrency('USDT'); + let req = builder.build(); + let resp = api.getSavingsProducts(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPromotionProducts request test', () => { + /** + * getPromotionProducts + * Get Promotion Products + * /api/v1/earn/promotion/products + */ + let builder = GetPromotionProductsReq.builder(); + builder.setCurrency('USDT'); + let req = builder.build(); + let resp = api.getPromotionProducts(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAccountHolding request test', () => { + /** + * getAccountHolding + * Get Account Holding + * /api/v1/earn/hold-assets + */ + let builder = GetAccountHoldingReq.builder(); + builder + .setCurrency('USDT') + .setProductId('2152') + .setProductCategory(GetAccountHoldingReq.ProductCategoryEnum.DEMAND); + let req = builder.build(); + let resp = api.getAccountHolding(req); + return resp.then((result) => { + expect(result.totalNum).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getStakingProducts request test', () => { + /** + * getStakingProducts + * Get Staking Products + * /api/v1/earn/staking/products + */ + let builder = GetStakingProductsReq.builder(); + builder.setCurrency('ATOM'); + let req = builder.build(); + let resp = api.getStakingProducts(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getKcsStakingProducts request test', () => { + /** + * getKcsStakingProducts + * Get KCS Staking Products + * /api/v1/earn/kcs-staking/products + */ + let builder = GetKcsStakingProductsReq.builder(); + builder.setCurrency('KCS'); + let req = builder.build(); + let resp = api.getKcsStakingProducts(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getETHStakingProducts request test', () => { + /** + * getETHStakingProducts + * Get ETH Staking Products + * /api/v1/earn/eth-staking/products + */ + let builder = GetETHStakingProductsReq.builder(); + builder.setCurrency('eth'); + let req = builder.build(); + let resp = api.getETHStakingProducts(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts b/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts new file mode 100644 index 00000000..0f57c0c9 --- /dev/null +++ b/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts @@ -0,0 +1,108 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + FundingFeesAPI, + GetCurrentFundingRateReq, + GetPrivateFundingHistoryReq, + GetPublicFundingHistoryReq, +} from '@src/generate/futures/fundingfees'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: FundingFeesAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getFuturesService().getFundingFeesApi(); + }); + + test('getCurrentFundingRate request test', () => { + /** + * getCurrentFundingRate + * Get Current Funding Rate + * /api/v1/funding-rate/{symbol}/current + */ + let builder = GetCurrentFundingRateReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getCurrentFundingRate(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.granularity).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.predictedValue).toEqual(expect.anything()); + expect(result.fundingRateCap).toEqual(expect.anything()); + expect(result.fundingRateFloor).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPublicFundingHistory request test', () => { + /** + * getPublicFundingHistory + * Get Public Funding History + * /api/v1/contract/funding-rates + */ + let builder = GetPublicFundingHistoryReq.builder(); + builder.setSymbol('XBTUSDTM').setFrom(1700310700000).setTo(1702310700000); + let req = builder.build(); + let resp = api.getPublicFundingHistory(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPrivateFundingHistory request test', () => { + /** + * getPrivateFundingHistory + * Get Private Funding History + * /api/v1/funding-history + */ + let builder = GetPrivateFundingHistoryReq.builder(); + builder + .setSymbol('XBTUSDTM') + .setFrom(1700310700000) + .setTo(1702310700000) + .setReverse(true) + .setMaxCount(100); + let req = builder.build(); + let resp = api.getPrivateFundingHistory(req); + return resp.then((result) => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/futures_test/market.test.ts b/sdk/node/tests/e2e/rest/futures_test/market.test.ts new file mode 100644 index 00000000..cc3dab7d --- /dev/null +++ b/sdk/node/tests/e2e/rest/futures_test/market.test.ts @@ -0,0 +1,403 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + GetFullOrderBookReq, + GetInterestRateIndexReq, + GetKlinesReq, + GetMarkPriceReq, + GetPartOrderBookReq, + GetPremiumIndexReq, + GetSpotIndexPriceReq, + GetSymbolReq, + GetTickerReq, + GetTradeHistoryReq, + MarketAPI, +} from '@src/generate/futures/market'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: MarketAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getFuturesService().getMarketApi(); + }); + + test('getSymbol request test', () => { + /** + * getSymbol + * Get Symbol + * /api/v1/contracts/{symbol} + */ + let builder = GetSymbolReq.builder(); + builder.setSymbol('XBTUSDM'); + let req = builder.build(); + let resp = api.getSymbol(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.rootSymbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.firstOpenDate).toEqual(expect.anything()); + expect(result.expireDate).toEqual(expect.anything()); + expect(result.settleDate).toEqual(expect.anything()); + expect(result.baseCurrency).toEqual(expect.anything()); + expect(result.quoteCurrency).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.maxOrderQty).toEqual(expect.anything()); + expect(result.maxPrice).toEqual(expect.anything()); + expect(result.lotSize).toEqual(expect.anything()); + expect(result.tickSize).toEqual(expect.anything()); + expect(result.indexPriceTickSize).toEqual(expect.anything()); + expect(result.multiplier).toEqual(expect.anything()); + expect(result.initialMargin).toEqual(expect.anything()); + expect(result.maintainMargin).toEqual(expect.anything()); + expect(result.maxRiskLimit).toEqual(expect.anything()); + expect(result.minRiskLimit).toEqual(expect.anything()); + expect(result.riskStep).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.takerFixFee).toEqual(expect.anything()); + expect(result.makerFixFee).toEqual(expect.anything()); + expect(result.settlementFee).toEqual(expect.anything()); + expect(result.isDeleverage).toEqual(expect.anything()); + expect(result.isQuanto).toEqual(expect.anything()); + expect(result.isInverse).toEqual(expect.anything()); + expect(result.markMethod).toEqual(expect.anything()); + expect(result.fairMethod).toEqual(expect.anything()); + expect(result.fundingBaseSymbol).toEqual(expect.anything()); + expect(result.fundingQuoteSymbol).toEqual(expect.anything()); + expect(result.fundingRateSymbol).toEqual(expect.anything()); + expect(result.indexSymbol).toEqual(expect.anything()); + expect(result.settlementSymbol).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.fundingFeeRate).toEqual(expect.anything()); + expect(result.predictedFundingFeeRate).toEqual(expect.anything()); + expect(result.fundingRateGranularity).toEqual(expect.anything()); + expect(result.openInterest).toEqual(expect.anything()); + expect(result.turnoverOf24h).toEqual(expect.anything()); + expect(result.volumeOf24h).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.indexPrice).toEqual(expect.anything()); + expect(result.lastTradePrice).toEqual(expect.anything()); + expect(result.nextFundingRateTime).toEqual(expect.anything()); + expect(result.maxLeverage).toEqual(expect.anything()); + expect(result.sourceExchanges).toEqual(expect.anything()); + expect(result.premiumsSymbol1M).toEqual(expect.anything()); + expect(result.premiumsSymbol8H).toEqual(expect.anything()); + expect(result.fundingBaseSymbol1M).toEqual(expect.anything()); + expect(result.fundingQuoteSymbol1M).toEqual(expect.anything()); + expect(result.lowPrice).toEqual(expect.anything()); + expect(result.highPrice).toEqual(expect.anything()); + expect(result.priceChgPct).toEqual(expect.anything()); + expect(result.priceChg).toEqual(expect.anything()); + expect(result.k).toEqual(expect.anything()); + expect(result.m).toEqual(expect.anything()); + expect(result.f).toEqual(expect.anything()); + expect(result.mmrLimit).toEqual(expect.anything()); + expect(result.mmrLevConstant).toEqual(expect.anything()); + expect(result.supportCross).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAllSymbols request test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v1/contracts/active + */ + let resp = api.getAllSymbols(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTicker request test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/ticker + */ + let builder = GetTickerReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getTicker(req); + return resp.then((result) => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.tradeId).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.bestBidPrice).toEqual(expect.anything()); + expect(result.bestBidSize).toEqual(expect.anything()); + expect(result.bestAskPrice).toEqual(expect.anything()); + expect(result.bestAskSize).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAllTickers request test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/allTickers + */ + let resp = api.getAllTickers(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFullOrderBook request test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v1/level2/snapshot + */ + let builder = GetFullOrderBookReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getFullOrderBook(req); + return resp.then((result) => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPartOrderBook request test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/level2/depth{size} + */ + let builder = GetPartOrderBookReq.builder(); + builder.setSymbol('XBTUSDTM').setSize('100'); + let req = builder.build(); + let resp = api.getPartOrderBook(req); + return resp.then((result) => { + expect(result.sequence).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + expect(result.ts).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/trade/history + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getKlines request test', () => { + /** + * getKlines + * Get Klines + * /api/v1/kline/query + */ + let builder = GetKlinesReq.builder(); + builder + .setSymbol('XBTUSDTM') + .setGranularity(GetKlinesReq.GranularityEnum._1) + .setFrom(1732464000000) + .setTo(1732521600000); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMarkPrice request test', () => { + /** + * getMarkPrice + * Get Mark Price + * /api/v1/mark-price/{symbol}/current + */ + let builder = GetMarkPriceReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getMarkPrice(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.granularity).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.indexPrice).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSpotIndexPrice request test', () => { + /** + * getSpotIndexPrice + * Get Spot Index Price + * /api/v1/index/query + */ + let builder = GetSpotIndexPriceReq.builder(); + builder + .setSymbol('.KXBTUSDT') + .setStartAt(1732464000000) + .setEndAt(1732521600000) + .setMaxCount(10); + let req = builder.build(); + let resp = api.getSpotIndexPrice(req); + return resp.then((result) => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getInterestRateIndex request test', () => { + /** + * getInterestRateIndex + * Get Interest Rate Index + * /api/v1/interest/query + */ + let builder = GetInterestRateIndexReq.builder(); + builder.setSymbol('.XBTINT').setStartAt(1732464000000).setEndAt(1732521600000); + let req = builder.build(); + let resp = api.getInterestRateIndex(req); + return resp.then((result) => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPremiumIndex request test', () => { + /** + * getPremiumIndex + * Get Premium Index + * /api/v1/premium/query + */ + let builder = GetPremiumIndexReq.builder(); + builder.setSymbol('XBTUSDTMPI').setStartAt(1732464000000).setEndAt(1732521600000); + let req = builder.build(); + let resp = api.getPremiumIndex(req); + return resp.then((result) => { + expect(result.dataList).toEqual(expect.anything()); + expect(result.hasMore).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('get24hrStats request test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/trade-statistics + */ + let resp = api.get24hrStats(); + return resp.then((result) => { + expect(result.turnoverOf24h).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getServerTime request test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + let resp = api.getServerTime(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getServiceStatus request test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + let resp = api.getServiceStatus(); + return resp.then((result) => { + expect(result.msg).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPublicToken request test', () => { + /** + * getPublicToken + * Get Public Token - Futures + * /api/v1/bullet-public + */ + let resp = api.getPublicToken(); + return resp.then((result) => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Futures + * /api/v1/bullet-private + */ + let resp = api.getPrivateToken(); + return resp.then((result) => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/futures_test/order.test.ts b/sdk/node/tests/e2e/rest/futures_test/order.test.ts new file mode 100644 index 00000000..8ca1cc98 --- /dev/null +++ b/sdk/node/tests/e2e/rest/futures_test/order.test.ts @@ -0,0 +1,508 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddOrderReq, + AddOrderTestReq, + AddTPSLOrderReq, + BatchAddOrdersItem, + BatchAddOrdersReq, + BatchCancelOrdersClientOidsList, + BatchCancelOrdersReq, + CancelAllOrdersV1Req, + CancelAllOrdersV3Req, + CancelAllStopOrdersReq, + CancelOrderByClientOidReq, + CancelOrderByIdReq, + GetOpenOrderValueReq, + GetOrderByClientOidReq, + GetOrderByOrderIdReq, + GetOrderListReq, + GetRecentClosedOrdersReq, + GetRecentTradeHistoryReq, + GetStopOrderListReq, + GetTradeHistoryReq, + OrderAPI, +} from '@src/generate/futures/order'; +import { DefaultClient } from '@api/index'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: OrderAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getFuturesService().getOrderApi(); + }); + + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/orders + */ + let builder = AddOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3.0) + .setType(AddOrderReq.TypeEnum.LIMIT) + .setRemark('order_test') + .setMarginMode(AddOrderReq.MarginModeEnum.ISOLATED) + .setPrice('1') + .setSize(1); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderTestReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3.0) + .setType(AddOrderTestReq.TypeEnum.LIMIT) + .setRemark('order_test') + .setMarginMode(AddOrderTestReq.MarginModeEnum.ISOLATED) + .setPrice('1') + .setSize(1); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchAddOrders request test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/orders/multi + */ + let builder = BatchAddOrdersReq.builder(); + + let order1 = BatchAddOrdersItem.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersItem.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3.0) + .setType(BatchAddOrdersItem.TypeEnum.LIMIT) + .setRemark('order_test') + .setMarginMode(BatchAddOrdersItem.MarginModeEnum.ISOLATED) + .setPrice('1') + .setSize(1) + .build(); + let order2 = BatchAddOrdersItem.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersItem.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3.0) + .setType(BatchAddOrdersItem.TypeEnum.LIMIT) + .setRemark('order_test') + .setMarginMode(BatchAddOrdersItem.MarginModeEnum.ISOLATED) + .setPrice('1') + .setSize(1) + .build(); + + builder.setItems([order1, order2]); + let req = builder.build(); + let resp = api.batchAddOrders(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addTPSLOrder request test', () => { + /** + * addTPSLOrder + * Add Take Profit And Stop Loss Order + * /api/v1/st-orders + */ + let builder = AddTPSLOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddTPSLOrderReq.SideEnum.BUY) + .setSymbol('XBTUSDTM') + .setLeverage(3.0) + .setType(AddTPSLOrderReq.TypeEnum.LIMIT) + .setRemark('order_test') + .setMarginMode(AddTPSLOrderReq.MarginModeEnum.ISOLATED) + .setPrice('10000') + .setSize(1) + .setTriggerStopUpPrice('8000') + .setTriggerStopDownPrice('12000') + .build(); + let req = builder.build(); + let resp = api.addTPSLOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderById request test', () => { + /** + * cancelOrderById + * Cancel Order By OrderId + * /api/v1/orders/{orderId} + */ + let builder = CancelOrderByIdReq.builder(); + builder.setOrderId(''); + let req = builder.build(); + let resp = api.cancelOrderById(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setSymbol('').setClientOid(''); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchCancelOrders request test', () => { + /** + * batchCancelOrders + * Batch Cancel Orders + * /api/v1/orders/multi-cancel + */ + let builder = BatchCancelOrdersReq.builder(); + builder + .setOrderIdsList(['', '']) + .setClientOidsList([ + BatchCancelOrdersClientOidsList.create({ symbol: '', clientOid: '' }), + ]); + let req = builder.build(); + let resp = api.batchCancelOrders(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelAllOrdersV3 request test', () => { + /** + * cancelAllOrdersV3 + * Cancel All Orders + * /api/v3/orders + */ + let builder = CancelAllOrdersV3Req.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.cancelAllOrdersV3(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelAllStopOrders request test', () => { + /** + * cancelAllStopOrders + * Cancel All Stop orders + * /api/v1/stopOrders + */ + let builder = CancelAllStopOrdersReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.cancelAllStopOrders(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/orders/{order-id} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setOrderId(''); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.dealValue).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPriceType).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.forceHold).toEqual(expect.anything()); + expect(result.closeOrder).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.endAt).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.avgDealPrice).toEqual(expect.anything()); + expect(result.filledSize).toEqual(expect.anything()); + expect(result.filledValue).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reduceOnly).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/orders/byClientOid + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setClientOid(''); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + expect(result.dealValue).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.stp).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPriceType).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.forceHold).toEqual(expect.anything()); + expect(result.closeOrder).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.tags).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.updatedAt).toEqual(expect.anything()); + expect(result.endAt).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.avgDealPrice).toEqual(expect.anything()); + expect(result.filledSize).toEqual(expect.anything()); + expect(result.filledValue).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.reduceOnly).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderList request test', () => { + /** + * getOrderList + * Get Order List + * /api/v1/orders + */ + let builder = GetOrderListReq.builder(); + builder + .setStatus(GetOrderListReq.StatusEnum.ACTIVE) + .setSymbol('XBTUSDTM') + .setSide(GetOrderListReq.SideEnum.BUY); + let req = builder.build(); + let resp = api.getOrderList(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRecentClosedOrders request test', () => { + /** + * getRecentClosedOrders + * Get Recent Closed Orders + * /api/v1/recentDoneOrders + */ + let builder = GetRecentClosedOrdersReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getRecentClosedOrders(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getStopOrderList request test', () => { + /** + * getStopOrderList + * Get Stop Order List + * /api/v1/stopOrders + */ + let builder = GetStopOrderListReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getStopOrderList(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOpenOrderValue request test', () => { + /** + * getOpenOrderValue + * Get Open Order Value + * /api/v1/openOrderStatistics + */ + let builder = GetOpenOrderValueReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getOpenOrderValue(req); + return resp.then((result) => { + expect(result.openOrderBuySize).toEqual(expect.anything()); + expect(result.openOrderSellSize).toEqual(expect.anything()); + expect(result.openOrderBuyCost).toEqual(expect.anything()); + expect(result.openOrderSellCost).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRecentTradeHistory request test', () => { + /** + * getRecentTradeHistory + * Get Recent Trade History + * /api/v1/recentFills + */ + let builder = GetRecentTradeHistoryReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getRecentTradeHistory(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setType(GetTradeHistoryReq.TypeEnum.LIMIT).setSide(GetTradeHistoryReq.SideEnum.BUY); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelAllOrdersV1 request test', () => { + /** + * cancelAllOrdersV1 + * Cancel All Orders - V1 + * /api/v1/orders + */ + let builder = CancelAllOrdersV1Req.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.cancelAllOrdersV1(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/futures_test/positions.test.ts b/sdk/node/tests/e2e/rest/futures_test/positions.test.ts new file mode 100644 index 00000000..23483e16 --- /dev/null +++ b/sdk/node/tests/e2e/rest/futures_test/positions.test.ts @@ -0,0 +1,373 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddIsolatedMarginReq, + GetCrossMarginLeverageReq, + GetIsolatedMarginRiskLimitReq, + GetMarginModeReq, + GetMaxOpenSizeReq, + GetMaxWithdrawMarginReq, + GetPositionDetailsReq, + GetPositionListReq, + GetPositionsHistoryReq, + ModifyAutoDepositStatusReq, + ModifyIsolatedMarginRiskLimtReq, + ModifyMarginLeverageReq, + PositionsAPI, + RemoveIsolatedMarginReq, + SwitchMarginModeReq, +} from '@src/generate/futures/positions'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: PositionsAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getFuturesService().getPositionsApi(); + }); + + test('getMarginMode request test', ()=> { + /** + * getMarginMode + * Get Margin Mode + * /api/v2/position/getMarginMode + */ + let builder = GetMarginModeReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getMarginMode(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('switchMarginMode request test', ()=> { + /** + * switchMarginMode + * Switch Margin Mode + * /api/v2/position/changeMarginMode + */ + let builder = SwitchMarginModeReq.builder(); + builder.setSymbol('XBTUSDTM').setMarginMode(SwitchMarginModeReq.MarginModeEnum.CROSS); + let req = builder.build(); + let resp = api.switchMarginMode(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMaxOpenSize request test', ()=> { + /** + * getMaxOpenSize + * Get Max Open Size + * /api/v2/getMaxOpenSize + */ + let builder = GetMaxOpenSizeReq.builder(); + builder.setSymbol('XBTUSDTM').setPrice('10000').setLeverage(10); + let req = builder.build(); + let resp = api.getMaxOpenSize(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.maxBuyOpenSize).toEqual(expect.anything()); + expect(result.maxSellOpenSize).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getPositionDetails request test', ()=> { + /** + * getPositionDetails + * Get Position Details + * /api/v1/position + */ + let builder = GetPositionDetailsReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getPositionDetails(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + expect(result.isInverse).toEqual(expect.anything()); + expect(result.marginMode).toEqual(expect.anything()); + expect(result.positionSide).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posCrossMargin).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posCommCommon).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posFunding).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.maintainMargin).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getPositionList request test', ()=> { + /** + * getPositionList + * Get Position List + * /api/v1/positions + */ + let builder = GetPositionListReq.builder(); + builder.setCurrency('USDT'); + let req = builder.build(); + let resp = api.getPositionList(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getPositionsHistory request test', ()=> { + /** + * getPositionsHistory + * Get Positions History + * /api/v1/history-positions + */ + let builder = GetPositionsHistoryReq.builder(); + builder.setSymbol('XBTUSDTM') + let req = builder.build(); + let resp = api.getPositionsHistory(req); + return resp.then(result => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMaxWithdrawMargin request test', ()=> { + /** + * getMaxWithdrawMargin + * Get Max Withdraw Margin + * /api/v1/margin/maxWithdrawMargin + */ + let builder = GetMaxWithdrawMarginReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getMaxWithdrawMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getCrossMarginLeverage request test', ()=> { + /** + * getCrossMarginLeverage + * Get Cross Margin Leverage + * /api/v2/getCrossUserLeverage + */ + let builder = GetCrossMarginLeverageReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getCrossMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyMarginLeverage request test', ()=> { + /** + * modifyMarginLeverage + * Modify Cross Margin Leverage + * /api/v2/changeCrossUserLeverage + */ + let builder = ModifyMarginLeverageReq.builder(); + builder.setSymbol('XBTUSDTM').setLeverage('20'); + let req = builder.build(); + let resp = api.modifyMarginLeverage(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.leverage).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('addIsolatedMargin request test', ()=> { + /** + * addIsolatedMargin + * Add Isolated Margin + * /api/v1/position/margin/deposit-margin + */ + let builder = AddIsolatedMarginReq.builder(); + builder.setSymbol('DOGEUSDTM').setMargin(2).setBizNo('251160679598325760'); + let req = builder.build(); + let resp = api.addIsolatedMargin(req); + return resp.then(result => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.autoDeposit).toEqual(expect.anything()); + expect(result.maintMarginReq).toEqual(expect.anything()); + expect(result.riskLimit).toEqual(expect.anything()); + expect(result.realLeverage).toEqual(expect.anything()); + expect(result.crossMode).toEqual(expect.anything()); + expect(result.delevPercentage).toEqual(expect.anything()); + expect(result.openingTimestamp).toEqual(expect.anything()); + expect(result.currentTimestamp).toEqual(expect.anything()); + expect(result.currentQty).toEqual(expect.anything()); + expect(result.currentCost).toEqual(expect.anything()); + expect(result.currentComm).toEqual(expect.anything()); + expect(result.unrealisedCost).toEqual(expect.anything()); + expect(result.realisedGrossCost).toEqual(expect.anything()); + expect(result.realisedCost).toEqual(expect.anything()); + expect(result.isOpen).toEqual(expect.anything()); + expect(result.markPrice).toEqual(expect.anything()); + expect(result.markValue).toEqual(expect.anything()); + expect(result.posCost).toEqual(expect.anything()); + expect(result.posCross).toEqual(expect.anything()); + expect(result.posInit).toEqual(expect.anything()); + expect(result.posComm).toEqual(expect.anything()); + expect(result.posLoss).toEqual(expect.anything()); + expect(result.posMargin).toEqual(expect.anything()); + expect(result.posMaint).toEqual(expect.anything()); + expect(result.maintMargin).toEqual(expect.anything()); + expect(result.realisedGrossPnl).toEqual(expect.anything()); + expect(result.realisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnl).toEqual(expect.anything()); + expect(result.unrealisedPnlPcnt).toEqual(expect.anything()); + expect(result.unrealisedRoePcnt).toEqual(expect.anything()); + expect(result.avgEntryPrice).toEqual(expect.anything()); + expect(result.liquidationPrice).toEqual(expect.anything()); + expect(result.bankruptPrice).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.settleCurrency).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('removeIsolatedMargin request test', ()=> { + /** + * removeIsolatedMargin + * Remove Isolated Margin + * /api/v1/margin/withdrawMargin + */ + let builder = RemoveIsolatedMarginReq.builder(); + builder.setSymbol('DOGEUSDTM').setWithdrawAmount('1'); + let req = builder.build(); + let resp = api.removeIsolatedMargin(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getIsolatedMarginRiskLimit request test', ()=> { + /** + * getIsolatedMarginRiskLimit + * Get Isolated Margin Risk Limit + * /api/v1/contracts/risk-limit/{symbol} + */ + let builder = GetIsolatedMarginRiskLimitReq.builder(); + builder.setSymbol('XBTUSDTM'); + let req = builder.build(); + let resp = api.getIsolatedMarginRiskLimit(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyIsolatedMarginRiskLimt request test', ()=> { + /** + * modifyIsolatedMarginRiskLimt + * Modify Isolated Margin Risk Limit + * /api/v1/position/risk-limit-level/change + */ + let builder = ModifyIsolatedMarginRiskLimtReq.builder(); + builder.setSymbol('XBTUSDTM').setLevel(10); + let req = builder.build(); + let resp = api.modifyIsolatedMarginRiskLimt(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('modifyAutoDepositStatus request test', ()=> { + /** + * modifyAutoDepositStatus + * Modify Isolated Margin Auto-Deposit Status + * /api/v1/position/margin/auto-deposit-status + */ + let builder = ModifyAutoDepositStatusReq.builder(); + builder.setSymbol('DOGEUSDTM').setStatus(true); + let req = builder.build(); + let resp = api.modifyAutoDepositStatus(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + +}); diff --git a/sdk/node/tests/e2e/rest/margin_test/credit.test.ts b/sdk/node/tests/e2e/rest/margin_test/credit.test.ts new file mode 100644 index 00000000..957c7b0c --- /dev/null +++ b/sdk/node/tests/e2e/rest/margin_test/credit.test.ts @@ -0,0 +1,175 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + CreditAPI, + GetLoanMarketInterestRateReq, + GetLoanMarketReq, + GetPurchaseOrdersReq, + GetRedeemOrdersReq, + ModifyPurchaseReq, + PurchaseReq, + RedeemReq, +} from '@src/generate/margin/credit'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: CreditAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getMarginService().getCreditApi(); + }); + + test('getLoanMarket request test', () => { + /** + * getLoanMarket + * Get Loan Market + * /api/v3/project/list + */ + let builder = GetLoanMarketReq.builder(); + builder.setCurrency('DOGE'); + let req = builder.build(); + let resp = api.getLoanMarket(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getLoanMarketInterestRate request test', () => { + /** + * getLoanMarketInterestRate + * Get Loan Market Interest Rate + * /api/v3/project/marketInterestRate + */ + let builder = GetLoanMarketInterestRateReq.builder(); + builder.setCurrency('DOGE'); + let req = builder.build(); + let resp = api.getLoanMarketInterestRate(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('purchase request test', () => { + /** + * purchase + * Purchase + * /api/v3/purchase + */ + let builder = PurchaseReq.builder(); + builder.setCurrency('DOGE').setSize('10').setInterestRate('0.01'); + let req = builder.build(); + let resp = api.purchase(req); + return resp.then((result) => { + expect(result.orderNo).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifyPurchase request test', () => { + /** + * modifyPurchase + * Modify Purchase + * /api/v3/lend/purchase/update + */ + let builder = ModifyPurchaseReq.builder(); + builder + .setCurrency('DOGE') + .setInterestRate('0.02') + .setPurchaseOrderNo('6745708dad11d500073f083f'); + let req = builder.build(); + let resp = api.modifyPurchase(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPurchaseOrders request test', () => { + /** + * getPurchaseOrders + * Get Purchase Orders + * /api/v3/purchase/orders + */ + let builder = GetPurchaseOrdersReq.builder(); + builder.setCurrency('DOGE').setPurchaseOrderNo(''); + let req = builder.build(); + let resp = api.getPurchaseOrders(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('redeem request test', () => { + /** + * redeem + * Redeem + * /api/v3/redeem + */ + let builder = RedeemReq.builder(); + builder.setCurrency('DOGE').setSize('10').setPurchaseOrderNo('6745708dad11d500073f083f'); + let req = builder.build(); + let resp = api.redeem(req); + return resp.then((result) => { + expect(result.orderNo).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRedeemOrders request test', () => { + /** + * getRedeemOrders + * Get Redeem Orders + * /api/v3/redeem/orders + */ + let builder = GetRedeemOrdersReq.builder(); + builder.setCurrency('DOGE').setStatus(GetRedeemOrdersReq.StatusEnum.DONE); + let req = builder.build(); + let resp = api.getRedeemOrders(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/margin_test/debit.test.ts b/sdk/node/tests/e2e/rest/margin_test/debit.test.ts new file mode 100644 index 00000000..820ddfd9 --- /dev/null +++ b/sdk/node/tests/e2e/rest/margin_test/debit.test.ts @@ -0,0 +1,176 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + BorrowReq, + DebitAPI, + GetBorrowHistoryReq, + GetInterestHistoryReq, + GetRepayHistoryReq, + ModifyLeverageReq, + RepayReq, +} from '@src/generate/margin/debit'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: DebitAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getMarginService().getDebitApi(); + }); + + test('borrow request test', () => { + /** + * borrow + * Borrow + * /api/v3/margin/borrow + */ + let builder = BorrowReq.builder(); + builder + .setCurrency('USDT') + .setSize(10.0) + .setTimeInForce(BorrowReq.TimeInForceEnum.IOC) + .setSymbol('BTC-USDT') + .setIsIsolated(true) + .setIsHf(true); + let req = builder.build(); + let resp = api.borrow(req); + return resp.then((result) => { + expect(result.orderNo).toEqual(expect.anything()); + expect(result.actualSize).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getBorrowHistory request test', () => { + /** + * getBorrowHistory + * Get Borrow History + * /api/v3/margin/borrow + */ + let builder = GetBorrowHistoryReq.builder(); + builder.setCurrency('USDT').setIsIsolated(true).setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getBorrowHistory(req); + return resp.then((result) => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('repay request test', () => { + /** + * repay + * Repay + * /api/v3/margin/repay + */ + let builder = RepayReq.builder(); + builder + .setCurrency('USDT') + .setSize(10.0) + .setSymbol('BTC-USDT') + .setIsIsolated(true) + .setIsHf(true); + let req = builder.build(); + let resp = api.repay(req); + return resp.then((result) => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.orderNo).toEqual(expect.anything()); + expect(result.actualSize).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getRepayHistory request test', () => { + /** + * getRepayHistory + * Get Repay History + * /api/v3/margin/repay + */ + let builder = GetRepayHistoryReq.builder(); + builder.setCurrency('USDT').setIsIsolated(true).setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getRepayHistory(req); + return resp.then((result) => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getInterestHistory request test', () => { + /** + * getInterestHistory + * Get Interest History + * /api/v3/margin/interest + */ + let builder = GetInterestHistoryReq.builder(); + builder.setIsIsolated(true).setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getInterestHistory(req); + return resp.then((result) => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifyLeverage request test', () => { + /** + * modifyLeverage + * Modify Leverage + * /api/v3/position/update-user-leverage + */ + let builder = ModifyLeverageReq.builder(); + builder.setSymbol('BTC-USDT').setIsIsolated(true).setLeverage('3.1'); + let req = builder.build(); + let resp = api.modifyLeverage(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/margin_test/market.test.ts b/sdk/node/tests/e2e/rest/margin_test/market.test.ts new file mode 100644 index 00000000..d4c806be --- /dev/null +++ b/sdk/node/tests/e2e/rest/margin_test/market.test.ts @@ -0,0 +1,43 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { MarketAPI } from '@src/generate/margin/market'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: MarketAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getMarginService().getMarketApi(); + }); +}); From e1ef3bd034f58db1cfa076b23470061c1281fed5 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Mon, 10 Feb 2025 23:54:26 +0800 Subject: [PATCH 063/106] test(nodejs): add public tests --- sdk/node/tests/e2e/ws/spot/public.test.ts | 166 +++++++++++++++++++++- 1 file changed, 164 insertions(+), 2 deletions(-) diff --git a/sdk/node/tests/e2e/ws/spot/public.test.ts b/sdk/node/tests/e2e/ws/spot/public.test.ts index 0dc1b42f..230f2e7a 100644 --- a/sdk/node/tests/e2e/ws/spot/public.test.ts +++ b/sdk/node/tests/e2e/ws/spot/public.test.ts @@ -5,15 +5,30 @@ import { GlobalFuturesApiEndpoint, WebSocketClientOptionBuilder, } from '@model/index'; -import { AllTickersEvent, SpotPublicWS } from '@src/generate/spot/spotpublic'; +import { + AllTickersEvent, + SpotPublicWS, + TickerEvent, + OrderbookIncrementEvent, + OrderbookLevel5Event, + KlinesEvent, + TradeEvent, + OrderbookLevel50Event, + MarketSnapshotEvent +} from '@src/generate/spot/spotpublic'; import { DefaultClient } from '@api/index'; function delay(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -describe('Auto Test', () => { +// Set longer timeout for WebSocket tests +jest.setTimeout(30000); + +describe('Spot Public WebSocket API Tests', () => { let api: SpotPublicWS; + const TEST_SYMBOL = 'BTC-USDT'; + const TEST_DURATION = 5000; // 5 seconds for each test beforeAll(async () => { const key = process.env.API_KEY || ''; @@ -68,4 +83,151 @@ describe('Auto Test', () => { return api.unSubscribe(id); }); }); + + test('ticker test', () => { + const subid = api.ticker([TEST_SYMBOL], (topic: string, subject: string, data: TickerEvent) => { + expect(data).toBeDefined(); + expect(data.sequence).toEqual(expect.anything()); + expect(data.price).toEqual(expect.anything()); + expect(data.size).toEqual(expect.anything()); + expect(data.bestAsk).toEqual(expect.anything()); + expect(data.bestAskSize).toEqual(expect.anything()); + expect(data.bestBid).toEqual(expect.anything()); + expect(data.bestBidSize).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook increment subscription test', () => { + const subid = api.orderbookIncrement([TEST_SYMBOL], (topic: string, subject: string, data: OrderbookIncrementEvent) => { + expect(data).toBeDefined(); + expect(data.sequenceStart).toEqual(expect.anything()); + expect(data.sequenceEnd).toEqual(expect.anything()); + expect(data.changes).toBeDefined(); + expect(data.time).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook level5 subscription test', () => { + const subid = api.orderbookLevel5([TEST_SYMBOL], (topic: string, subject: string, data: OrderbookLevel5Event) => { + expect(data).toBeDefined(); + expect(data.asks).toEqual(expect.anything()); + expect(data.bids).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('klines subscription test', () => { + const subid = api.klines(TEST_SYMBOL, '1min', (topic: string, subject: string, data: KlinesEvent) => { + expect(data).toBeDefined(); + expect(data.candles).toEqual(expect.anything()); + expect(data.candles).toEqual(expect.anything()); + expect(data.time).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('trade subscription test', () => { + const subid = api.trade([TEST_SYMBOL], (topic: string, subject: string, data: TradeEvent) => { + expect(data).toBeDefined(); + expect(data.makerOrderId).toEqual(expect.anything()); + expect(data.price).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.side).toEqual(expect.anything()); + expect(data.size).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + expect(data.takerOrderId).toEqual(expect.anything()); + expect(data.time).toEqual(expect.anything()); + expect(data.type).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook level50 subscription test', () => { + const subid = api.orderbookLevel50([TEST_SYMBOL], (topic: string, subject: string, data: OrderbookLevel50Event) => { + expect(data).toBeDefined(); + expect(data.sequenceStart).toEqual(expect.anything()); + expect(data.sequenceEnd).toEqual(expect.anything()); + expect(data.changes).toEqual(expect.anything()); + expect(data.time).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('market snapshot subscription test', () => { + const subid = api.marketSnapshot(TEST_SYMBOL, (topic: string, subject: string, data: MarketSnapshotEvent) => { + expect(data).toBeDefined(); + expect(data.sequence).toEqual(expect.anything()); + expect(data.data).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + }); From 652b167f999f94d8b64fa383343b356f51cf392c Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 11 Feb 2025 00:32:10 +0800 Subject: [PATCH 064/106] test(nodejs): add futures public websocket tests --- sdk/node/tests/e2e/ws/futures/public.test.ts | 293 +++++++++++++++++++ 1 file changed, 293 insertions(+) create mode 100644 sdk/node/tests/e2e/ws/futures/public.test.ts diff --git a/sdk/node/tests/e2e/ws/futures/public.test.ts b/sdk/node/tests/e2e/ws/futures/public.test.ts new file mode 100644 index 00000000..7c200882 --- /dev/null +++ b/sdk/node/tests/e2e/ws/futures/public.test.ts @@ -0,0 +1,293 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { + AnnouncementEvent, + ExecutionEvent, + FuturesPublicWS, + InstrumentEvent, + KlinesEvent, + OrderbookIncrementEvent, + OrderbookLevel5Event, + OrderbookLevel50Event, + SymbolSnapshotEvent, + TickerV1Event, + TickerV2Event +} from '@src/generate/futures/futurespublic'; +import { DefaultClient } from '@api/index'; + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +// Set longer timeout for WebSocket tests +jest.setTimeout(30000); + + + + +describe('Futures Public WebSocket API Tests', () => { + let api: FuturesPublicWS; + const TEST_SYMBOL = 'XBTUSDTM'; + const TEST_DURATION = 5000; // 5 seconds for each test + + beforeAll(async () => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + api = wsService.newFuturesPublicWS(); + await api.start(); + }); + + afterAll(() => { + api.stop(); + }); + + test('announcement subscription test', () => { + const subid = api.announcement(TEST_SYMBOL, (topic: string, subject: string, data: AnnouncementEvent) => { + expect(data).toBeDefined(); + expect(data.symbol).toEqual(expect.anything()); + expect(data.fundingTime).toEqual(expect.anything()); + expect(data.fundingRate).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('execution subscription test', () => { + const subid = api.execution(TEST_SYMBOL, (topic: string, subject: string, data: ExecutionEvent) => { + expect(data).toBeDefined(); + expect(data.makerOrderId).toEqual(expect.anything()); + expect(data.price).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.side).toEqual(expect.anything()); + expect(data.size).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + expect(data.takerOrderId).toEqual(expect.anything()); + expect(data.tradeId).toEqual(expect.anything()); + expect(data.ts).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('instrument subscription test', () => { + const subid = api.instrument(TEST_SYMBOL, (topic: string, subject: string, data: InstrumentEvent) => { + expect(data).toBeDefined(); + expect(data.granularity).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + // Optional fields + if (data.fundingRate !== undefined) { + expect(data.fundingRate).toEqual(expect.anything()); + } + if (data.markPrice !== undefined) { + expect(data.markPrice).toEqual(expect.anything()); + } + if (data.indexPrice !== undefined) { + expect(data.indexPrice).toEqual(expect.anything()); + } + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('klines subscription test', () => { + const subid = api.klines(TEST_SYMBOL, '1min', (topic: string, subject: string, data: KlinesEvent) => { + expect(data).toBeDefined(); + expect(data.candles).toEqual(expect.anything()); + expect(data.time).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook increment subscription test', () => { + const subid = api.orderbookIncrement(TEST_SYMBOL, (topic: string, subject: string, data: OrderbookIncrementEvent) => { + expect(data).toBeDefined(); + expect(data.change).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook level50 subscription test', () => { + const subid = api.orderbookLevel50(TEST_SYMBOL, (topic: string, subject: string, data: OrderbookLevel50Event) => { + expect(data).toBeDefined(); + expect(data.asks).toEqual(expect.anything()); + expect(data.bids).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('orderbook level5 subscription test', () => { + const subid = api.orderbookLevel5(TEST_SYMBOL, (topic: string, subject: string, data: OrderbookLevel5Event) => { + expect(data).toBeDefined(); + expect(data.asks).toEqual(expect.anything()); + expect(data.bids).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('symbol snapshot subscription test', () => { + const subid = api.symbolSnapshot(TEST_SYMBOL, (topic: string, subject: string, data: SymbolSnapshotEvent) => { + expect(data).toBeDefined(); + expect(data.highPrice).toEqual(expect.anything()); + expect(data.lastPrice).toEqual(expect.anything()); + expect(data.lowPrice).toEqual(expect.anything()); + expect(data.price24HoursBefore).toEqual(expect.anything()); + + expect(data.priceChg).toEqual(expect.anything()); + expect(data.priceChgPct).toEqual(expect.anything()); + expect(data.symbol).toEqual(expect.anything()); + expect(data.ts).toEqual(expect.anything()); + expect(data.turnover).toEqual(expect.anything()); + expect(data.volume).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('ticker v1 subscription test', () => { + const subid = api.tickerV1(TEST_SYMBOL, (topic: string, subject: string, data: TickerV1Event) => { + expect(data).toBeDefined(); + expect(data.symbol).toEqual(expect.anything()); + expect(data.bestAskSize).toEqual(expect.anything()); + expect(data.tradeId).toEqual(expect.anything()); + expect(data.bestBidSize).toEqual(expect.anything()); + expect(data.price).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.size).toEqual(expect.anything()); + expect(data.side).toEqual(expect.anything()); + expect(data.ts).toEqual(expect.anything()); + expect(data.bestAskPrice).toEqual(expect.anything()); + expect(data.bestBidPrice).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('ticker v2 subscription test', () => { + const subid = api.tickerV2(TEST_SYMBOL, (topic: string, subject: string, data: TickerV2Event) => { + expect(data).toBeDefined(); + expect(data.symbol).toEqual(expect.anything()); + expect(data.bestAskSize).toEqual(expect.anything()); + expect(data.bestBidPrice).toEqual(expect.anything()); + expect(data.bestBidSize).toEqual(expect.anything()); + expect(data.bestAskPrice).toEqual(expect.anything()); + expect(data.bestAskSize).toEqual(expect.anything()); + expect(data.sequence).toEqual(expect.anything()); + expect(data.ts).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); +}); From 8e4ed6e3dd4a4370aab4e890ac978dbd378f5266 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 11 Feb 2025 09:52:41 +0800 Subject: [PATCH 065/106] test(nodejs): add more tests --- .../tests/e2e/rest/margin_test/market.test.ts | 95 ++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/sdk/node/tests/e2e/rest/margin_test/market.test.ts b/sdk/node/tests/e2e/rest/margin_test/market.test.ts index d4c806be..587c9125 100644 --- a/sdk/node/tests/e2e/rest/margin_test/market.test.ts +++ b/sdk/node/tests/e2e/rest/margin_test/market.test.ts @@ -5,7 +5,7 @@ import { GlobalFuturesApiEndpoint, TransportOptionBuilder, } from '@model/index'; -import { MarketAPI } from '@src/generate/margin/market'; +import { GetCrossMarginSymbolsReq, GetETFInfoReq, GetMarkPriceDetailReq, MarketAPI } from '@src/generate/margin/market'; import { DefaultClient } from '@api/index'; describe('Auto Test', () => { @@ -40,4 +40,97 @@ describe('Auto Test', () => { const kucoinRestService = client.restService(); api = kucoinRestService.getMarginService().getMarketApi(); }); + + test('getCrossMarginSymbols request test', ()=> { + /** + * getCrossMarginSymbols + * Get Symbols - Cross Margin + * /api/v3/margin/symbols + */ + let builder = GetCrossMarginSymbolsReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getCrossMarginSymbols(req); + return resp.then(result => { + expect(result.timestamp).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMarginConfig request test', ()=> { + /** + * getMarginConfig + * Get Margin Config + * /api/v1/margin/config + */ + let resp = api.getMarginConfig(); + return resp.then(result => { + expect(result.currencyList).toEqual(expect.anything()); + expect(result.maxLeverage).toEqual(expect.anything()); + expect(result.warningDebtRatio).toEqual(expect.anything()); + expect(result.liqDebtRatio).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getETFInfo request test', ()=> { + /** + * getETFInfo + * Get ETF Info + * /api/v3/etf/info + */ + let builder = GetETFInfoReq.builder(); + builder.setCurrency(?); + let req = builder.build(); + let resp = api.getETFInfo(req); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMarkPriceList request test', ()=> { + /** + * getMarkPriceList + * Get Mark Price List + * /api/v3/mark-price/all-symbols + */ + let resp = api.getMarkPriceList(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getMarkPriceDetail request test', ()=> { + /** + * getMarkPriceDetail + * Get Mark Price Detail + * /api/v1/mark-price/{symbol}/current + */ + let builder = GetMarkPriceDetailReq.builder(); + builder.setSymbol(?); + let req = builder.build(); + let resp = api.getMarkPriceDetail(req); + return resp.then(result => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.timePoint).toEqual(expect.anything()); + expect(result.value).toEqual(expect.anything()); + console.log(resp); + }); + }) + + test('getIsolatedMarginSymbols request test', ()=> { + /** + * getIsolatedMarginSymbols + * Get Symbols - Isolated Margin + * /api/v1/isolated/symbols + */ + let resp = api.getIsolatedMarginSymbols(); + return resp.then(result => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }) }); From 2139d9011e1ed6e48e270440b8100d00d934beb4 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 11 Feb 2025 10:56:00 +0800 Subject: [PATCH 066/106] test(nodejs): add margin public websocket tests --- sdk/node/tests/e2e/ws/margin/public.test.ts | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sdk/node/tests/e2e/ws/margin/public.test.ts diff --git a/sdk/node/tests/e2e/ws/margin/public.test.ts b/sdk/node/tests/e2e/ws/margin/public.test.ts new file mode 100644 index 00000000..52b6034c --- /dev/null +++ b/sdk/node/tests/e2e/ws/margin/public.test.ts @@ -0,0 +1,93 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { + MarginPublicWS, + IndexPriceEvent, + MarkPriceEvent, +} from '@src/generate/margin/marginpublic'; +import { DefaultClient } from '@api/index'; + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +// Set longer timeout for WebSocket tests +jest.setTimeout(30000); + +describe('Margin Public WebSocket API Tests', () => { + let api: MarginPublicWS; + const TEST_SYMBOL = ['BTC-USDT']; + const TEST_DURATION = 5000; // 5 seconds for each test + + beforeAll(async () => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + api = wsService.newMarginPublicWS(); + await api.start(); + }); + + afterAll(() => { + api.stop(); + }); + + test('indexPrice subscription test', () => { + const subid = api.indexPrice(TEST_SYMBOL, (topic: string, subject: string, data: IndexPriceEvent) => { + expect(data).toBeDefined(); + expect(data.symbol).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + expect(data.granularity).toEqual(expect.anything()); + expect(data.value).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); + + test('markPrice subscription test', () => { + const subid = api.markPrice(TEST_SYMBOL, (topic: string, subject: string, data: MarkPriceEvent) => { + expect(data).toBeDefined(); + expect(data.symbol).toEqual(expect.anything()); + expect(data.timestamp).toEqual(expect.anything()); + expect(data.granularity).toEqual(expect.anything()); + expect(data.value).toEqual(expect.anything()); + console.log(data); + }); + + return subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return api.unSubscribe(id); + }); + }); +}); From f857c6c30cb1ec3378cf533f8d72ae9b239ad3f2 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 11 Feb 2025 12:11:44 +0800 Subject: [PATCH 067/106] test(nodejs): update margin test --- .../src/internal/infra/default_transport.ts | 6 +- sdk/node/src/model/common.ts | 10 +- .../tests/e2e/rest/margin_test/credit.test.ts | 34 +- .../tests/e2e/rest/margin_test/debit.test.ts | 28 +- .../tests/e2e/rest/margin_test/market.test.ts | 100 +++- .../tests/e2e/rest/margin_test/order.test.ts | 476 ++++++++++++++++++ .../e2e/rest/margin_test/risklimit.test.ts | 62 +++ 7 files changed, 673 insertions(+), 43 deletions(-) create mode 100644 sdk/node/tests/e2e/rest/margin_test/order.test.ts create mode 100644 sdk/node/tests/e2e/rest/margin_test/risklimit.test.ts diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index f0f26902..3bd65529 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -114,7 +114,7 @@ export class DefaultTransport implements Transport { } private processHeaders( - body: string, + body: string | null, rawUrl: string, config: AxiosRequestConfig, method: string, @@ -184,7 +184,7 @@ export class DefaultTransport implements Transport { ): AxiosRequestConfig { const fullPath = endpoint + path; const rawUrl = path; - let reqBody = ''; + let reqBody = null; let queryPath = path; if (requestAsJson) { @@ -316,7 +316,7 @@ export class DefaultTransport implements Transport { if (err instanceof RestError) { throw err; } else { - throw new RestError(null, err.message); + throw new RestError(null, err); } }); } diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index 23058527..e4d1a283 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -53,7 +53,7 @@ export class RestResponse { } throw new RestError( this, - `Server returned error, code: {${this.code}}, message: {${this.msg || 'unknown'}}`, + new Error(`Server returned error, code: {${this.code}}, message: {${this.msg || 'unknown'}}`), ); } } @@ -61,16 +61,16 @@ export class RestResponse { export class RestError extends Error { constructor( private response: RestResponse | null, - private msg?: string, + private err?: Error, ) { - super(msg); + super(err?.message || 'unknown'); } toString() { if (this.response) { - return `request error, server code: ${this.response.code}, server msg: ${this.response.msg}, context msg: ${this.msg}`; + return `request error, server code: ${this.response.code}, server msg: ${this.response.msg}, context msg: ${this.err?.message || 'unknown'}`; } - return `request error, context msg: ${this.msg}`; + return `request error, ${this.err}`; } getCommonResponse() { diff --git a/sdk/node/tests/e2e/rest/margin_test/credit.test.ts b/sdk/node/tests/e2e/rest/margin_test/credit.test.ts index 957c7b0c..6a93e77d 100644 --- a/sdk/node/tests/e2e/rest/margin_test/credit.test.ts +++ b/sdk/node/tests/e2e/rest/margin_test/credit.test.ts @@ -61,7 +61,19 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getLoanMarket(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((element) => { + expect(element.currency).toEqual(expect.anything()); + expect(element.purchaseEnable).toEqual(expect.anything()); + expect(element.redeemEnable).toEqual(expect.anything()); + expect(element.increment).toEqual(expect.anything()); + expect(element.minPurchaseSize).toEqual(expect.anything()); + expect(element.minInterestRate).toEqual(expect.anything()); + expect(element.maxInterestRate).toEqual(expect.anything()); + expect(element.interestIncrement).toEqual(expect.anything()); + expect(element.maxPurchaseSize).toEqual(expect.anything()); + expect(element.marketInterestRate).toEqual(expect.anything()); + expect(element.autoPurchaseEnable).toEqual(expect.anything()); + }) console.log(resp); }); }); @@ -77,7 +89,10 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getLoanMarketInterestRate(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((element) => { + expect(element.marketInterestRate).toEqual(expect.anything()); + expect(element.time).toEqual(expect.anything()); + }) console.log(resp); }); }); @@ -108,7 +123,7 @@ describe('Auto Test', () => { builder .setCurrency('DOGE') .setInterestRate('0.02') - .setPurchaseOrderNo('6745708dad11d500073f083f'); + .setPurchaseOrderNo('67aabb111a8c110007ba2e5a'); let req = builder.build(); let resp = api.modifyPurchase(req); return resp.then((result) => { @@ -124,7 +139,7 @@ describe('Auto Test', () => { * /api/v3/purchase/orders */ let builder = GetPurchaseOrdersReq.builder(); - builder.setCurrency('DOGE').setPurchaseOrderNo(''); + builder.setCurrency('DOGE').setPurchaseOrderNo('67aabb111a8c110007ba2e5a').setStatus(GetPurchaseOrdersReq.StatusEnum.DONE); let req = builder.build(); let resp = api.getPurchaseOrders(req); return resp.then((result) => { @@ -144,7 +159,7 @@ describe('Auto Test', () => { * /api/v3/redeem */ let builder = RedeemReq.builder(); - builder.setCurrency('DOGE').setSize('10').setPurchaseOrderNo('6745708dad11d500073f083f'); + builder.setCurrency('DOGE').setSize('10').setPurchaseOrderNo('67aabb111a8c110007ba2e5a'); let req = builder.build(); let resp = api.redeem(req); return resp.then((result) => { @@ -168,7 +183,14 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((element) => { + expect(element.currency).toEqual(expect.anything()); + expect(element.purchaseOrderNo).toEqual(expect.anything()); + expect(element.redeemOrderNo).toEqual(expect.anything()); + expect(element.redeemSize).toEqual(expect.anything()); + expect(element.receiptSize).toEqual(expect.anything()); + expect(element.status).toEqual(expect.anything()); + }) console.log(resp); }); }); diff --git a/sdk/node/tests/e2e/rest/margin_test/debit.test.ts b/sdk/node/tests/e2e/rest/margin_test/debit.test.ts index 820ddfd9..6000c0c0 100644 --- a/sdk/node/tests/e2e/rest/margin_test/debit.test.ts +++ b/sdk/node/tests/e2e/rest/margin_test/debit.test.ts @@ -88,7 +88,15 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.orderNo).toEqual(expect.anything()); + expect(item.symbol).toEqual(expect.anything()); + expect(item.currency).toEqual(expect.anything()); + expect(item.size).toEqual(expect.anything()); + expect(item.actualSize).toEqual(expect.anything()); + expect(item.status).toEqual(expect.anything()); + expect(item.createdTime).toEqual(expect.anything()); + }) console.log(resp); }); }); @@ -132,7 +140,16 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.orderNo).toEqual(expect.anything()); + expect(item.symbol).toEqual(expect.anything()); + expect(item.currency).toEqual(expect.anything()); + expect(item.size).toEqual(expect.anything()); + expect(item.principal).toEqual(expect.anything()); + expect(item.interest).toEqual(expect.anything()); + expect(item.status).toEqual(expect.anything()); + expect(item.createdTime).toEqual(expect.anything()); + }) console.log(resp); }); }); @@ -153,7 +170,12 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.currency).toEqual(expect.anything()); + expect(item.createdTime).toEqual(expect.anything()); + expect(item.dayRatio).toEqual(expect.anything()); + expect(item.interestAmount).toEqual(expect.anything()); + }) console.log(resp); }); }); diff --git a/sdk/node/tests/e2e/rest/margin_test/market.test.ts b/sdk/node/tests/e2e/rest/margin_test/market.test.ts index 587c9125..42a288b3 100644 --- a/sdk/node/tests/e2e/rest/margin_test/market.test.ts +++ b/sdk/node/tests/e2e/rest/margin_test/market.test.ts @@ -5,7 +5,12 @@ import { GlobalFuturesApiEndpoint, TransportOptionBuilder, } from '@model/index'; -import { GetCrossMarginSymbolsReq, GetETFInfoReq, GetMarkPriceDetailReq, MarketAPI } from '@src/generate/margin/market'; +import { + GetCrossMarginSymbolsReq, + GetETFInfoReq, + GetMarkPriceDetailReq, + MarketAPI, +} from '@src/generate/margin/market'; import { DefaultClient } from '@api/index'; describe('Auto Test', () => { @@ -41,96 +46,139 @@ describe('Auto Test', () => { api = kucoinRestService.getMarginService().getMarketApi(); }); - test('getCrossMarginSymbols request test', ()=> { + test('getCrossMarginSymbols request test', () => { /** * getCrossMarginSymbols * Get Symbols - Cross Margin * /api/v3/margin/symbols */ let builder = GetCrossMarginSymbolsReq.builder(); - builder.setSymbol(?); + builder.setSymbol('BTC-USDT'); let req = builder.build(); let resp = api.getCrossMarginSymbols(req); - return resp.then(result => { + return resp.then((result) => { expect(result.timestamp).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.symbol).toEqual(expect.anything()); + expect(item.name).toEqual(expect.anything()); + expect(item.enableTrading).toEqual(expect.any(Boolean)); + expect(item.market).toEqual(expect.anything()); + expect(item.baseCurrency).toEqual(expect.anything()); + expect(item.quoteCurrency).toEqual(expect.anything()); + expect(item.baseIncrement).toEqual(expect.anything()); + expect(item.baseMinSize).toEqual(expect.anything()); + expect(item.quoteIncrement).toEqual(expect.anything()); + expect(item.quoteMinSize).toEqual(expect.anything()); + expect(item.baseMaxSize).toEqual(expect.anything()); + expect(item.quoteMaxSize).toEqual(expect.anything()); + expect(item.priceIncrement).toEqual(expect.anything()); + expect(item.feeCurrency).toEqual(expect.anything()); + expect(item.priceLimitRate).toEqual(expect.anything()); + expect(item.minFunds).toEqual(expect.anything()); + }); console.log(resp); }); - }) + }); - test('getMarginConfig request test', ()=> { + test('getMarginConfig request test', () => { /** * getMarginConfig * Get Margin Config * /api/v1/margin/config */ let resp = api.getMarginConfig(); - return resp.then(result => { + return resp.then((result) => { expect(result.currencyList).toEqual(expect.anything()); expect(result.maxLeverage).toEqual(expect.anything()); expect(result.warningDebtRatio).toEqual(expect.anything()); expect(result.liqDebtRatio).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getETFInfo request test', ()=> { + test('getETFInfo request test', () => { /** * getETFInfo * Get ETF Info * /api/v3/etf/info */ let builder = GetETFInfoReq.builder(); - builder.setCurrency(?); + builder.setCurrency('BTCUP'); let req = builder.build(); let resp = api.getETFInfo(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.currency).toEqual(expect.any(String)); + expect(item.netAsset).toEqual(expect.any(String)); + expect(item.targetLeverage).toEqual(expect.any(String)); + expect(item.actualLeverage).toEqual(expect.any(String)); + expect(item.issuedSize).toEqual(expect.any(String)); + expect(item.basket).toEqual(expect.any(String)); + }); console.log(resp); }); - }) + }); - test('getMarkPriceList request test', ()=> { + test('getMarkPriceList request test', () => { /** * getMarkPriceList * Get Mark Price List * /api/v3/mark-price/all-symbols */ let resp = api.getMarkPriceList(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.timePoint).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(Number)); + }); console.log(resp); }); - }) + }); - test('getMarkPriceDetail request test', ()=> { + test('getMarkPriceDetail request test', () => { /** * getMarkPriceDetail * Get Mark Price Detail * /api/v1/mark-price/{symbol}/current */ let builder = GetMarkPriceDetailReq.builder(); - builder.setSymbol(?); + builder.setSymbol('USDT-BTC'); let req = builder.build(); let resp = api.getMarkPriceDetail(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.timePoint).toEqual(expect.anything()); expect(result.value).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getIsolatedMarginSymbols request test', ()=> { + test('getIsolatedMarginSymbols request test', () => { /** * getIsolatedMarginSymbols * Get Symbols - Isolated Margin * /api/v1/isolated/symbols */ let resp = api.getIsolatedMarginSymbols(); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.symbolName).toEqual(expect.any(String)); + expect(item.baseCurrency).toEqual(expect.any(String)); + expect(item.quoteCurrency).toEqual(expect.any(String)); + expect(item.maxLeverage).toEqual(expect.any(Number)); + expect(item.flDebtRatio).toEqual(expect.any(String)); + expect(item.tradeEnable).toEqual(expect.any(Boolean)); + expect(item.autoRenewMaxDebtRatio).toEqual(expect.any(String)); + expect(item.baseBorrowEnable).toEqual(expect.any(Boolean)); + expect(item.quoteBorrowEnable).toEqual(expect.any(Boolean)); + expect(item.baseTransferInEnable).toEqual(expect.any(Boolean)); + expect(item.quoteTransferInEnable).toEqual(expect.any(Boolean)); + expect(item.baseBorrowCoefficient).toEqual(expect.any(String)); + expect(item.quoteBorrowCoefficient).toEqual(expect.any(String)); + }); console.log(resp); }); - }) + }); }); diff --git a/sdk/node/tests/e2e/rest/margin_test/order.test.ts b/sdk/node/tests/e2e/rest/margin_test/order.test.ts new file mode 100644 index 00000000..ee17566e --- /dev/null +++ b/sdk/node/tests/e2e/rest/margin_test/order.test.ts @@ -0,0 +1,476 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddOrderReq, + AddOrderTestReq, + AddOrderTestV1Req, + AddOrderV1Req, + CancelAllOrdersBySymbolReq, + CancelOrderByClientOidReq, + CancelOrderByOrderIdReq, + GetClosedOrdersReq, + GetOpenOrdersReq, + GetOrderByClientOidReq, + GetOrderByOrderIdReq, + GetSymbolsWithOpenOrderReq, + GetTradeHistoryReq, + OrderAPI, +} from '@src/generate/margin/order'; +import { DefaultClient } from '@api/index'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: OrderAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getMarginService().getOrderApi(); + }); + + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v3/hf/margin/order + */ + let builder = AddOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderReq.SideEnum.BUY) + .setSymbol('DOGE-USDT') + .setType(AddOrderReq.TypeEnum.LIMIT) + .setSize('100') + .setPrice('0.01') + .setIsIsolated(false) + .setAutoBorrow(true) + .setAutoRepay(true); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + // 429 + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v3/hf/margin/order/test + */ + let builder = AddOrderTestReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderTestReq.SideEnum.BUY) + .setSymbol('DOGE-USDT') + .setType(AddOrderTestReq.TypeEnum.MARKET) + .setFunds('10') + .setIsIsolated(false) + .setAutoBorrow(true) + .setAutoRepay(true); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByOrderId request test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId('67aaca338930080007f4e36d').setSymbol('DOGE-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByOrderId(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid('c5157df9-a091-4f26-90e9-0a5b40a2ffa0').setSymbol('DOGE-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelAllOrdersBySymbol request test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v3/hf/margin/orders + */ + let builder = CancelAllOrdersBySymbolReq.builder(); + builder + .setSymbol('DOGE-USDT') + .setTradeType(CancelAllOrdersBySymbolReq.TradeTypeEnum.MARGIN_ISOLATED_TRADE); + let req = builder.build(); + let resp = api.cancelAllOrdersBySymbol(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSymbolsWithOpenOrder request test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v3/hf/margin/order/active/symbols + */ + let builder = GetSymbolsWithOpenOrderReq.builder(); + builder.setTradeType(GetSymbolsWithOpenOrderReq.TradeTypeEnum.MARGIN_ISOLATED_TRADE); + let req = builder.build(); + let resp = api.getSymbolsWithOpenOrder(req); + return resp.then((result) => { + expect(result.symbolSize).toEqual(expect.anything()); + expect(result.symbols).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOpenOrders request test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v3/hf/margin/orders/active + */ + let builder = GetOpenOrdersReq.builder(); + builder.setSymbol('DOGE-USDT').setTradeType(GetOpenOrdersReq.TradeTypeEnum.MARGIN_TRADE); + let req = builder.build(); + let resp = api.getOpenOrders(req); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.opType).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.funds).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(String)); + expect(item.dealFunds).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.stopPrice).toEqual(expect.any(String)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.visibleSize).toEqual(expect.any(String)); + expect(item.cancelAfter).toEqual(expect.any(Number)); + expect(item.channel).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.lastUpdatedAt).toEqual(expect.any(Number)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.inOrderBook).toEqual(expect.any(Boolean)); + expect(item.cancelledSize).toEqual(expect.any(String)); + expect(item.cancelledFunds).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.remainFunds).toEqual(expect.any(String)); + expect(item.tax).toEqual(expect.any(String)); + expect(item.active).toEqual(expect.any(Boolean)); + }); + console.log(resp); + }); + }); + + test('getClosedOrders request test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v3/hf/margin/orders/done + */ + let builder = GetClosedOrdersReq.builder(); + builder + .setSymbol('DOGE-USDT') + .setTradeType(GetClosedOrdersReq.TradeTypeEnum.MARGIN_TRADE) + .setSide(GetClosedOrdersReq.SideEnum.BUY) + .setType(GetClosedOrdersReq.TypeEnum.MARKET); + let req = builder.build(); + let resp = api.getClosedOrders(req); + return resp.then((result) => { + result.items.forEach(item => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.opType).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.funds).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(String)); + expect(item.dealFunds).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.stopPrice).toEqual(expect.any(String)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.visibleSize).toEqual(expect.any(String)); + expect(item.cancelAfter).toEqual(expect.any(Number)); + expect(item.channel).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.lastUpdatedAt).toEqual(expect.any(Number)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.inOrderBook).toEqual(expect.any(Boolean)); + expect(item.cancelledSize).toEqual(expect.any(String)); + expect(item.cancelledFunds).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.tax).toEqual(expect.any(String)); + expect(item.active).toEqual(expect.any(Boolean)); + }) + console.log(resp); + }); + }); + + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v3/hf/margin/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder + .setSymbol('DOGE-USDT') + .setTradeType(GetTradeHistoryReq.TradeTypeEnum.MARGIN_TRADE) + .setSide(GetTradeHistoryReq.SideEnum.BUY); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then((result) => { + result.items.forEach(item=> { + expect(item.id).toEqual(expect.any(Number)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(Number)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.counterOrderId).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.forceTaker).toEqual(expect.any(Boolean)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.funds).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeRate).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.tax).toEqual(expect.any(String)); + expect(item.taxRate).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + }) + expect(result.lastId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v3/hf/margin/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol('DOGE-USDT').setOrderId('67aacc7eb7f57d000798aa0f'); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v3/hf/margin/orders/client-order/{clientOid} + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setSymbol('DOGE-USDT').setClientOid('7dc5c71f-048d-4a83-8846-eb7b3040e1ea'); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderV1 request test', () => { + /** + * addOrderV1 + * Add Order - V1 + * /api/v1/margin/order + */ + let builder = AddOrderV1Req.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderV1Req.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderV1Req.TypeEnum.LIMIT) + .setPrice('10000') + .setSize('0.001') + .setAutoBorrow(false) + .setAutoRepay(false) + .setMarginModel(AddOrderV1Req.MarginModelEnum.ISOLATED); + let req = builder.build(); + let resp = api.addOrderV1(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + // 429 + test('addOrderTestV1 request test', () => { + /** + * addOrderTestV1 + * Add Order Test - V1 + * /api/v1/margin/order/test + */ + let builder = AddOrderTestV1Req.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderTestV1Req.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderTestV1Req.TypeEnum.LIMIT) + .setPrice('10000') + .setSize('0.001') + .setAutoBorrow(false) + .setAutoRepay(false) + .setMarginModel(AddOrderTestV1Req.MarginModelEnum.ISOLATED); + let req = builder.build(); + let resp = api.addOrderTestV1(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.loanApplyId).toEqual(expect.anything()); + expect(result.borrowSize).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/margin_test/risklimit.test.ts b/sdk/node/tests/e2e/rest/margin_test/risklimit.test.ts new file mode 100644 index 00000000..f27bb9b2 --- /dev/null +++ b/sdk/node/tests/e2e/rest/margin_test/risklimit.test.ts @@ -0,0 +1,62 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { GetMarginRiskLimitReq, RiskLimitAPI } from '@src/generate/margin/risklimit'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: RiskLimitAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getMarginService().getRiskLimitApi(); + }); + + test('getMarginRiskLimit request test', () => { + /** + * getMarginRiskLimit + * Get Margin Risk Limit + * /api/v3/margin/currencies + */ + let builder = GetMarginRiskLimitReq.builder(); + builder.setIsIsolated(false).setCurrency('BTC'); + let req = builder.build(); + let resp = api.getMarginRiskLimit(req); + return resp.then((result) => { + result.data.forEach((item) => { + console.log(item); + }); + console.log(resp); + }); + }); + 1; +}); From 5916a0cd167ee0491c3f2a177356a276cacd021f Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 11 Feb 2025 16:28:19 +0800 Subject: [PATCH 068/106] test(nodejs): update futures test --- .../src/internal/infra/default_transport.ts | 10 +- .../e2e/rest/futures_test/funding_fee.test.ts | 26 ++- .../e2e/rest/futures_test/market.test.ts | 76 ++++++-- .../tests/e2e/rest/futures_test/order.test.ts | 155 ++++++++++++++-- .../e2e/rest/futures_test/positions.test.ts | 167 ++++++++++++------ 5 files changed, 337 insertions(+), 97 deletions(-) diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 3bd65529..5ce76b6b 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -224,18 +224,14 @@ export class DefaultTransport implements Transport { const config: AxiosRequestConfig = { method: method.toLowerCase() as any, url: endpoint + queryPath, - data: reqBody, headers: { + 'Content-Type': 'application/json', 'User-Agent': `Kucoin-Universal-Node-SDK/${this.version}`, }, }; - // Add Content-Type only for POST and PUT requests - if (method === 'POST' || method === 'PUT') { - config.headers = { - ...config.headers, - 'Content-Type': 'application/json', - }; + if (reqBody != null) { + config.data = reqBody; } // Use queryPath instead of rawUrl for signature diff --git a/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts b/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts index 0f57c0c9..40118d4a 100644 --- a/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts +++ b/sdk/node/tests/e2e/rest/futures_test/funding_fee.test.ts @@ -79,11 +79,15 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getPublicFundingHistory(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); - console.log(resp); + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.fundingRate).toEqual(expect.any(Number)); + expect(item.timepoint).toEqual(expect.any(Number)); + }) }); }); + // TODO empty test('getPrivateFundingHistory request test', () => { /** * getPrivateFundingHistory @@ -93,14 +97,26 @@ describe('Auto Test', () => { let builder = GetPrivateFundingHistoryReq.builder(); builder .setSymbol('XBTUSDTM') - .setFrom(1700310700000) - .setTo(1702310700000) + .setFrom(1739203200000) + .setTo(1739289600000) .setReverse(true) .setMaxCount(100); let req = builder.build(); let resp = api.getPrivateFundingHistory(req); return resp.then((result) => { - expect(result.dataList).toEqual(expect.anything()); + result.dataList.forEach((item) => { + expect(item.id).toEqual(expect.any(Number)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.timePoint).toEqual(expect.any(Number)); + expect(item.fundingRate).toEqual(expect.any(Number)); + expect(item.markPrice).toEqual(expect.any(Number)); + expect(item.positionQty).toEqual(expect.any(Number)); + expect(item.positionCost).toEqual(expect.any(Number)); + expect(item.funding).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.context).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + }) expect(result.hasMore).toEqual(expect.anything()); console.log(resp); }); diff --git a/sdk/node/tests/e2e/rest/futures_test/market.test.ts b/sdk/node/tests/e2e/rest/futures_test/market.test.ts index cc3dab7d..9f994d90 100644 --- a/sdk/node/tests/e2e/rest/futures_test/market.test.ts +++ b/sdk/node/tests/e2e/rest/futures_test/market.test.ts @@ -2,7 +2,7 @@ import { ClientOptionBuilder, GlobalApiEndpoint, GlobalBrokerApiEndpoint, - GlobalFuturesApiEndpoint, + GlobalFuturesApiEndpoint, Interceptor, TransportOptionBuilder, } from '@model/index'; import { @@ -27,12 +27,23 @@ describe('Auto Test', () => { const key = process.env.API_KEY || ''; const secret = process.env.API_SECRET || ''; const passphrase = process.env.API_PASSPHRASE || ''; - + let interceptors: Array = [ + { + before: { + onFulfilled: (config) => { + console.log('debug: ', config.url); + return config; + }, + }, + after: {}, + }, + ]; // Set specific options, others will fall back to default values const httpTransportOption = new TransportOptionBuilder() .setKeepAlive(true) .setMaxConnsPerHost(10) .setMaxIdleConns(10) + .setInterceptors(interceptors) .build(); // Create a client using the specified options @@ -68,8 +79,6 @@ describe('Auto Test', () => { expect(result.rootSymbol).toEqual(expect.anything()); expect(result.type).toEqual(expect.anything()); expect(result.firstOpenDate).toEqual(expect.anything()); - expect(result.expireDate).toEqual(expect.anything()); - expect(result.settleDate).toEqual(expect.anything()); expect(result.baseCurrency).toEqual(expect.anything()); expect(result.quoteCurrency).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); @@ -88,7 +97,6 @@ describe('Auto Test', () => { expect(result.takerFeeRate).toEqual(expect.anything()); expect(result.takerFixFee).toEqual(expect.anything()); expect(result.makerFixFee).toEqual(expect.anything()); - expect(result.settlementFee).toEqual(expect.anything()); expect(result.isDeleverage).toEqual(expect.anything()); expect(result.isQuanto).toEqual(expect.anything()); expect(result.isInverse).toEqual(expect.anything()); @@ -98,7 +106,6 @@ describe('Auto Test', () => { expect(result.fundingQuoteSymbol).toEqual(expect.anything()); expect(result.fundingRateSymbol).toEqual(expect.anything()); expect(result.indexSymbol).toEqual(expect.anything()); - expect(result.settlementSymbol).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); expect(result.fundingFeeRate).toEqual(expect.anything()); expect(result.predictedFundingFeeRate).toEqual(expect.anything()); @@ -177,7 +184,19 @@ describe('Auto Test', () => { */ let resp = api.getAllTickers(); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.sequence).toEqual(expect.any(Number)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.bestBidPrice).toEqual(expect.any(String)); + expect(item.bestBidSize).toEqual(expect.any(Number)); + expect(item.bestAskPrice).toEqual(expect.any(String)); + expect(item.bestAskSize).toEqual(expect.any(Number)); + expect(item.ts).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -233,7 +252,17 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getTradeHistory(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.sequence).toEqual(expect.any(Number)); + expect(item.contractId).toEqual(expect.any(Number)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.makerOrderId).toEqual(expect.any(String)); + expect(item.takerOrderId).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.price).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + }); console.log(resp); }); }); @@ -248,8 +277,8 @@ describe('Auto Test', () => { builder .setSymbol('XBTUSDTM') .setGranularity(GetKlinesReq.GranularityEnum._1) - .setFrom(1732464000000) - .setTo(1732521600000); + .setFrom(1738339200000) + .setTo(1738425600000); let req = builder.build(); let resp = api.getKlines(req); return resp.then((result) => { @@ -287,13 +316,18 @@ describe('Auto Test', () => { let builder = GetSpotIndexPriceReq.builder(); builder .setSymbol('.KXBTUSDT') - .setStartAt(1732464000000) - .setEndAt(1732521600000) + .setStartAt(1738339200000) + .setEndAt(1738425600000) .setMaxCount(10); let req = builder.build(); let resp = api.getSpotIndexPrice(req); return resp.then((result) => { - expect(result.dataList).toEqual(expect.anything()); + result.dataList.forEach(item=> { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.granularity).toEqual(expect.any(Number)); + expect(item.timePoint).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(Number)); + }); expect(result.hasMore).toEqual(expect.anything()); console.log(resp); }); @@ -306,11 +340,16 @@ describe('Auto Test', () => { * /api/v1/interest/query */ let builder = GetInterestRateIndexReq.builder(); - builder.setSymbol('.XBTINT').setStartAt(1732464000000).setEndAt(1732521600000); + builder.setSymbol('.XBTINT').setStartAt(1738339200000).setEndAt(1738425600000); let req = builder.build(); let resp = api.getInterestRateIndex(req); return resp.then((result) => { - expect(result.dataList).toEqual(expect.anything()); + result.dataList.forEach(item=> { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.granularity).toEqual(expect.any(Number)); + expect(item.timePoint).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(Number)); + }); expect(result.hasMore).toEqual(expect.anything()); console.log(resp); }); @@ -327,7 +366,12 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getPremiumIndex(req); return resp.then((result) => { - expect(result.dataList).toEqual(expect.anything()); + result.dataList.forEach(item=> { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.granularity).toEqual(expect.any(Number)); + expect(item.timePoint).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(Number)); + }); expect(result.hasMore).toEqual(expect.anything()); console.log(resp); }); diff --git a/sdk/node/tests/e2e/rest/futures_test/order.test.ts b/sdk/node/tests/e2e/rest/futures_test/order.test.ts index 8ca1cc98..059fd277 100644 --- a/sdk/node/tests/e2e/rest/futures_test/order.test.ts +++ b/sdk/node/tests/e2e/rest/futures_test/order.test.ts @@ -153,6 +153,10 @@ describe('Auto Test', () => { return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(resp); + result.data.forEach((item) => { + console.log(item.orderId); + console.log(item.clientOid); + }) }); }); @@ -170,6 +174,7 @@ describe('Auto Test', () => { .setLeverage(3.0) .setType(AddTPSLOrderReq.TypeEnum.LIMIT) .setRemark('order_test') + .setStopPriceType(AddTPSLOrderReq.StopPriceTypeEnum.TRADE_PRICE) .setMarginMode(AddTPSLOrderReq.MarginModeEnum.ISOLATED) .setPrice('10000') .setSize(1) @@ -192,7 +197,7 @@ describe('Auto Test', () => { * /api/v1/orders/{orderId} */ let builder = CancelOrderByIdReq.builder(); - builder.setOrderId(''); + builder.setOrderId('278696338965737472'); let req = builder.build(); let resp = api.cancelOrderById(req); return resp.then((result) => { @@ -208,7 +213,7 @@ describe('Auto Test', () => { * /api/v1/orders/client-order/{clientOid} */ let builder = CancelOrderByClientOidReq.builder(); - builder.setSymbol('').setClientOid(''); + builder.setSymbol('XBTUSDTM').setClientOid('ab78cba6-55f7-42d7-a49f-fee676b265a4'); let req = builder.build(); let resp = api.cancelOrderByClientOid(req); return resp.then((result) => { @@ -225,9 +230,10 @@ describe('Auto Test', () => { */ let builder = BatchCancelOrdersReq.builder(); builder - .setOrderIdsList(['', '']) + .setOrderIdsList(['278697532131983364', '278697532211675136']) .setClientOidsList([ - BatchCancelOrdersClientOidsList.create({ symbol: '', clientOid: '' }), + BatchCancelOrdersClientOidsList.create({ symbol: 'XBTUSDTM', clientOid: '5f888dfe-8fec-4691-a36d-d2cfb9f050b0' }), + BatchCancelOrdersClientOidsList.create({ symbol: 'XBTUSDTM', clientOid: '48d63d98-2369-43c1-a599-db4ceba41fbf' }), ]); let req = builder.build(); let resp = api.batchCancelOrders(req); @@ -276,7 +282,7 @@ describe('Auto Test', () => { * /api/v1/orders/{order-id} */ let builder = GetOrderByOrderIdReq.builder(); - builder.setOrderId(''); + builder.setOrderId('278700272115560449'); let req = builder.build(); let resp = api.getOrderByOrderId(req); return resp.then((result) => { @@ -293,7 +299,6 @@ describe('Auto Test', () => { expect(result.stop).toEqual(expect.anything()); expect(result.stopPriceType).toEqual(expect.anything()); expect(result.stopTriggered).toEqual(expect.anything()); - expect(result.stopPrice).toEqual(expect.anything()); expect(result.timeInForce).toEqual(expect.anything()); expect(result.postOnly).toEqual(expect.anything()); expect(result.hidden).toEqual(expect.anything()); @@ -303,13 +308,10 @@ describe('Auto Test', () => { expect(result.closeOrder).toEqual(expect.anything()); expect(result.visibleSize).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); - expect(result.remark).toEqual(expect.anything()); - expect(result.tags).toEqual(expect.anything()); expect(result.isActive).toEqual(expect.anything()); expect(result.cancelExist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); expect(result.updatedAt).toEqual(expect.anything()); - expect(result.endAt).toEqual(expect.anything()); expect(result.orderTime).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); expect(result.marginMode).toEqual(expect.anything()); @@ -329,7 +331,7 @@ describe('Auto Test', () => { * /api/v1/orders/byClientOid */ let builder = GetOrderByClientOidReq.builder(); - builder.setClientOid(''); + builder.setClientOid('4595de36-25e9-434c-ab13-fb93670ade2a'); let req = builder.build(); let resp = api.getOrderByClientOid(req); return resp.then((result) => { @@ -346,7 +348,6 @@ describe('Auto Test', () => { expect(result.stop).toEqual(expect.anything()); expect(result.stopPriceType).toEqual(expect.anything()); expect(result.stopTriggered).toEqual(expect.anything()); - expect(result.stopPrice).toEqual(expect.anything()); expect(result.timeInForce).toEqual(expect.anything()); expect(result.postOnly).toEqual(expect.anything()); expect(result.hidden).toEqual(expect.anything()); @@ -356,13 +357,10 @@ describe('Auto Test', () => { expect(result.closeOrder).toEqual(expect.anything()); expect(result.visibleSize).toEqual(expect.anything()); expect(result.clientOid).toEqual(expect.anything()); - expect(result.remark).toEqual(expect.anything()); - expect(result.tags).toEqual(expect.anything()); expect(result.isActive).toEqual(expect.anything()); expect(result.cancelExist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); expect(result.updatedAt).toEqual(expect.anything()); - expect(result.endAt).toEqual(expect.anything()); expect(result.orderTime).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); expect(result.marginMode).toEqual(expect.anything()); @@ -393,7 +391,42 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(String)); + expect(item.dealValue).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(Number)); + expect(item.stp).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.stopPriceType).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.leverage).toEqual(expect.any(String)); + expect(item.forceHold).toEqual(expect.any(Boolean)); + expect(item.closeOrder).toEqual(expect.any(Boolean)); + expect(item.visibleSize).toEqual(expect.any(Number)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.isActive).toEqual(expect.any(Boolean)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.updatedAt).toEqual(expect.any(Number)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.avgDealPrice).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(Number)); + expect(item.filledValue).toEqual(expect.any(String)); + expect(item.reduceOnly).toEqual(expect.any(Boolean)); + }) console.log(resp); }); }); @@ -409,7 +442,43 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getRecentClosedOrders(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach(item=> { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(String)); + expect(item.dealValue).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(Number)); + expect(item.stp).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.stopPriceType).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.leverage).toEqual(expect.any(String)); + expect(item.forceHold).toEqual(expect.any(Boolean)); + expect(item.closeOrder).toEqual(expect.any(Boolean)); + expect(item.visibleSize).toEqual(expect.any(Number)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.isActive).toEqual(expect.any(Boolean)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.updatedAt).toEqual(expect.any(Number)); + expect(item.endAt).toEqual(expect.any(Number)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.avgDealPrice).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(Number)); + expect(item.filledValue).toEqual(expect.any(String)); + expect(item.reduceOnly).toEqual(expect.any(Boolean)); + }) console.log(resp); }); }); @@ -465,7 +534,31 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getRecentTradeHistory(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach(item=> { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.forceTaker).toEqual(expect.any(Boolean)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(String)); + expect(item.openFeePay).toEqual(expect.any(String)); + expect(item.closeFeePay).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.feeRate).toEqual(expect.any(String)); + expect(item.fixFee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.tradeTime).toEqual(expect.any(Number)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.displayType).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + }) console.log(resp); }); }); @@ -477,7 +570,7 @@ describe('Auto Test', () => { * /api/v1/fills */ let builder = GetTradeHistoryReq.builder(); - builder.setType(GetTradeHistoryReq.TypeEnum.LIMIT).setSide(GetTradeHistoryReq.SideEnum.BUY); + builder.setType(GetTradeHistoryReq.TypeEnum.MARKET).setSide(GetTradeHistoryReq.SideEnum.BUY); let req = builder.build(); let resp = api.getTradeHistory(req); return resp.then((result) => { @@ -485,7 +578,31 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach(item=> { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.forceTaker).toEqual(expect.any(Boolean)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.value).toEqual(expect.any(String)); + expect(item.openFeePay).toEqual(expect.any(String)); + expect(item.closeFeePay).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.feeRate).toEqual(expect.any(String)); + expect(item.fixFee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.tradeTime).toEqual(expect.any(Number)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.displayType).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + }) console.log(resp); }); }); diff --git a/sdk/node/tests/e2e/rest/futures_test/positions.test.ts b/sdk/node/tests/e2e/rest/futures_test/positions.test.ts index 23483e16..3254f672 100644 --- a/sdk/node/tests/e2e/rest/futures_test/positions.test.ts +++ b/sdk/node/tests/e2e/rest/futures_test/positions.test.ts @@ -57,7 +57,7 @@ describe('Auto Test', () => { api = kucoinRestService.getFuturesService().getPositionsApi(); }); - test('getMarginMode request test', ()=> { + test('getMarginMode request test', () => { /** * getMarginMode * Get Margin Mode @@ -67,31 +67,31 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getMarginMode(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.marginMode).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('switchMarginMode request test', ()=> { + test('switchMarginMode request test', () => { /** * switchMarginMode * Switch Margin Mode * /api/v2/position/changeMarginMode */ let builder = SwitchMarginModeReq.builder(); - builder.setSymbol('XBTUSDTM').setMarginMode(SwitchMarginModeReq.MarginModeEnum.CROSS); + builder.setSymbol('XBTUSDTM').setMarginMode(SwitchMarginModeReq.MarginModeEnum.ISOLATED); let req = builder.build(); let resp = api.switchMarginMode(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.marginMode).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getMaxOpenSize request test', ()=> { + test('getMaxOpenSize request test', () => { /** * getMaxOpenSize * Get Max Open Size @@ -101,15 +101,15 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM').setPrice('10000').setLeverage(10); let req = builder.build(); let resp = api.getMaxOpenSize(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.maxBuyOpenSize).toEqual(expect.anything()); expect(result.maxSellOpenSize).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getPositionDetails request test', ()=> { + test('getPositionDetails request test', () => { /** * getPositionDetails * Get Position Details @@ -119,7 +119,7 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getPositionDetails(req); - return resp.then(result => { + return resp.then((result) => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); expect(result.crossMode).toEqual(expect.anything()); @@ -147,7 +147,6 @@ describe('Auto Test', () => { expect(result.liquidationPrice).toEqual(expect.anything()); expect(result.bankruptPrice).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); - expect(result.isInverse).toEqual(expect.anything()); expect(result.marginMode).toEqual(expect.anything()); expect(result.positionSide).toEqual(expect.anything()); expect(result.leverage).toEqual(expect.anything()); @@ -166,9 +165,9 @@ describe('Auto Test', () => { expect(result.maintainMargin).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getPositionList request test', ()=> { + test('getPositionList request test', () => { /** * getPositionList * Get Position List @@ -178,33 +177,94 @@ describe('Auto Test', () => { builder.setCurrency('USDT'); let req = builder.build(); let resp = api.getPositionList(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.crossMode).toEqual(expect.any(Boolean)); + expect(item.delevPercentage).toEqual(expect.any(Number)); + expect(item.openingTimestamp).toEqual(expect.any(Number)); + expect(item.currentTimestamp).toEqual(expect.any(Number)); + expect(item.currentQty).toEqual(expect.any(Number)); + expect(item.currentCost).toEqual(expect.any(Number)); + expect(item.currentComm).toEqual(expect.any(Number)); + expect(item.unrealisedCost).toEqual(expect.any(Number)); + expect(item.realisedGrossCost).toEqual(expect.any(Number)); + expect(item.realisedCost).toEqual(expect.any(Number)); + expect(item.isOpen).toEqual(expect.any(Boolean)); + expect(item.markPrice).toEqual(expect.any(Number)); + expect(item.markValue).toEqual(expect.any(Number)); + expect(item.posCost).toEqual(expect.any(Number)); + expect(item.posInit).toEqual(expect.any(Number)); + expect(item.posMargin).toEqual(expect.any(Number)); + expect(item.realisedGrossPnl).toEqual(expect.any(Number)); + expect(item.realisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); + expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); + expect(item.avgEntryPrice).toEqual(expect.any(Number)); + expect(item.liquidationPrice).toEqual(expect.any(Number)); + expect(item.bankruptPrice).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.isInverse).toEqual(expect.any(Boolean)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.positionSide).toEqual(expect.any(String)); + expect(item.leverage).toEqual(expect.any(Number)); + expect(item.autoDeposit).toEqual(expect.any(Boolean)); + expect(item.maintMarginReq).toEqual(expect.any(Number)); + expect(item.riskLimit).toEqual(expect.any(Number)); + expect(item.realLeverage).toEqual(expect.any(Number)); + expect(item.posCross).toEqual(expect.any(Number)); + expect(item.posCrossMargin).toEqual(expect.any(Number)); + expect(item.posComm).toEqual(expect.any(Number)); + expect(item.posCommCommon).toEqual(expect.any(Number)); + expect(item.posLoss).toEqual(expect.any(Number)); + expect(item.posFunding).toEqual(expect.any(Number)); + expect(item.posMaint).toEqual(expect.any(Number)); + expect(item.maintMargin).toEqual(expect.any(Number)); + expect(item.maintainMargin).toEqual(expect.any(Number)); + }); console.log(resp); }); - }) + }); - test('getPositionsHistory request test', ()=> { + test('getPositionsHistory request test', () => { /** * getPositionsHistory * Get Positions History * /api/v1/history-positions */ let builder = GetPositionsHistoryReq.builder(); - builder.setSymbol('XBTUSDTM') + builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getPositionsHistory(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.closeId).toEqual(expect.any(String)); + expect(item.userId).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.pnl).toEqual(expect.any(String)); + expect(item.realisedGrossCost).toEqual(expect.any(String)); + expect(item.withdrawPnl).toEqual(expect.any(String)); + expect(item.tradeFee).toEqual(expect.any(String)); + expect(item.fundingFee).toEqual(expect.any(String)); + expect(item.openTime).toEqual(expect.any(Number)); + expect(item.closeTime).toEqual(expect.any(Number)); + expect(item.openPrice).toEqual(expect.any(String)); + expect(item.closePrice).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + }); console.log(resp); }); - }) + }); - test('getMaxWithdrawMargin request test', ()=> { + test('getMaxWithdrawMargin request test', () => { /** * getMaxWithdrawMargin * Get Max Withdraw Margin @@ -214,13 +274,13 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getMaxWithdrawMargin(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getCrossMarginLeverage request test', ()=> { + test('getCrossMarginLeverage request test', () => { /** * getCrossMarginLeverage * Get Cross Margin Leverage @@ -230,14 +290,15 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getCrossMarginLeverage(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.leverage).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('modifyMarginLeverage request test', ()=> { + // TODO: fix by change schema + test('modifyMarginLeverage request test', () => { /** * modifyMarginLeverage * Modify Cross Margin Leverage @@ -247,14 +308,14 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM').setLeverage('20'); let req = builder.build(); let resp = api.modifyMarginLeverage(req); - return resp.then(result => { + return resp.then((result) => { expect(result.symbol).toEqual(expect.anything()); expect(result.leverage).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('addIsolatedMargin request test', ()=> { + test('addIsolatedMargin request test', () => { /** * addIsolatedMargin * Add Isolated Margin @@ -264,7 +325,7 @@ describe('Auto Test', () => { builder.setSymbol('DOGEUSDTM').setMargin(2).setBizNo('251160679598325760'); let req = builder.build(); let resp = api.addIsolatedMargin(req); - return resp.then(result => { + return resp.then((result) => { expect(result.id).toEqual(expect.anything()); expect(result.symbol).toEqual(expect.anything()); expect(result.autoDeposit).toEqual(expect.anything()); @@ -300,13 +361,12 @@ describe('Auto Test', () => { expect(result.avgEntryPrice).toEqual(expect.anything()); expect(result.liquidationPrice).toEqual(expect.anything()); expect(result.bankruptPrice).toEqual(expect.anything()); - expect(result.userId).toEqual(expect.anything()); expect(result.settleCurrency).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('removeIsolatedMargin request test', ()=> { + test('removeIsolatedMargin request test', () => { /** * removeIsolatedMargin * Remove Isolated Margin @@ -316,13 +376,13 @@ describe('Auto Test', () => { builder.setSymbol('DOGEUSDTM').setWithdrawAmount('1'); let req = builder.build(); let resp = api.removeIsolatedMargin(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('getIsolatedMarginRiskLimit request test', ()=> { + test('getIsolatedMarginRiskLimit request test', () => { /** * getIsolatedMarginRiskLimit * Get Isolated Margin Risk Limit @@ -332,13 +392,21 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM'); let req = builder.build(); let resp = api.getIsolatedMarginRiskLimit(req); - return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.level).toEqual(expect.any(Number)); + expect(item.maxRiskLimit).toEqual(expect.any(Number)); + expect(item.minRiskLimit).toEqual(expect.any(Number)); + expect(item.maxLeverage).toEqual(expect.any(Number)); + expect(item.initialMargin).toEqual(expect.any(Number)); + expect(item.maintainMargin).toEqual(expect.any(Number)); + }) console.log(resp); }); - }) + }); - test('modifyIsolatedMarginRiskLimt request test', ()=> { + test('modifyIsolatedMarginRiskLimt request test', () => { /** * modifyIsolatedMarginRiskLimt * Modify Isolated Margin Risk Limit @@ -348,13 +416,13 @@ describe('Auto Test', () => { builder.setSymbol('XBTUSDTM').setLevel(10); let req = builder.build(); let resp = api.modifyIsolatedMarginRiskLimt(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(resp); }); - }) + }); - test('modifyAutoDepositStatus request test', ()=> { + test('modifyAutoDepositStatus request test', () => { /** * modifyAutoDepositStatus * Modify Isolated Margin Auto-Deposit Status @@ -364,10 +432,9 @@ describe('Auto Test', () => { builder.setSymbol('DOGEUSDTM').setStatus(true); let req = builder.build(); let resp = api.modifyAutoDepositStatus(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(resp); }); - }) - + }); }); From 315b9abd063e885c4616fb9892c4fe8e66691c3b Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 11 Feb 2025 19:30:11 +0800 Subject: [PATCH 069/106] test(nodejs): add more tests --- .../e2e/rest/account_test/account_api.test.ts | 53 +++++-- .../rest/account_test/account_deposit.test.ts | 33 ++++- .../e2e/rest/account_test/account_fee.test.ts | 6 +- .../account_test/account_subaccount.test.ts | 68 ++++++--- .../account_test/account_transfer.test.ts | 68 ++++++--- .../account_test/account_withdraw.test.ts | 30 ++-- .../e2e/rest/broker_test/nd_broker.test.ts | 54 +++++-- .../e2e/rest/copytrading_test/futures.test.ts | 4 +- .../tests/e2e/rest/earn_test/earn.test.ts | 135 ++++++++++++++++-- 9 files changed, 363 insertions(+), 88 deletions(-) diff --git a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts index 8baccb9c..8bedf25d 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_api.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_api.test.ts @@ -133,7 +133,6 @@ describe('Auto Test', () => { }); }); - // TODO test('getSpotAccountDetail request test', () => { /** * getSpotAccountDetail @@ -141,7 +140,7 @@ describe('Auto Test', () => { * /api/v1/accounts/{accountId} */ let builder = GetSpotAccountDetailReq.builder(); - builder.setAccountId('671badb050647f0007d94011'); + builder.setAccountId('6582f6a48c171f000769b867'); let req = builder.build(); let resp = api.getSpotAccountDetail(req); return resp.then((result) => { @@ -221,7 +220,6 @@ describe('Auto Test', () => { }); }); - // todo empty test('getSpotLedger request test', () => { /** * getSpotLedger @@ -231,8 +229,8 @@ describe('Auto Test', () => { let builder = GetSpotLedgerReq.builder(); builder .setCurrency('USDT') - .setStartAt(1732032000000) - .setEndAt(1732118400000) + .setStartAt(1707580800000) + .setEndAt(1707667200000) .setCurrentPage(1) .setPageSize(100); let req = builder.build(); @@ -247,7 +245,6 @@ describe('Auto Test', () => { }); }); - // todo empty test('getSpotHFLedger request test', () => { /** * getSpotHFLedger @@ -262,12 +259,23 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getSpotHFLedger(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.amount).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.tax).toEqual(expect.any(String)); + expect(item.balance).toEqual(expect.any(String)); + expect(item.accountType).toEqual(expect.any(String)); + expect(item.bizType).toEqual(expect.any(String)); + expect(item.direction).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(String)); + expect(item.context).toEqual(expect.any(String)); + }); console.log(result); }); }); - // todo empty test('getMarginHFLedger request test', () => { /** * getMarginHFLedger @@ -279,12 +287,23 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getMarginHFLedger(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(Number)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.amount).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.balance).toEqual(expect.any(String)); + expect(item.accountType).toEqual(expect.any(String)); + expect(item.bizType).toEqual(expect.any(String)); + expect(item.direction).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.context).toEqual(expect.any(String)); + expect(item.tax).toEqual(expect.any(String)); + }); console.log(result); }); }); - // todo empyty test('getFuturesLedger request test', () => { /** * getFuturesLedger @@ -292,11 +311,21 @@ describe('Auto Test', () => { * /api/v1/transaction-history */ let builder = GetFuturesLedgerReq.builder(); - builder.setCurrency('DOT').setType('RealisedPNL'); + builder.setCurrency('USDT').setType('Transferin'); let req = builder.build(); let resp = api.getFuturesLedger(req); return resp.then((result) => { - expect(result.dataList).toEqual(expect.anything()); + result.dataList.forEach((item) => { + expect(item.time).toEqual(expect.any(Number)); + expect(item.type).toEqual(expect.any(String)); + expect(item.amount).toEqual(expect.any(Number)); + expect(item.fee).toEqual(expect.any(Number)); + expect(item.accountEquity).toEqual(expect.any(Number)); + expect(item.status).toEqual(expect.any(String)); + expect(item.remark).toEqual(expect.any(String)); + expect(item.offset).toEqual(expect.any(Number)); + expect(item.currency).toEqual(expect.any(String)); + }); expect(result.hasMore).toEqual(expect.anything()); console.log(result); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts index a6fcdce3..359c1ee1 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_deposit.test.ts @@ -53,12 +53,11 @@ describe('Auto Test', () => { * /api/v3/deposit-address/create */ let builder = AddDepositAddressV3Req.builder(); - builder.setCurrency('USDT').setChain('ton').setTo(AddDepositAddressV3Req.ToEnum.MAIN).setAmount('1'); + builder.setCurrency('USDT').setChain('near').setTo(AddDepositAddressV3Req.ToEnum.MAIN).setAmount('1'); let req = builder.build(); let resp = api.addDepositAddressV3(req); return resp.then(result => { expect(result.address).toEqual(expect.anything()); - expect(result.memo).toEqual(expect.anything()); expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); expect(result.expirationDate).toEqual(expect.anything()); @@ -99,7 +98,21 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach(item=> { + expect(item.currency).toEqual(expect.any(String)); + expect(item.chain).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.address).toEqual(expect.any(String)); + expect(item.memo).toEqual(expect.any(String)); + expect(item.isInner).toEqual(expect.any(Boolean)); + expect(item.amount).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.walletTxId).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.updatedAt).toEqual(expect.any(Number)); + expect(item.remark).toEqual(expect.any(String)); + expect(item.arrears).toEqual(expect.any(Boolean)); + }); console.log(result); }); }); @@ -115,7 +128,15 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getDepositAddressV2(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach(item => { + expect(item.address).toEqual(expect.any(String)); + expect(item.memo).toEqual(expect.any(String)); + expect(item.chain).toEqual(expect.any(String)); + expect(item.chainId).toEqual(expect.any(String)); + expect(item.to).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.contractAddress).toEqual(expect.any(String)); + }) console.log(result); }); }); @@ -137,7 +158,6 @@ describe('Auto Test', () => { expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); expect(result.currency).toEqual(expect.anything()); - expect(result.contractAddress).toEqual(expect.anything()); console.log(result); }); }); @@ -169,12 +189,11 @@ describe('Auto Test', () => { * /api/v1/deposit-addresses */ let builder = AddDepositAddressV1Req.builder(); - builder.setCurrency('ETH').setChain('eth'); + builder.setCurrency('ETH').setChain('kcc'); let req = builder.build(); let resp = api.addDepositAddressV1(req); return resp.then(result => { expect(result.address).toEqual(expect.anything()); - expect(result.memo).toEqual(expect.anything()); expect(result.chain).toEqual(expect.anything()); expect(result.chainId).toEqual(expect.anything()); expect(result.to).toEqual(expect.anything()); diff --git a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts index a6538885..78968f7e 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts @@ -69,7 +69,11 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getSpotActualFee(req); return resp.then(result => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.takerFeeRate).toEqual(expect.any(String)); + expect(item.makerFeeRate).toEqual(expect.any(String)); + }) console.log(result); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts index 0015de41..bf07cef0 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_subaccount.test.ts @@ -84,7 +84,7 @@ describe('Auto Test', () => { * /api/v3/sub/user/margin/enable */ let builder = AddSubAccountMarginPermissionReq.builder(); - builder.setUid('229290616'); + builder.setUid('111'); let req = builder.build(); let resp = api.addSubAccountMarginPermission(req); return resp.then((result) => { @@ -100,7 +100,7 @@ describe('Auto Test', () => { * /api/v3/sub/user/futures/enable */ let builder = AddSubAccountFuturesPermissionReq.builder(); - builder.setUid('229290616'); + builder.setUid('1111'); let req = builder.build(); let resp = api.addSubAccountFuturesPermission(req); return resp.then((result) => { @@ -124,7 +124,18 @@ describe('Auto Test', () => { expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.userId).toEqual(expect.any(String)); + expect(item.uid).toEqual(expect.any(Number)); + expect(item.subName).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.anything()); + expect(item.type).toEqual(expect.anything()); + expect(item.access).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.remarks).toEqual(expect.any(String)); + expect(item.tradeTypes).toEqual(expect.any(Array)); + expect(item.openedTradeTypes).toEqual(expect.any(Array)); + }); console.log(result); }); }); @@ -182,7 +193,17 @@ describe('Auto Test', () => { let resp = api.getFuturesSubAccountListV2(req); return resp.then((result) => { expect(result.summary).toEqual(expect.anything()); - expect(result.accounts).toEqual(expect.anything()); + result.accounts.forEach((item) => { + expect(item.accountName).toEqual(expect.any(String)); + expect(item.accountEquity).toEqual(expect.any(Number)); + expect(item.unrealisedPNL).toEqual(expect.any(Number)); + expect(item.marginBalance).toEqual(expect.any(Number)); + expect(item.positionMargin).toEqual(expect.any(Number)); + expect(item.orderMargin).toEqual(expect.any(Number)); + expect(item.frozenFunds).toEqual(expect.any(Number)); + expect(item.availableBalance).toEqual(expect.any(Number)); + expect(item.currency).toEqual(expect.any(String)); + }); console.log(result); }); }); @@ -196,21 +217,18 @@ describe('Auto Test', () => { let builder = AddSubAccountApiReq.builder(); builder .setPassphrase('*****') - .setRemark('**********') + .setRemark('*****') .setPermission('General,Spot') .setExpire(AddSubAccountApiReq.ExpireEnum._30) - .setSubName('**********'); + .setSubName('*****'); let req = builder.build(); let resp = api.addSubAccountApi(req); return resp.then((result) => { - expect(result.subName).toEqual(expect.anything()); - expect(result.remark).toEqual(expect.anything()); expect(result.apiKey).toEqual(expect.anything()); expect(result.apiSecret).toEqual(expect.anything()); expect(result.apiVersion).toEqual(expect.anything()); expect(result.passphrase).toEqual(expect.anything()); expect(result.permission).toEqual(expect.anything()); - expect(result.ipWhitelist).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); console.log(result); }); @@ -224,12 +242,12 @@ describe('Auto Test', () => { */ let builder = ModifySubAccountApiReq.builder(); builder - .setPassphrase('**********') - .setPermission('**********') + .setPassphrase('******') + .setPermission('General,Spot') .setIpWhitelist('General') .setExpire(ModifySubAccountApiReq.ExpireEnum._30) - .setSubName('**********') - .setApiKey('6745b6ba87eb0e000107ea6c'); + .setSubName('******') + .setApiKey('******'); let req = builder.build(); let resp = api.modifySubAccountApi(req); return resp.then((result) => { @@ -248,11 +266,20 @@ describe('Auto Test', () => { * /api/v1/sub/api-key */ let builder = GetSubAccountApiListReq.builder(); - builder.setApiKey('6745b6ba87eb0e000107ea6c').setSubName('****'); + builder.setApiKey('********').setSubName('********'); let req = builder.build(); let resp = api.getSubAccountApiList(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.subName).toEqual(expect.any(String)); + expect(item.remark).toEqual(expect.any(String)); + expect(item.apiKey).toEqual(expect.any(String)); + expect(item.apiVersion).toEqual(expect.any(Number)); + expect(item.permission).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.uid).toEqual(expect.any(Number)); + expect(item.isMaster).toEqual(expect.any(Boolean)); + }); console.log(result); }); }); @@ -264,7 +291,7 @@ describe('Auto Test', () => { * /api/v1/sub/api-key */ let builder = DeleteSubAccountApiReq.builder(); - builder.setApiKey('').setSubName('').setPassphrase(''); + builder.setApiKey('*****').setSubName('*****').setPassphrase('********'); let req = builder.build(); let resp = api.deleteSubAccountApi(req); return resp.then((result) => { @@ -282,7 +309,14 @@ describe('Auto Test', () => { */ let resp = api.getSpotSubAccountsSummaryV1(); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.userId).toEqual(expect.any(String)); + expect(item.uid).toEqual(expect.any(Number)); + expect(item.subName).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(Number)); + expect(item.remarks).toEqual(expect.any(String)); + expect(item.access).toEqual(expect.any(String)); + }); console.log(result); }); }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts index 8fc24ea1..9ec4d4d8 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_transfer.test.ts @@ -58,10 +58,10 @@ describe('Auto Test', () => { * /api/v1/accounts/transferable */ let builder = GetTransferQuotasReq.builder(); - builder.setCurrency('').setType(GetTransferQuotasReq.TypeEnum.MAIN).setTag(''); + builder.setCurrency('USDT').setType(GetTransferQuotasReq.TypeEnum.MAIN).setTag(''); let req = builder.build(); let resp = api.getTransferQuotas(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currency).toEqual(expect.anything()); expect(result.balance).toEqual(expect.anything()); expect(result.available).toEqual(expect.anything()); @@ -78,10 +78,18 @@ describe('Auto Test', () => { * /api/v3/accounts/universal-transfer */ let builder = FlexTransferReq.builder(); - builder.setClientOid(randomUUID().toString()).setCurrency('USDT').setAmount('1').setFromUserId('6744227ce235b300012232d6').setFromAccountType(FlexTransferReq.FromAccountTypeEnum.MAIN).setType(FlexTransferReq.TypeEnum.INTERNAL).setToUserId('6744227ce235b300012232d6').setToAccountType(FlexTransferReq.ToAccountTypeEnum.TRADE); + builder + .setClientOid(randomUUID().toString()) + .setCurrency('USDT') + .setAmount('1') + .setFromUserId('6744227ce235b300012232d6') + .setFromAccountType(FlexTransferReq.FromAccountTypeEnum.MAIN) + .setType(FlexTransferReq.TypeEnum.INTERNAL) + .setToUserId('6744227ce235b300012232d6') + .setToAccountType(FlexTransferReq.ToAccountTypeEnum.TRADE); let req = builder.build(); let resp = api.flexTransfer(req); - return resp.then(result => { + return resp.then((result) => { expect(result.orderId).toEqual(expect.anything()); console.log(result); }); @@ -94,10 +102,17 @@ describe('Auto Test', () => { * /api/v2/accounts/sub-transfer */ let builder = SubAccountTransferReq.builder(); - // builder.setClientOid(?).setCurrency(?).setAmount(?).setDirection(?).setAccountType(?).setSubAccountType(?).setSubUserId(?); + builder + .setClientOid(randomUUID()) + .setCurrency('USDT') + .setAmount('10') + .setDirection(SubAccountTransferReq.DirectionEnum.OUT) + .setAccountType(SubAccountTransferReq.AccountTypeEnum.MAIN) + .setSubAccountType(SubAccountTransferReq.SubAccountTypeEnum.MAIN) + .setSubUserId('6744227ce235b300012232d6'); let req = builder.build(); let resp = api.subAccountTransfer(req); - return resp.then(result => { + return resp.then((result) => { expect(result.orderId).toEqual(expect.anything()); console.log(result); }); @@ -110,10 +125,15 @@ describe('Auto Test', () => { * /api/v2/accounts/inner-transfer */ let builder = InnerTransferReq.builder(); - // builder.setClientOid(?).setCurrency(?).setAmount(?).setTo(?).setFromTag(?).setToTag(?).setFrom(?); + builder + .setClientOid(randomUUID()) + .setCurrency('USDT') + .setAmount('1') + .setTo(InnerTransferReq.ToEnum.MAIN) + .setFrom(InnerTransferReq.FromEnum.TRADE); let req = builder.build(); let resp = api.innerTransfer(req); - return resp.then(result => { + return resp.then((result) => { expect(result.orderId).toEqual(expect.anything()); console.log(result); }); @@ -126,10 +146,13 @@ describe('Auto Test', () => { * /api/v3/transfer-out */ let builder = FuturesAccountTransferOutReq.builder(); - // builder.setCurrency(?).setAmount(?).setRecAccountType(?); + builder + .setCurrency('USDT') + .setAmount(1) + .setRecAccountType(FuturesAccountTransferOutReq.RecAccountTypeEnum.MAIN); let req = builder.build(); let resp = api.futuresAccountTransferOut(req); - return resp.then(result => { + return resp.then((result) => { expect(result.applyId).toEqual(expect.anything()); expect(result.bizNo).toEqual(expect.anything()); expect(result.payAccountType).toEqual(expect.anything()); @@ -158,10 +181,13 @@ describe('Auto Test', () => { * /api/v1/transfer-in */ let builder = FuturesAccountTransferInReq.builder(); - // builder.setCurrency(?).setAmount(?).setPayAccountType(?); + builder + .setCurrency('USDT') + .setAmount(1.0) + .setPayAccountType(FuturesAccountTransferInReq.PayAccountTypeEnum.MAIN); let req = builder.build(); let resp = api.futuresAccountTransferIn(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(result); }); @@ -174,17 +200,27 @@ describe('Auto Test', () => { * /api/v1/transfer-list */ let builder = GetFuturesAccountTransferOutLedgerReq.builder(); - // builder.setCurrency(?).setType(?).setTag(?).setStartAt(?).setEndAt(?).setCurrentPage(?).setPageSize(?); + builder.setCurrency('USDT').setType(GetFuturesAccountTransferOutLedgerReq.TypeEnum.MAIN); let req = builder.build(); let resp = api.getFuturesAccountTransferOutLedger(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.applyId).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.recRemark).toEqual(expect.any(String)); + expect(item.recSystem).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.amount).toEqual(expect.any(String)); + expect(item.reason).toEqual(expect.any(String)); + expect(item.offset).toEqual(expect.any(Number)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.remark).toEqual(expect.any(String)); + }) console.log(result); }); }); - }); diff --git a/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts index 30f8242f..92e1a073 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_withdraw.test.ts @@ -59,7 +59,7 @@ describe('Auto Test', () => { builder.setCurrency('USDT').setChain('bsc'); let req = builder.build(); let resp = api.getWithdrawalQuotas(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currency).toEqual(expect.anything()); expect(result.limitBTCAmount).toEqual(expect.anything()); expect(result.usedBTCAmount).toEqual(expect.anything()); @@ -74,7 +74,6 @@ describe('Auto Test', () => { expect(result.isWithdrawEnabled).toEqual(expect.anything()); expect(result.precision).toEqual(expect.anything()); expect(result.chain).toEqual(expect.anything()); - expect(result.reason).toEqual(expect.anything()); expect(result.lockedAmount).toEqual(expect.anything()); console.log(result); }); @@ -87,10 +86,17 @@ describe('Auto Test', () => { * /api/v3/withdrawals */ let builder = WithdrawalV3Req.builder(); - builder.setCurrency('USDT').setChain('bsc').setAmount(20).setIsInner(false).setRemark('******').setWithdrawType(WithdrawalV3Req.WithdrawTypeEnum.ADDRESS); + builder + .setCurrency('USDT') + .setChain('bsc') + .setAmount(20) + .setIsInner(false) + .setRemark('******') + .setWithdrawType(WithdrawalV3Req.WithdrawTypeEnum.ADDRESS) + .setToAddress('****'); let req = builder.build(); let resp = api.withdrawalV3(req); - return resp.then(result => { + return resp.then((result) => { expect(result.withdrawalId).toEqual(expect.anything()); console.log(result); }); @@ -106,7 +112,7 @@ describe('Auto Test', () => { builder.setWithdrawalId('674fba71b6afc90007e29bd2'); let req = builder.build(); let resp = api.cancelWithdrawal(req); - return resp.then(result => { + return resp.then((result) => { expect(result.data).toEqual(expect.anything()); console.log(result); }); @@ -122,7 +128,7 @@ describe('Auto Test', () => { builder.setCurrency('USDT').setStartAt(1703001600000).setEndAt(1703260800000); let req = builder.build(); let resp = api.getWithdrawalHistory(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); @@ -142,7 +148,7 @@ describe('Auto Test', () => { builder.setCurrency('USDT').setStartAt(1703001600000).setEndAt(1703260800000); let req = builder.build(); let resp = api.getWithdrawalHistoryOld(req); - return resp.then(result => { + return resp.then((result) => { expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalNum).toEqual(expect.anything()); @@ -159,13 +165,17 @@ describe('Auto Test', () => { * /api/v1/withdrawals */ let builder = WithdrawalV1Req.builder(); - builder.setCurrency('USDT').setChain('bsc').setAddress('***********').setAmount(20).setIsInner(false); + builder + .setCurrency('USDT') + .setChain('bsc') + .setAddress('***********') + .setAmount(20) + .setIsInner(false); let req = builder.build(); let resp = api.withdrawalV1(req); - return resp.then(result => { + return resp.then((result) => { expect(result.withdrawalId).toEqual(expect.anything()); console.log(result); }); }); - }); diff --git a/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts b/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts index 5acee4a2..abc5a370 100644 --- a/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts +++ b/sdk/node/tests/e2e/rest/broker_test/nd_broker.test.ts @@ -31,6 +31,9 @@ describe('Auto Test', () => { const key = process.env.API_KEY || ''; const secret = process.env.API_SECRET || ''; const passphrase = process.env.API_PASSPHRASE || ''; + const brokerName = process.env.BROKER_NAME || ''; + const brokerPartner = process.env.BROKER_PARTNER || ''; + const brokerKey = process.env.BROKER_KEY || ''; // Set specific options, others will fall back to default values const httpTransportOption = new TransportOptionBuilder() @@ -44,6 +47,9 @@ describe('Auto Test', () => { .setKey(key) .setSecret(secret) .setPassphrase(passphrase) + .setBrokerName(brokerName) + .setBrokerPartner(brokerPartner) + .setBrokerKey(brokerKey) .setSpotEndpoint(GlobalApiEndpoint) .setFuturesEndpoint(GlobalFuturesApiEndpoint) .setBrokerEndpoint(GlobalBrokerApiEndpoint) @@ -69,7 +75,6 @@ describe('Auto Test', () => { let resp = api.getBrokerInfo(req); return resp.then((result) => { expect(result.accountSize).toEqual(expect.anything()); - expect(result.maxAccountSize).toEqual(expect.anything()); expect(result.level).toEqual(expect.anything()); console.log(resp); }); @@ -82,7 +87,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account */ let builder = AddSubAccountReq.builder(); - builder.setAccountName('sdk_test'); + builder.setAccountName('sdk_test_3'); let req = builder.build(); let resp = api.addSubAccount(req); return resp.then((result) => { @@ -101,7 +106,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account */ let builder = GetSubAccountReq.builder(); - builder.setUid('229317507'); + builder.setUid('237082742'); let req = builder.build(); let resp = api.getSubAccount(req); return resp.then((result) => { @@ -122,7 +127,7 @@ describe('Auto Test', () => { */ let builder = AddSubAccountApiReq.builder(); builder - .setUid('229317507') + .setUid('237082742') .setPassphrase('11223344') .setIpWhitelist(['127.0.0.1', '192.168.1.1']) .setPermissions([ @@ -152,11 +157,19 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account/apikey */ let builder = GetSubAccountAPIReq.builder(); - builder.setUid('226383154').setApiKey('67446f679d8f66000107eb6d'); + builder.setUid('237082742').setApiKey('67ab33d46425d800012b91f9'); let req = builder.build(); let resp = api.getSubAccountAPI(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.uid).toEqual(expect.any(String)); + expect(item.label).toEqual(expect.any(String)); + expect(item.apiKey).toEqual(expect.any(String)); + expect(item.apiVersion).toEqual(expect.any(Number)); + expect(item.permissions).toEqual(expect.any(Array)); + expect(item.ipWhitelist).toEqual(expect.any(Array)); + expect(item.createdAt).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -169,11 +182,11 @@ describe('Auto Test', () => { */ let builder = ModifySubAccountApiReq.builder(); builder - .setUid('229317507') + .setUid('237082742') .setIpWhitelist(['127.0.0.1']) .setPermissions([ModifySubAccountApiReq.PermissionsEnum.GENERAL]) .setLabel('label') - .setApiKey('67447006890ba200018d2722'); + .setApiKey('67ab33d46425d800012b91f9'); let req = builder.build(); let resp = api.modifySubAccountApi(req); return resp.then((result) => { @@ -195,7 +208,7 @@ describe('Auto Test', () => { * /api/v1/broker/nd/account/apikey */ let builder = DeleteSubAccountAPIReq.builder(); - builder.setUid('229317507').setApiKey('67447006890ba200018d2722'); + builder.setUid('237082742').setApiKey('67ab33d46425d800012b91f9'); let req = builder.build(); let resp = api.deleteSubAccountAPI(req); return resp.then((result) => { @@ -216,7 +229,7 @@ describe('Auto Test', () => { .setAmount('0.01') .setDirection(TransferReq.DirectionEnum.OUT) .setAccountType(TransferReq.AccountTypeEnum.TRADE) - .setSpecialUid('229317507') + .setSpecialUid('237082742') .setSpecialAccountType(TransferReq.SpecialAccountTypeEnum.MAIN) .setClientOid(randomUUID()); let req = builder.build(); @@ -234,7 +247,7 @@ describe('Auto Test', () => { * /api/v3/broker/nd/transfer/detail */ let builder = GetTransferHistoryReq.builder(); - builder.setOrderId('11111'); + builder.setOrderId('67ab343bb22eb20007293b5e'); let req = builder.build(); let resp = api.getTransferHistory(req); return resp.then((result) => { @@ -248,7 +261,6 @@ describe('Auto Test', () => { expect(result.toAccountType).toEqual(expect.anything()); expect(result.toAccountTag).toEqual(expect.anything()); expect(result.status).toEqual(expect.anything()); - expect(result.reason).toEqual(expect.anything()); expect(result.createdAt).toEqual(expect.anything()); console.log(resp); }); @@ -265,7 +277,22 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getDepositList(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.uid).toEqual(expect.any(Number)); + expect(item.hash).toEqual(expect.any(String)); + expect(item.address).toEqual(expect.any(String)); + expect(item.memo).toEqual(expect.any(String)); + expect(item.amount).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.isInner).toEqual(expect.any(Boolean)); + expect(item.walletTxId).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.remark).toEqual(expect.any(String)); + expect(item.chain).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.updatedAt).toEqual(expect.any(Number)); + }) console.log(resp); }); }); @@ -312,7 +339,6 @@ describe('Auto Test', () => { return resp.then((result) => { expect(result.id).toEqual(expect.anything()); expect(result.chain).toEqual(expect.anything()); - expect(result.walletTxId).toEqual(expect.anything()); expect(result.uid).toEqual(expect.anything()); expect(result.updatedAt).toEqual(expect.anything()); expect(result.amount).toEqual(expect.anything()); diff --git a/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts b/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts index 0aa0f327..a0a42160 100644 --- a/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts +++ b/sdk/node/tests/e2e/rest/copytrading_test/futures.test.ts @@ -149,7 +149,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/orders */ let builder = CancelOrderByIdReq.builder(); - builder.setOrderId(''); + builder.setOrderId('278750197184520192'); let req = builder.build(); let resp = api.cancelOrderById(req); return resp.then((result) => { @@ -165,7 +165,7 @@ describe('Auto Test', () => { * /api/v1/copy-trade/futures/orders/client-order */ let builder = CancelOrderByClientOidReq.builder(); - builder.setSymbol('').setClientOid(''); + builder.setSymbol('XBTUSDTM').setClientOid('52d18a28-32d8-4a1d-b183-46fa5cd09780'); let req = builder.build(); let resp = api.cancelOrderByClientOid(req); return resp.then((result) => { diff --git a/sdk/node/tests/e2e/rest/earn_test/earn.test.ts b/sdk/node/tests/e2e/rest/earn_test/earn.test.ts index 8bbf143e..bed11161 100644 --- a/sdk/node/tests/e2e/rest/earn_test/earn.test.ts +++ b/sdk/node/tests/e2e/rest/earn_test/earn.test.ts @@ -80,7 +80,7 @@ describe('Auto Test', () => { */ let builder = GetRedeemPreviewReq.builder(); builder - .setOrderId('2849600') + .setOrderId('2155441') .setFromAccountType(GetRedeemPreviewReq.FromAccountTypeEnum.MAIN); let req = builder.build(); let resp = api.getRedeemPreview(req); @@ -104,8 +104,8 @@ describe('Auto Test', () => { */ let builder = RedeemReq.builder(); builder - .setOrderId('2849600') - .setAmount('10.0') + .setOrderId('2155441') + .setAmount('10.68910651') .setFromAccountType(RedeemReq.FromAccountTypeEnum.MAIN) .setConfirmPunishRedeem('1'); let req = builder.build(); @@ -130,7 +130,27 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getSavingsProducts(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.category).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.productUpperLimit).toEqual(expect.any(String)); + expect(item.userUpperLimit).toEqual(expect.any(String)); + expect(item.userLowerLimit).toEqual(expect.any(String)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.applyStartTime).toEqual(expect.any(Number)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.productRemainAmount).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.redeemType).toEqual(expect.any(String)); + expect(item.incomeReleaseType).toEqual(expect.any(String)); + expect(item.interestDate).toEqual(expect.any(Number)); + expect(item.duration).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -146,7 +166,27 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getPromotionProducts(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.category).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.productUpperLimit).toEqual(expect.any(String)); + expect(item.userUpperLimit).toEqual(expect.any(String)); + expect(item.userLowerLimit).toEqual(expect.any(String)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.applyStartTime).toEqual(expect.any(Number)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.productRemainAmount).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.redeemType).toEqual(expect.any(String)); + expect(item.incomeReleaseType).toEqual(expect.any(String)); + expect(item.interestDate).toEqual(expect.any(Number)); + expect(item.duration).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -166,7 +206,24 @@ describe('Auto Test', () => { let resp = api.getAccountHolding(req); return resp.then((result) => { expect(result.totalNum).toEqual(expect.anything()); - expect(result.items).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.orderId).toEqual(expect.any(String)); + expect(item.productId).toEqual(expect.any(String)); + expect(item.productCategory).toEqual(expect.any(String)); + expect(item.productType).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.holdAmount).toEqual(expect.any(String)); + expect(item.redeemedAmount).toEqual(expect.any(String)); + expect(item.redeemingAmount).toEqual(expect.any(String)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.lockEndTime).toEqual(expect.any(Number)); + expect(item.purchaseTime).toEqual(expect.any(Number)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.status).toEqual(expect.any(String)); + expect(item.earlyRedeemSupported).toEqual(expect.any(String)); + }); expect(result.currentPage).toEqual(expect.anything()); expect(result.pageSize).toEqual(expect.anything()); expect(result.totalPage).toEqual(expect.anything()); @@ -185,7 +242,27 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getStakingProducts(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.category).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.productUpperLimit).toEqual(expect.any(String)); + expect(item.userUpperLimit).toEqual(expect.any(String)); + expect(item.userLowerLimit).toEqual(expect.any(String)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.applyStartTime).toEqual(expect.any(Number)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.productRemainAmount).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.redeemType).toEqual(expect.any(String)); + expect(item.incomeReleaseType).toEqual(expect.any(String)); + expect(item.interestDate).toEqual(expect.any(Number)); + expect(item.duration).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -201,7 +278,27 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getKcsStakingProducts(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.category).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.productUpperLimit).toEqual(expect.any(String)); + expect(item.userUpperLimit).toEqual(expect.any(String)); + expect(item.userLowerLimit).toEqual(expect.any(String)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.applyStartTime).toEqual(expect.any(Number)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.productRemainAmount).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.redeemType).toEqual(expect.any(String)); + expect(item.incomeReleaseType).toEqual(expect.any(String)); + expect(item.interestDate).toEqual(expect.any(Number)); + expect(item.duration).toEqual(expect.any(Number)); + }); console.log(resp); }); }); @@ -217,7 +314,27 @@ describe('Auto Test', () => { let req = builder.build(); let resp = api.getETHStakingProducts(req); return resp.then((result) => { - expect(result.data).toEqual(expect.anything()); + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.category).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.productUpperLimit).toEqual(expect.any(String)); + expect(item.userUpperLimit).toEqual(expect.any(String)); + expect(item.userLowerLimit).toEqual(expect.any(String)); + expect(item.redeemPeriod).toEqual(expect.any(Number)); + expect(item.lockStartTime).toEqual(expect.any(Number)); + expect(item.applyStartTime).toEqual(expect.any(Number)); + expect(item.returnRate).toEqual(expect.any(String)); + expect(item.incomeCurrency).toEqual(expect.any(String)); + expect(item.productRemainAmount).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.redeemType).toEqual(expect.any(String)); + expect(item.incomeReleaseType).toEqual(expect.any(String)); + expect(item.interestDate).toEqual(expect.any(Number)); + expect(item.duration).toEqual(expect.any(Number)); + }); console.log(resp); }); }); From 4810186147f4eec09bc8769076aaf315b52e8dee Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 12 Feb 2025 14:01:39 +0800 Subject: [PATCH 070/106] test(nodejs): add spot tests --- .../tests/e2e/rest/spot_test/market.test.ts | 433 ++++++ .../tests/e2e/rest/spot_test/order.test.ts | 1354 +++++++++++++++++ .../rest/viplending_test/viplending.test.ts | 76 + 3 files changed, 1863 insertions(+) create mode 100644 sdk/node/tests/e2e/rest/spot_test/market.test.ts create mode 100644 sdk/node/tests/e2e/rest/spot_test/order.test.ts create mode 100644 sdk/node/tests/e2e/rest/viplending_test/viplending.test.ts diff --git a/sdk/node/tests/e2e/rest/spot_test/market.test.ts b/sdk/node/tests/e2e/rest/spot_test/market.test.ts new file mode 100644 index 00000000..0a2ebee1 --- /dev/null +++ b/sdk/node/tests/e2e/rest/spot_test/market.test.ts @@ -0,0 +1,433 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + Get24hrStatsReq, + GetAllSymbolsReq, + GetAnnouncementsReq, + GetCurrencyReq, + GetFiatPriceReq, + GetFullOrderBookReq, + GetKlinesReq, + GetPartOrderBookReq, + GetSymbolReq, + GetTickerReq, + GetTradeHistoryReq, + MarketAPI, +} from '@src/generate/spot/market'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: MarketAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getSpotService().getMarketApi(); + }); + + test('getAnnouncements request test', () => { + /** + * getAnnouncements + * Get Announcements + * /api/v3/announcements + */ + let builder = GetAnnouncementsReq.builder(); + builder + .setAnnType(GetAnnouncementsReq.AnnTypeEnum.LATEST_ANNOUNCEMENTS) + .setLang(GetAnnouncementsReq.LangEnum.EN_US); + let req = builder.build(); + let resp = api.getAnnouncements(req); + return resp.then((result) => { + expect(result.totalNum).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.annId).toEqual(expect.any(Number)); + expect(item.annTitle).toEqual(expect.any(String)); + expect(item.annType).toEqual(expect.any(Array)); + expect(item.annDesc).toEqual(expect.any(String)); + expect(item.cTime).toEqual(expect.any(Number)); + expect(item.language).toEqual(expect.any(String)); + expect(item.annUrl).toEqual(expect.any(String)); + }); + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getCurrency request test', () => { + /** + * getCurrency + * Get Currency + * /api/v3/currencies/{currency} + */ + let builder = GetCurrencyReq.builder(); + builder.setCurrency('BTC').setChain('btc'); + let req = builder.build(); + let resp = api.getCurrency(req); + return resp.then((result) => { + expect(result.currency).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.fullName).toEqual(expect.anything()); + expect(result.precision).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.isDebitEnabled).toEqual(expect.anything()); + expect(result.chains).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAllCurrencies request test', () => { + /** + * getAllCurrencies + * Get All Currencies + * /api/v3/currencies + */ + let resp = api.getAllCurrencies(); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.currency).toEqual(expect.any(String)); + expect(item.name).toEqual(expect.any(String)); + expect(item.fullName).toEqual(expect.any(String)); + expect(item.precision).toEqual(expect.any(Number)); + expect(item.isMarginEnabled).toEqual(expect.any(Boolean)); + expect(item.isDebitEnabled).toEqual(expect.any(Boolean)); + }); + console.log(resp); + }); + }); + + test('getSymbol request test', () => { + /** + * getSymbol + * Get Symbol + * /api/v2/symbols/{symbol} + */ + let builder = GetSymbolReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getSymbol(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.name).toEqual(expect.anything()); + expect(result.baseCurrency).toEqual(expect.anything()); + expect(result.quoteCurrency).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.market).toEqual(expect.anything()); + expect(result.baseMinSize).toEqual(expect.anything()); + expect(result.quoteMinSize).toEqual(expect.anything()); + expect(result.baseMaxSize).toEqual(expect.anything()); + expect(result.quoteMaxSize).toEqual(expect.anything()); + expect(result.baseIncrement).toEqual(expect.anything()); + expect(result.quoteIncrement).toEqual(expect.anything()); + expect(result.priceIncrement).toEqual(expect.anything()); + expect(result.priceLimitRate).toEqual(expect.anything()); + expect(result.minFunds).toEqual(expect.anything()); + expect(result.isMarginEnabled).toEqual(expect.anything()); + expect(result.enableTrading).toEqual(expect.anything()); + expect(result.feeCategory).toEqual(expect.anything()); + expect(result.makerFeeCoefficient).toEqual(expect.anything()); + expect(result.takerFeeCoefficient).toEqual(expect.anything()); + expect(result.st).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAllSymbols request test', () => { + /** + * getAllSymbols + * Get All Symbols + * /api/v2/symbols + */ + let builder = GetAllSymbolsReq.builder(); + builder.setMarket('USDS'); + let req = builder.build(); + let resp = api.getAllSymbols(req); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.name).toEqual(expect.any(String)); + expect(item.baseCurrency).toEqual(expect.any(String)); + expect(item.quoteCurrency).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.market).toEqual(expect.any(String)); + expect(item.baseMinSize).toEqual(expect.any(String)); + expect(item.quoteMinSize).toEqual(expect.any(String)); + expect(item.baseMaxSize).toEqual(expect.any(String)); + expect(item.quoteMaxSize).toEqual(expect.any(String)); + expect(item.baseIncrement).toEqual(expect.any(String)); + expect(item.quoteIncrement).toEqual(expect.any(String)); + expect(item.priceIncrement).toEqual(expect.any(String)); + expect(item.priceLimitRate).toEqual(expect.any(String)); + expect(item.minFunds).toEqual(expect.any(String)); + expect(item.enableTrading).toEqual(expect.any(Boolean)); + expect(item.makerFeeCoefficient).toEqual(expect.any(String)); + expect(item.takerFeeCoefficient).toEqual(expect.any(String)); + expect(item.st).toEqual(expect.any(Boolean)); + }); + console.log(resp); + }); + }); + + test('getTicker request test', () => { + /** + * getTicker + * Get Ticker + * /api/v1/market/orderbook/level1 + */ + let builder = GetTickerReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getTicker(req); + return resp.then((result) => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.bestBid).toEqual(expect.anything()); + expect(result.bestBidSize).toEqual(expect.anything()); + expect(result.bestAsk).toEqual(expect.anything()); + expect(result.bestAskSize).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getAllTickers request test', () => { + /** + * getAllTickers + * Get All Tickers + * /api/v1/market/allTickers + */ + let resp = api.getAllTickers(); + return resp.then((result) => { + expect(result.time).toEqual(expect.anything()); + expect(result.ticker).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/market/histories + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.sequence).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.time).toEqual(expect.any(Number)); + }); + console.log(resp); + }); + }); + + test('getKlines request test', () => { + /** + * getKlines + * Get Klines + * /api/v1/market/candles + */ + let builder = GetKlinesReq.builder(); + builder + .setSymbol('BTC-USDT') + .setType(GetKlinesReq.TypeEnum._1MIN) + .setStartAt(1566703297) + .setEndAt(1566789757); + let req = builder.build(); + let resp = api.getKlines(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPartOrderBook request test', () => { + /** + * getPartOrderBook + * Get Part OrderBook + * /api/v1/market/orderbook/level2_{size} + */ + let builder = GetPartOrderBookReq.builder(); + builder.setSymbol('BTC-USDT').setSize('20'); + let req = builder.build(); + let resp = api.getPartOrderBook(req); + return resp.then((result) => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFullOrderBook request test', () => { + /** + * getFullOrderBook + * Get Full OrderBook + * /api/v3/market/orderbook/level2 + */ + let builder = GetFullOrderBookReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getFullOrderBook(req); + return resp.then((result) => { + expect(result.time).toEqual(expect.anything()); + expect(result.sequence).toEqual(expect.anything()); + expect(result.bids).toEqual(expect.anything()); + expect(result.asks).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getFiatPrice request test', () => { + /** + * getFiatPrice + * Get Fiat Price + * /api/v1/prices + */ + let builder = GetFiatPriceReq.builder(); + builder.setBase('USD').setCurrencies('BTC,ETH'); + let req = builder.build(); + let resp = api.getFiatPrice(req); + return resp.then((result) => { + expect(result.BTC).toEqual(expect.anything()); + expect(result.ETH).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('get24hrStats request test', () => { + /** + * get24hrStats + * Get 24hr Stats + * /api/v1/market/stats + */ + let builder = Get24hrStatsReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.get24hrStats(req); + return resp.then((result) => { + expect(result.time).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.buy).toEqual(expect.anything()); + expect(result.sell).toEqual(expect.anything()); + expect(result.changeRate).toEqual(expect.anything()); + expect(result.changePrice).toEqual(expect.anything()); + expect(result.high).toEqual(expect.anything()); + expect(result.low).toEqual(expect.anything()); + expect(result.vol).toEqual(expect.anything()); + expect(result.volValue).toEqual(expect.anything()); + expect(result.last).toEqual(expect.anything()); + expect(result.averagePrice).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.takerCoefficient).toEqual(expect.anything()); + expect(result.makerCoefficient).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getMarketList request test', () => { + /** + * getMarketList + * Get Market List + * /api/v1/markets + */ + let resp = api.getMarketList(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getServerTime request test', () => { + /** + * getServerTime + * Get Server Time + * /api/v1/timestamp + */ + let resp = api.getServerTime(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getServiceStatus request test', () => { + /** + * getServiceStatus + * Get Service Status + * /api/v1/status + */ + let resp = api.getServiceStatus(); + return resp.then((result) => { + expect(result.status).toEqual(expect.anything()); + expect(result.msg).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPublicToken request test', () => { + /** + * getPublicToken + * Get Public Token - Spot/Margin + * /api/v1/bullet-public + */ + let resp = api.getPublicToken(); + return resp.then((result) => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getPrivateToken request test', () => { + /** + * getPrivateToken + * Get Private Token - Spot/Margin + * /api/v1/bullet-private + */ + let resp = api.getPrivateToken(); + return resp.then((result) => { + expect(result.token).toEqual(expect.anything()); + expect(result.instanceServers).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/spot_test/order.test.ts b/sdk/node/tests/e2e/rest/spot_test/order.test.ts new file mode 100644 index 00000000..744addc3 --- /dev/null +++ b/sdk/node/tests/e2e/rest/spot_test/order.test.ts @@ -0,0 +1,1354 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { + AddOcoOrderReq, + AddOrderOldReq, + AddOrderReq, + AddOrderSyncReq, + AddOrderTestOldReq, + AddOrderTestReq, + AddStopOrderReq, + BatchAddOrdersOldOrderList, + BatchAddOrdersOldReq, + BatchAddOrdersOrderList, + BatchAddOrdersReq, + BatchAddOrdersSyncOrderList, + BatchAddOrdersSyncReq, + BatchCancelOcoOrdersReq, + BatchCancelOrderOldReq, + BatchCancelStopOrderReq, + CancelAllOrdersBySymbolReq, + CancelOcoOrderByClientOidReq, + CancelOcoOrderByOrderIdReq, + CancelOrderByClientOidOldReq, + CancelOrderByClientOidReq, + CancelOrderByClientOidSyncReq, + CancelOrderByOrderIdOldReq, + CancelOrderByOrderIdReq, + CancelOrderByOrderIdSyncReq, + CancelPartialOrderReq, + CancelStopOrderByClientOidReq, + CancelStopOrderByOrderIdReq, + GetClosedOrdersReq, + GetOcoOrderByClientOidReq, + GetOcoOrderByOrderIdReq, + GetOcoOrderDetailByOrderIdReq, + GetOcoOrderListReq, + GetOpenOrdersReq, + GetOrderByClientOidOldReq, + GetOrderByClientOidReq, + GetOrderByOrderIdOldReq, + GetOrderByOrderIdReq, + GetOrdersListOldReq, + GetRecentOrdersListOldReq, + GetRecentTradeHistoryOldReq, + GetStopOrderByClientOidReq, + GetStopOrderByOrderIdReq, + GetStopOrdersListReq, + GetTradeHistoryOldReq, + GetTradeHistoryReq, + ModifyOrderReq, + OrderAPI, + SetDCPReq, +} from '@src/generate/spot/order'; +import { DefaultClient } from '@api/index'; +import { randomUUID } from 'crypto'; + +describe('Auto Test', () => { + let api: OrderAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getSpotService().getOrderApi(); + }); + + test('addOrder request test', () => { + /** + * addOrder + * Add Order + * /api/v1/hf/orders + */ + let builder = AddOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderReq.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001'); + let req = builder.build(); + let resp = api.addOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderSync request test', () => { + /** + * addOrderSync + * Add Order Sync + * /api/v1/hf/orders/sync + */ + let builder = AddOrderSyncReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderSyncReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001'); + let req = builder.build(); + let resp = api.addOrderSync(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.matchTime).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderTest request test', () => { + /** + * addOrderTest + * Add Order Test + * /api/v1/hf/orders/test + */ + let builder = AddOrderTestReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderTestReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddOrderTestReq.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001'); + let req = builder.build(); + let resp = api.addOrderTest(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchAddOrders request test', () => { + /** + * batchAddOrders + * Batch Add Orders + * /api/v1/hf/orders/multi + */ + let builder = BatchAddOrdersReq.builder(); + + let order1 = BatchAddOrdersOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersOrderList.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(BatchAddOrdersOrderList.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001') + .build(); + + let order2 = BatchAddOrdersOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersOrderList.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(BatchAddOrdersOrderList.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001') + .build(); + + builder.setOrderList([order1, order2]); + let req = builder.build(); + let resp = api.batchAddOrders(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchAddOrdersSync request test', () => { + /** + * batchAddOrdersSync + * Batch Add Orders Sync + * /api/v1/hf/orders/multi/sync + */ + let builder = BatchAddOrdersSyncReq.builder(); + + let order1 = BatchAddOrdersSyncOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersSyncOrderList.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(BatchAddOrdersSyncOrderList.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001') + .build(); + + let order2 = BatchAddOrdersSyncOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersSyncOrderList.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(BatchAddOrdersSyncOrderList.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001') + .build(); + + builder.setOrderList([order1, order2]); + let req = builder.build(); + let resp = api.batchAddOrdersSync(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByOrderId request test', () => { + /** + * cancelOrderByOrderId + * Cancel Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let builder = CancelOrderByOrderIdReq.builder(); + builder.setOrderId('67ac0e57ae86dc0008981482').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByOrderId(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByOrderIdSync request test', () => { + /** + * cancelOrderByOrderIdSync + * Cancel Order By OrderId Sync + * /api/v1/hf/orders/sync/{orderId} + */ + let builder = CancelOrderByOrderIdSyncReq.builder(); + builder.setOrderId('67ac0f8a5040460007779a50').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdSync(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOid request test', () => { + /** + * cancelOrderByClientOid + * Cancel Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidReq.builder(); + builder.setClientOid('04e1dc6f-47af-4e3c-8551-7aa757dac0da').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByClientOid(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOidSync request test', () => { + /** + * cancelOrderByClientOidSync + * Cancel Order By ClientOid Sync + * /api/v1/hf/orders/sync/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidSyncReq.builder(); + builder.setClientOid('a6f95aa9-7b4f-476f-9eff-87f51a4e61cc').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.cancelOrderByClientOidSync(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + expect(result.originSize).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.canceledSize).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelPartialOrder request test', () => { + /** + * cancelPartialOrder + * Cancel Partial Order + * /api/v1/hf/orders/cancel/{orderId} + */ + let builder = CancelPartialOrderReq.builder(); + builder + .setOrderId('67ac100407813c00077755d1') + .setSymbol('BTC-USDT') + .setCancelSize('0.0005'); + let req = builder.build(); + let resp = api.cancelPartialOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.cancelSize).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelAllOrdersBySymbol request test', () => { + /** + * cancelAllOrdersBySymbol + * Cancel All Orders By Symbol + * /api/v1/hf/orders + */ + let builder = CancelAllOrdersBySymbolReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.cancelAllOrdersBySymbol(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + test('cancelAllOrders request test', () => { + /** + * cancelAllOrders + * Cancel All Orders + * /api/v1/hf/orders/cancelAll + */ + let resp = api.cancelAllOrders(); + return resp.then((result) => { + expect(result.succeedSymbols).toEqual(expect.anything()); + expect(result.failedSymbols).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('modifyOrder request test', () => { + /** + * modifyOrder + * Modify Order + * /api/v1/hf/orders/alter + */ + let builder = ModifyOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSymbol('BTC-USDT') + .setOrderId('67ac106d07813c000779486e') + .setNewPrice('9000') + .setNewSize('0.001'); + let req = builder.build(); + let resp = api.modifyOrder(req); + return resp.then((result) => { + expect(result.newOrderId).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByOrderId request test', () => { + /** + * getOrderByOrderId + * Get Order By OrderId + * /api/v1/hf/orders/{orderId} + */ + let builder = GetOrderByOrderIdReq.builder(); + builder.setSymbol('BTC-USDT').setOrderId('67ac106d07813c000779486e'); + let req = builder.build(); + let resp = api.getOrderByOrderId(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByClientOid request test', () => { + /** + * getOrderByClientOid + * Get Order By ClientOid + * /api/v1/hf/orders/client-order/{clientOid} + */ + let builder = GetOrderByClientOidReq.builder(); + builder.setSymbol('BTC-USDT').setClientOid('f7b518cc-fa55-472b-9c56-89e64d2af3a2'); + let req = builder.build(); + let resp = api.getOrderByClientOid(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getSymbolsWithOpenOrder request test', () => { + /** + * getSymbolsWithOpenOrder + * Get Symbols With Open Order + * /api/v1/hf/orders/active/symbols + */ + let resp = api.getSymbolsWithOpenOrder(); + return resp.then((result) => { + expect(result.symbols).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOpenOrders request test', () => { + /** + * getOpenOrders + * Get Open Orders + * /api/v1/hf/orders/active + */ + let builder = GetOpenOrdersReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getOpenOrders(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getClosedOrders request test', () => { + /** + * getClosedOrders + * Get Closed Orders + * /api/v1/hf/orders/done + */ + let builder = GetClosedOrdersReq.builder(); + builder + .setSymbol('BTC-USDT') + .setSide(GetClosedOrdersReq.SideEnum.BUY) + .setType(GetClosedOrdersReq.TypeEnum.LIMIT); + let req = builder.build(); + let resp = api.getClosedOrders(req); + return resp.then((result) => { + expect(result.lastId).toEqual(expect.anything()); + expect(result.items).toEqual(expect.anything()); + result.items.forEach((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.lastUpdatedAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.inOrderBook).toEqual(expect.anything()); + expect(result.cancelledSize).toEqual(expect.anything()); + expect(result.cancelledFunds).toEqual(expect.anything()); + expect(result.remainSize).toEqual(expect.anything()); + expect(result.remainFunds).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + expect(result.active).toEqual(expect.anything()); + }); + console.log(resp); + }); + }); + + test('getTradeHistory request test', () => { + /** + * getTradeHistory + * Get Trade History + * /api/v1/hf/fills + */ + let builder = GetTradeHistoryReq.builder(); + builder.setSymbol('KCS-USDT').setSide(GetTradeHistoryReq.SideEnum.SELL); + let req = builder.build(); + let resp = api.getTradeHistory(req); + return resp.then((result) => { + result.items.forEach((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.tax).toEqual(expect.anything()); + }); + expect(result.lastId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getDCP request test', () => { + /** + * getDCP + * Get DCP + * /api/v1/hf/orders/dead-cancel-all/query + */ + let resp = api.getDCP(); + return resp.then((result) => { + expect(result.timeout).toEqual(expect.anything()); + expect(result.symbols).toEqual(expect.anything()); + expect(result.currentTime).toEqual(expect.anything()); + expect(result.triggerTime).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('setDCP request test', () => { + /** + * setDCP + * Set DCP + * /api/v1/hf/orders/dead-cancel-all + */ + let builder = SetDCPReq.builder(); + builder.setTimeout(5).setSymbols('BTC-USDT'); + let req = builder.build(); + let resp = api.setDCP(req); + return resp.then((result) => { + expect(result.currentTime).toEqual(expect.anything()); + expect(result.triggerTime).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addStopOrder request test', () => { + /** + * addStopOrder + * Add Stop Order + * /api/v1/stop-order + */ + let builder = AddStopOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddStopOrderReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setType(AddStopOrderReq.TypeEnum.LIMIT) + .setRemark('sdk_test') + .setPrice('10000') + .setSize('0.001') + .setStopPrice('8000'); + let req = builder.build(); + let resp = api.addStopOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + console.log(req.clientOid); + }); + }); + + test('cancelStopOrderByClientOid request test', () => { + /** + * cancelStopOrderByClientOid + * Cancel Stop Order By ClientOid + * /api/v1/stop-order/cancelOrderByClientOid + */ + let builder = CancelStopOrderByClientOidReq.builder(); + builder.setSymbol('BTC-USDT').setClientOid('0d760198-6696-4220-82e4-509cc248c537'); + let req = builder.build(); + let resp = api.cancelStopOrderByClientOid(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + expect(result.cancelledOrderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelStopOrderByOrderId request test', () => { + /** + * cancelStopOrderByOrderId + * Cancel Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let builder = CancelStopOrderByOrderIdReq.builder(); + builder.setOrderId('vs93gptc29o8u2if003v8h2f'); + let req = builder.build(); + let resp = api.cancelStopOrderByOrderId(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchCancelStopOrder request test', () => { + /** + * batchCancelStopOrder + * Batch Cancel Stop Orders + * /api/v1/stop-order/cancel + */ + let builder = BatchCancelStopOrderReq.builder(); + builder.setSymbol('BTC-USDT').setTradeType('TRADE').setOrderIds('vs93gptc2bgm77kh003gj9js'); + let req = builder.build(); + let resp = api.batchCancelStopOrder(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getStopOrdersList request test', () => { + /** + * getStopOrdersList + * Get Stop Orders List + * /api/v1/stop-order + */ + let builder = GetStopOrdersListReq.builder(); + builder + .setSymbol('BTC-USDT') + .setSide(GetStopOrdersListReq.SideEnum.BUY) + .setType(GetStopOrdersListReq.TypeEnum.LIMIT) + .setTradeType(GetStopOrdersListReq.TradeTypeEnum.TRADE); + let req = builder.build(); + let resp = api.getStopOrdersList(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + result.items?.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.userId).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.cancelAfter).toEqual(expect.any(Number)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.channel).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.remark).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.domainId).toEqual(expect.any(String)); + expect(item.tradeSource).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.takerFeeRate).toEqual(expect.any(String)); + }); + console.log(resp); + }); + }); + + test('getStopOrderByOrderId request test', () => { + /** + * getStopOrderByOrderId + * Get Stop Order By OrderId + * /api/v1/stop-order/{orderId} + */ + let builder = GetStopOrderByOrderIdReq.builder(); + builder.setOrderId('vs93gptc2etm77kh003gj9kc'); + let req = builder.build(); + let resp = api.getStopOrderByOrderId(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.domainId).toEqual(expect.anything()); + expect(result.tradeSource).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getStopOrderByClientOid request test', () => { + /** + * getStopOrderByClientOid + * Get Stop Order By ClientOid + * /api/v1/stop-order/queryOrderByClientOid + */ + let builder = GetStopOrderByClientOidReq.builder(); + builder.setClientOid('0b7b79ae-d435-44d1-916e-c9cf970f7d08').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getStopOrderByClientOid(req); + return resp.then((result) => { + result.data.forEach((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.userId).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.remark).toEqual(expect.anything()); + expect(result.domainId).toEqual(expect.anything()); + expect(result.tradeSource).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.takerFeeRate).toEqual(expect.anything()); + expect(result.makerFeeRate).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.stop).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + }); + console.log(resp); + }); + }); + + test('addOcoOrder request test', () => { + /** + * addOcoOrder + * Add OCO Order + * /api/v3/oco/order + */ + let builder = AddOcoOrderReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOcoOrderReq.SideEnum.BUY) + .setSymbol('BTC-USDT') + .setPrice('94000') + .setSize('0.001') + .setStopPrice('98000') + .setLimitPrice('96000') + .setTradeType(AddOcoOrderReq.TradeTypeEnum.TRADE); + let req = builder.build(); + let resp = api.addOcoOrder(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOcoOrderByOrderId request test', () => { + /** + * cancelOcoOrderByOrderId + * Cancel OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let builder = CancelOcoOrderByOrderIdReq.builder(); + builder.setOrderId('67ac14f68f0a4f0007f44486'); + let req = builder.build(); + let resp = api.cancelOcoOrderByOrderId(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOcoOrderByClientOid request test', () => { + /** + * cancelOcoOrderByClientOid + * Cancel OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let builder = CancelOcoOrderByClientOidReq.builder(); + builder.setClientOid('9e4ffc79-eac5-4253-9a03-85cb1951de74'); + let req = builder.build(); + let resp = api.cancelOcoOrderByClientOid(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchCancelOcoOrders request test', () => { + /** + * batchCancelOcoOrders + * Batch Cancel OCO Order + * /api/v3/oco/orders + */ + let builder = BatchCancelOcoOrdersReq.builder(); + builder.setOrderIds('67ac15d038b7780007aecda6').setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.batchCancelOcoOrders(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOcoOrderByOrderId request test', () => { + /** + * getOcoOrderByOrderId + * Get OCO Order By OrderId + * /api/v3/oco/order/{orderId} + */ + let builder = GetOcoOrderByOrderIdReq.builder(); + builder.setOrderId('67ac152467338f0007143106'); + let req = builder.build(); + let resp = api.getOcoOrderByOrderId(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOcoOrderByClientOid request test', () => { + /** + * getOcoOrderByClientOid + * Get OCO Order By ClientOid + * /api/v3/oco/client-order/{clientOid} + */ + let builder = GetOcoOrderByClientOidReq.builder(); + builder.setClientOid('9e4ffc79-eac5-4253-9a03-85cb1951de74'); + let req = builder.build(); + let resp = api.getOcoOrderByClientOid(req); + return resp.then((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderId).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOcoOrderDetailByOrderId request test', () => { + /** + * getOcoOrderDetailByOrderId + * Get OCO Order Detail By OrderId + * /api/v3/oco/order/details/{orderId} + */ + let builder = GetOcoOrderDetailByOrderIdReq.builder(); + builder.setOrderId('67ac152467338f0007143106'); + let req = builder.build(); + let resp = api.getOcoOrderDetailByOrderId(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.orderTime).toEqual(expect.anything()); + expect(result.status).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOcoOrderList request test', () => { + /** + * getOcoOrderList + * Get OCO Order List + * /api/v3/oco/orders + */ + let builder = GetOcoOrderListReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getOcoOrderList(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.orderId).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.status).toEqual(expect.any(String)); + }); + console.log(resp); + }); + }); + + test('addOrderOld request test', () => { + /** + * addOrderOld + * Add Order - Old + * /api/v1/orders + */ + let builder = AddOrderOldReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderOldReq.SideEnum.BUY) + .setTradeType(AddOrderOldReq.TradeTypeEnum.TRADE) + .setType(AddOrderOldReq.TypeEnum.LIMIT) + .setSymbol('BTC-USDT') + .setPrice('10000') + .setSize('0.001'); + let req = builder.build(); + let resp = api.addOrderOld(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('addOrderTestOld request test', () => { + /** + * addOrderTestOld + * Add Order Test - Old + * /api/v1/orders/test + */ + let builder = AddOrderTestOldReq.builder(); + builder + .setClientOid(randomUUID()) + .setSide(AddOrderOldReq.SideEnum.BUY) + .setTradeType(AddOrderOldReq.TradeTypeEnum.TRADE) + .setType(AddOrderOldReq.TypeEnum.LIMIT) + .setSymbol('BTC-USDT') + .setPrice('94000') + .setSize('0.001'); + let req = builder.build(); + let resp = api.addOrderTestOld(req); + return resp.then((result) => { + expect(result.orderId).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchAddOrdersOld request test', () => { + /** + * batchAddOrdersOld + * Batch Add Orders - Old + * /api/v1/orders/multi + */ + let builder = BatchAddOrdersOldReq.builder(); + + let order1 = BatchAddOrdersOldOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersOldOrderList.SideEnum.BUY) + .setTradeType(BatchAddOrdersOldOrderList.TradeTypeEnum.TRADE) + .setType(BatchAddOrdersOldOrderList.TypeEnum.LIMIT) + .setSymbol('BTC-USDT') + .setPrice('10000') + .setSize('0.001') + .build(); + + let order2 = BatchAddOrdersOldOrderList.builder() + .setClientOid(randomUUID()) + .setSide(BatchAddOrdersOldOrderList.SideEnum.BUY) + .setTradeType(BatchAddOrdersOldOrderList.TradeTypeEnum.TRADE) + .setType(BatchAddOrdersOldOrderList.TypeEnum.LIMIT) + .setSymbol('BTC-USDT') + .setPrice('10000') + .setSize('0.001') + .build(); + + builder.setOrderList([order1, order2]).setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.batchAddOrdersOld(req); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByOrderIdOld request test', () => { + /** + * cancelOrderByOrderIdOld + * Cancel Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let builder = CancelOrderByOrderIdOldReq.builder(); + builder.setSymbol('BTC-USDT').setOrderId('67ac173127f3550007502cfc'); + let req = builder.build(); + let resp = api.cancelOrderByOrderIdOld(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('cancelOrderByClientOidOld request test', () => { + /** + * cancelOrderByClientOidOld + * Cancel Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let builder = CancelOrderByClientOidOldReq.builder(); + builder.setSymbol('BTC-USDT').setClientOid('0a3a8abd-09e1-498f-a6cc-94eeacfe2203'); + let req = builder.build(); + let resp = api.cancelOrderByClientOidOld(req); + return resp.then((result) => { + expect(result.clientOid).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('batchCancelOrderOld request test', () => { + /** + * batchCancelOrderOld + * Batch Cancel Order - Old + * /api/v1/orders + */ + let builder = BatchCancelOrderOldReq.builder(); + builder.setSymbol('BTC-USDT').setTradeType(BatchCancelOrderOldReq.TradeTypeEnum.TRADE); + let req = builder.build(); + let resp = api.batchCancelOrderOld(req); + return resp.then((result) => { + expect(result.cancelledOrderIds).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrdersListOld request test', () => { + /** + * getOrdersListOld + * Get Orders List - Old + * /api/v1/orders + */ + let builder = GetOrdersListOldReq.builder(); + builder.setSymbol('BTC-USDT'); + let req = builder.build(); + let resp = api.getOrdersListOld(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + result.items.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.opType).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.dealFunds).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.stopPrice).toEqual(expect.any(String)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.cancelAfter).toEqual(expect.any(Number)); + expect(item.channel).toEqual(expect.any(String)); + expect(item.isActive).toEqual(expect.any(Boolean)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.tradeType).toEqual(expect.any(String)); + }); + console.log(resp); + }); + }); + + test('getRecentOrdersListOld request test', () => { + /** + * getRecentOrdersListOld + * Get Recent Orders List - Old + * /api/v1/limit/orders + */ + let builder = GetRecentOrdersListOldReq.builder(); + let req = builder.build(); + let resp = api.getRecentOrdersListOld(req); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.id).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.opType).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.dealFunds).toEqual(expect.any(String)); + expect(item.dealSize).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.stopTriggered).toEqual(expect.any(Boolean)); + expect(item.stopPrice).toEqual(expect.any(String)); + expect(item.timeInForce).toEqual(expect.any(String)); + expect(item.postOnly).toEqual(expect.any(Boolean)); + expect(item.hidden).toEqual(expect.any(Boolean)); + expect(item.iceberg).toEqual(expect.any(Boolean)); + expect(item.cancelAfter).toEqual(expect.any(Number)); + expect(item.channel).toEqual(expect.any(String)); + expect(item.isActive).toEqual(expect.any(Boolean)); + expect(item.cancelExist).toEqual(expect.any(Boolean)); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.tradeType).toEqual(expect.any(String)); + }); + console.log(resp); + }); + }); + + test('getOrderByOrderIdOld request test', () => { + /** + * getOrderByOrderIdOld + * Get Order By OrderId - Old + * /api/v1/orders/{orderId} + */ + let builder = GetOrderByOrderIdOldReq.builder(); + builder.setOrderId('67ac1892a794c7000729b372'); + let req = builder.build(); + let resp = api.getOrderByOrderIdOld(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getOrderByClientOidOld request test', () => { + /** + * getOrderByClientOidOld + * Get Order By ClientOid - Old + * /api/v1/order/client-order/{clientOid} + */ + let builder = GetOrderByClientOidOldReq.builder(); + builder.setClientOid('f156fff8-fb03-4557-84c1-d30acb976ee8'); + let req = builder.build(); + let resp = api.getOrderByClientOidOld(req); + return resp.then((result) => { + expect(result.id).toEqual(expect.anything()); + expect(result.symbol).toEqual(expect.anything()); + expect(result.opType).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.dealFunds).toEqual(expect.anything()); + expect(result.dealSize).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.stopTriggered).toEqual(expect.anything()); + expect(result.stopPrice).toEqual(expect.anything()); + expect(result.timeInForce).toEqual(expect.anything()); + expect(result.postOnly).toEqual(expect.anything()); + expect(result.hidden).toEqual(expect.anything()); + expect(result.iceberg).toEqual(expect.anything()); + expect(result.visibleSize).toEqual(expect.anything()); + expect(result.cancelAfter).toEqual(expect.anything()); + expect(result.channel).toEqual(expect.anything()); + expect(result.clientOid).toEqual(expect.anything()); + expect(result.isActive).toEqual(expect.anything()); + expect(result.cancelExist).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + console.log(resp); + }); + }); + + test('getTradeHistoryOld request test', () => { + /** + * getTradeHistoryOld + * Get Trade History - Old + * /api/v1/fills + */ + let builder = GetTradeHistoryOldReq.builder(); + builder.setSymbol('KCS-USDT').setTradeType(GetTradeHistoryOldReq.TradeTypeEnum.TRADE); + let req = builder.build(); + let resp = api.getTradeHistoryOld(req); + return resp.then((result) => { + expect(result.currentPage).toEqual(expect.anything()); + expect(result.pageSize).toEqual(expect.anything()); + expect(result.totalNum).toEqual(expect.anything()); + expect(result.totalPage).toEqual(expect.anything()); + result.items.forEach((result) => { + expect(result.symbol).toEqual(expect.anything()); + expect(result.type).toEqual(expect.anything()); + expect(result.side).toEqual(expect.anything()); + expect(result.price).toEqual(expect.anything()); + expect(result.size).toEqual(expect.anything()); + expect(result.funds).toEqual(expect.anything()); + expect(result.fee).toEqual(expect.anything()); + expect(result.feeCurrency).toEqual(expect.anything()); + expect(result.createdAt).toEqual(expect.anything()); + expect(result.tradeType).toEqual(expect.anything()); + }); + console.log(resp); + }); + }); + + test('getRecentTradeHistoryOld request test', () => { + /** + * getRecentTradeHistoryOld + * Get Recent Trade History - Old + * /api/v1/limit/fills + */ + let builder = GetRecentTradeHistoryOldReq.builder(); + let req = builder.build(); + let resp = api.getRecentTradeHistoryOld(req); + return resp.then((result) => { + result.data.forEach((item) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.counterOrderId).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.forceTaker).toEqual(expect.any(Boolean)); + expect(item.price).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.funds).toEqual(expect.any(String)); + expect(item.fee).toEqual(expect.any(String)); + expect(item.feeRate).toEqual(expect.any(String)); + expect(item.feeCurrency).toEqual(expect.any(String)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.createdAt).toEqual(expect.any(Number)); + }); + console.log(resp); + }); + }); +}); diff --git a/sdk/node/tests/e2e/rest/viplending_test/viplending.test.ts b/sdk/node/tests/e2e/rest/viplending_test/viplending.test.ts new file mode 100644 index 00000000..0d3e043d --- /dev/null +++ b/sdk/node/tests/e2e/rest/viplending_test/viplending.test.ts @@ -0,0 +1,76 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { VIPLendingAPI } from '@src/generate/viplending/viplending'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + let api: VIPLendingAPI; + + beforeAll(() => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + api = kucoinRestService.getVipLendingService().getVIPLendingApi(); + }); + + // TODO 401 + test('getAccountDetail request test', () => { + /** + * getAccountDetail + * Get Account Detail + * /api/v1/otc-loan/loan + */ + let resp = api.getAccountDetail(); + return resp.then((result) => { + expect(result.parentUid).toEqual(expect.anything()); + expect(result.orders).toEqual(expect.anything()); + expect(result.ltv).toEqual(expect.anything()); + expect(result.totalMarginAmount).toEqual(expect.anything()); + expect(result.transferMarginAmount).toEqual(expect.anything()); + expect(result.margins).toEqual(expect.anything()); + console.log(resp); + }); + }); + + // TODO 401 + test('getAccounts request test', () => { + /** + * getAccounts + * Get Accounts + * /api/v1/otc-loan/accounts + */ + let resp = api.getAccounts(); + return resp.then((result) => { + expect(result.data).toEqual(expect.anything()); + console.log(resp); + }); + }); +}); From 2b965af0c268dfceb415cd77c99de0cc60c5e3a7 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 12 Feb 2025 16:10:26 +0800 Subject: [PATCH 071/106] test(nodejs): add more test for robustness --- .../src/internal/infra/default_transport.ts | 14 ++ sdk/node/src/model/common.ts | 4 + sdk/node/src/model/transport_option.ts | 14 +- .../tests/robustness/rest/reliability.test.ts | 142 ++++++++++++++++++ .../tests/robustness/rest/resource.test.ts | 141 +++++++++++++++++ 5 files changed, 311 insertions(+), 4 deletions(-) create mode 100644 sdk/node/tests/robustness/rest/reliability.test.ts create mode 100644 sdk/node/tests/robustness/rest/resource.test.ts diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 5ce76b6b..91a1e551 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -42,6 +42,8 @@ export class DefaultTransport implements Transport { } private createHttpClient(trans_option: TransportOption): AxiosInstance { + const selectedProxy = trans_option.proxy?.https ?? trans_option.proxy?.http; + const instance = axios.create({ timeout: trans_option.timeout || DEFAULT_TRANSPORT_OPTION.timeout, headers: { @@ -73,6 +75,18 @@ export class DefaultTransport implements Transport { trans_option.idleConnTimeout || DEFAULT_TRANSPORT_OPTION.idleConnTimeout, }) : undefined, + proxy: selectedProxy + ? { + host: selectedProxy.host, + port: selectedProxy.port, + auth: trans_option.proxy?.auth + ? { + username: trans_option.proxy.auth.username, + password: trans_option.proxy.auth.password, + } + : undefined, + } + : false, } as CreateAxiosDefaults); // Add retry logic diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index e4d1a283..5f54ec13 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -73,6 +73,10 @@ export class RestError extends Error { return `request error, ${this.err}`; } + getError() { + return this.err; + } + getCommonResponse() { return this.response; } diff --git a/sdk/node/src/model/transport_option.ts b/sdk/node/src/model/transport_option.ts index 0527d222..9f1cb6c6 100644 --- a/sdk/node/src/model/transport_option.ts +++ b/sdk/node/src/model/transport_option.ts @@ -38,6 +38,12 @@ export interface Interceptor { after: AxiosResponseInterceptor; } +export interface ProxyOption { + http?: { host: string; port: number }; + https?: { host: string; port: number }; + auth?: { username: string; password: string }; +} + /** * TransportOption interface for storing various HTTP request configurations */ @@ -71,9 +77,9 @@ export interface TransportOption { */ idleConnTimeout: number; /** - * HTTP proxy function + * HTTP(s) proxy options */ - proxy?: (req: Request) => Promise | URL | null; + proxy?: ProxyOption; /** * Maximum number of retry attempts */ @@ -171,9 +177,9 @@ export class TransportOptionBuilder { } /** - * Set the HTTP proxy function + * Set the HTTP(s) proxy options */ - setProxy(proxy: (req: Request) => Promise | URL | null): TransportOptionBuilder { + setProxy(proxy: ProxyOption): TransportOptionBuilder { this.option.proxy = proxy; return this; } diff --git a/sdk/node/tests/robustness/rest/reliability.test.ts b/sdk/node/tests/robustness/rest/reliability.test.ts new file mode 100644 index 00000000..0e5deef9 --- /dev/null +++ b/sdk/node/tests/robustness/rest/reliability.test.ts @@ -0,0 +1,142 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Interceptor, + RestError, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; + +describe('Auto Test', () => { + test('test proxy', () => { + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .setProxy({ + http: { + host: '127.0.0.1', + port: 7890, + }, + }) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + let api = kucoinRestService.getSpotService().getMarketApi(); + + return api.getAllCurrencies().then((result) => { + console.log(result); + }); + }); + + test('test timeout retry', () => { + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .setTimeout(1) + .setRetryDelay(100) + .setMaxRetries(3) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + let api = kucoinRestService.getSpotService().getMarketApi(); + + return api + .getAllCurrencies() + .then((result) => { + console.log(result); + }) + .catch((e) => { + if (e instanceof RestError) { + expect(e.getError()?.name).toEqual('AxiosError'); + } + }); + }); + + test('test interceptor', () => { + let interceptors: Array = [ + { + before: { + onFulfilled: (config) => { + console.log('debug: ', config.url); + return config; + }, + onRejected: (error) => { + console.log('debug: ', error); + return Promise.reject(error); + }, + }, + after: { + onFulfilled: (value) => { + console.log('debug: ', value); + return value; + }, + onRejected: (error) => { + console.log('debug: ', error); + return Promise.reject(error); + }, + }, + }, + ]; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .setInterceptors(interceptors) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + let api = kucoinRestService.getSpotService().getMarketApi(); + + return api.getAllCurrencies(); + }); +}); diff --git a/sdk/node/tests/robustness/rest/resource.test.ts b/sdk/node/tests/robustness/rest/resource.test.ts new file mode 100644 index 00000000..786ac987 --- /dev/null +++ b/sdk/node/tests/robustness/rest/resource.test.ts @@ -0,0 +1,141 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; + +import { execSync } from 'child_process'; + +// only work on macOS/Linux +function getProcessTCPConnectionsWithLsof(): number { + try { + const result = execSync(`lsof -iTCP -n -P | grep ${process.pid} | wc -l`); + return parseInt(result.toString().trim(), 10) || 0; + } catch (error) { + console.error(`Error executing lsof: ${error}`); + return 0; + } +} + +function logMemoryUsage() { + const memoryUsage = process.memoryUsage(); + + console.log(`Memory Usage: + - RSS: ${(memoryUsage.rss / 1024 / 1024).toFixed(2)} MB + - Heap Total: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(2)} MB + - Heap Used: ${(memoryUsage.heapUsed / 1024 / 1024).toFixed(2)} MB + - External: ${(memoryUsage.external / 1024 / 1024).toFixed(2)} MB + - Array Buffers: ${(memoryUsage.arrayBuffers / 1024 / 1024).toFixed(2)} MB`); +} + +describe('Auto Test', () => { + test('test tcp leak', () => { + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(1) + .setMaxIdleConns(2) + .setMaxIdleConnsPerHost(1) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + let spotApi = kucoinRestService.getSpotService().getMarketApi(); + let futuresApi = kucoinRestService.getFuturesService().getMarketApi(); + let marginApi = kucoinRestService.getMarginService().getMarketApi(); + + return Promise.resolve() + .then(() => { + console.log(`before : ${getProcessTCPConnectionsWithLsof()}`); + let promises = []; + for (let i = 0; i < 10; i++) { + promises.push(spotApi.getAllCurrencies()); + promises.push(futuresApi.getAllTickers()); + promises.push(marginApi.getMarginConfig()); + } + return Promise.all(promises); + }) + .then(() => { + console.log(`after: ${getProcessTCPConnectionsWithLsof()}`); + }); + }); + + jest.setTimeout(120000); + test('test memory leak', (done) => { + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(1) + .setMaxIdleConns(2) + .setMaxIdleConnsPerHost(1) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + let spotApi = kucoinRestService.getSpotService().getMarketApi(); + let futuresApi = kucoinRestService.getFuturesService().getMarketApi(); + let marginApi = kucoinRestService.getMarginService().getMarketApi(); + + let x = 0; + + let elapsedSeconds = 0; + const interval = setInterval(async () => { + elapsedSeconds++; + logMemoryUsage(); + let promises = []; + for (let i = 0; i < 10; i++) { + promises.push( + spotApi.getAllCurrencies().then((result) => { + x += result.data.length; + }), + ); + promises.push( + futuresApi.getAllTickers().then((result) => { + x += result.data.length; + }), + ); + promises.push( + marginApi.getMarginConfig().then((result) => { + x += result.maxLeverage; + }), + ); + } + await Promise.all(promises); + + if (elapsedSeconds >= 60) { + clearInterval(interval); + console.log('\nTest completed. Stopping requests.'); + done(); + } + }, 1000); + }); +}); From 88bb45bfe0dc9ec79c77e9f1c30d78bcbb3b5e46 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Wed, 12 Feb 2025 16:30:42 +0800 Subject: [PATCH 072/106] feat(nodejs): update websocket impl,use work thread manage connection --- .../src/internal/infra/default_ws_client.ts | 280 +++++++++--------- .../src/internal/infra/default_ws_service.ts | 129 +++----- sdk/node/src/internal/infra/message_worker.ts | 118 +++++--- 3 files changed, 256 insertions(+), 271 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 72f587ee..0c15cc65 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,12 +1,15 @@ import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; import { Readable, Writable } from 'stream'; +import path from 'path'; import { WsMessage } from '../../model/common'; import { MessageType } from '../../model/constant'; import { WebSocketClientOption } from '../../model/websocket_option'; import { WebSocketEvent } from '../../model/websocket_option'; import { WsToken, WsTokenProvider } from '../interfaces/websocket'; +import fs from 'fs'; +import { Worker } from 'worker_threads'; /** * WriteMsg represents a message to be written to the WebSocket connection @@ -60,7 +63,7 @@ class MessageQueue extends Readable { * MessageWriter implements a message writer using Node.js streams */ class MessageWriter extends Writable { - constructor(private client: WebSocket) { + constructor(private worker: Worker) { super({ objectMode: true, highWaterMark: 256 @@ -69,13 +72,12 @@ class MessageWriter extends Writable { _write(message: WsMessage, encoding: string, callback: (error?: Error | null) => void): void { try { - this.client.send(JSON.stringify(message), (error) => { - if (error) { - callback(error); - } else { - callback(); - } + // Send message through worker + this.worker.postMessage({ + command: 'send', + data: message }); + callback(); } catch (error) { callback(error as Error); } @@ -108,6 +110,7 @@ export class WebSocketClient { private lastPingTime: number | null; private messageWriter: MessageWriter | null = null; + public worker: Worker | null = null; constructor( tokenProvider: WsTokenProvider, @@ -161,37 +164,31 @@ export class WebSocketClient { // Start the message processing and keep-alive private run(): void { - // + if (!this.worker) { + throw new Error('Worker not initialized'); + } + if (!this.keepAliveInterval) { this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); } - this.messageWriter = new MessageWriter(this.conn as WebSocket); + // Initialize message writer + this.messageWriter = new MessageWriter(this.worker); this.writeMsgQueue.pipe(this.messageWriter); } // Stop the WebSocket client stop(): Promise { - console.debug('Stopping WebSocket client...'); this.shutdown = true; - this.reconnectClosed = true; - - // Clear intervals and resources first this.clearResources(); - return new Promise((resolve) => { - // Close WebSocket connection if it exists - if (this.conn && this.conn.readyState === WebSocket.OPEN) { - this.conn.once('close', () => { - console.debug('WebSocket client stopped'); - resolve(); - }); - this.conn.close(); - } else { - console.debug('WebSocket client stopped'); - resolve(); - } - }); + if (this.worker) { + this.worker.postMessage({ command: 'close' }); + this.worker.terminate(); + this.worker = null; + } + + return Promise.resolve(); } // Clear all resources @@ -219,32 +216,70 @@ export class WebSocketClient { .then((tokenInfos) => { this.tokenInfo = this.randomEndpoint(tokenInfos); - // create WebSocket connection + // create WebSocket connection parameters const queryParams = new URLSearchParams({ connectId: Date.now().toString(), token: this.tokenInfo.token, }); - // create WebSocket connection + // create WebSocket URL const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; - this.conn = new WebSocket(wsUrl); + + // Get the worker file path relative to the compiled js file + const workerPath = path.join(__dirname, '..', '..', '..', 'dist', 'internal', 'infra', 'message_worker.js'); + + if (!fs.existsSync(workerPath)) { + throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); + } + + // Create a new worker thread + this.worker = new Worker(workerPath); return new Promise((resolve, reject) => { - if (!this.conn) return reject(new Error('No connection')); + if (!this.worker) { + reject(new Error('Failed to create worker')); + return; + } - this.conn.on('open', () => { - this.onOpen(); - resolve(); + // Handle worker messages + this.worker.addListener('message', (message: any) => { + switch (message.type) { + case 'open': + this.onOpen(); + resolve(); + break; + case 'message': + this.onMessage(message.data); + break; + case 'error': + this.onError(new Error(message.error)); + break; + case 'close': + this.onClose(message.code, message.reason); + break; + } }); - this.conn.on('message', (data: WebSocketData) => - this.onMessage(data.toString()), - ); - this.conn.on('error', (error: Error) => this.onError(error)); - this.conn.on('close', (code: number, reason: string) => - this.onClose(code, reason.toString()), - ); + // Handle worker errors + this.worker.addListener('error', (error: Error) => { + console.error('Worker error:', error); + reject(error); + }); + + // Handle worker exit + this.worker.addListener('exit', (code: number) => { + if (code !== 0) { + console.error(`Worker stopped with exit code ${code}`); + } + }); + // Send connect command to worker + this.worker.postMessage({ + command: 'connect', + wsUrl + }); + + // Set timeout for welcome message setTimeout(() => { if (!this.welcomeReceived) { reject(new Error('Did not receive welcome message')); @@ -433,6 +468,73 @@ export class WebSocketClient { } } + public close(): void { + if (this.worker) { + this.worker.postMessage({ command: 'close' }); + this.worker.terminate(); + this.worker = null; + } + // Clear intervals + if (this.keepAliveInterval) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = null; + } + + // Clear message queues + this.clearMessageQueues(); + + // Reset state + this.disconnected = true; + this.connected = false; + this.welcomeReceived = false; + this.lastPingTime = null; + } + + // Clear all message queues and cleanup resources + private clearMessageQueues(): void { + // Clear read message queue + this.readMsgQueue.clear(); + + // Clear write message queue and reject pending promises + this.writeMsgQueue.clear(); + this.ackEvents.forEach((writeMsg) => { + writeMsg.reject(new Error('WebSocket connection closed')); + }); + this.ackEvents.clear(); + } + + private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { + try { + this.eventEmitter.emit('ws_event', event, msg); + } catch (err) { + console.error('Exception in notify_event:', err); + } + } + + private randomEndpoint(tokens: WsToken[]): WsToken { + if (!tokens.length) { + throw new Error('Tokens list is empty'); + } + return tokens[Math.floor(Math.random() * tokens.length)]; + } + + private newPingMessage(): WsMessage { + const pingMessage = new WsMessage(); + pingMessage.id = Date.now().toString(); + pingMessage.type = MessageType.PingMessage; + return pingMessage; + } + + // Check if the client has been reconnected + isReconnected(): boolean { + return this.reconnected; + } + + // Clear the reconnected flag + clearReconnectedFlag(): void { + this.reconnected = false; + } + private async reconnect(): Promise { const reconnectLoop = async () => { while (!this.reconnectClosed) { @@ -492,102 +594,4 @@ export class WebSocketClient { this.notifyEvent(WebSocketEvent.EventClientFail, `Critical error: ${err.message}`); }); } - - // Clear all message queues and cleanup resources - private clearMessageQueues(): void { - // Clear read message queue - this.readMsgQueue.clear(); - - // Clear write message queue and reject pending promises - this.writeMsgQueue.clear(); - this.ackEvents.forEach((writeMsg) => { - writeMsg.reject(new Error('WebSocket connection closed')); - }); - this.ackEvents.clear(); - } - - // close the WebSocket connection and clean up resources - close(): Promise { - return new Promise((resolve) => { - // Clear intervals - if (this.keepAliveInterval) { - clearInterval(this.keepAliveInterval); - this.keepAliveInterval = null; - } - - // Clear message queues - this.clearMessageQueues(); - - // Close WebSocket connection - if (this.conn) { - const closeTimeout = setTimeout(() => { - console.log('WebSocket close timeout, forcing close'); - this.conn = null; - this.connected = false; - this.closed = true; - resolve(); - }, 3000); - - // Listen for close event before closing - this.conn.once('close', () => { - clearTimeout(closeTimeout); - this.conn = null; - this.connected = false; - this.closed = true; - resolve(); - }); - - try { - // Close the connection - this.conn.close(); - } catch (err) { - console.error('Error during WebSocket close:', err); - clearTimeout(closeTimeout); - this.conn = null; - this.connected = false; - this.closed = true; - resolve(); - } - } else { - // If no connection exists, resolve immediately - this.connected = false; - this.closed = true; - resolve(); - } - }); - } - - private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { - try { - this.eventEmitter.emit('ws_event', event, msg); - } catch (err) { - console.error('Exception in notify_event:', err); - } - } - - // - private randomEndpoint(tokens: WsToken[]): WsToken { - if (!tokens.length) { - throw new Error('Tokens list is empty'); - } - return tokens[Math.floor(Math.random() * tokens.length)]; - } - - // - private newPingMessage(): WsMessage { - const pingMessage = new WsMessage(); - pingMessage.id = Date.now().toString(); - pingMessage.type = MessageType.PingMessage; - return pingMessage; - } - - // Check if the client has been reconnected - isReconnected(): boolean { - return this.reconnected; - } - - // Clear the reconnected flag - clearReconnectedFlag(): void { - this.reconnected = false; - } } diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 853bcd6b..9b0a561b 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -60,10 +60,10 @@ export class DefaultWsService implements WebSocketService { this.versionString = versionString; this.tokenTransport = new DefaultTransport(option, versionString); this.topicManager = new TopicManager(); - + // init EventEmitter this.eventEmitter = new EventEmitter(); - + // if config eventCallback, register as event listener if (this.wsOption.eventCallback) { this.eventEmitter.on('ws_event', (event: WebSocketEvent, msg: string, msg2: string) => { @@ -80,7 +80,6 @@ export class DefaultWsService implements WebSocketService { this.wsOption, this.eventEmitter ); - } /** @@ -119,131 +118,69 @@ export class DefaultWsService implements WebSocketService { } } - /** - * MessageTransform handles the transformation of WebSocket messages - */ - private MessageTransform = class extends Transform { - constructor(private worker: Worker) { - super({ - objectMode: true, // Enable object mode for handling WsMessage objects - highWaterMark: 1024 // Set buffer size to 1024 messages - }); - } - - _transform(message: WsMessage, encoding: string, callback: TransformCallback): void { - try { - // Post message to worker and handle response asynchronously - this.worker.postMessage(message); - callback(); - } catch (error) { - callback(error instanceof Error ? error : new Error(String(error))); - } - } - }; - /** * Starts the message processing loop using a dedicated Worker Thread - * Creates a worker thread for message processing to handle WebSocket messages */ private startMessageLoop(): void { try { - // Get the worker file path relative to the compiled js file - const workerPath = path.join(__dirname, '..', '..', '..', 'dist', 'internal', 'infra', 'message_worker.js'); - - if (!fs.existsSync(workerPath)) { - throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); + if (!this.client.worker) { + throw new Error('Worker not initialized in client'); } - // Create a new worker thread - this.messageWorker = new Worker(workerPath); - - // Create message transform stream - const messageStream = new this.MessageTransform(this.messageWorker); - - // Handle stream errors - messageStream.on('error', (error) => { - console.error('[Main] Message stream error:', error); - this.notifyEvent(WebSocketEvent.EventErrorReceived, String(error)); - }); - - // Handle messages processed by the worker - this.messageWorker.on('message', (msg: WsMessage) => { + // Handle messages from worker + this.client.worker.addListener('message', (msg: any) => { if (this.stopSignal) { return; } - const callbackManager = this.topicManager.getCallbackManager(msg.topic); - if (!callbackManager) { - return; - } - - const cb = callbackManager.get(msg.topic); - if (!cb) { + if (msg.type !== 'message') { return; } try { - // Execute callback without checking return value - cb.onMessage(msg); + const wsMessage = JSON.parse(msg.data); + if (!wsMessage || !wsMessage.topic) { + console.warn('[Main] Received message without topic:', wsMessage); + return; + } + + const callbackManager = this.topicManager.getCallbackManager(wsMessage.topic); + if (!callbackManager) { + return; + } + + const callback = callbackManager.get(wsMessage.topic); + if (!callback) { + return; + } + + try { + callback.onMessage(wsMessage); + } catch (err) { + console.error('[Main] Error processing message in main thread:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); + } } catch (err) { - console.error('[Main] Error processing message in main thread:', err); + console.error('[Main] Error parsing message:', err); this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } }); // Handle worker errors - this.messageWorker.on('error', (error) => { + this.client.worker.addListener('error', (error: Error) => { console.error('[Main] Worker thread error:', error); this.notifyEvent(WebSocketEvent.EventCallbackError, String(error)); }); // Handle worker exit - this.messageWorker.on('exit', (code) => { + this.client.worker.addListener('exit', (code: number) => { if (code !== 0 && !this.stopSignal) { console.error('[Main] Worker stopped with non-zero exit code'); } }); - // Start message reading loop - const readMessages = async () => { - while (!this.stopSignal) { - try { - const msg = await this.client.read(); - if (!msg) { - await new Promise(resolve => setTimeout(resolve, 10)); - continue; - } - - // Write message to stream - if (!messageStream.write(msg)) { - // If buffer is full, wait for drain event - await new Promise(resolve => messageStream.once('drain', resolve)); - } - } catch (err) { - if (!this.stopSignal) { - console.error('[Main] Error reading message:', err); - await new Promise(resolve => setTimeout(resolve, 100)); - } - continue; - } - } - - // Clean up when loop ends - if (this.stopSignal) { - messageStream.end(); - } - }; - - // Start the message reading loop - readMessages().catch(err => { - if (!this.stopSignal) { - console.error('[Main] Fatal error in message reading loop:', err); - this.notifyEvent(WebSocketEvent.EventErrorReceived, String(err)); - } - }); - } catch (error) { - console.error('[Main] Error creating worker:', error); + console.error('[Main] Error in message loop:', error); throw error; } } diff --git a/sdk/node/src/internal/infra/message_worker.ts b/sdk/node/src/internal/infra/message_worker.ts index 766816e9..2ca08228 100644 --- a/sdk/node/src/internal/infra/message_worker.ts +++ b/sdk/node/src/internal/infra/message_worker.ts @@ -1,6 +1,6 @@ import { parentPort } from 'worker_threads'; import { WsMessage } from '@model/common'; -import { MessageType } from '@model/constant'; +import WebSocket from 'ws'; // Log worker initialization console.log('[Worker] Initializing worker thread'); @@ -10,50 +10,82 @@ if (!parentPort) { process.exit(1); } -// Handle messages from the main thread -parentPort.on('message', (message: WsMessage) => { +let ws: WebSocket | null = null; +// Parse WebSocket message +function parseMessage(data: WebSocket.Data): any { try { - // Process all message types - switch (message.type) { - case MessageType.Message: - // message - parentPort!.postMessage({ - ...message, - processedAt: new Date().toISOString() - }); - break; + const message = JSON.parse(data.toString()); + // Add topic field if not present + if (!message.topic && message.type) { + message.topic = message.type; + } + return message; + } catch (error) { + console.error('[Worker] Error parsing message:', error); + return null; + } +} + +// Handle messages from the main thread +parentPort.on('message', (message: any) => { + try { + if (message.command === 'connect') { + // Create WebSocket connection + ws = new WebSocket(message.wsUrl); - case MessageType.SubscribeMessage: - case MessageType.UnsubscribeMessage: - // Subscription related messages - console.log(`[Worker] Processing ${message.type} message for topic:`, message.topic); - parentPort!.postMessage(message); - break; + // Handle WebSocket events + ws.on('open', () => { + console.log('[Worker] WebSocket connection opened'); + parentPort!.postMessage({ type: 'open' }); + }); - case MessageType.WelcomeMessage: - case MessageType.PingMessage: - case MessageType.PongMessage: - case MessageType.AckMessage: - // System messages - console.log(`[Worker] Processing system message type:`, message.type); - parentPort!.postMessage(message); - break; + ws.on('message', (data: WebSocket.Data) => { + const parsedMessage = parseMessage(data); + if (parsedMessage) { + console.log('[Worker] Received message:', parsedMessage); + parentPort!.postMessage({ + type: 'message', + data: JSON.stringify(parsedMessage) + }); + } + }); - case MessageType.ErrorMessage: - // Error messages - console.error('[Worker] Received error message:', message); - parentPort!.postMessage(message); - break; + ws.on('error', (error: Error) => { + console.error('[Worker] WebSocket error:', error); + parentPort!.postMessage({ + type: 'error', + error: error.message + }); + }); - default: - // Other message types - console.log('[Worker] Processing unknown message type:', message.type); - parentPort!.postMessage(message); + ws.on('close', (code: number, reason: string) => { + console.log('[Worker] WebSocket closed:', code, reason); + parentPort!.postMessage({ + type: 'close', + code, + reason + }); + }); + } else if (message.command === 'send' && ws) { + // Send message through WebSocket + const data = message.data; + if (typeof data === 'object') { + ws.send(JSON.stringify(data)); + } else { + ws.send(data); + } + } else if (message.command === 'close' && ws) { + // Close WebSocket connection + ws.close(); + ws = null; } - } catch (error) { - console.error('[Worker] Error processing message:', error); + console.error('[Worker] Error handling message:', error); + parentPort!.postMessage({ + type: 'error', + error: error instanceof Error ? error.message : String(error) + }); } }); @@ -65,16 +97,28 @@ parentPort.on('error', (error) => { // Handle close parentPort.on('close', () => { console.log('[Worker] Close event: Worker is shutting down'); + if (ws) { + ws.close(); + ws = null; + } }); // Keep the worker alive process.on('exit', () => { console.log('[Worker] Process exit event received'); + if (ws) { + ws.close(); + ws = null; + } }); // Handle uncaught exceptions process.on('uncaughtException', (error) => { console.error('[Worker] Uncaught exception:', error); + if (ws) { + ws.close(); + ws = null; + } }); // Handle unhandled rejections From 307d0fbb8e40d232f9184a7b6d5a41d15775b950 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 12 Feb 2025 16:31:47 +0800 Subject: [PATCH 073/106] feat(nodejs): add readme --- Makefile | 6 +- README.md | 10 +- sdk/node/LICENSE | 21 +++ sdk/node/README.md | 196 +++++++++++++++++++++++++ sdk/node/src/model/transport_option.ts | 13 -- 5 files changed, 229 insertions(+), 17 deletions(-) create mode 100644 sdk/node/LICENSE diff --git a/Makefile b/Makefile index ad98a227..d52549c3 100644 --- a/Makefile +++ b/Makefile @@ -94,9 +94,9 @@ $(SUBDIRS): .PHONY: generate generate: setup-logs -# $(call generate-postman) -# $(call generate-code,golang,/pkg/generate) -# $(call generate-code,python,/kucoin_universal_sdk/generate) + $(call generate-postman) + $(call generate-code,golang,/pkg/generate) + $(call generate-code,python,/kucoin_universal_sdk/generate) $(call generate-code,node,/src/generate,v0.1.0-alpha) .PHONY: gen-postman diff --git a/README.md b/README.md index e5f8c0b0..c753768f 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,12 @@ go get github.com/Kucoin/kucoin-universal-sdk/sdk/golang go mod tidy ``` +### Node.js Installation (`0.1.0-alpha`) +Note: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK. +```bash +npm install kucoin-universal-sdk +``` + ### Postman Installation Visit the [KuCoin API Collection on Postman](https://www.postman.com/kucoin-api/kucoin-api/overview) @@ -124,6 +130,7 @@ For other languages, refer to the [Examples](#-examples) section. - Official Documentation: [KuCoin API Docs](https://www.kucoin.com/docs-new) - **[Python Documentation](sdk/python/README.md)** - **[Go Documentation](sdk/golang/README.md)** +- **[Node.js Documentation](sdk/node/README.md)** - **[Postman Documentation](sdk/postman/README.md)** ## 📂 Examples @@ -132,7 +139,8 @@ Find usage examples for your desired language by selecting the corresponding lin | Language | Example Directory | |----------|--------------------------------------------| | Python | [sdk/python/examples/](sdk/python/example/)| -| Go | [sdk/go/examples/](sdk/golang/example/) | +| Go | [sdk/go/examples/](sdk/golang/example/) | +| Node.js | [sdk/node/examples/](sdk/node/example/) | ## 📋 Changelog diff --git a/sdk/node/LICENSE b/sdk/node/LICENSE new file mode 100644 index 00000000..2e995d25 --- /dev/null +++ b/sdk/node/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 KuCoin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/node/README.md b/sdk/node/README.md index e69de29b..36a53fb4 100644 --- a/sdk/node/README.md +++ b/sdk/node/README.md @@ -0,0 +1,196 @@ +# Node.js SDK Documentation +![License Badge](https://img.shields.io/badge/license-MIT-green) +![Language](https://img.shields.io/badge/nodejs-blue) + +Welcome to the **Node.js** implementation of the KuCoin Universal SDK. This SDK is built based on KuCoin API specifications to provide a comprehensive and optimized interface for interacting with the KuCoin platform. + +For an overview of the project and SDKs in other languages, refer to the [Main README](https://github.com/kucoin/kucoin-universal-sdk). + +## 📦 Installation + +### Latest Version: `0.1.0-alpha` +Note: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK. + +Install the SDK using `npm`: + +```bash +npm install kucoin-universal-sdk +``` + +## 📖 Getting Started + +Here's a quick example to get you started with the SDK in **TypeScript**. + +```ts +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder +} from 'kucoin-universal-sdk'; + +function example() { + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + + // Get the Restful Service + const kucoinRestService = client.restService(); + + const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); + + // Create request by interface + let request = Spot.GetPartOrderBookReq.create({ + 'symbol': 'BTC-USDT', + 'size': '20', + }) + + // Or create request by builder + request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + + // Query for part orderbook depth data. (aggregated by price) + spotMarketApi.getPartOrderBook(request).then((result) => { + console.log(`Time: ${result.time}, Seq: ${result.sequence}, Bids: ${result.bids}, Asks: ${result.asks}`); + }).catch((err) => { + console.error('fail to get part order book', err); + }) +} + + +example() +``` +## 📚 Documentation +Official Documentation: [KuCoin API Docs](https://www.kucoin.com/docs-new) + +## 📂 Examples + +Explore more examples in the [example/](example/) directory for advanced usage. + +## 📋 Changelog + +For a detailed list of changes, see the [Changelog](./CHANGELOG.md). + +## 📌 Special Notes on APIs + +This section provides specific considerations and recommendations for using the REST and WebSocket APIs. + +### REST API Notes + +#### Client Features +- **Advanced HTTP Handling**: + - Supports retries, persistent connections, and connection pooling for efficient request handling. +- **Extensible Interceptors**: + - Provides HTTP interceptors that users can extend to customize request and response processing. +- **Rich Response Details**: + - Includes rate-limiting information and raw response data in API responses for better debugging and control. +- **Public API Access**: + - For public endpoints, API keys are not required, simplifying integration for non-authenticated use cases. + +--- + +### WebSocket API Notes + +#### Client Features +- **Flexible Service Creation**: + - Supports creating services for public/private channels in Spot, Futures, or Margin trading as needed. + - Multiple services can be created independently. +- **Service Lifecycle**: + - If a service is closed, create a new service instead of reusing it to avoid undefined behavior. +- **Connection-to-Channel Mapping**: + - Each WebSocket connection corresponds to a specific channel type. For example: + - Spot public/private and Futures public/private services require 4 active WebSocket connections. + +#### Threading and Callbacks +- **Simple Thread Model**: + - WebSocket services follow a simple thread model, ensuring callbacks are handled on a single thread. +- **Subscription Management**: + - Subscriptions are synchronous. A subscription is considered successful only after receiving an acknowledgment (ACK) from the server. + - Each subscription has a unique ID, which can be used for unsubscribe. + +#### Data and Message Handling +- **Framework-Managed Threads**: + - Data messages are handled by a single framework-managed thread, ensuring orderly processing. +- **Buffer Management**: + - When the message buffer is full, excess messages are dropped, and a notification event is sent. +- **Duplicate Subscriptions**: + - Avoid overlapping subscription parameters. For example: + - Subscribing to `["BTC-USDT", "ETH-USDT"]` and then to `["ETH-USDT", "DOGE-USDT"]` may result in undefined behavior. + - Identical subscriptions will raise an error for duplicate subscriptions. + +## 📑 Parameter Descriptions + +This section provides details about the configurable parameters for both HTTP and WebSocket client behavior. + +### HTTP Parameters + +| Parameter | Type | Description | Default Value | +|----------------------------|------------------------|-------------------------------------------------------------------|---------------------------------------| +| `timeout` | `number` | Request timeout duration in milliseconds. | 30000 (30 seconds) | +| `keepAlive` | `boolean` | Enables keep-alive for persistent connections. | true | +| `maxIdleConns` | `number` | Maximum number of idle (keep-alive) connections across all hosts. | 100 | +| `maxIdleConnsPerHost` | `number` | Maximum idle connections per host. | 2 | +| `maxConnsPerHost` | `number` | Total number of connections per host. | 10 | +| `idleConnTimeout` | `number` | Maximum time an idle connection will remain idle in milliseconds. | 90000 (90 seconds) | +| `proxy` | `Optional` | HTTP(s) proxy settings. | None | +| `maxRetries` | `number` | Maximum number of retry attempts. | 3 | +| `retryDelay` | `number` | Delay duration between retries in milliseconds. | 2000 (2 seconds) | +| `interceptors` | `Optional` | List of HTTP interceptors. | An empty list (`[]`) | + + +### WebSocket Parameters + +| Parameter | Type | Description | Default Value | +|-------------------------|---------------------------|-------------------------------------------------------------------------------------------------|---------------| +| `reconnect` | `boolean` | Enables automatic reconnection if the connection is lost. | true | +| `reconnectAttempts` | `number` | Maximum number of reconnection attempts; `-1` for unlimited attempts. | -1 | +| `reconnectInterval` | `number` | Interval between reconnection attempts in milliseconds. | 5000 (5 seconds) | +| `dialTimeout` | `number` | Timeout duration for establishing a WebSocket connection in milliseconds. | 10000 (10 seconds) | +| `readBufferBytes` | `number` | I/O buffer size in bytes. | 2048000 | +| `readMessageBuffer` | `number` | Buffer size for reading messages in the queue. | 1024 | +| `writeMessageBuffer` | `number` | Buffer size for writing messages in the queue. | 256 | +| `writeTimeout` | `number` | Timeout for sending messages in milliseconds. | 30000 (30 seconds) | +| `eventCallback` | `Optional` | A callback function to handle WebSocket events. | None | + + +## 📝 License + +This project is licensed under the MIT License. For more details, see the [LICENSE](LICENSE) file. + +## 📧 Contact Support + +If you encounter any issues or have questions, feel free to reach out through: +- GitHub Issues: [Submit an Issue](https://github.com/kucoin/kucoin-universal-sdk/issues) + +## ⚠️ Disclaimer + +- **Financial Risk**: This SDK is provided as a development tool to integrate with KuCoin's trading platform. It does not provide financial advice. Trading cryptocurrencies involves substantial risk, including the risk of loss. Users should assess their financial circumstances and consult with financial advisors before engaging in trading. + +- **No Warranty**: The SDK is provided "as is" without any guarantees of accuracy, reliability, or suitability for a specific purpose. Use it at your own risk. + +- **Compliance**: Users are responsible for ensuring compliance with all applicable laws and regulations in their jurisdiction when using this SDK. + +By using this SDK, you acknowledge that you have read, understood, and agreed to this disclaimer. \ No newline at end of file diff --git a/sdk/node/src/model/transport_option.ts b/sdk/node/src/model/transport_option.ts index 9f1cb6c6..382421c1 100644 --- a/sdk/node/src/model/transport_option.ts +++ b/sdk/node/src/model/transport_option.ts @@ -68,10 +68,6 @@ export interface TransportOption { * Total number of connections per host */ maxConnsPerHost: number; - /** - * Maximum time to wait for a TLS handshake (in milliseconds) - */ - tlsHandshakeTimeout: number; /** * Maximum time an idle connection will remain idle (in milliseconds) */ @@ -103,7 +99,6 @@ export const DEFAULT_TRANSPORT_OPTION: TransportOption = { maxIdleConns: 100, maxIdleConnsPerHost: 2, maxConnsPerHost: 10, - tlsHandshakeTimeout: 10000, // 10 seconds idleConnTimeout: 90000, // 90 seconds maxRetries: 3, retryDelay: 2000, // 2 seconds @@ -168,14 +163,6 @@ export class TransportOptionBuilder { return this; } - /** - * Set the maximum time to wait for a TLS handshake (in milliseconds) - */ - setTLSHandshakeTimeout(tlsHandshakeTimeout: number): TransportOptionBuilder { - this.option.tlsHandshakeTimeout = tlsHandshakeTimeout; - return this; - } - /** * Set the HTTP(s) proxy options */ From 99490cd85c7d73758fcc0556b94fb5a4be3df1fa Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 13 Feb 2025 11:39:23 +0800 Subject: [PATCH 074/106] test(nodejs): fix worker path --- .../src/internal/infra/default_ws_client.ts | 2 +- .../{message_worker.ts => message_worker.js} | 35 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) rename sdk/node/src/internal/infra/{message_worker.ts => message_worker.js} (79%) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 0c15cc65..4a95b71e 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -226,7 +226,7 @@ export class WebSocketClient { const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; // Get the worker file path relative to the compiled js file - const workerPath = path.join(__dirname, '..', '..', '..', 'dist', 'internal', 'infra', 'message_worker.js'); + const workerPath = path.join(__dirname, 'message_worker.js'); if (!fs.existsSync(workerPath)) { throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); diff --git a/sdk/node/src/internal/infra/message_worker.ts b/sdk/node/src/internal/infra/message_worker.js similarity index 79% rename from sdk/node/src/internal/infra/message_worker.ts rename to sdk/node/src/internal/infra/message_worker.js index 2ca08228..cbb00c7c 100644 --- a/sdk/node/src/internal/infra/message_worker.ts +++ b/sdk/node/src/internal/infra/message_worker.js @@ -1,6 +1,5 @@ -import { parentPort } from 'worker_threads'; -import { WsMessage } from '@model/common'; -import WebSocket from 'ws'; +const { parentPort } = require('worker_threads'); +const WebSocket = require('ws'); // Log worker initialization console.log('[Worker] Initializing worker thread'); @@ -10,10 +9,10 @@ if (!parentPort) { process.exit(1); } -let ws: WebSocket | null = null; +let ws = null; // Parse WebSocket message -function parseMessage(data: WebSocket.Data): any { +function parseMessage(data) { try { const message = JSON.parse(data.toString()); // Add topic field if not present @@ -28,7 +27,7 @@ function parseMessage(data: WebSocket.Data): any { } // Handle messages from the main thread -parentPort.on('message', (message: any) => { +parentPort.on('message', (message) => { try { if (message.command === 'connect') { // Create WebSocket connection @@ -37,34 +36,34 @@ parentPort.on('message', (message: any) => { // Handle WebSocket events ws.on('open', () => { console.log('[Worker] WebSocket connection opened'); - parentPort!.postMessage({ type: 'open' }); + parentPort.postMessage({ type: 'open' }); }); - ws.on('message', (data: WebSocket.Data) => { + ws.on('message', (data) => { const parsedMessage = parseMessage(data); if (parsedMessage) { console.log('[Worker] Received message:', parsedMessage); - parentPort!.postMessage({ + parentPort.postMessage({ type: 'message', - data: JSON.stringify(parsedMessage) + data: JSON.stringify(parsedMessage), }); } }); - ws.on('error', (error: Error) => { + ws.on('error', (error) => { console.error('[Worker] WebSocket error:', error); - parentPort!.postMessage({ + parentPort.postMessage({ type: 'error', - error: error.message + error: error.message, }); }); - ws.on('close', (code: number, reason: string) => { + ws.on('close', (code, reason) => { console.log('[Worker] WebSocket closed:', code, reason); - parentPort!.postMessage({ + parentPort.postMessage({ type: 'close', code, - reason + reason, }); }); } else if (message.command === 'send' && ws) { @@ -82,9 +81,9 @@ parentPort.on('message', (message: any) => { } } catch (error) { console.error('[Worker] Error handling message:', error); - parentPort!.postMessage({ + parentPort.postMessage({ type: 'error', - error: error instanceof Error ? error.message : String(error) + error: error instanceof Error ? error.message : String(error), }); } }); From 17b772d993130447a5925c44eb044316c00e6fcd Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Thu, 13 Feb 2025 15:30:56 +0800 Subject: [PATCH 075/106] fix(nodejs): remove some debug log --- sdk/node/src/internal/infra/default_ws_client.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 4a95b71e..a9024c11 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -435,12 +435,10 @@ export class WebSocketClient { private keepAlive(): void { if (!this.tokenInfo || this.shutdown || this.closed) { - console.debug('[KeepAlive] Skip - basic check failed'); return; } if (this.disconnected || !this.connected) { - console.debug('[KeepAlive] Skip - connection is not active'); return; } @@ -463,8 +461,6 @@ export class WebSocketClient { this.disconnected = true; } this.lastPingTime = currentTime; - } else { - console.debug('[KeepAlive] Skip - interval not reached'); } } From e89687f8db61ec28dfb1674995f5a40cb5cc9a41 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 13 Feb 2025 17:31:27 +0800 Subject: [PATCH 076/106] test(nodejs): add private channel test --- sdk/node/tests/e2e/ws/futures/private.test.ts | 344 ++++++++++++++++++ sdk/node/tests/e2e/ws/margin/private.test.ts | 97 +++++ 2 files changed, 441 insertions(+) create mode 100644 sdk/node/tests/e2e/ws/futures/private.test.ts create mode 100644 sdk/node/tests/e2e/ws/margin/private.test.ts diff --git a/sdk/node/tests/e2e/ws/futures/private.test.ts b/sdk/node/tests/e2e/ws/futures/private.test.ts new file mode 100644 index 00000000..6208c833 --- /dev/null +++ b/sdk/node/tests/e2e/ws/futures/private.test.ts @@ -0,0 +1,344 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { + AllOrderEvent, + AllPositionEvent, + BalanceEvent, + CrossLeverageEvent, + FuturesPrivateWS, + MarginModeEvent, + OrderEvent, + PositionEvent, + StopOrdersEvent, +} from '@src/generate/futures/futuresprivate'; +import { DefaultClient } from '@api/index'; + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +jest.setTimeout(300000); + +describe('Futures Private WebSocket API Tests', () => { + let api: FuturesPrivateWS; + + beforeAll(async () => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + api = wsService.newFuturesPrivateWS(); + await api.start(); + }); + + afterAll(() => { + // TODO + // return api.stop(); + }); + + test('allOrder subscription test', (done) => { + (async () => { + let subid = await api.allOrder( + async (topic: string, subject: string, item: AllOrderEvent) => { + expect(item).toBeDefined(); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.canceledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.size).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.tradeType).toEqual(expect.any(String)); + console.log(item); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('allPosition subscription test', (done) => { + (async () => { + let subid = await api.allPosition( + async (topic: string, subject: string, item: AllPositionEvent) => { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.crossMode).toEqual(expect.any(Boolean)); + expect(item.delevPercentage).toEqual(expect.any(Number)); + expect(item.openingTimestamp).toEqual(expect.any(Number)); + expect(item.currentTimestamp).toEqual(expect.any(Number)); + expect(item.currentQty).toEqual(expect.any(Number)); + expect(item.currentCost).toEqual(expect.any(Number)); + expect(item.currentComm).toEqual(expect.any(Number)); + expect(item.unrealisedCost).toEqual(expect.any(Number)); + expect(item.realisedGrossCost).toEqual(expect.any(Number)); + expect(item.realisedCost).toEqual(expect.any(Number)); + expect(item.isOpen).toEqual(expect.any(Boolean)); + expect(item.markPrice).toEqual(expect.any(Number)); + expect(item.markValue).toEqual(expect.any(Number)); + expect(item.posCost).toEqual(expect.any(Number)); + expect(item.posInit).toEqual(expect.any(Number)); + expect(item.posMargin).toEqual(expect.any(Number)); + expect(item.realisedGrossPnl).toEqual(expect.any(Number)); + expect(item.realisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); + expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); + expect(item.avgEntryPrice).toEqual(expect.any(Number)); + expect(item.liquidationPrice).toEqual(expect.any(Number)); + expect(item.bankruptPrice).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.positionSide).toEqual(expect.any(String)); + expect(item.leverage).toEqual(expect.any(Number)); + expect(item.autoDeposit).toEqual(expect.any(Boolean)); + expect(item.maintMarginReq).toEqual(expect.any(Number)); + expect(item.riskLimit).toEqual(expect.any(Number)); + expect(item.realLeverage).toEqual(expect.any(Number)); + expect(item.posCross).toEqual(expect.any(Number)); + expect(item.posComm).toEqual(expect.any(Number)); + expect(item.posLoss).toEqual(expect.any(Number)); + expect(item.posFunding).toEqual(expect.any(Number)); + expect(item.posMaint).toEqual(expect.any(Number)); + expect(item.maintMargin).toEqual(expect.any(Number)); + expect(item.fundingTime).toEqual(expect.any(Number)); + expect(item.qty).toEqual(expect.any(Number)); + expect(item.fundingRate).toEqual(expect.any(Number)); + expect(item.fundingFee).toEqual(expect.any(Number)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.success).toEqual(expect.any(Boolean)); + expect(item.msg).toEqual(expect.any(String)); + console.log(item); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('balance subscription test', (done) => { + (async () => { + let subid = await api.balance( + async (topic: string, subject: string, item: BalanceEvent) => { + expect(item.crossPosMargin).toEqual(expect.any(String)); + expect(item.isolatedOrderMargin).toEqual(expect.any(String)); + expect(item.holdBalance).toEqual(expect.any(String)); + expect(item.equity).toEqual(expect.any(String)); + expect(item.version).toEqual(expect.any(String)); + expect(item.availableBalance).toEqual(expect.any(String)); + expect(item.isolatedPosMargin).toEqual(expect.any(String)); + expect(item.walletBalance).toEqual(expect.any(String)); + expect(item.isolatedFundingFeeMargin).toEqual(expect.any(String)); + expect(item.crossUnPnl).toEqual(expect.any(String)); + expect(item.totalCrossMargin).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.isolatedUnPnl).toEqual(expect.any(String)); + expect(item.crossOrderMargin).toEqual(expect.any(String)); + expect(item.timestamp).toEqual(expect.any(String)); + console.log(item); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('crossLeverage subscription test', (done) => { + (async () => { + let subid = await api.crossLeverage( + async (topic: string, subject: string, item: CrossLeverageEvent) => { + for (let dataKey in item.data) { + expect(item.data[dataKey].leverage).toEqual(expect.any(String)); + } + console.log(item); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('marginMode subscription test', (done) => { + (async () => { + let subid = await api.marginMode( + async (topic: string, subject: string, item: MarginModeEvent) => { + expect(item.SYMBOL).toEqual(expect.any(String)); + console.log(item); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('order subscription test', (done) => { + (async () => { + let subid = await api.order( + 'XBTUSDTM', + async (topic: string, subject: string, item: OrderEvent) => { + console.log(item); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.canceledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.size).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.feeType).toEqual(expect.any(String)); + expect(item.matchPrice).toEqual(expect.any(String)); + expect(item.matchSize).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + expect(item.oldSize).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.tradeType).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('position subscription test', (done) => { + (async () => { + let subid = await api.position( + 'XBTUSDTM', + async (topic: string, subject: string, item: PositionEvent) => { + console.log(item); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.crossMode).toEqual(expect.any(Boolean)); + expect(item.delevPercentage).toEqual(expect.any(Number)); + expect(item.openingTimestamp).toEqual(expect.any(Number)); + expect(item.currentTimestamp).toEqual(expect.any(Number)); + expect(item.currentQty).toEqual(expect.any(Number)); + expect(item.currentCost).toEqual(expect.any(Number)); + expect(item.currentComm).toEqual(expect.any(Number)); + expect(item.unrealisedCost).toEqual(expect.any(Number)); + expect(item.realisedGrossCost).toEqual(expect.any(Number)); + expect(item.realisedCost).toEqual(expect.any(Number)); + expect(item.isOpen).toEqual(expect.any(Boolean)); + expect(item.markPrice).toEqual(expect.any(Number)); + expect(item.markValue).toEqual(expect.any(Number)); + expect(item.posCost).toEqual(expect.any(Number)); + expect(item.posInit).toEqual(expect.any(Number)); + expect(item.posMargin).toEqual(expect.any(Number)); + expect(item.realisedGrossPnl).toEqual(expect.any(Number)); + expect(item.realisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); + expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); + expect(item.avgEntryPrice).toEqual(expect.any(Number)); + expect(item.liquidationPrice).toEqual(expect.any(Number)); + expect(item.bankruptPrice).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.positionSide).toEqual(expect.any(String)); + expect(item.leverage).toEqual(expect.any(Number)); + expect(item.autoDeposit).toEqual(expect.any(Boolean)); + expect(item.maintMarginReq).toEqual(expect.any(Number)); + expect(item.riskLimit).toEqual(expect.any(Number)); + expect(item.realLeverage).toEqual(expect.any(Number)); + expect(item.posCross).toEqual(expect.any(Number)); + expect(item.posComm).toEqual(expect.any(Number)); + expect(item.posLoss).toEqual(expect.any(Number)); + expect(item.posFunding).toEqual(expect.any(Number)); + expect(item.posMaint).toEqual(expect.any(Number)); + expect(item.maintMargin).toEqual(expect.any(Number)); + expect(item.fundingTime).toEqual(expect.any(Number)); + expect(item.qty).toEqual(expect.any(Number)); + expect(item.fundingRate).toEqual(expect.any(Number)); + expect(item.fundingFee).toEqual(expect.any(Number)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.success).toEqual(expect.any(Boolean)); + expect(item.msg).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('stopOrders subscription test', (done) => { + (async () => { + let subid = await api.stopOrders( + async (topic: string, subject: string, item: StopOrdersEvent) => { + console.log(item); + expect(item.createdAt).toEqual(expect.any(Number)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.orderPrice).toEqual(expect.any(String)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(Number)); + expect(item.stop).toEqual(expect.any(String)); + expect(item.stopPrice).toEqual(expect.any(String)); + expect(item.stopPriceType).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.type).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); +}); diff --git a/sdk/node/tests/e2e/ws/margin/private.test.ts b/sdk/node/tests/e2e/ws/margin/private.test.ts new file mode 100644 index 00000000..e58b9393 --- /dev/null +++ b/sdk/node/tests/e2e/ws/margin/private.test.ts @@ -0,0 +1,97 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { + CrossMarginPositionEvent, + IsolatedMarginPositionEvent, + MarginPrivateWS, +} from '@src/generate/margin/marginprivate'; +import { DefaultClient } from '@api/index'; + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +jest.setTimeout(300000); + +describe('Futures Private WebSocket API Tests', () => { + let api: MarginPrivateWS; + + beforeAll(async () => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + api = wsService.newMarginPrivateWS(); + await api.start(); + }); + + afterAll(() => { + // TODO + // return api.stop(); + }); + + test('crossMarginPosition subscription test', (done) => { + (async () => { + let subid = await api.crossMarginPosition( + async (topic: string, subject: string, item: CrossMarginPositionEvent) => { + console.log(item); + expect(item.debtRatio).toEqual(expect.any(Number)); + expect(item.totalAsset).toEqual(expect.any(Number)); + expect(item.marginCoefficientTotalAsset).toEqual(expect.any(String)); + expect(item.totalDebt).toEqual(expect.any(String)); + expect(item.assetList).toEqual(expect.any(Object)); + expect(item.debtList).toEqual(expect.any(Object)); + expect(item.timestamp).toEqual(expect.any(Number)); + expect(item.type).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('isolatedMarginPosition subscription test', (done) => { + (async () => { + let subid = await api.isolatedMarginPosition( + 'BTC-USDT', + async (topic: string, subject: string, item: IsolatedMarginPositionEvent) => { + console.log(item); + expect(item.tag).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.statusBizType).toEqual(expect.any(String)); + expect(item.accumulatedPrincipal).toEqual(expect.any(String)); + expect(item.changeAssets).toEqual(expect.any(Object)); + expect(item.timestamp).toEqual(expect.any(Number)); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); +}); From c831afc75e80d70f588c169700a1a0fba82bfe15 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 13 Feb 2025 20:10:13 +0800 Subject: [PATCH 077/106] test(nodejs): add private channel test --- sdk/node/tests/e2e/ws/margin/private.test.ts | 2 +- sdk/node/tests/e2e/ws/spot/private.test.ts | 144 +++++++++++++++++++ 2 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 sdk/node/tests/e2e/ws/spot/private.test.ts diff --git a/sdk/node/tests/e2e/ws/margin/private.test.ts b/sdk/node/tests/e2e/ws/margin/private.test.ts index e58b9393..0865e78c 100644 --- a/sdk/node/tests/e2e/ws/margin/private.test.ts +++ b/sdk/node/tests/e2e/ws/margin/private.test.ts @@ -18,7 +18,7 @@ function delay(ms: number): Promise { jest.setTimeout(300000); -describe('Futures Private WebSocket API Tests', () => { +describe('Margin Private WebSocket API Tests', () => { let api: MarginPrivateWS; beforeAll(async () => { diff --git a/sdk/node/tests/e2e/ws/spot/private.test.ts b/sdk/node/tests/e2e/ws/spot/private.test.ts new file mode 100644 index 00000000..e68f492c --- /dev/null +++ b/sdk/node/tests/e2e/ws/spot/private.test.ts @@ -0,0 +1,144 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { AccountEvent, OrderV1Event, OrderV2Event, SpotPrivateWS } from '@src/generate/spot/spotprivate'; +import { DefaultClient } from '@api/index'; + +jest.setTimeout(300000); + +describe('Spot Private WebSocket API Tests', () => { + let api: SpotPrivateWS; + + beforeAll(async () => { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + api = wsService.newSpotPrivateWS(); + await api.start(); + }); + + afterAll(() => { + // TODO + // return api.stop(); + }); + + test('account subscription test', (done) => { + (async () => { + let subid = await api.account( + async (topic: string, subject: string, item: AccountEvent) => { + console.log(item); + expect(item.accountId).toEqual(expect.any(String)); + expect(item.available).toEqual(expect.any(String)); + expect(item.availableChange).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.hold).toEqual(expect.any(String)); + expect(item.holdChange).toEqual(expect.any(String)); + expect(item.relationContext).toEqual(expect.any(Object)); + expect(item.relationEvent).toEqual(expect.any(String)); + expect(item.relationEventId).toEqual(expect.any(String)); + expect(item.time).toEqual(expect.any(String)); + expect(item.total).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('orderV1 subscription test', (done) => { + (async () => { + let subid = await api.orderV1( + async (topic: string, subject: string, item: OrderV1Event) => { + console.log(item); + expect(item.canceledSize).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.originSize).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.remainFunds).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.type).toEqual(expect.any(String)); + expect(item.oldSize).toEqual(expect.any(String)); + expect(item.feeType).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.matchPrice).toEqual(expect.any(String)); + expect(item.matchSize).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); + + test('orderV2 subscription test', (done) => { + (async () => { + let subid = await api.orderV2( + async (topic: string, subject: string, item: OrderV2Event) => { + console.log(item); + expect(item.canceledSize).toEqual(expect.any(String)); + expect(item.clientOid).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.originSize).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.remainFunds).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.size).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.symbol).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + expect(item.type).toEqual(expect.any(String)); + expect(item.oldSize).toEqual(expect.any(String)); + expect(item.feeType).toEqual(expect.any(String)); + expect(item.liquidity).toEqual(expect.any(String)); + expect(item.matchPrice).toEqual(expect.any(String)); + expect(item.matchSize).toEqual(expect.any(String)); + expect(item.tradeId).toEqual(expect.any(String)); + api.unSubscribe(subid).then(() => { + done(); + }); + }, + ); + + console.log(`subscribe id: ${subid}`); + })(); + }); +}); From bf6ab2466fb8ed5d991b76522f5d60ff898035ed Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 14 Feb 2025 15:22:33 +0800 Subject: [PATCH 078/106] feat(nodejs): add log framework --- sdk/node/jest.config.js | 1 + sdk/node/src/common/index.ts | 1 + sdk/node/src/common/logger/logger.d.ts | 17 ++++++ sdk/node/src/common/logger/logger.js | 34 +++++++++++ sdk/node/src/index.ts | 4 +- sdk/node/src/internal/infra/default_signer.ts | 5 +- .../src/internal/infra/default_ws_client.ts | 51 ++++++++-------- .../src/internal/infra/default_ws_service.ts | 58 +++++++++---------- sdk/node/src/internal/infra/message_worker.js | 29 +++++----- .../src/internal/rest/default_rest_impl.ts | 3 +- .../tests/robustness/rest/reliability.test.ts | 57 ++++++++++++++++++ sdk/node/tsconfig.json | 1 + 12 files changed, 186 insertions(+), 75 deletions(-) create mode 100644 sdk/node/src/common/index.ts create mode 100644 sdk/node/src/common/logger/logger.d.ts create mode 100644 sdk/node/src/common/logger/logger.js diff --git a/sdk/node/jest.config.js b/sdk/node/jest.config.js index d52d99c7..d5cd3cde 100644 --- a/sdk/node/jest.config.js +++ b/sdk/node/jest.config.js @@ -8,5 +8,6 @@ module.exports = { transform: { '^.+\\.ts$': 'ts-jest', }, + silent: false, moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }), }; diff --git a/sdk/node/src/common/index.ts b/sdk/node/src/common/index.ts new file mode 100644 index 00000000..5620ca25 --- /dev/null +++ b/sdk/node/src/common/index.ts @@ -0,0 +1 @@ +export * from './logger/logger'; diff --git a/sdk/node/src/common/logger/logger.d.ts b/sdk/node/src/common/logger/logger.d.ts new file mode 100644 index 00000000..898adfec --- /dev/null +++ b/sdk/node/src/common/logger/logger.d.ts @@ -0,0 +1,17 @@ +export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; + +export interface Logger { + log: (level: LogLevel, message: string, ...meta: any[]) => void; + info: (message: string, ...meta: any[]) => void; + warn: (message: string, ...meta: any[]) => void; + error: (message: string, ...meta: any[]) => void; + debug: (message: string, ...meta: any[]) => void; + setGlobalLogger: (newLogger: Logger, newOptions?: LoggerOptions) => void; +} + +export interface LoggerOptions { + level: LogLevel; + format: (level: LogLevel, message: string, meta?: any) => string; +} + +export const logger: Logger; diff --git a/sdk/node/src/common/logger/logger.js b/sdk/node/src/common/logger/logger.js new file mode 100644 index 00000000..3404ae1f --- /dev/null +++ b/sdk/node/src/common/logger/logger.js @@ -0,0 +1,34 @@ +const LOG_LEVELS = ['debug', 'info', 'warn', 'error']; + +let options = { + level: 'info', + format: (level, message, meta) => { + const time = new Date().toISOString(); + const metaStr = meta && meta.length > 0 ? JSON.stringify(meta) : ''; + return `${time} [${level.toUpperCase()}] ${message}${metaStr ? ` ${metaStr}` : ''}`; + } +}; + +const logger = { + log: (level, message, ...meta) => { + if (shouldLog(level)) { + console.log(options.format(level, message, meta)); + } + }, + info: (message, ...meta) => logger.log('info', message, ...meta), + warn: (message, ...meta) => logger.log('warn', message, ...meta), + error: (message, ...meta) => logger.log('error', message, ...meta), + debug: (message, ...meta) => logger.log('debug', message, ...meta), + setGlobalLogger: (newLogger, newOptions) => { + Object.assign(logger, newLogger); + options = newOptions || options; + } +}; + +function shouldLog(level) { + const currentIndex = LOG_LEVELS.indexOf(options.level); + const levelIndex = LOG_LEVELS.indexOf(level); + return levelIndex >= currentIndex; +} + +module.exports = { logger }; \ No newline at end of file diff --git a/sdk/node/src/index.ts b/sdk/node/src/index.ts index 8c810c02..3596b62c 100644 --- a/sdk/node/src/index.ts +++ b/sdk/node/src/index.ts @@ -1,9 +1,9 @@ import 'reflect-metadata'; // Exporting from api +export * from './common' export * from './api'; export * from './model'; // Exporting from generate services -export * from './generate' - +export * from './generate' \ No newline at end of file diff --git a/sdk/node/src/internal/infra/default_signer.ts b/sdk/node/src/internal/infra/default_signer.ts index 8eb2feb6..854fe678 100644 --- a/sdk/node/src/internal/infra/default_signer.ts +++ b/sdk/node/src/internal/infra/default_signer.ts @@ -1,4 +1,5 @@ import * as crypto from 'crypto'; +import { logger } from '@src/common'; /** * KcSigner contains information about `apiKey`, `apiSecret`, `apiPassPhrase`, and `apiKeyVersion` @@ -31,7 +32,7 @@ export class KcSigner { this.brokerKey = brokerKey; if (!apiKey || !apiSecret || !apiPassphrase) { - console.warn( + logger.warn( '[AUTH WARNING] API credentials incomplete. Access is restricted to public interfaces only.', ); } @@ -72,7 +73,7 @@ export class KcSigner { */ public brokerHeaders(plain: string): Record { if (!this.brokerPartner || !this.brokerName) { - console.error('[BROKER ERROR] Missing broker information'); + logger.error('[BROKER ERROR] Missing broker information'); throw new Error('Broker information cannot be empty'); } diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index a9024c11..903d42df 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -10,6 +10,7 @@ import { WebSocketEvent } from '../../model/websocket_option'; import { WsToken, WsTokenProvider } from '../interfaces/websocket'; import fs from 'fs'; import { Worker } from 'worker_threads'; +import { logger } from '@src/common'; /** * WriteMsg represents a message to be written to the WebSocket connection @@ -146,7 +147,7 @@ export class WebSocketClient { // # Start the WebSocket client start(): Promise { if (this.connected) { - console.warn('WebSocket client is already connected.'); + logger.warn('WebSocket client is already connected.'); return Promise.resolve(); } @@ -157,7 +158,7 @@ export class WebSocketClient { this.run(); }) .catch((err) => { - console.error('Failed to start WebSocket client:', err); + logger.error('Failed to start WebSocket client:', err); throw err; }); } @@ -262,14 +263,14 @@ export class WebSocketClient { // Handle worker errors this.worker.addListener('error', (error: Error) => { - console.error('Worker error:', error); + logger.error('Worker error:', error); reject(error); }); // Handle worker exit this.worker.addListener('exit', (code: number) => { if (code !== 0) { - console.error(`Worker stopped with exit code ${code}`); + logger.error(`Worker stopped with exit code ${code}`); } }); @@ -288,26 +289,26 @@ export class WebSocketClient { }); }) .catch((err) => { - console.error('Failed to dial WebSocket server:', err); + logger.error('Failed to dial WebSocket server:', err); throw err; }); } // open callback private onOpen(): void { - console.log('WebSocket connection opened.'); + logger.info('WebSocket connection opened.'); this.notifyEvent(WebSocketEvent.EventConnected, 'WebSocket connection opened.'); } // error callback private onError(error: Error): void { - console.error('WebSocket error:', error); + logger.error('WebSocket error:', error); this.disconnected = true; } // close callback private onClose(code: number, reason: string): void { - console.debug(`WebSocket closed with code ${code}: ${reason}`); + logger.debug(`WebSocket closed with code ${code}: ${reason}`); this.disconnected = true; // Clear resources @@ -325,7 +326,7 @@ export class WebSocketClient { // receive message callback private onMessage(message: string): void { if (this.shutdown || this.closed) { - console.debug('Ignoring message as client is shutting down or closed'); + logger.debug('Ignoring message as client is shutting down or closed'); return; } @@ -333,14 +334,14 @@ export class WebSocketClient { try { m = JSON.parse(message); } catch (e) { - console.error('Failed to parse message:', e); + logger.error('Failed to parse message:', e); return; } switch (m.type) { case MessageType.WelcomeMessage: this.welcomeReceived = true; - console.log('Welcome message received.'); + logger.info('Welcome message received.'); break; case MessageType.Message: @@ -351,14 +352,14 @@ export class WebSocketClient { this.readMsgQueue._read(1); } else { this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); - console.warn('Read buffer full'); + logger.warn('Read buffer full'); } } break; case MessageType.PongMessage: this.notifyEvent(WebSocketEvent.EventPongReceived, ''); - console.debug('PONG received'); + logger.debug('PONG received'); this.handleAckEvent(m); break; @@ -368,7 +369,7 @@ export class WebSocketClient { break; default: - console.warn('Unknown message type:', m.type); + logger.warn('Unknown message type:', m.type); } } @@ -382,7 +383,7 @@ export class WebSocketClient { this.ackEvents.delete(m.id); if (m.type === MessageType.PongMessage) { - console.debug('[HandleAckEvent] Handling pong message'); + logger.debug('[HandleAckEvent] Handling pong message'); this.metric.pingSuccess++; data.resolve(); return; @@ -452,11 +453,11 @@ export class WebSocketClient { const pingMsg = this.newPingMessage(); try { this.write(pingMsg, timeout).catch((e) => { - console.error('[KeepAlive] Heartbeat ping error:', e); + logger.error('[KeepAlive] Heartbeat ping error:', e); this.disconnected = true; }); } catch (e) { - console.error('[KeepAlive] Heartbeat ping error:', e); + logger.error('[KeepAlive] Heartbeat ping error:', e); this.metric.pingErr++; this.disconnected = true; } @@ -503,7 +504,7 @@ export class WebSocketClient { try { this.eventEmitter.emit('ws_event', event, msg); } catch (err) { - console.error('Exception in notify_event:', err); + logger.error('Exception in notify_event:', err); } } @@ -535,11 +536,11 @@ export class WebSocketClient { const reconnectLoop = async () => { while (!this.reconnectClosed) { if (this.disconnected && !this.shutdown) { - console.log('Broken WebSocket connection, starting reconnection'); + logger.info('Broken WebSocket connection, starting reconnection'); try { await this.close(); } catch (err) { - console.error('Error closing connection:', err); + logger.error('Error closing connection:', err); } this.notifyEvent(WebSocketEvent.EventTryReconnect, ''); @@ -554,7 +555,7 @@ export class WebSocketClient { (this.options.reconnectAttempts === -1 || attempt < this.options.reconnectAttempts) ) { - console.log( + logger.info( `Reconnecting in ${this.options.reconnectInterval/1000} seconds... (attempt ${attempt + 1}/${this.options.reconnectAttempts})`, ); await new Promise((resolve) => @@ -569,16 +570,16 @@ export class WebSocketClient { this.run(); reconnected = true; this.reconnected = true; - console.log('Successfully reconnected to WebSocket server'); + logger.info('Successfully reconnected to WebSocket server'); } catch (err) { - console.error(`Reconnect attempt ${attempt + 1} failed:`, err); + logger.error(`Reconnect attempt ${attempt + 1} failed:`, err); attempt++; } } if (!reconnected) { this.notifyEvent(WebSocketEvent.EventClientFail, 'Failed to reconnect after all attempts'); - console.error('Failed to reconnect after all attempts.'); + logger.error('Failed to reconnect after all attempts.'); } } await new Promise((resolve) => setTimeout(resolve, 1000)); @@ -586,7 +587,7 @@ export class WebSocketClient { }; reconnectLoop().catch((err) => { - console.error('Critical error in reconnect loop:', err); + logger.error('Critical error in reconnect loop:', err); this.notifyEvent(WebSocketEvent.EventClientFail, `Critical error: ${err.message}`); }); } diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 9b0a561b..9238bce7 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -1,22 +1,19 @@ import { WebSocketMessageCallback, WebSocketService } from '@internal/interfaces/websocket'; import { ClientOption } from '@model/client_option'; -import { DomainType } from '@model/constant'; +import { DomainType, MessageType } from '@model/constant'; import { DefaultTransport } from './default_transport'; -import { TopicManager, CallbackManager } from './default_ws_callback'; -import { WebSocketClient, WriteMsg } from './default_ws_client'; +import { CallbackManager, TopicManager } from './default_ws_callback'; +import { WebSocketClient } from './default_ws_client'; import { DefaultWsTokenProvider } from './default_ws_token_provider'; -import { WebSocketClientOption, WebSocketEvent } from '../../model/websocket_option'; +import { WebSocketClientOption, WebSocketEvent } from '@src/model'; import { SubInfo } from '@internal/util/sub'; import { WsMessage } from '@model/common'; -import { MessageType } from '@model/constant'; import { randomUUID } from 'crypto'; import { EventEmitter } from 'events'; import { Worker } from 'worker_threads'; -import { Transform, TransformCallback } from 'stream'; -import path from 'path'; -import fs from 'fs'; +import { logger } from '@src/common'; /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. @@ -70,7 +67,7 @@ export class DefaultWsService implements WebSocketService { try { this.wsOption.eventCallback!(event, msg); } catch (err) { - console.error('Exception in eventCallback:', err); + logger.error('Exception in eventCallback:', err); } }); } @@ -78,7 +75,7 @@ export class DefaultWsService implements WebSocketService { this.client = new WebSocketClient( new DefaultWsTokenProvider(this.tokenTransport, domain, privateChannel), this.wsOption, - this.eventEmitter + this.eventEmitter, ); } @@ -93,7 +90,7 @@ export class DefaultWsService implements WebSocketService { // use EventEmitter send event this.eventEmitter.emit('ws_event', event, msg, msg2); } catch (err) { - console.error('Exception in notify_event:', err); + logger.error('Exception in notify_event:', err); } } @@ -140,7 +137,7 @@ export class DefaultWsService implements WebSocketService { try { const wsMessage = JSON.parse(msg.data); if (!wsMessage || !wsMessage.topic) { - console.warn('[Main] Received message without topic:', wsMessage); + logger.warn('[Main] Received message without topic:', wsMessage); return; } @@ -157,30 +154,29 @@ export class DefaultWsService implements WebSocketService { try { callback.onMessage(wsMessage); } catch (err) { - console.error('[Main] Error processing message in main thread:', err); + logger.error('[Main] Error processing message in main thread:', err); this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } } catch (err) { - console.error('[Main] Error parsing message:', err); + logger.error('[Main] Error parsing message:', err); this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } }); // Handle worker errors this.client.worker.addListener('error', (error: Error) => { - console.error('[Main] Worker thread error:', error); + logger.error('[Main] Worker thread error:', error); this.notifyEvent(WebSocketEvent.EventCallbackError, String(error)); }); // Handle worker exit this.client.worker.addListener('exit', (code: number) => { if (code !== 0 && !this.stopSignal) { - console.error('[Main] Worker stopped with non-zero exit code'); + logger.error('[Main] Worker stopped with non-zero exit code'); } }); - } catch (error) { - console.error('[Main] Error in message loop:', error); + logger.error('[Main] Error in message loop:', error); throw error; } } @@ -198,7 +194,7 @@ export class DefaultWsService implements WebSocketService { } if (this.client.isReconnected()) { - console.info('WebSocket client reconnected, resubscribe...'); + logger.info('WebSocket client reconnected, resubscribe...'); const oldTopicManager = this.topicManager; this.topicManager = new TopicManager(); @@ -213,9 +209,9 @@ export class DefaultWsService implements WebSocketService { }); await Promise.all(resubscribePromises); - console.log('All topics resubscribed successfully'); + logger.info('All topics resubscribed successfully'); } catch (err) { - console.error('Error during resubscribe:', err); + logger.error('Error during resubscribe:', err); this.notifyEvent( WebSocketEvent.EventReSubscribeError, `Failed to resubscribe: ${err}`, @@ -242,7 +238,7 @@ export class DefaultWsService implements WebSocketService { this.startRecoveryLoop(); }) .catch((err) => { - console.error('Failed to start client:', err); + logger.error('Failed to start client:', err); throw err; }); } @@ -251,9 +247,9 @@ export class DefaultWsService implements WebSocketService { * Stops the message processing and cleans up resources */ stop(): Promise { - console.debug('Stopping WebSocket service...'); + logger.debug('Stopping WebSocket service...'); this.stopSignal = true; - + return new Promise((resolve) => { // Terminate worker and clear intervals if (this.messageWorker) { @@ -271,7 +267,7 @@ export class DefaultWsService implements WebSocketService { // Stop the WebSocket client this.client.stop().then(() => { - console.debug('WebSocket service stopped'); + logger.debug('WebSocket service stopped'); resolve(); }); }); @@ -296,7 +292,7 @@ export class DefaultWsService implements WebSocketService { // Check if already subscribed if (!created) { - console.info(`Already subscribed: ${subId}`); + logger.info(`Already subscribed: ${subId}`); return Promise.reject(new Error('Already subscribed')); } @@ -315,7 +311,7 @@ export class DefaultWsService implements WebSocketService { // Clean up on failure const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); callbackManager.remove(subId); - console.error(`Subscribe error: ${err}`); + logger.error(`Subscribe error: ${err}`); throw err; }); } @@ -340,20 +336,20 @@ export class DefaultWsService implements WebSocketService { subEvent.response = true; callbackManager.remove(id); - console.log('[DEBUG] callback removed for id:', id); + logger.info('[DEBUG] callback removed for id:', id); this.client .write(subEvent, this.wsOption.writeTimeout) .then(() => { - console.log('[DEBUG] unsubscribe message sent successfully'); + logger.info('[DEBUG] unsubscribe message sent successfully'); resolve(); }) .catch((e) => { - console.error('[DEBUG] Failed to send unsubscribe message:', e); + logger.error('[DEBUG] Failed to send unsubscribe message:', e); reject(e); }); } catch (e) { - console.error('[DEBUG] unsubscribe error:', e); + logger.error('[DEBUG] unsubscribe error:', e); reject(e); } }); diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index cbb00c7c..e71c940a 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -1,11 +1,12 @@ const { parentPort } = require('worker_threads'); const WebSocket = require('ws'); +const { logger } = require('../../common/logger/logger'); // Log worker initialization -console.log('[Worker] Initializing worker thread'); +logger.info('[Worker] Initializing worker thread'); if (!parentPort) { - console.error('[Worker] parentPort is null - worker must be run as a worker thread'); + logger.error('[Worker] parentPort is null - worker must be run as a worker thread'); process.exit(1); } @@ -21,7 +22,7 @@ function parseMessage(data) { } return message; } catch (error) { - console.error('[Worker] Error parsing message:', error); + logger.error('[Worker] Error parsing message:', error); return null; } } @@ -35,14 +36,14 @@ parentPort.on('message', (message) => { // Handle WebSocket events ws.on('open', () => { - console.log('[Worker] WebSocket connection opened'); + logger.info('[Worker] WebSocket connection opened'); parentPort.postMessage({ type: 'open' }); }); ws.on('message', (data) => { const parsedMessage = parseMessage(data); if (parsedMessage) { - console.log('[Worker] Received message:', parsedMessage); + logger.info('[Worker] Received message:', parsedMessage); parentPort.postMessage({ type: 'message', data: JSON.stringify(parsedMessage), @@ -51,7 +52,7 @@ parentPort.on('message', (message) => { }); ws.on('error', (error) => { - console.error('[Worker] WebSocket error:', error); + logger.error('[Worker] WebSocket error:', error); parentPort.postMessage({ type: 'error', error: error.message, @@ -59,7 +60,7 @@ parentPort.on('message', (message) => { }); ws.on('close', (code, reason) => { - console.log('[Worker] WebSocket closed:', code, reason); + logger.info('[Worker] WebSocket closed:', code, reason); parentPort.postMessage({ type: 'close', code, @@ -80,7 +81,7 @@ parentPort.on('message', (message) => { ws = null; } } catch (error) { - console.error('[Worker] Error handling message:', error); + logger.error('[Worker] Error handling message:', error); parentPort.postMessage({ type: 'error', error: error instanceof Error ? error.message : String(error), @@ -90,12 +91,12 @@ parentPort.on('message', (message) => { // Handle errors parentPort.on('error', (error) => { - console.error('[Worker] Error event:', error); + logger.error('[Worker] Error event:', error); }); // Handle close parentPort.on('close', () => { - console.log('[Worker] Close event: Worker is shutting down'); + logger.info('[Worker] Close event: Worker is shutting down'); if (ws) { ws.close(); ws = null; @@ -104,7 +105,7 @@ parentPort.on('close', () => { // Keep the worker alive process.on('exit', () => { - console.log('[Worker] Process exit event received'); + logger.info('[Worker] Process exit event received'); if (ws) { ws.close(); ws = null; @@ -113,7 +114,7 @@ process.on('exit', () => { // Handle uncaught exceptions process.on('uncaughtException', (error) => { - console.error('[Worker] Uncaught exception:', error); + logger.error('[Worker] Uncaught exception:', error); if (ws) { ws.close(); ws = null; @@ -122,8 +123,8 @@ process.on('uncaughtException', (error) => { // Handle unhandled rejections process.on('unhandledRejection', (reason) => { - console.error('[Worker] Unhandled rejection:', reason); + logger.error('[Worker] Unhandled rejection:', reason); }); // Log worker startup -console.log('[Worker] Started and ready to process messages at:', new Date().toISOString()); +logger.info('[Worker] Started and ready to process messages at:', new Date().toISOString()); diff --git a/sdk/node/src/internal/rest/default_rest_impl.ts b/sdk/node/src/internal/rest/default_rest_impl.ts index e5ad445b..d9bb1bae 100644 --- a/sdk/node/src/internal/rest/default_rest_impl.ts +++ b/sdk/node/src/internal/rest/default_rest_impl.ts @@ -12,6 +12,7 @@ import { SdkVersion } from '@generate/version'; import { DefaultTransport } from '@internal/infra/default_transport'; import { DEFAULT_TRANSPORT_OPTION } from '@src/model'; import { CopyTradingService, CopyTradingServiceImpl } from '@src/generate'; +import { logger } from '@src/common'; export class DefaultKucoinRestAPIImpl implements KucoinRestService { private readonly accountService: AccountService; @@ -33,7 +34,7 @@ export class DefaultKucoinRestAPIImpl implements KucoinRestService { options.transportOption = DEFAULT_TRANSPORT_OPTION; } - console.info(`SDK version: ${SdkVersion}`); + logger.info(`SDK version: ${SdkVersion}`); const transport = new DefaultTransport(options, SdkVersion); diff --git a/sdk/node/tests/robustness/rest/reliability.test.ts b/sdk/node/tests/robustness/rest/reliability.test.ts index 0e5deef9..7ceda168 100644 --- a/sdk/node/tests/robustness/rest/reliability.test.ts +++ b/sdk/node/tests/robustness/rest/reliability.test.ts @@ -8,8 +8,19 @@ import { TransportOptionBuilder, } from '@model/index'; import { DefaultClient } from '@api/index'; +import { logger, Logger, LoggerOptions} from '@src/common' describe('Auto Test', () => { + const jestConsole = console; + + beforeEach(() => { + global.console = require('console'); + }); + + afterEach(() => { + global.console = jestConsole; + }); + test('test proxy', () => { // Set specific options, others will fall back to default values const httpTransportOption = new TransportOptionBuilder() @@ -139,4 +150,50 @@ describe('Auto Test', () => { return api.getAllCurrencies(); }); + + test('test logger', () => { + logger.info('info'); + logger.debug('debug'); + logger.warn('warn'); + logger.error('error'); + }); + + + test('test logger2', () => { + const customLogger = { + log: (level: string, message: string, ...meta: any[]) => { + console.log(`[CUSTOM LOG] [${level.toUpperCase()}] ${message}`, meta); + }, + info: (message: string, ...meta: any[]) => { + console.log(`[CUSTOM INFO] ${message}`, meta); + }, + warn: (message: string, ...meta: any[]) => { + console.warn(`[CUSTOM WARN] ${message}`, meta); + }, + error: (message: string, ...meta: any[]) => { + console.error(`[CUSTOM ERROR] ${message}`, meta); + }, + debug: (message: string, ...meta: any[]) => { + console.debug(`[CUSTOM DEBUG] ${message}`, meta); + }, + setGlobalLogger: (newLogger: Logger, newOptions?: LoggerOptions) => { + Object.assign(customLogger, newLogger); + } + }; + + logger.setGlobalLogger(customLogger, { + level: 'debug', + format: (level: string, message: string, meta?: any[]) => { + const time = new Date().toISOString(); + const metaStr = meta && meta.length > 0 ? JSON.stringify(meta) : ''; + return `[TS TEST] ${time} [${level.toUpperCase()}] ${message}${metaStr ? ` ${metaStr}` : ''}`; + } + }); + + logger.info('info'); + logger.debug('debug'); + logger.warn('warn'); + logger.error('error'); + + }); }); diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index c86fba88..b63ee5ef 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -13,6 +13,7 @@ "paths": { "@src/*": ["src/*"], "@model/*": ["src/model/*"], + "@common/*": ["src/common/*"], "@internal/*": ["src/internal/*"], "@generate/*": ["src/generate/*"], "@api/*": ["src/api/*"] From c72b7b636c28be3dbdf146a4b2370881c6ff543e Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 14 Feb 2025 15:45:37 +0800 Subject: [PATCH 079/106] feat(nodejs): fix logger package --- sdk/node/src/common/index.ts | 2 +- sdk/node/tsconfig.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/node/src/common/index.ts b/sdk/node/src/common/index.ts index 5620ca25..0004fec4 100644 --- a/sdk/node/src/common/index.ts +++ b/sdk/node/src/common/index.ts @@ -1 +1 @@ -export * from './logger/logger'; +export * from './logger/logger.js'; diff --git a/sdk/node/tsconfig.json b/sdk/node/tsconfig.json index b63ee5ef..9ad80fc0 100644 --- a/sdk/node/tsconfig.json +++ b/sdk/node/tsconfig.json @@ -8,6 +8,7 @@ "strict": true, "esModuleInterop": true, "skipLibCheck": true, + "allowJs": true, "outDir": "./dist", "baseUrl": "./", "paths": { From e7ca1ecbaa318eb8677c112df333b32e826e12e7 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 14 Feb 2025 16:50:26 +0800 Subject: [PATCH 080/106] feat(nodejs): export interface --- .../plugin/generator/NodeSdkGenerator.java | 11 + .../sdk/plugin/SdkGeneratorTest.java | 2 +- sdk/node/example/src/ts/example_ws.ts | 578 +----------------- sdk/node/src/generate/account/index.ts | 8 + sdk/node/src/generate/affiliate/index.ts | 3 + sdk/node/src/generate/broker/index.ts | 4 + sdk/node/src/generate/copytrading/index.ts | 3 + sdk/node/src/generate/earn/index.ts | 3 + sdk/node/src/generate/futures/index.ts | 8 + sdk/node/src/generate/margin/index.ts | 9 + sdk/node/src/generate/spot/index.ts | 6 + sdk/node/src/generate/version.ts | 2 +- sdk/node/src/generate/viplending/index.ts | 3 + 13 files changed, 72 insertions(+), 568 deletions(-) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 67b050ac..a62b345f 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -16,6 +16,7 @@ import io.swagger.v3.oas.models.servers.Server; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.*; import org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen; import org.openapitools.codegen.model.ModelMap; @@ -389,11 +390,13 @@ private void generateApiExport(Meta meta, Set export) { //}; List serviceAliases = new LinkedList<>(); + List> typeAliases = new LinkedList<>(); operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { String serviceAlias = v.getSubService().toUpperCase(); export.add(String.format("import * as %s from \"./%s\"", serviceAlias, formatPackage(v.getSubService()))); serviceAliases.add(serviceAlias); + typeAliases.add(Pair.of(serviceAlias, formatService(v.getSubService() + "_API"))); } }); @@ -407,6 +410,10 @@ private void generateApiExport(Meta meta, Set export) { serviceAliases.add(privateService); serviceAliases.add(publicService); + + typeAliases.add(Pair.of(privateService, formatService(service + "PrivateWS"))); + typeAliases.add(Pair.of(publicService, formatService(service + "PublicWS"))); + } @@ -414,6 +421,10 @@ private void generateApiExport(Meta meta, Set export) { export.add(String.format("export const %s = \n{\n%s\n};", exportService, serviceAliases.stream().map(s -> " ..." + s).collect(Collectors.joining(",\n")))); + // export interface... + export.add(String.format("export namespace %s {\n%s\n}", exportService, + typeAliases.stream().map(s -> + " export type " + s.getValue() + " = " + s.getKey() + "." + s.getValue()).collect(Collectors.joining(";\n")))); break; } diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 748e8e8d..ba43f2eb 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -9,7 +9,7 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-deposit.json"; - private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json"; + private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; private static final String CSV_PATH = "../../spec"; diff --git a/sdk/node/example/src/ts/example_ws.ts b/sdk/node/example/src/ts/example_ws.ts index 22721802..80e279a0 100644 --- a/sdk/node/example/src/ts/example_ws.ts +++ b/sdk/node/example/src/ts/example_ws.ts @@ -1,5 +1,3 @@ -import 'reflect-metadata'; -import { EventEmitter } from 'events'; import { ClientOptionBuilder, DefaultClient, @@ -7,591 +5,39 @@ import { GlobalBrokerApiEndpoint, GlobalFuturesApiEndpoint, WebSocketClientOptionBuilder, - WebSocketEvent, - SpotPublicWS, - TransportOptionBuilder + Account, + Spot, } from 'kucoin-universal-sdk'; -// Create a custom event handler class -class WebSocketEventHandler extends EventEmitter { - constructor() { - super(); - this.setupEventHandlers(); - } - private setupEventHandlers() { - // Connection related events - this.on('ws_event', (event: WebSocketEvent, msg: string) => { - switch (event) { - case WebSocketEvent.EventConnected: - console.log('WebSocket Connected'); - break; - case WebSocketEvent.EventDisconnected: - console.log('WebSocket Disconnected:', msg); - break; - case WebSocketEvent.EventTryReconnect: - console.log('Attempting to reconnect:', msg); - break; - case WebSocketEvent.EventReSubscribeOK: - console.log('Resubscription successful'); - break; - case WebSocketEvent.EventReSubscribeError: - console.log('Resubscription failed:', msg); - break; - case WebSocketEvent.EventErrorReceived: - console.log('Error occurred:', msg); - break; - case WebSocketEvent.EventClientFail: - console.log('Client failure:', msg); - break; - case WebSocketEvent.EventMessageReceived: - // Skip logging for regular message events - break; - default: - console.log(`Other event - ${event}:`, msg); - } - }); - - // Ticker event handler - this.on('ticker_update', (topic: string, data: TickerEvent) => { - const symbol = topic.split(':')[1]; - console.log(`Price Update: ${symbol} = ${data.price} (${data.size})`); - }); - - // AllTickers event handler - this.on('all_tickers_update', (topic: string, data: AllTickersEvent) => { - console.log(`Market-wide Update: ${data.time}`); - console.log(` Symbol: ${topic.split(':')[1]}`); - console.log(` Latest Price: ${data.price}`); - console.log(` Best Bid: ${data.bestBid} (${data.bestBidSize})`); - console.log(` Best Ask: ${data.bestAsk} (${data.bestAskSize})`); - }); - - // OrderbookLevel1 event handler - this.on('level1_update', (topic: string, data: OrderbookLevel1Event) => { - const symbol = topic.split(':')[1]; - console.log(`Level1 Depth Update: ${symbol}`); - if (data.bids && data.bids.length >= 2) { - console.log(` Best Bid: ${data.bids[0]} (${data.bids[1]})`); - } - if (data.asks && data.asks.length >= 2) { - console.log(` Best Ask: ${data.asks[0]} (${data.asks[1]})`); - } - console.log(` Update Time: ${data.timestamp}`); - console.log(' ----------------'); - }); - - // OrderbookLevel5 event handler - this.on('level5_update', (topic: string, data: OrderbookLevel5Event) => { - const symbol = topic.split(':')[1]; - console.log(`Level5 Depth Update: ${symbol}`); - console.log(` Top 5 Bids:`); - data.bids.slice(0, 5).forEach((bid, index) => { - console.log(` ${index + 1}. Price: ${bid[0]}, Size: ${bid[1]}`); - }); - console.log(` Top 5 Asks:`); - data.asks.slice(0, 5).forEach((ask, index) => { - console.log(` ${index + 1}. Price: ${ask[0]}, Size: ${ask[1]}`); - }); - console.log(` Update Time: ${data.timestamp}`); - }); - - // Level2/Level50 depth update handler - this.on('level50_update', (topic: string, data: OrderbookLevel50Event) => { - const symbol = topic.split(':')[1]; - console.log(`Depth Data Update: ${symbol}`); - try { - if (data && typeof data === 'object') { - if ('changes' in data) { - console.log(` ===== Incremental Depth Update =====`); - const changes = data.changes; - if (changes.asks && changes.asks.length > 0) { - console.log(' Ask Updates:'); - changes.asks.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - if (changes.bids && changes.bids.length > 0) { - console.log(' Bid Updates:'); - changes.bids.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - console.log(` Sequence: ${data.sequenceStart} - ${data.sequenceEnd}`); - console.log(` Time: ${new Date(data.time).toLocaleString()}`); - } else { - // Full depth data (if available) - console.log(` Bid Count: ${data?.bids?.length || 0}`); - console.log(` Ask Count: ${data?.asks?.length || 0}`); - console.log(` Update Time: ${data?.timestamp ? new Date(data.timestamp).toLocaleString() : 'N/A'}`); - } - } - } catch (error) { - console.error(' Data Processing Error:', error); - } - }); - - // OrderbookIncrement event handler - this.on('increment_update', (topic: string, data: OrderbookIncrementEvent) => { - try { - const symbol = topic.split(':')[1]; - console.log(`Incremental Depth Update: ${symbol}`); - - if (data.changes) { - if (data.changes.asks && data.changes.asks.length > 0) { - console.log(' Ask Changes:'); - data.changes.asks.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - if (data.changes.bids && data.changes.bids.length > 0) { - console.log(' Bid Changes:'); - data.changes.bids.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - } - - console.log(` Change Summary - Asks: ${data.changes?.asks?.length || 0}, Bids: ${data.changes?.bids?.length || 0}`); - if (data.sequence) { - console.log(` Sequence: ${data.sequence}`); - } - console.log(` Event: ${topic}`); - console.log(' ----------------'); - - // Emit event after successful processing - this.eventHandler.emit('increment_update', topic, data); - } catch (error) { - console.error('Error processing increment update:', error); - } - }); - - // Trade event handler - this.on('trade_update', (topic: string, data: TradeEvent) => { - const symbol = topic.split(':')[1]; - console.log(`Trade Update: ${symbol}`); - console.log(` Price: ${data.price}, Size: ${data.size}, Side: ${data.side}`); - }); - - // Klines event handler - this.on('klines_update', (topic: string, data: KlinesEvent) => { - const [startTime, open, close, high, low, volume, amount] = data.candles; - console.log(`Kline Update: ${data.symbol}`); - console.log(` Time: ${startTime}`); - console.log(` Open: ${open}`); - console.log(` Close: ${close}`); - console.log(` High: ${high}`); - console.log(` Low: ${low}`); - console.log(` Volume: ${volume}`); - console.log(` Amount: ${amount}`); - }); - - // Symbol snapshot event handler - this.on('symbol_snapshot_update', (topic: string, data: SymbolSnapshotEvent) => { - console.log(`Symbol Snapshot: ${data.data.symbol}`); - console.log(` Latest Price: ${data.data.close}`); - console.log(` 24h High: ${data.data.high}`); - console.log(` 24h Low: ${data.data.low}`); - console.log(` 24h Volume: ${data.data.vol}`); - console.log(` 24h Amount: ${data.data.volValue}`); - console.log(` Update Time: ${data.data.datetime}`); - }); - } - - // Add a method to handle WebSocket events - handleWebSocketEvent(event: WebSocketEvent, msg: string) { - this.emit('ws_event', event, msg); - } -} - -// Interface configuration type -interface WebSocketConfig { - ticker: boolean; - allTickers: boolean; - depth: { - level1: boolean; - level5: boolean; - level50: boolean; - increment: boolean; - }; - trade: boolean; - klines: boolean; - snapshot: boolean; - symbols: string[]; - waitTime: number; -} - -// Default configuration -const defaultConfig: WebSocketConfig = { - ticker: false, - allTickers: false, - depth: { - level1: false, - level5: false, - level50: false, - increment: false - }, - trade: false, - klines: false, - snapshot: false, - symbols: ["BTC-USDT"], - waitTime: 30000 -}; - -// Callback handlers for different types of market data -class MarketDataHandlers { - constructor(private eventHandler: WebSocketEventHandler) {} - - // Ticker handlers - tickerCallback = (topic: string, subject: string, data: TickerEvent) => { - this.eventHandler.emit('ticker_update', topic, data); - console.log(`Received ticker event topic:${topic} subject:${subject} sequence:${data.sequence} price:${data.price} time:${data.time} size:${data.size}`); - }; - - allTickersCallback = (topic: string, subject: string, data: AllTickersEvent) => { - this.eventHandler.emit('all_tickers_update', topic, data); - console.log(`Received all tickers event topic:${topic} subject:${subject} time:${data.time}`); - }; - - // Depth handlers - level1Callback = (topic: string, subject: string, data: OrderbookLevel1Event) => { - this.eventHandler.emit('level1_update', topic, data); - const symbol = topic.split(':')[1]; - console.log(`Level1 Depth Update: ${symbol}`); - if (data.bids && data.bids.length >= 2) { - console.log(` Best Bid: ${data.bids[0]} (${data.bids[1]})`); - } - if (data.asks && data.asks.length >= 2) { - console.log(` Best Ask: ${data.asks[0]} (${data.asks[1]})`); - } - console.log(` Update Time: ${data.timestamp}`); - console.log(' ----------------'); - }; - - level5Callback = (topic: string, subject: string, data: OrderbookLevel5Event) => { - this.eventHandler.emit('level5_update', topic, data); - console.log(`Received level5 event topic:${topic} subject:${subject}`); - }; - - level50Callback = (topic: string, subject: string, data: OrderbookLevel50Event) => { - this.eventHandler.emit('level50_update', topic, data); - console.log(`Received level50 event topic:${topic} subject:${subject}`); - }; - - incrementCallback = (topic: string, subject: string, data: OrderbookIncrementEvent) => { - try { - const symbol = topic.split(':')[1]; - console.log(`Incremental Depth Update: ${symbol}`); - - if (data.changes) { - if (data.changes.asks && data.changes.asks.length > 0) { - console.log(' Ask Changes:'); - data.changes.asks.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - if (data.changes.bids && data.changes.bids.length > 0) { - console.log(' Bid Changes:'); - data.changes.bids.forEach(([price, size, sequence]) => { - const sizeNum = parseFloat(size); - const action = sizeNum === 0 ? 'Remove' : 'Update'; - console.log(` ${action} - Price: ${price}, Size: ${size}`); - }); - } - } - - console.log(` Change Summary - Asks: ${data.changes?.asks?.length || 0}, Bids: ${data.changes?.bids?.length || 0}`); - if (data.sequence) { - console.log(` Sequence: ${data.sequence}`); - } - if (subject) { - console.log(` Event: ${subject}`); - } - console.log(' ----------------'); - - // Emit event after successful processing - this.eventHandler.emit('increment_update', topic, data); - } catch (error) { - console.error('Error processing increment update:', error); - } - }; - - // Other market data handlers - tradeCallback = (topic: string, subject: string, data: TradeEvent) => { - this.eventHandler.emit('trade_update', topic, data); - console.log(`Received trade event topic:${topic} subject:${subject} sequence:${data.sequence}`); - }; - - klinesCallback = (topic: string, subject: string, data: KlinesEvent) => { - this.eventHandler.emit('klines_update', topic, data); - console.log(`Received klines event topic:${topic} subject:${subject}`); - }; - - symbolSnapshotCallback = (topic: string, subject: string, data: SymbolSnapshotEvent) => { - this.eventHandler.emit('symbol_snapshot_update', topic, data); - console.log(`Received symbol snapshot event topic:${topic} subject:${subject}`); - }; -} - -async function spotWsExample(spotPublicWs: SpotPublicWS, eventHandler: WebSocketEventHandler, config: Partial = {}) { - try { - // Merge with default config - const finalConfig: WebSocketConfig = { ...defaultConfig, ...config }; - const handlers = new MarketDataHandlers(eventHandler); - - // Start WebSocket service - await spotPublicWs.start(); - console.log('Starting to subscribe to interfaces...'); - - // Subscribe to market data based on configuration - if (finalConfig.ticker) { - await spotPublicWs.ticker(finalConfig.symbols, handlers.tickerCallback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} ticker`); - } - - if (finalConfig.allTickers) { - await spotPublicWs.allTickers(handlers.allTickersCallback); - console.log('Subscribed to all market tickers'); - } - - // Depth data subscription - if (finalConfig.depth.level1) { - await spotPublicWs.orderbookLevel1(finalConfig.symbols, handlers.level1Callback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level1 depth`); - } - - if (finalConfig.depth.level5) { - await spotPublicWs.orderbookLevel5(finalConfig.symbols, handlers.level5Callback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level5 depth`); - } - - if (finalConfig.depth.level50) { - await spotPublicWs.orderbookLevel50(finalConfig.symbols, handlers.level50Callback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} Level50 depth`); - } - - if (finalConfig.depth.increment) { - await spotPublicWs.orderbookIncrement(finalConfig.symbols, handlers.incrementCallback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} incremental depth`); - } - - if (finalConfig.trade) { - await spotPublicWs.trade(finalConfig.symbols, handlers.tradeCallback); - console.log(`Subscribed to ${finalConfig.symbols.join(', ')} trade data`); - } - - if (finalConfig.klines) { - for (const symbol of finalConfig.symbols) { - await spotPublicWs.klines(symbol, "1min", handlers.klinesCallback); - console.log(`Subscribed to ${symbol} 1min klines`); - } - } - - if (finalConfig.snapshot) { - for (const symbol of finalConfig.symbols) { - await spotPublicWs.symbolSnapshot(symbol, handlers.symbolSnapshotCallback); - console.log(`Subscribed to ${symbol} market snapshot`); - } - } - - // Wait for specified time - console.log(`Waiting ${finalConfig.waitTime/1000} seconds to receive data...`); - await new Promise(resolve => setTimeout(resolve, finalConfig.waitTime)); - - // Unsubscribe from all - console.log('Starting to unsubscribe...'); - try { - // For single symbol tickers - if (finalConfig.ticker) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/ticker@@${symbol}`); - console.log(`Unsubscribed from ticker:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from ticker:${symbol}`, e); - } - } - } - - // For all tickers - skip unsubscribe as it's handled automatically on disconnect - if (finalConfig.allTickers) { - console.log('All tickers subscription will be cleared on disconnect'); - } - - // Depth data unsubscription - if (finalConfig.depth.level1) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/level1@@${symbol}`); - console.log(`Unsubscribed from level1:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from level1:${symbol}`, e); - } - } - } - - if (finalConfig.depth.level5) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/level2Depth5@@${symbol}`); - console.log(`Unsubscribed from level5:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from level5:${symbol}`, e); - } - } - } - - if (finalConfig.depth.level50) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/level2Depth50@@${symbol}`); - console.log(`Unsubscribed from level50:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from level50:${symbol}`, e); - } - } - } - - if (finalConfig.depth.increment) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/level2@@${symbol}`); - console.log(`Unsubscribed from increment:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from increment:${symbol}`, e); - } - } - } - - if (finalConfig.trade) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/match@@${symbol}`); - console.log(`Unsubscribed from trade:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from trade:${symbol}`, e); - } - } - } - - if (finalConfig.klines) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/candles@@${symbol}_1min`); - console.log(`Unsubscribed from klines:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from klines:${symbol}`, e); - } - } - } - - if (finalConfig.snapshot) { - for (const symbol of finalConfig.symbols) { - try { - await spotPublicWs.unSubscribe(`/market/snapshot@@${symbol}`); - console.log(`Unsubscribed from snapshot:${symbol}`); - } catch (e) { - console.log(`Failed to unsubscribe from snapshot:${symbol}`, e); - } - } - } - - console.log('Unsubscribe process completed'); - } catch (unsubError) { - console.log('[DEBUG] unsubscribe error:', unsubError); - } - - } catch (e) { - console.error("Error occurred:", e); - } finally { - // Stop the WebSocket service which will clear all subscriptions - console.log('Stopping WebSocket service...'); - await spotPublicWs.stop(); - console.log('WebSocket service stopped'); - } -} - -// Example usage: -async function main() { - const eventHandler = new WebSocketEventHandler(); - - // Retrieve API secret information from environment variables +function wsExample() { const key = process.env.API_KEY || ''; const secret = process.env.API_SECRET || ''; const passphrase = process.env.API_PASSPHRASE || ''; - - // WebSocket client options - const wsClientOption = new WebSocketClientOptionBuilder() - .withDialTimeout(10000) - .withReconnect(true) - .withReconnectAttempts(20) - .withReconnectInterval(3000) - .withWriteTimeout(5000) - .withReadMessageBuffer(100) - .withWriteMessageBuffer(100) - .withEventCallback((event, msg) => { - eventHandler.handleWebSocketEvent(event, msg); - }) - .build(); - // Transport options - const transportOption = new TransportOptionBuilder() - .setTimeout(5000) - .setKeepAlive(true) - .build(); + const websocketClientOption = new WebSocketClientOptionBuilder().build(); - // Client options const clientOption = new ClientOptionBuilder() .setKey(key) .setSecret(secret) .setPassphrase(passphrase) - .setWebSocketClientOption(wsClientOption) - .setTransportOption(transportOption) .setSpotEndpoint(GlobalApiEndpoint) .setFuturesEndpoint(GlobalFuturesApiEndpoint) .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) .build(); const client = new DefaultClient(clientOption); - const kucoinWsService = client.wsService(); - - // Example configuration with all available options - const config: Partial = { - // Market ticker options - ticker: false, // Single symbol ticker - allTickers: false, // All market tickers + const wsService = client.wsService(); - // Depth data options - depth: { - level1: false, // Level 1 depth (best bid/ask) - level5: false, // Level 5 depth (top 5 bids/asks) - level50: false, // Level 50 depth (top 50 bids/asks) - increment: false // Incremental depth updates - }, + Spot.AccountEvent - // Other market data options - trade: false, // Trade execution data - klines: false, // Kline/Candlestick data - snapshot: true, // Market snapshot data + spotWsExample(wsService.newSpotPublicWS()); +} - // General settings - symbols: ["BTC-USDT"], // Trading pairs to subscribe - waitTime: 10000 // How long to wait for data (in milliseconds) - }; - // Run example with configuration - await spotWsExample(kucoinWsService.newSpotPublicWS(), eventHandler, config); +function spotWsExample(spotPublic: Spot.SpotPublicWS) { + console.log(112); } -// Run example -main().catch(console.error); \ No newline at end of file +wsExample() \ No newline at end of file diff --git a/sdk/node/src/generate/account/index.ts b/sdk/node/src/generate/account/index.ts index 5aa743a4..22ce0245 100644 --- a/sdk/node/src/generate/account/index.ts +++ b/sdk/node/src/generate/account/index.ts @@ -12,3 +12,11 @@ export const Account = { ...SUBACCOUNT, ...TRANSFER, }; +export namespace Account { + export type AccountAPI = ACCOUNT.AccountAPI; + export type DepositAPI = DEPOSIT.DepositAPI; + export type WithdrawalAPI = WITHDRAWAL.WithdrawalAPI; + export type FeeAPI = FEE.FeeAPI; + export type SubAccountAPI = SUBACCOUNT.SubAccountAPI; + export type TransferAPI = TRANSFER.TransferAPI; +} diff --git a/sdk/node/src/generate/affiliate/index.ts b/sdk/node/src/generate/affiliate/index.ts index 06a24a45..bd347fef 100644 --- a/sdk/node/src/generate/affiliate/index.ts +++ b/sdk/node/src/generate/affiliate/index.ts @@ -2,3 +2,6 @@ import * as AFFILIATE from './affiliate'; export const Affiliate = { ...AFFILIATE, }; +export namespace Affiliate { + export type AffiliateAPI = AFFILIATE.AffiliateAPI; +} diff --git a/sdk/node/src/generate/broker/index.ts b/sdk/node/src/generate/broker/index.ts index d9ce8890..650e9b99 100644 --- a/sdk/node/src/generate/broker/index.ts +++ b/sdk/node/src/generate/broker/index.ts @@ -4,3 +4,7 @@ export const Broker = { ...APIBROKER, ...NDBROKER, }; +export namespace Broker { + export type APIBrokerAPI = APIBROKER.APIBrokerAPI; + export type NDBrokerAPI = NDBROKER.NDBrokerAPI; +} diff --git a/sdk/node/src/generate/copytrading/index.ts b/sdk/node/src/generate/copytrading/index.ts index a2c99777..a41e1b15 100644 --- a/sdk/node/src/generate/copytrading/index.ts +++ b/sdk/node/src/generate/copytrading/index.ts @@ -2,3 +2,6 @@ import * as FUTURES from './futures'; export const Copytrading = { ...FUTURES, }; +export namespace Copytrading { + export type FuturesAPI = FUTURES.FuturesAPI; +} diff --git a/sdk/node/src/generate/earn/index.ts b/sdk/node/src/generate/earn/index.ts index 5dd2fc54..1178265c 100644 --- a/sdk/node/src/generate/earn/index.ts +++ b/sdk/node/src/generate/earn/index.ts @@ -2,3 +2,6 @@ import * as EARN from './earn'; export const Earn = { ...EARN, }; +export namespace Earn { + export type EarnAPI = EARN.EarnAPI; +} diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts index 62321266..fded1da7 100644 --- a/sdk/node/src/generate/futures/index.ts +++ b/sdk/node/src/generate/futures/index.ts @@ -12,3 +12,11 @@ export const Futures = { ...FUTURESPRIVATE, ...FUTURESPUBLIC, }; +export namespace Futures { + export type OrderAPI = ORDER.OrderAPI; + export type PositionsAPI = POSITIONS.PositionsAPI; + export type FundingFeesAPI = FUNDINGFEES.FundingFeesAPI; + export type MarketAPI = MARKET.MarketAPI; + export type FuturesPrivateWS = FUTURESPRIVATE.FuturesPrivateWS; + export type FuturesPublicWS = FUTURESPUBLIC.FuturesPublicWS; +} diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts index 9e878580..8956ec47 100644 --- a/sdk/node/src/generate/margin/index.ts +++ b/sdk/node/src/generate/margin/index.ts @@ -14,3 +14,12 @@ export const Margin = { ...MARGINPRIVATE, ...MARGINPUBLIC, }; +export namespace Margin { + export type OrderAPI = ORDER.OrderAPI; + export type DebitAPI = DEBIT.DebitAPI; + export type CreditAPI = CREDIT.CreditAPI; + export type MarketAPI = MARKET.MarketAPI; + export type RiskLimitAPI = RISKLIMIT.RiskLimitAPI; + export type MarginPrivateWS = MARGINPRIVATE.MarginPrivateWS; + export type MarginPublicWS = MARGINPUBLIC.MarginPublicWS; +} diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index 150479d9..42fc16dc 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -8,3 +8,9 @@ export const Spot = { ...SPOTPRIVATE, ...SPOTPUBLIC, }; +export namespace Spot { + export type OrderAPI = ORDER.OrderAPI; + export type MarketAPI = MARKET.MarketAPI; + export type SpotPrivateWS = SPOTPRIVATE.SpotPrivateWS; + export type SpotPublicWS = SPOTPUBLIC.SpotPublicWS; +} diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index b4bfb1d1..a7fcebc8 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-01-21'; +export const SdkGenerateDate = '2025-02-14'; diff --git a/sdk/node/src/generate/viplending/index.ts b/sdk/node/src/generate/viplending/index.ts index 49cc630b..f500c95f 100644 --- a/sdk/node/src/generate/viplending/index.ts +++ b/sdk/node/src/generate/viplending/index.ts @@ -2,3 +2,6 @@ import * as VIPLENDING from './viplending'; export const Viplending = { ...VIPLENDING, }; +export namespace Viplending { + export type VIPLendingAPI = VIPLENDING.VIPLendingAPI; +} From fa158334da3a3b2bbdb61de6c11c42c7da85b96b Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Sat, 15 Feb 2025 20:05:53 +0800 Subject: [PATCH 081/106] test(nodejs): add some websocket test --- sdk/node/tests/robustness/ws/resource.test.ts | 491 ++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 sdk/node/tests/robustness/ws/resource.test.ts diff --git a/sdk/node/tests/robustness/ws/resource.test.ts b/sdk/node/tests/robustness/ws/resource.test.ts new file mode 100644 index 00000000..12513c1a --- /dev/null +++ b/sdk/node/tests/robustness/ws/resource.test.ts @@ -0,0 +1,491 @@ +import { + ClientOptionBuilder, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} from '@model/index'; +import { DefaultClient } from '@api/index'; +import { exec } from 'child_process'; +import { promisify } from 'util'; +import { TickerEvent } from '@generate/spot/spotpublic/model_ticker_event'; +import { TickerV2Event } from '@generate/futures/futurespublic/model_ticker_v2_event'; +import { WebSocketEvent } from '@model/websocket_option'; + +const execAsync = promisify(exec); + + +async function getProcessTCPConnections(): Promise { + try { + const { stdout } = await execAsync(`ss -tn | grep ESTAB | wc -l`); + return parseInt(stdout.trim(), 10); + } catch (error) { + console.error('Error getting TCP connections:', error); + return -1; + } +} + +function getMemoryUsage(): { heapUsed: number, heapTotal: number, rss: number } { + const memUsage = process.memoryUsage(); + return { + heapUsed: Math.round(memUsage.heapUsed / 1024 / 1024), // MB + heapTotal: Math.round(memUsage.heapTotal / 1024 / 1024), // MB + rss: Math.round(memUsage.rss / 1024 / 1024) // MB + }; +} + + +function logMemoryUsage() { + const usage = getMemoryUsage(); + console.log(`Memory Usage - Heap Used: ${usage.heapUsed}MB, Heap Total: ${usage.heapTotal}MB, RSS: ${usage.rss}MB`); +} + + +async function verifyResourceCleanup(initialTCP: number, initialMemory: ReturnType) { + + await new Promise(resolve => setTimeout(resolve, 2000)); + + const currentTCP = await getProcessTCPConnections(); + const tcpDiff = currentTCP - initialTCP; + + const currentMemory = getMemoryUsage(); + const memoryDiff = { + heapUsed: currentMemory.heapUsed - initialMemory.heapUsed, + heapTotal: currentMemory.heapTotal - initialMemory.heapTotal, + rss: currentMemory.rss - initialMemory.rss + }; + + console.log('\nResource Cleanup Verification:'); + console.log(`TCP Connections - Initial: ${initialTCP}, Current: ${currentTCP}, Diff: ${tcpDiff}`); + console.log('Memory Usage Diff:'); + console.log(`- Heap Used: ${memoryDiff.heapUsed}MB`); + console.log(`- Heap Total: ${memoryDiff.heapTotal}MB`); + console.log(`- RSS: ${memoryDiff.rss}MB`); + + // 返回验证结果 + return { + tcpLeaked: tcpDiff > 0, + memoryLeaked: memoryDiff.heapUsed > 50, // 允许50MB的误差 + tcpDiff, + memoryDiff + }; +} + +describe('WebSocket Robustness Test', () => { + let initialTCP: number; + let initialMemory: ReturnType; + + beforeEach(async () => { + initialTCP = await getProcessTCPConnections(); + initialMemory = getMemoryUsage(); + console.log('\nInitial Resource State:'); + console.log(`TCP Connections: ${initialTCP}`); + logMemoryUsage(); + }); + + afterEach(async () => { + const result = await verifyResourceCleanup(initialTCP, initialMemory); + + if (result.tcpLeaked) { + console.warn(`Warning: TCP connections may be leaking (${result.tcpDiff} unreleased connections)`); + } + if (result.memoryLeaked) { + console.warn(`Warning: Memory may be leaking (${result.memoryDiff.heapUsed}MB increase in heap usage)`); + } + + expect(result.tcpLeaked).toBe(false); + expect(result.memoryLeaked).toBe(false); + }); + + // Test WebSocket connection leak + test('test websocket connection leak', async () => { + let spotConnected = false; + let futuresConnected = false; + const wsClients: { ws: any, type: string }[] = []; + + const wsOption = new WebSocketClientOptionBuilder() + .withReconnect(true) + .withReconnectInterval(1000) + .withDialTimeout(5000) + .withEventCallback((event: WebSocketEvent, msg: string) => { + console.log(`WebSocket Event: ${event}, Message: ${msg}`); + if (event === WebSocketEvent.EventConnected) { + if (msg.includes('spot')) { + spotConnected = true; + } else if (msg.includes('futures')) { + futuresConnected = true; + } + } + }) + .build(); + + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + + try { + console.log(`Before connections: ${await getProcessTCPConnections()}`); + + // Subscribe to some topics + const subscriptionPromises = []; + for (let i = 0; i < 5; i++) { + const spotPublicWS = wsService.newSpotPublicWS(); + const futuresPublicWS = wsService.newFuturesPublicWS(); + + wsClients.push({ ws: spotPublicWS, type: 'spot' }); + wsClients.push({ ws: futuresPublicWS, type: 'futures' }); + + // Start WebSocket clients + await spotPublicWS.start(); + await futuresPublicWS.start(); + + // Wait for connections to be established + await new Promise((resolve) => { + const checkConnections = () => { + if (spotConnected && futuresConnected) { + resolve(); + } + }; + const interval = setInterval(checkConnections, 100); + setTimeout(() => { + clearInterval(interval); + resolve(); // Resolve anyway after timeout + }, 5000); + }); + + // Reset flags for next iteration + spotConnected = false; + futuresConnected = false; + + // Subscribe to some topics and store both the WS instance and subscription ID + const spotPromise = spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => {}) + .then(subId => ({ ws: spotPublicWS, subId })); + const futuresPromise = futuresPublicWS.tickerV2('XBTUSDTM', (topic: string, subject: string, data: TickerV2Event) => {}) + .then(subId => ({ ws: futuresPublicWS, subId })); + + subscriptionPromises.push(spotPromise, futuresPromise); + } + + // Wait for all subscriptions to be established + const subscriptions = await Promise.all(subscriptionPromises); + + // Wait for a moment to ensure all connections are active + await new Promise(resolve => setTimeout(resolve, 5000)); + + console.log(`Current connections: ${await getProcessTCPConnections()}`); + + // Clean up + console.log('Cleaning up subscriptions...'); + await Promise.all(subscriptions.map(sub => sub.ws.unSubscribe(sub.subId))); + + console.log('Stopping WebSocket clients...'); + await Promise.all(wsClients.map(client => client.ws.stop())); + + // Wait for connections to close + await new Promise(resolve => setTimeout(resolve, 2000)); + + console.log(`After connections: ${await getProcessTCPConnections()}`); + } catch (error) { + console.error('Error:', error); + throw error; + } finally { + // Ensure all WebSocket clients are stopped + await Promise.all(wsClients.map(client => client.ws.stop().catch(console.error))); + } + }); + + // Test WebSocket memory leak + jest.setTimeout(120000); + test('test websocket memory leak', async () => { + let connected = false; + const wsClients: { ws: any, type: string }[] = []; + + const wsOption = new WebSocketClientOptionBuilder() + .withReconnect(true) + .withReconnectInterval(1000) + .withDialTimeout(5000) + .withEventCallback((event: WebSocketEvent, msg: string) => { + console.log(`WebSocket Event: ${event}, Message: ${msg}`); + if (event === WebSocketEvent.EventConnected) { + connected = true; + } + }) + .build(); + + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + + let messageCount = 0; + let elapsedSeconds = 0; + const subscriptions: any[] = []; + + console.log(`Before connections: ${await getProcessTCPConnections()}`); + + try { + while (elapsedSeconds < 30) { + elapsedSeconds++; + logMemoryUsage(); + + if (elapsedSeconds % 5 === 0) { + const spotPublicWS = wsService.newSpotPublicWS(); + const futuresPublicWS = wsService.newFuturesPublicWS(); + + wsClients.push({ ws: spotPublicWS, type: 'spot' }); + wsClients.push({ ws: futuresPublicWS, type: 'futures' }); + + // Start WebSocket clients + await spotPublicWS.start(); + await futuresPublicWS.start(); + + // Wait for connections to be established + await new Promise((resolve) => { + const checkConnection = () => { + if (connected) { + resolve(); + } + }; + const interval = setInterval(checkConnection, 100); + setTimeout(() => { + clearInterval(interval); + resolve(); // Resolve anyway after timeout + }, 5000); + }); + + // Reset flag + connected = false; + + const spotSub = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { + messageCount++; + }); + const futuresSub = await futuresPublicWS.tickerV2('XBTUSDTM', (topic: string, subject: string, data: TickerV2Event) => { + messageCount++; + }); + + subscriptions.push( + { ws: spotPublicWS, subId: spotSub }, + { ws: futuresPublicWS, subId: futuresSub } + ); + + console.log(`Current connections: ${await getProcessTCPConnections()}`); + } + + // 等待1秒 + await new Promise(resolve => setTimeout(resolve, 1000)); + } + + // Clean up + console.log('Cleaning up subscriptions...'); + for (const sub of subscriptions) { + try { + await sub.ws.unSubscribe(sub.subId); + } catch (error) { + console.error('Error unsubscribing:', error); + } + } + + console.log('Stopping WebSocket clients...'); + for (const client of wsClients) { + try { + await client.ws.stop(); + } catch (error) { + console.error('Error stopping client:', error); + } + } + + // Wait for connections to close + await new Promise(resolve => setTimeout(resolve, 2000)); + console.log(`After connections: ${await getProcessTCPConnections()}`); + + } catch (error) { + console.error('Test error:', error); + throw error; + } finally { + // 确保所有WebSocket客户端都被停止 + console.log('Final cleanup in finally block...'); + for (const client of wsClients) { + try { + await client.ws.stop(); + } catch (error) { + console.error('Error in final cleanup:', error); + } + } + } + }); + + // Test WebSocket reconnection + test('test websocket reconnection', async () => { + let connected = false; + + const wsOption = new WebSocketClientOptionBuilder() + .withReconnect(true) + .withReconnectInterval(1000) + .withDialTimeout(5000) + .withEventCallback((event: WebSocketEvent, msg: string) => { + console.log(`WebSocket Event: ${event}, Message: ${msg}`); + if (event === WebSocketEvent.EventConnected) { + connected = true; + } + }) + .build(); + + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + const spotPublicWS = wsService.newSpotPublicWS(); + + try { + console.log(`Before connections: ${await getProcessTCPConnections()}`); + + // Start WebSocket client + await spotPublicWS.start(); + + // Wait for connection to be established + await new Promise((resolve) => { + const checkConnection = () => { + if (connected) { + resolve(); + } + }; + const interval = setInterval(checkConnection, 100); + setTimeout(() => { + clearInterval(interval); + resolve(); // Resolve anyway after timeout + }, 5000); + }); + + console.log(`After connection established: ${await getProcessTCPConnections()}`); + + // Reset flag + connected = false; + + // Subscribe to a topic + const subscription = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { + console.log('Received message:', data); + }); + + // Wait for some messages + await new Promise(resolve => setTimeout(resolve, 5000)); + + // Clean up + await spotPublicWS.unSubscribe(subscription); + await spotPublicWS.stop(); + + // Wait for connections to close + await new Promise(resolve => setTimeout(resolve, 2000)); + console.log(`After cleanup: ${await getProcessTCPConnections()}`); + } catch (error) { + console.error('Error:', error); + throw error; + } finally { + // Ensure WebSocket client is stopped + await spotPublicWS.stop().catch(console.error); + } + }); + + // Test single connection + test('test single connection', async () => { + let connected = false; + + const wsOption = new WebSocketClientOptionBuilder() + .withReconnect(true) + .withReconnectInterval(1000) + .withDialTimeout(5000) + .withEventCallback((event: WebSocketEvent, msg: string) => { + console.log(`WebSocket Event: ${event}, Message: ${msg}`); + if (event === WebSocketEvent.EventConnected) { + connected = true; + } + }) + .build(); + + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + const spotPublicWS = wsService.newSpotPublicWS(); + + try { + console.log(`Before connections: ${await getProcessTCPConnections()}`); + + // Start WebSocket client + await spotPublicWS.start(); + + // Wait for connection to be established + await new Promise((resolve) => { + const checkConnection = () => { + if (connected) { + resolve(); + } + }; + const interval = setInterval(checkConnection, 100); + setTimeout(() => { + clearInterval(interval); + resolve(); // Resolve anyway after timeout + }, 5000); + }); + + console.log(`After connection established: ${await getProcessTCPConnections()}`); + + // Reset flag + connected = false; + + // Subscribe to a topic + const subscription = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { + console.log('Received message:', data); + }); + + // Wait for some messages + await new Promise(resolve => setTimeout(resolve, 5000)); + + // Clean up + await spotPublicWS.unSubscribe(subscription); + await spotPublicWS.stop(); + + // Wait for connections to close + await new Promise(resolve => setTimeout(resolve, 2000)); + console.log(`After cleanup: ${await getProcessTCPConnections()}`); + } catch (error) { + console.error('Error:', error); + throw error; + } finally { + // Ensure WebSocket client is stopped + await spotPublicWS.stop().catch(console.error); + } + }); +}); From a82cbdf406cf35e43b60006bb37b5ea6158b23e3 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 17 Feb 2025 19:50:01 +0800 Subject: [PATCH 082/106] feat(nodejs): update ts export --- .../plugin/generator/NodeSdkGenerator.java | 83 ++++++-- .../node-sdk/module_exports_template.mustache | 3 + .../sdk/plugin/SdkGeneratorTest.java | 2 +- .../example/src/js/example_get_started.js | 4 +- sdk/node/example/src/ts/example_api.ts | 16 +- .../example/src/ts/example_get_started.ts | 4 +- sdk/node/example/src/ts/example_ws.ts | 106 ++++++---- .../generate/account/account/export.template | 43 ++++ .../generate/account/deposit/export.template | 20 ++ .../src/generate/account/fee/export.template | 9 + sdk/node/src/generate/account/index.ts | 185 +++++++++++++++++- .../account/subaccount/export.template | 42 ++++ .../generate/account/transfer/export.template | 17 ++ .../account/withdrawal/export.template | 16 ++ .../affiliate/affiliate/export.template | 6 + sdk/node/src/generate/affiliate/index.ts | 8 +- .../generate/broker/apibroker/export.template | 4 + sdk/node/src/generate/broker/index.ts | 39 +++- .../generate/broker/ndbroker/export.template | 31 +++ .../copytrading/futures/export.template | 24 +++ sdk/node/src/generate/copytrading/index.ts | 26 ++- .../src/generate/earn/earn/export.template | 26 +++ sdk/node/src/generate/earn/index.ts | 28 ++- .../futures/fundingfees/export.template | 10 + sdk/node/src/generate/futures/index.ts | 141 ++++++++++++- .../generate/futures/market/export.template | 38 ++++ .../generate/futures/order/export.template | 47 +++++ .../futures/positions/export.template | 33 ++++ .../generate/margin/credit/export.template | 20 ++ .../src/generate/margin/debit/export.template | 17 ++ sdk/node/src/generate/margin/index.ts | 102 +++++++++- .../generate/margin/market/export.template | 15 ++ .../src/generate/margin/order/export.template | 31 +++ .../generate/margin/risklimit/export.template | 5 + sdk/node/src/generate/spot/index.ts | 161 ++++++++++++++- .../src/generate/spot/market/export.template | 40 ++++ .../src/generate/spot/order/export.template | 113 +++++++++++ sdk/node/src/generate/version.ts | 2 +- sdk/node/src/generate/viplending/index.ts | 10 +- .../viplending/viplending/export.template | 8 + 40 files changed, 1436 insertions(+), 99 deletions(-) create mode 100644 generator/plugin/src/main/resources/node-sdk/module_exports_template.mustache create mode 100644 sdk/node/src/generate/account/account/export.template create mode 100644 sdk/node/src/generate/account/deposit/export.template create mode 100644 sdk/node/src/generate/account/fee/export.template create mode 100644 sdk/node/src/generate/account/subaccount/export.template create mode 100644 sdk/node/src/generate/account/transfer/export.template create mode 100644 sdk/node/src/generate/account/withdrawal/export.template create mode 100644 sdk/node/src/generate/affiliate/affiliate/export.template create mode 100644 sdk/node/src/generate/broker/apibroker/export.template create mode 100644 sdk/node/src/generate/broker/ndbroker/export.template create mode 100644 sdk/node/src/generate/copytrading/futures/export.template create mode 100644 sdk/node/src/generate/earn/earn/export.template create mode 100644 sdk/node/src/generate/futures/fundingfees/export.template create mode 100644 sdk/node/src/generate/futures/market/export.template create mode 100644 sdk/node/src/generate/futures/order/export.template create mode 100644 sdk/node/src/generate/futures/positions/export.template create mode 100644 sdk/node/src/generate/margin/credit/export.template create mode 100644 sdk/node/src/generate/margin/debit/export.template create mode 100644 sdk/node/src/generate/margin/market/export.template create mode 100644 sdk/node/src/generate/margin/order/export.template create mode 100644 sdk/node/src/generate/margin/risklimit/export.template create mode 100644 sdk/node/src/generate/spot/market/export.template create mode 100644 sdk/node/src/generate/spot/order/export.template create mode 100644 sdk/node/src/generate/viplending/viplending/export.template diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index a62b345f..e0e8c905 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -27,6 +27,8 @@ import java.io.File; import java.io.FileReader; +import java.io.IOException; +import java.nio.file.Files; import java.util.*; import java.util.stream.Collectors; @@ -65,6 +67,7 @@ public String toImport() { private String service; private String subService; private Set exports = new LinkedHashSet<>(); + private Set serviceExportsTemplate = new HashSet<>(); private static final Set wsServices = Set.of("spot", "futures", "margin"); public CodegenType getTag() { @@ -96,6 +99,7 @@ public void processOpts() { modelTemplateFiles.put("model.mustache", ".ts"); apiTemplateFiles.put("api.mustache", ".ts"); supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/%s/index.ts", service, formatPackage(subService)))); + supportingFiles.add(new SupportingFile("module_exports_template.mustache", String.format("./%s/%s/export.template", service, formatPackage(subService)))); break; } case TEST: { @@ -369,7 +373,32 @@ private void generateApiImport(Meta meta, boolean req, Map } } - private void generateApiExport(Meta meta, Set export) { + private static List getSubdirectories(File parentDir) { + return Arrays.stream(Objects.requireNonNull(parentDir.listFiles(File::isDirectory))) + .collect(Collectors.toList()); + } + + private static List readExportTemplates(File parentDir) { + List subDirs = getSubdirectories(parentDir); + List contents = new LinkedList<>(); + + for (File subDir : subDirs) { + File templateFile = new File(subDir, "export.template"); + if (templateFile.exists()) { + try { + String content = new String(Files.readAllBytes(templateFile.toPath())).trim(); + if (!content.isEmpty()) { + contents.add(content + "\n"); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + return contents; + } + + private void generateValueExport(Meta meta, Set export) { switch (modeSwitch.getMode()) { case API: case WS: { @@ -389,13 +418,15 @@ private void generateApiExport(Meta meta, Set export) { // ... //}; - List serviceAliases = new LinkedList<>(); + List> serviceAliases = new LinkedList<>(); List> typeAliases = new LinkedList<>(); operationService.getServiceMeta().forEach((k, v) -> { if (v.getService().equalsIgnoreCase(meta.getService())) { String serviceAlias = v.getSubService().toUpperCase(); + String exportService = camelize( v.getSubService(), CamelizeOption.UPPERCASE_FIRST_CHAR); + export.add(String.format("import * as %s from \"./%s\"", serviceAlias, formatPackage(v.getSubService()))); - serviceAliases.add(serviceAlias); + serviceAliases.add(Pair.of(exportService, serviceAlias)); typeAliases.add(Pair.of(serviceAlias, formatService(v.getSubService() + "_API"))); } }); @@ -408,8 +439,10 @@ private void generateApiExport(Meta meta, Set export) { export.add(String.format("import * as %s from \"./%s\"", privateService, formatPackage(privateService))); export.add(String.format("import * as %s from \"./%s\"", publicService, formatPackage(publicService))); - serviceAliases.add(privateService); - serviceAliases.add(publicService); + String exportService = camelize(service.toLowerCase(), CamelizeOption.UPPERCASE_FIRST_CHAR); + + serviceAliases.add(Pair.of(exportService + "Private", privateService)); + serviceAliases.add(Pair.of(exportService + "Public", publicService)); typeAliases.add(Pair.of(privateService, formatService(service + "PrivateWS"))); typeAliases.add(Pair.of(publicService, formatService(service + "PublicWS"))); @@ -419,12 +452,20 @@ private void generateApiExport(Meta meta, Set export) { String exportService = camelize(service.toLowerCase(), CamelizeOption.UPPERCASE_FIRST_CHAR); export.add(String.format("export const %s = \n{\n%s\n};", exportService, - serviceAliases.stream().map(s -> " ..." + s).collect(Collectors.joining(",\n")))); + serviceAliases.stream().map(s -> s.getKey() + ":" + s.getValue()).collect(Collectors.joining(",\n")))); + + + List exports = typeAliases.stream().map(s -> + " export type " + s.getValue() + " = " + s.getKey() + "." + s.getValue()).collect(Collectors.toList()); + + + String targetDir = outputFolder() + "/" + formatPackage(meta.getService()); + + exports.addAll(readExportTemplates(new File(targetDir))); // export interface... export.add(String.format("export namespace %s {\n%s\n}", exportService, - typeAliases.stream().map(s -> - " export type " + s.getValue() + " = " + s.getKey() + "." + s.getValue()).collect(Collectors.joining(";\n")))); + String.join(";\n", exports))); break; } @@ -440,6 +481,22 @@ private void generateApiExport(Meta meta, Set export) { } + private void generateTypeExport(Meta meta, Set export, List allModels) { + + String service = meta.getService(); + String subService = meta.getSubService(); + + List exportEntry = new LinkedList<>(); + + // type aliases(model) + allModels.forEach(m -> { + String modelName = (String) m.get("importPath"); + exportEntry.add(String.format("export type %s = %s.%s;", modelName, subService.toUpperCase(), modelName)); + }); + + export.add(String.format("export namespace %s {\n%s\n}", subService, String.join("\n", exportEntry))); + } + @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); @@ -470,14 +527,14 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { generateApiImport(meta, false, imports); - generateApiExport(meta, exports); - + generateValueExport(meta, exports); }); break; } case API: case TEST: { + generateTypeExport(meta, serviceExportsTemplate, allModels); allModels.stream().forEach(m -> { String path = (String) m.get("importPath"); path = toModelFilename(path); @@ -488,8 +545,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List postProcessSupportingFileData(Map objs) { Map data = super.postProcessSupportingFileData(objs); data.put("exports", exports); + data.put("template-exports", serviceExportsTemplate); String csvPath = (String) additionalProperties.get("CSV_PATH"); if (csvPath == null) { diff --git a/generator/plugin/src/main/resources/node-sdk/module_exports_template.mustache b/generator/plugin/src/main/resources/node-sdk/module_exports_template.mustache new file mode 100644 index 00000000..8958fdf7 --- /dev/null +++ b/generator/plugin/src/main/resources/node-sdk/module_exports_template.mustache @@ -0,0 +1,3 @@ +{{#template-exports}} +{{{.}}} +{{/template-exports}} \ No newline at end of file diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index ba43f2eb..7704de1d 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -8,7 +8,7 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; - private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-deposit.json"; + private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-market.json"; private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; private static final String OUTPUT_DIR = "./out"; diff --git a/sdk/node/example/src/js/example_get_started.js b/sdk/node/example/src/js/example_get_started.js index c17468e1..2696081b 100644 --- a/sdk/node/example/src/js/example_get_started.js +++ b/sdk/node/example/src/js/example_get_started.js @@ -40,13 +40,13 @@ function example() { const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); // Create request by interface - let request = Spot.GetPartOrderBookReq.create({ + let request = Spot.Market.GetPartOrderBookReq.create({ symbol: 'BTC-USDT', size: '20', }); // Or create request by builder - request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + request = Spot.Market.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); // Query for part orderbook depth data. (aggregated by price) spotMarketApi.getPartOrderBook(request) diff --git a/sdk/node/example/src/ts/example_api.ts b/sdk/node/example/src/ts/example_api.ts index b792a0a4..ae3e5060 100644 --- a/sdk/node/example/src/ts/example_api.ts +++ b/sdk/node/example/src/ts/example_api.ts @@ -70,7 +70,7 @@ async function accountServiceExample(accountService: AccountService) { // Get fee api const feeApi = accountService.getFeeApi(); - const getActualFeeReq = Account.GetSpotActualFeeReq.builder().setSymbols('BTC-USDT,ETH-USDT') + const getActualFeeReq = Account.Fee.GetSpotActualFeeReq.builder().setSymbols('BTC-USDT,ETH-USDT') .build(); const getActualFeeResp = feeApi.getSpotActualFee(getActualFeeReq).then((resp) => { if (resp.data) { @@ -94,11 +94,11 @@ async function spotServiceExample(spotService: SpotService) { const orderApi = spotService.getOrderApi(); // Add limit order - const addOrderReq = Spot.AddOrderSyncReq.builder() + const addOrderReq = Spot.Order.AddOrderSyncReq.builder() .setClientOid(randomUUID().toString()) - .setSide(Spot.AddOrderSyncReq.SideEnum.BUY) + .setSide(Spot.Order.AddOrderSyncReq.SideEnum.BUY) .setSymbol('BTC-USDT') - .setType(Spot.AddOrderSyncReq.TypeEnum.LIMIT) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) .setRemark('sdk_example') .setPrice('10000') .setSize('0.001') @@ -109,7 +109,7 @@ async function spotServiceExample(spotService: SpotService) { // Query order detail const orderId = addOrderResp.orderId; - const queryOrderDetailReq = Spot.GetOrderByOrderIdReq.builder() + const queryOrderDetailReq = Spot.Order.GetOrderByOrderIdReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -117,7 +117,7 @@ async function spotServiceExample(spotService: SpotService) { console.log(`Order detail: ${orderDetailResp.toJson()}`); // Cancel order - const cancelOrderReq = Spot.CancelOrderByOrderIdSyncReq.builder() + const cancelOrderReq = Spot.Order.CancelOrderByOrderIdSyncReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -135,9 +135,9 @@ async function futuresServiceExample(futuresService: FuturesService) { const start = Date.now() - 10 * 60 * 1000; const end = Date.now(); - const getKlineReq = Futures.GetKlinesReq.builder() + const getKlineReq = Futures.Market.GetKlinesReq.builder() .setSymbol(symbol.symbol) - .setGranularity(Futures.GetKlinesReq.GranularityEnum._1) + .setGranularity(Futures.Market.GetKlinesReq.GranularityEnum._1) .setFrom(start) .setTo(end) .build(); diff --git a/sdk/node/example/src/ts/example_get_started.ts b/sdk/node/example/src/ts/example_get_started.ts index 0f8f50a2..dfefc6a2 100644 --- a/sdk/node/example/src/ts/example_get_started.ts +++ b/sdk/node/example/src/ts/example_get_started.ts @@ -40,13 +40,13 @@ function example() { const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); // Create request by interface - let request = Spot.GetPartOrderBookReq.create({ + let request = Spot.Market.GetPartOrderBookReq.create({ 'symbol': 'BTC-USDT', 'size': '20', }) // Or create request by builder - request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + request = Spot.Market.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); // Query for part orderbook depth data. (aggregated by price) spotMarketApi.getPartOrderBook(request).then((result) => { diff --git a/sdk/node/example/src/ts/example_ws.ts b/sdk/node/example/src/ts/example_ws.ts index 80e279a0..bc4748dd 100644 --- a/sdk/node/example/src/ts/example_ws.ts +++ b/sdk/node/example/src/ts/example_ws.ts @@ -1,43 +1,63 @@ -import { - ClientOptionBuilder, - DefaultClient, - GlobalApiEndpoint, - GlobalBrokerApiEndpoint, - GlobalFuturesApiEndpoint, - WebSocketClientOptionBuilder, - Account, - Spot, -} from 'kucoin-universal-sdk'; - - -function wsExample() { - const key = process.env.API_KEY || ''; - const secret = process.env.API_SECRET || ''; - const passphrase = process.env.API_PASSPHRASE || ''; - - const websocketClientOption = new WebSocketClientOptionBuilder().build(); - - const clientOption = new ClientOptionBuilder() - .setKey(key) - .setSecret(secret) - .setPassphrase(passphrase) - .setSpotEndpoint(GlobalApiEndpoint) - .setFuturesEndpoint(GlobalFuturesApiEndpoint) - .setBrokerEndpoint(GlobalBrokerApiEndpoint) - .setWebSocketClientOption(websocketClientOption) - .build(); - - const client = new DefaultClient(clientOption); - const wsService = client.wsService(); - - Spot.AccountEvent - - spotWsExample(wsService.newSpotPublicWS()); -} - - -function spotWsExample(spotPublic: Spot.SpotPublicWS) { - console.log(112); -} - -wsExample() \ No newline at end of file +// import { +// ClientOptionBuilder, +// DefaultClient, +// GlobalApiEndpoint, +// GlobalBrokerApiEndpoint, +// GlobalFuturesApiEndpoint, +// WebSocketClientOptionBuilder, +// Account, +// Spot, +// } from 'kucoin-universal-sdk'; +// +// +// function delay(ms: number): Promise { +// return new Promise((resolve) => setTimeout(resolve, ms)); +// } +// +// function wsExample() { +// const key = process.env.API_KEY || ''; +// const secret = process.env.API_SECRET || ''; +// const passphrase = process.env.API_PASSPHRASE || ''; +// +// const websocketClientOption = new WebSocketClientOptionBuilder().build(); +// +// const clientOption = new ClientOptionBuilder() +// .setKey(key) +// .setSecret(secret) +// .setPassphrase(passphrase) +// .setSpotEndpoint(GlobalApiEndpoint) +// .setFuturesEndpoint(GlobalFuturesApiEndpoint) +// .setBrokerEndpoint(GlobalBrokerApiEndpoint) +// .setWebSocketClientOption(websocketClientOption) +// .build(); +// +// const client = new DefaultClient(clientOption); +// const wsService = client.wsService(); +// +// spotWsExample(wsService.newSpotPublicWS()); +// } +// +// +// async function spotWsExample(spotPublic: Spot.SpotPublicWS) { +// +// await spotPublic.start() +// +// +// +// let subid = spotPublic.allTickers((topic: string, subject: string, data: Spot.) => { +// console.log(data); +// }); +// +// await subid +// .then(async (id) => { +// await delay(5000); +// return id; +// }) +// .then((id) => { +// return spotPublic.unSubscribe(id); +// }).then(() => { +// return spotPublic.stop +// }); +// } +// +// wsExample() \ No newline at end of file diff --git a/sdk/node/src/generate/account/account/export.template b/sdk/node/src/generate/account/account/export.template new file mode 100644 index 00000000..76c26707 --- /dev/null +++ b/sdk/node/src/generate/account/account/export.template @@ -0,0 +1,43 @@ +export namespace Account { +export type GetAccountInfoResp = ACCOUNT.GetAccountInfoResp; +export type GetApikeyInfoResp = ACCOUNT.GetApikeyInfoResp; +export type GetCrossMarginAccountAccounts = ACCOUNT.GetCrossMarginAccountAccounts; +export type GetCrossMarginAccountReq = ACCOUNT.GetCrossMarginAccountReq; +export type GetCrossMarginAccountResp = ACCOUNT.GetCrossMarginAccountResp; +export type GetFuturesAccountReq = ACCOUNT.GetFuturesAccountReq; +export type GetFuturesAccountResp = ACCOUNT.GetFuturesAccountResp; +export type GetFuturesLedgerDataList = ACCOUNT.GetFuturesLedgerDataList; +export type GetFuturesLedgerReq = ACCOUNT.GetFuturesLedgerReq; +export type GetFuturesLedgerResp = ACCOUNT.GetFuturesLedgerResp; +export type GetIsolatedMarginAccountAssets = ACCOUNT.GetIsolatedMarginAccountAssets; +export type GetIsolatedMarginAccountAssetsBaseAsset = ACCOUNT.GetIsolatedMarginAccountAssetsBaseAsset; +export type GetIsolatedMarginAccountAssetsQuoteAsset = ACCOUNT.GetIsolatedMarginAccountAssetsQuoteAsset; +export type GetIsolatedMarginAccountDetailV1BaseAsset = ACCOUNT.GetIsolatedMarginAccountDetailV1BaseAsset; +export type GetIsolatedMarginAccountDetailV1QuoteAsset = ACCOUNT.GetIsolatedMarginAccountDetailV1QuoteAsset; +export type GetIsolatedMarginAccountDetailV1Req = ACCOUNT.GetIsolatedMarginAccountDetailV1Req; +export type GetIsolatedMarginAccountDetailV1Resp = ACCOUNT.GetIsolatedMarginAccountDetailV1Resp; +export type GetIsolatedMarginAccountListV1Assets = ACCOUNT.GetIsolatedMarginAccountListV1Assets; +export type GetIsolatedMarginAccountListV1AssetsBaseAsset = ACCOUNT.GetIsolatedMarginAccountListV1AssetsBaseAsset; +export type GetIsolatedMarginAccountListV1AssetsQuoteAsset = ACCOUNT.GetIsolatedMarginAccountListV1AssetsQuoteAsset; +export type GetIsolatedMarginAccountListV1Req = ACCOUNT.GetIsolatedMarginAccountListV1Req; +export type GetIsolatedMarginAccountListV1Resp = ACCOUNT.GetIsolatedMarginAccountListV1Resp; +export type GetIsolatedMarginAccountReq = ACCOUNT.GetIsolatedMarginAccountReq; +export type GetIsolatedMarginAccountResp = ACCOUNT.GetIsolatedMarginAccountResp; +export type GetMarginAccountDetailAccounts = ACCOUNT.GetMarginAccountDetailAccounts; +export type GetMarginAccountDetailResp = ACCOUNT.GetMarginAccountDetailResp; +export type GetMarginHFLedgerData = ACCOUNT.GetMarginHFLedgerData; +export type GetMarginHFLedgerReq = ACCOUNT.GetMarginHFLedgerReq; +export type GetMarginHFLedgerResp = ACCOUNT.GetMarginHFLedgerResp; +export type GetSpotAccountDetailReq = ACCOUNT.GetSpotAccountDetailReq; +export type GetSpotAccountDetailResp = ACCOUNT.GetSpotAccountDetailResp; +export type GetSpotAccountListData = ACCOUNT.GetSpotAccountListData; +export type GetSpotAccountListReq = ACCOUNT.GetSpotAccountListReq; +export type GetSpotAccountListResp = ACCOUNT.GetSpotAccountListResp; +export type GetSpotAccountTypeResp = ACCOUNT.GetSpotAccountTypeResp; +export type GetSpotHFLedgerData = ACCOUNT.GetSpotHFLedgerData; +export type GetSpotHFLedgerReq = ACCOUNT.GetSpotHFLedgerReq; +export type GetSpotHFLedgerResp = ACCOUNT.GetSpotHFLedgerResp; +export type GetSpotLedgerItems = ACCOUNT.GetSpotLedgerItems; +export type GetSpotLedgerReq = ACCOUNT.GetSpotLedgerReq; +export type GetSpotLedgerResp = ACCOUNT.GetSpotLedgerResp; +} diff --git a/sdk/node/src/generate/account/deposit/export.template b/sdk/node/src/generate/account/deposit/export.template new file mode 100644 index 00000000..198ae774 --- /dev/null +++ b/sdk/node/src/generate/account/deposit/export.template @@ -0,0 +1,20 @@ +export namespace Deposit { +export type AddDepositAddressV1Req = DEPOSIT.AddDepositAddressV1Req; +export type AddDepositAddressV1Resp = DEPOSIT.AddDepositAddressV1Resp; +export type AddDepositAddressV3Req = DEPOSIT.AddDepositAddressV3Req; +export type AddDepositAddressV3Resp = DEPOSIT.AddDepositAddressV3Resp; +export type GetDepositAddressV1Req = DEPOSIT.GetDepositAddressV1Req; +export type GetDepositAddressV1Resp = DEPOSIT.GetDepositAddressV1Resp; +export type GetDepositAddressV2Data = DEPOSIT.GetDepositAddressV2Data; +export type GetDepositAddressV2Req = DEPOSIT.GetDepositAddressV2Req; +export type GetDepositAddressV2Resp = DEPOSIT.GetDepositAddressV2Resp; +export type GetDepositAddressV3Data = DEPOSIT.GetDepositAddressV3Data; +export type GetDepositAddressV3Req = DEPOSIT.GetDepositAddressV3Req; +export type GetDepositAddressV3Resp = DEPOSIT.GetDepositAddressV3Resp; +export type GetDepositHistoryItems = DEPOSIT.GetDepositHistoryItems; +export type GetDepositHistoryOldItems = DEPOSIT.GetDepositHistoryOldItems; +export type GetDepositHistoryOldReq = DEPOSIT.GetDepositHistoryOldReq; +export type GetDepositHistoryOldResp = DEPOSIT.GetDepositHistoryOldResp; +export type GetDepositHistoryReq = DEPOSIT.GetDepositHistoryReq; +export type GetDepositHistoryResp = DEPOSIT.GetDepositHistoryResp; +} diff --git a/sdk/node/src/generate/account/fee/export.template b/sdk/node/src/generate/account/fee/export.template new file mode 100644 index 00000000..68cfc24d --- /dev/null +++ b/sdk/node/src/generate/account/fee/export.template @@ -0,0 +1,9 @@ +export namespace Fee { +export type GetBasicFeeReq = FEE.GetBasicFeeReq; +export type GetBasicFeeResp = FEE.GetBasicFeeResp; +export type GetFuturesActualFeeReq = FEE.GetFuturesActualFeeReq; +export type GetFuturesActualFeeResp = FEE.GetFuturesActualFeeResp; +export type GetSpotActualFeeData = FEE.GetSpotActualFeeData; +export type GetSpotActualFeeReq = FEE.GetSpotActualFeeReq; +export type GetSpotActualFeeResp = FEE.GetSpotActualFeeResp; +} diff --git a/sdk/node/src/generate/account/index.ts b/sdk/node/src/generate/account/index.ts index 22ce0245..6153b554 100644 --- a/sdk/node/src/generate/account/index.ts +++ b/sdk/node/src/generate/account/index.ts @@ -5,12 +5,12 @@ import * as FEE from './fee'; import * as SUBACCOUNT from './subaccount'; import * as TRANSFER from './transfer'; export const Account = { - ...ACCOUNT, - ...DEPOSIT, - ...WITHDRAWAL, - ...FEE, - ...SUBACCOUNT, - ...TRANSFER, + Account: ACCOUNT, + Deposit: DEPOSIT, + Withdrawal: WITHDRAWAL, + Fee: FEE, + SubAccount: SUBACCOUNT, + Transfer: TRANSFER, }; export namespace Account { export type AccountAPI = ACCOUNT.AccountAPI; @@ -19,4 +19,177 @@ export namespace Account { export type FeeAPI = FEE.FeeAPI; export type SubAccountAPI = SUBACCOUNT.SubAccountAPI; export type TransferAPI = TRANSFER.TransferAPI; + export namespace Deposit { + export type AddDepositAddressV1Req = DEPOSIT.AddDepositAddressV1Req; + export type AddDepositAddressV1Resp = DEPOSIT.AddDepositAddressV1Resp; + export type AddDepositAddressV3Req = DEPOSIT.AddDepositAddressV3Req; + export type AddDepositAddressV3Resp = DEPOSIT.AddDepositAddressV3Resp; + export type GetDepositAddressV1Req = DEPOSIT.GetDepositAddressV1Req; + export type GetDepositAddressV1Resp = DEPOSIT.GetDepositAddressV1Resp; + export type GetDepositAddressV2Data = DEPOSIT.GetDepositAddressV2Data; + export type GetDepositAddressV2Req = DEPOSIT.GetDepositAddressV2Req; + export type GetDepositAddressV2Resp = DEPOSIT.GetDepositAddressV2Resp; + export type GetDepositAddressV3Data = DEPOSIT.GetDepositAddressV3Data; + export type GetDepositAddressV3Req = DEPOSIT.GetDepositAddressV3Req; + export type GetDepositAddressV3Resp = DEPOSIT.GetDepositAddressV3Resp; + export type GetDepositHistoryItems = DEPOSIT.GetDepositHistoryItems; + export type GetDepositHistoryOldItems = DEPOSIT.GetDepositHistoryOldItems; + export type GetDepositHistoryOldReq = DEPOSIT.GetDepositHistoryOldReq; + export type GetDepositHistoryOldResp = DEPOSIT.GetDepositHistoryOldResp; + export type GetDepositHistoryReq = DEPOSIT.GetDepositHistoryReq; + export type GetDepositHistoryResp = DEPOSIT.GetDepositHistoryResp; + } + export namespace Fee { + export type GetBasicFeeReq = FEE.GetBasicFeeReq; + export type GetBasicFeeResp = FEE.GetBasicFeeResp; + export type GetFuturesActualFeeReq = FEE.GetFuturesActualFeeReq; + export type GetFuturesActualFeeResp = FEE.GetFuturesActualFeeResp; + export type GetSpotActualFeeData = FEE.GetSpotActualFeeData; + export type GetSpotActualFeeReq = FEE.GetSpotActualFeeReq; + export type GetSpotActualFeeResp = FEE.GetSpotActualFeeResp; + } + export namespace Withdrawal { + export type CancelWithdrawalReq = WITHDRAWAL.CancelWithdrawalReq; + export type CancelWithdrawalResp = WITHDRAWAL.CancelWithdrawalResp; + export type GetWithdrawalHistoryItems = WITHDRAWAL.GetWithdrawalHistoryItems; + export type GetWithdrawalHistoryOldItems = WITHDRAWAL.GetWithdrawalHistoryOldItems; + export type GetWithdrawalHistoryOldReq = WITHDRAWAL.GetWithdrawalHistoryOldReq; + export type GetWithdrawalHistoryOldResp = WITHDRAWAL.GetWithdrawalHistoryOldResp; + export type GetWithdrawalHistoryReq = WITHDRAWAL.GetWithdrawalHistoryReq; + export type GetWithdrawalHistoryResp = WITHDRAWAL.GetWithdrawalHistoryResp; + export type GetWithdrawalQuotasReq = WITHDRAWAL.GetWithdrawalQuotasReq; + export type GetWithdrawalQuotasResp = WITHDRAWAL.GetWithdrawalQuotasResp; + export type WithdrawalV1Req = WITHDRAWAL.WithdrawalV1Req; + export type WithdrawalV1Resp = WITHDRAWAL.WithdrawalV1Resp; + export type WithdrawalV3Req = WITHDRAWAL.WithdrawalV3Req; + export type WithdrawalV3Resp = WITHDRAWAL.WithdrawalV3Resp; + } + export namespace Transfer { + export type FlexTransferReq = TRANSFER.FlexTransferReq; + export type FlexTransferResp = TRANSFER.FlexTransferResp; + export type FuturesAccountTransferInReq = TRANSFER.FuturesAccountTransferInReq; + export type FuturesAccountTransferInResp = TRANSFER.FuturesAccountTransferInResp; + export type FuturesAccountTransferOutReq = TRANSFER.FuturesAccountTransferOutReq; + export type FuturesAccountTransferOutResp = TRANSFER.FuturesAccountTransferOutResp; + export type GetFuturesAccountTransferOutLedgerItems = + TRANSFER.GetFuturesAccountTransferOutLedgerItems; + export type GetFuturesAccountTransferOutLedgerReq = + TRANSFER.GetFuturesAccountTransferOutLedgerReq; + export type GetFuturesAccountTransferOutLedgerResp = + TRANSFER.GetFuturesAccountTransferOutLedgerResp; + export type GetTransferQuotasReq = TRANSFER.GetTransferQuotasReq; + export type GetTransferQuotasResp = TRANSFER.GetTransferQuotasResp; + export type InnerTransferReq = TRANSFER.InnerTransferReq; + export type InnerTransferResp = TRANSFER.InnerTransferResp; + export type SubAccountTransferReq = TRANSFER.SubAccountTransferReq; + export type SubAccountTransferResp = TRANSFER.SubAccountTransferResp; + } + export namespace SubAccount { + export type AddSubAccountApiReq = SUBACCOUNT.AddSubAccountApiReq; + export type AddSubAccountApiResp = SUBACCOUNT.AddSubAccountApiResp; + export type AddSubAccountFuturesPermissionReq = + SUBACCOUNT.AddSubAccountFuturesPermissionReq; + export type AddSubAccountFuturesPermissionResp = + SUBACCOUNT.AddSubAccountFuturesPermissionResp; + export type AddSubAccountMarginPermissionReq = SUBACCOUNT.AddSubAccountMarginPermissionReq; + export type AddSubAccountMarginPermissionResp = + SUBACCOUNT.AddSubAccountMarginPermissionResp; + export type AddSubAccountReq = SUBACCOUNT.AddSubAccountReq; + export type AddSubAccountResp = SUBACCOUNT.AddSubAccountResp; + export type DeleteSubAccountApiReq = SUBACCOUNT.DeleteSubAccountApiReq; + export type DeleteSubAccountApiResp = SUBACCOUNT.DeleteSubAccountApiResp; + export type GetFuturesSubAccountListV2Accounts = + SUBACCOUNT.GetFuturesSubAccountListV2Accounts; + export type GetFuturesSubAccountListV2Req = SUBACCOUNT.GetFuturesSubAccountListV2Req; + export type GetFuturesSubAccountListV2Resp = SUBACCOUNT.GetFuturesSubAccountListV2Resp; + export type GetFuturesSubAccountListV2Summary = + SUBACCOUNT.GetFuturesSubAccountListV2Summary; + export type GetSpotSubAccountDetailMainAccounts = + SUBACCOUNT.GetSpotSubAccountDetailMainAccounts; + export type GetSpotSubAccountDetailMarginAccounts = + SUBACCOUNT.GetSpotSubAccountDetailMarginAccounts; + export type GetSpotSubAccountDetailReq = SUBACCOUNT.GetSpotSubAccountDetailReq; + export type GetSpotSubAccountDetailResp = SUBACCOUNT.GetSpotSubAccountDetailResp; + export type GetSpotSubAccountDetailTradeAccounts = + SUBACCOUNT.GetSpotSubAccountDetailTradeAccounts; + export type GetSpotSubAccountListV1Data = SUBACCOUNT.GetSpotSubAccountListV1Data; + export type GetSpotSubAccountListV1DataMainAccounts = + SUBACCOUNT.GetSpotSubAccountListV1DataMainAccounts; + export type GetSpotSubAccountListV1DataMarginAccounts = + SUBACCOUNT.GetSpotSubAccountListV1DataMarginAccounts; + export type GetSpotSubAccountListV1DataTradeAccounts = + SUBACCOUNT.GetSpotSubAccountListV1DataTradeAccounts; + export type GetSpotSubAccountListV1Resp = SUBACCOUNT.GetSpotSubAccountListV1Resp; + export type GetSpotSubAccountListV2Items = SUBACCOUNT.GetSpotSubAccountListV2Items; + export type GetSpotSubAccountListV2ItemsMainAccounts = + SUBACCOUNT.GetSpotSubAccountListV2ItemsMainAccounts; + export type GetSpotSubAccountListV2ItemsMarginAccounts = + SUBACCOUNT.GetSpotSubAccountListV2ItemsMarginAccounts; + export type GetSpotSubAccountListV2ItemsTradeAccounts = + SUBACCOUNT.GetSpotSubAccountListV2ItemsTradeAccounts; + export type GetSpotSubAccountListV2Req = SUBACCOUNT.GetSpotSubAccountListV2Req; + export type GetSpotSubAccountListV2Resp = SUBACCOUNT.GetSpotSubAccountListV2Resp; + export type GetSpotSubAccountsSummaryV1Data = SUBACCOUNT.GetSpotSubAccountsSummaryV1Data; + export type GetSpotSubAccountsSummaryV1Resp = SUBACCOUNT.GetSpotSubAccountsSummaryV1Resp; + export type GetSpotSubAccountsSummaryV2Items = SUBACCOUNT.GetSpotSubAccountsSummaryV2Items; + export type GetSpotSubAccountsSummaryV2Req = SUBACCOUNT.GetSpotSubAccountsSummaryV2Req; + export type GetSpotSubAccountsSummaryV2Resp = SUBACCOUNT.GetSpotSubAccountsSummaryV2Resp; + export type GetSubAccountApiListData = SUBACCOUNT.GetSubAccountApiListData; + export type GetSubAccountApiListReq = SUBACCOUNT.GetSubAccountApiListReq; + export type GetSubAccountApiListResp = SUBACCOUNT.GetSubAccountApiListResp; + export type ModifySubAccountApiReq = SUBACCOUNT.ModifySubAccountApiReq; + export type ModifySubAccountApiResp = SUBACCOUNT.ModifySubAccountApiResp; + } + export namespace Account { + export type GetAccountInfoResp = ACCOUNT.GetAccountInfoResp; + export type GetApikeyInfoResp = ACCOUNT.GetApikeyInfoResp; + export type GetCrossMarginAccountAccounts = ACCOUNT.GetCrossMarginAccountAccounts; + export type GetCrossMarginAccountReq = ACCOUNT.GetCrossMarginAccountReq; + export type GetCrossMarginAccountResp = ACCOUNT.GetCrossMarginAccountResp; + export type GetFuturesAccountReq = ACCOUNT.GetFuturesAccountReq; + export type GetFuturesAccountResp = ACCOUNT.GetFuturesAccountResp; + export type GetFuturesLedgerDataList = ACCOUNT.GetFuturesLedgerDataList; + export type GetFuturesLedgerReq = ACCOUNT.GetFuturesLedgerReq; + export type GetFuturesLedgerResp = ACCOUNT.GetFuturesLedgerResp; + export type GetIsolatedMarginAccountAssets = ACCOUNT.GetIsolatedMarginAccountAssets; + export type GetIsolatedMarginAccountAssetsBaseAsset = + ACCOUNT.GetIsolatedMarginAccountAssetsBaseAsset; + export type GetIsolatedMarginAccountAssetsQuoteAsset = + ACCOUNT.GetIsolatedMarginAccountAssetsQuoteAsset; + export type GetIsolatedMarginAccountDetailV1BaseAsset = + ACCOUNT.GetIsolatedMarginAccountDetailV1BaseAsset; + export type GetIsolatedMarginAccountDetailV1QuoteAsset = + ACCOUNT.GetIsolatedMarginAccountDetailV1QuoteAsset; + export type GetIsolatedMarginAccountDetailV1Req = + ACCOUNT.GetIsolatedMarginAccountDetailV1Req; + export type GetIsolatedMarginAccountDetailV1Resp = + ACCOUNT.GetIsolatedMarginAccountDetailV1Resp; + export type GetIsolatedMarginAccountListV1Assets = + ACCOUNT.GetIsolatedMarginAccountListV1Assets; + export type GetIsolatedMarginAccountListV1AssetsBaseAsset = + ACCOUNT.GetIsolatedMarginAccountListV1AssetsBaseAsset; + export type GetIsolatedMarginAccountListV1AssetsQuoteAsset = + ACCOUNT.GetIsolatedMarginAccountListV1AssetsQuoteAsset; + export type GetIsolatedMarginAccountListV1Req = ACCOUNT.GetIsolatedMarginAccountListV1Req; + export type GetIsolatedMarginAccountListV1Resp = ACCOUNT.GetIsolatedMarginAccountListV1Resp; + export type GetIsolatedMarginAccountReq = ACCOUNT.GetIsolatedMarginAccountReq; + export type GetIsolatedMarginAccountResp = ACCOUNT.GetIsolatedMarginAccountResp; + export type GetMarginAccountDetailAccounts = ACCOUNT.GetMarginAccountDetailAccounts; + export type GetMarginAccountDetailResp = ACCOUNT.GetMarginAccountDetailResp; + export type GetMarginHFLedgerData = ACCOUNT.GetMarginHFLedgerData; + export type GetMarginHFLedgerReq = ACCOUNT.GetMarginHFLedgerReq; + export type GetMarginHFLedgerResp = ACCOUNT.GetMarginHFLedgerResp; + export type GetSpotAccountDetailReq = ACCOUNT.GetSpotAccountDetailReq; + export type GetSpotAccountDetailResp = ACCOUNT.GetSpotAccountDetailResp; + export type GetSpotAccountListData = ACCOUNT.GetSpotAccountListData; + export type GetSpotAccountListReq = ACCOUNT.GetSpotAccountListReq; + export type GetSpotAccountListResp = ACCOUNT.GetSpotAccountListResp; + export type GetSpotAccountTypeResp = ACCOUNT.GetSpotAccountTypeResp; + export type GetSpotHFLedgerData = ACCOUNT.GetSpotHFLedgerData; + export type GetSpotHFLedgerReq = ACCOUNT.GetSpotHFLedgerReq; + export type GetSpotHFLedgerResp = ACCOUNT.GetSpotHFLedgerResp; + export type GetSpotLedgerItems = ACCOUNT.GetSpotLedgerItems; + export type GetSpotLedgerReq = ACCOUNT.GetSpotLedgerReq; + export type GetSpotLedgerResp = ACCOUNT.GetSpotLedgerResp; + } } diff --git a/sdk/node/src/generate/account/subaccount/export.template b/sdk/node/src/generate/account/subaccount/export.template new file mode 100644 index 00000000..8496b9c7 --- /dev/null +++ b/sdk/node/src/generate/account/subaccount/export.template @@ -0,0 +1,42 @@ +export namespace SubAccount { +export type AddSubAccountApiReq = SUBACCOUNT.AddSubAccountApiReq; +export type AddSubAccountApiResp = SUBACCOUNT.AddSubAccountApiResp; +export type AddSubAccountFuturesPermissionReq = SUBACCOUNT.AddSubAccountFuturesPermissionReq; +export type AddSubAccountFuturesPermissionResp = SUBACCOUNT.AddSubAccountFuturesPermissionResp; +export type AddSubAccountMarginPermissionReq = SUBACCOUNT.AddSubAccountMarginPermissionReq; +export type AddSubAccountMarginPermissionResp = SUBACCOUNT.AddSubAccountMarginPermissionResp; +export type AddSubAccountReq = SUBACCOUNT.AddSubAccountReq; +export type AddSubAccountResp = SUBACCOUNT.AddSubAccountResp; +export type DeleteSubAccountApiReq = SUBACCOUNT.DeleteSubAccountApiReq; +export type DeleteSubAccountApiResp = SUBACCOUNT.DeleteSubAccountApiResp; +export type GetFuturesSubAccountListV2Accounts = SUBACCOUNT.GetFuturesSubAccountListV2Accounts; +export type GetFuturesSubAccountListV2Req = SUBACCOUNT.GetFuturesSubAccountListV2Req; +export type GetFuturesSubAccountListV2Resp = SUBACCOUNT.GetFuturesSubAccountListV2Resp; +export type GetFuturesSubAccountListV2Summary = SUBACCOUNT.GetFuturesSubAccountListV2Summary; +export type GetSpotSubAccountDetailMainAccounts = SUBACCOUNT.GetSpotSubAccountDetailMainAccounts; +export type GetSpotSubAccountDetailMarginAccounts = SUBACCOUNT.GetSpotSubAccountDetailMarginAccounts; +export type GetSpotSubAccountDetailReq = SUBACCOUNT.GetSpotSubAccountDetailReq; +export type GetSpotSubAccountDetailResp = SUBACCOUNT.GetSpotSubAccountDetailResp; +export type GetSpotSubAccountDetailTradeAccounts = SUBACCOUNT.GetSpotSubAccountDetailTradeAccounts; +export type GetSpotSubAccountListV1Data = SUBACCOUNT.GetSpotSubAccountListV1Data; +export type GetSpotSubAccountListV1DataMainAccounts = SUBACCOUNT.GetSpotSubAccountListV1DataMainAccounts; +export type GetSpotSubAccountListV1DataMarginAccounts = SUBACCOUNT.GetSpotSubAccountListV1DataMarginAccounts; +export type GetSpotSubAccountListV1DataTradeAccounts = SUBACCOUNT.GetSpotSubAccountListV1DataTradeAccounts; +export type GetSpotSubAccountListV1Resp = SUBACCOUNT.GetSpotSubAccountListV1Resp; +export type GetSpotSubAccountListV2Items = SUBACCOUNT.GetSpotSubAccountListV2Items; +export type GetSpotSubAccountListV2ItemsMainAccounts = SUBACCOUNT.GetSpotSubAccountListV2ItemsMainAccounts; +export type GetSpotSubAccountListV2ItemsMarginAccounts = SUBACCOUNT.GetSpotSubAccountListV2ItemsMarginAccounts; +export type GetSpotSubAccountListV2ItemsTradeAccounts = SUBACCOUNT.GetSpotSubAccountListV2ItemsTradeAccounts; +export type GetSpotSubAccountListV2Req = SUBACCOUNT.GetSpotSubAccountListV2Req; +export type GetSpotSubAccountListV2Resp = SUBACCOUNT.GetSpotSubAccountListV2Resp; +export type GetSpotSubAccountsSummaryV1Data = SUBACCOUNT.GetSpotSubAccountsSummaryV1Data; +export type GetSpotSubAccountsSummaryV1Resp = SUBACCOUNT.GetSpotSubAccountsSummaryV1Resp; +export type GetSpotSubAccountsSummaryV2Items = SUBACCOUNT.GetSpotSubAccountsSummaryV2Items; +export type GetSpotSubAccountsSummaryV2Req = SUBACCOUNT.GetSpotSubAccountsSummaryV2Req; +export type GetSpotSubAccountsSummaryV2Resp = SUBACCOUNT.GetSpotSubAccountsSummaryV2Resp; +export type GetSubAccountApiListData = SUBACCOUNT.GetSubAccountApiListData; +export type GetSubAccountApiListReq = SUBACCOUNT.GetSubAccountApiListReq; +export type GetSubAccountApiListResp = SUBACCOUNT.GetSubAccountApiListResp; +export type ModifySubAccountApiReq = SUBACCOUNT.ModifySubAccountApiReq; +export type ModifySubAccountApiResp = SUBACCOUNT.ModifySubAccountApiResp; +} diff --git a/sdk/node/src/generate/account/transfer/export.template b/sdk/node/src/generate/account/transfer/export.template new file mode 100644 index 00000000..82b6ee9e --- /dev/null +++ b/sdk/node/src/generate/account/transfer/export.template @@ -0,0 +1,17 @@ +export namespace Transfer { +export type FlexTransferReq = TRANSFER.FlexTransferReq; +export type FlexTransferResp = TRANSFER.FlexTransferResp; +export type FuturesAccountTransferInReq = TRANSFER.FuturesAccountTransferInReq; +export type FuturesAccountTransferInResp = TRANSFER.FuturesAccountTransferInResp; +export type FuturesAccountTransferOutReq = TRANSFER.FuturesAccountTransferOutReq; +export type FuturesAccountTransferOutResp = TRANSFER.FuturesAccountTransferOutResp; +export type GetFuturesAccountTransferOutLedgerItems = TRANSFER.GetFuturesAccountTransferOutLedgerItems; +export type GetFuturesAccountTransferOutLedgerReq = TRANSFER.GetFuturesAccountTransferOutLedgerReq; +export type GetFuturesAccountTransferOutLedgerResp = TRANSFER.GetFuturesAccountTransferOutLedgerResp; +export type GetTransferQuotasReq = TRANSFER.GetTransferQuotasReq; +export type GetTransferQuotasResp = TRANSFER.GetTransferQuotasResp; +export type InnerTransferReq = TRANSFER.InnerTransferReq; +export type InnerTransferResp = TRANSFER.InnerTransferResp; +export type SubAccountTransferReq = TRANSFER.SubAccountTransferReq; +export type SubAccountTransferResp = TRANSFER.SubAccountTransferResp; +} diff --git a/sdk/node/src/generate/account/withdrawal/export.template b/sdk/node/src/generate/account/withdrawal/export.template new file mode 100644 index 00000000..ccbf28dc --- /dev/null +++ b/sdk/node/src/generate/account/withdrawal/export.template @@ -0,0 +1,16 @@ +export namespace Withdrawal { +export type CancelWithdrawalReq = WITHDRAWAL.CancelWithdrawalReq; +export type CancelWithdrawalResp = WITHDRAWAL.CancelWithdrawalResp; +export type GetWithdrawalHistoryItems = WITHDRAWAL.GetWithdrawalHistoryItems; +export type GetWithdrawalHistoryOldItems = WITHDRAWAL.GetWithdrawalHistoryOldItems; +export type GetWithdrawalHistoryOldReq = WITHDRAWAL.GetWithdrawalHistoryOldReq; +export type GetWithdrawalHistoryOldResp = WITHDRAWAL.GetWithdrawalHistoryOldResp; +export type GetWithdrawalHistoryReq = WITHDRAWAL.GetWithdrawalHistoryReq; +export type GetWithdrawalHistoryResp = WITHDRAWAL.GetWithdrawalHistoryResp; +export type GetWithdrawalQuotasReq = WITHDRAWAL.GetWithdrawalQuotasReq; +export type GetWithdrawalQuotasResp = WITHDRAWAL.GetWithdrawalQuotasResp; +export type WithdrawalV1Req = WITHDRAWAL.WithdrawalV1Req; +export type WithdrawalV1Resp = WITHDRAWAL.WithdrawalV1Resp; +export type WithdrawalV3Req = WITHDRAWAL.WithdrawalV3Req; +export type WithdrawalV3Resp = WITHDRAWAL.WithdrawalV3Resp; +} diff --git a/sdk/node/src/generate/affiliate/affiliate/export.template b/sdk/node/src/generate/affiliate/affiliate/export.template new file mode 100644 index 00000000..ad8593d3 --- /dev/null +++ b/sdk/node/src/generate/affiliate/affiliate/export.template @@ -0,0 +1,6 @@ +export namespace Affiliate { +export type GetAccountLtv = AFFILIATE.GetAccountLtv; +export type GetAccountMargins = AFFILIATE.GetAccountMargins; +export type GetAccountOrders = AFFILIATE.GetAccountOrders; +export type GetAccountResp = AFFILIATE.GetAccountResp; +} diff --git a/sdk/node/src/generate/affiliate/index.ts b/sdk/node/src/generate/affiliate/index.ts index bd347fef..b2af1ef8 100644 --- a/sdk/node/src/generate/affiliate/index.ts +++ b/sdk/node/src/generate/affiliate/index.ts @@ -1,7 +1,13 @@ import * as AFFILIATE from './affiliate'; export const Affiliate = { - ...AFFILIATE, + Affiliate: AFFILIATE, }; export namespace Affiliate { export type AffiliateAPI = AFFILIATE.AffiliateAPI; + export namespace Affiliate { + export type GetAccountLtv = AFFILIATE.GetAccountLtv; + export type GetAccountMargins = AFFILIATE.GetAccountMargins; + export type GetAccountOrders = AFFILIATE.GetAccountOrders; + export type GetAccountResp = AFFILIATE.GetAccountResp; + } } diff --git a/sdk/node/src/generate/broker/apibroker/export.template b/sdk/node/src/generate/broker/apibroker/export.template new file mode 100644 index 00000000..2986a055 --- /dev/null +++ b/sdk/node/src/generate/broker/apibroker/export.template @@ -0,0 +1,4 @@ +export namespace APIBroker { +export type GetRebaseReq = APIBROKER.GetRebaseReq; +export type GetRebaseResp = APIBROKER.GetRebaseResp; +} diff --git a/sdk/node/src/generate/broker/index.ts b/sdk/node/src/generate/broker/index.ts index 650e9b99..3a6d84f5 100644 --- a/sdk/node/src/generate/broker/index.ts +++ b/sdk/node/src/generate/broker/index.ts @@ -1,10 +1,45 @@ import * as APIBROKER from './apibroker'; import * as NDBROKER from './ndbroker'; export const Broker = { - ...APIBROKER, - ...NDBROKER, + APIBroker: APIBROKER, + NDBroker: NDBROKER, }; export namespace Broker { export type APIBrokerAPI = APIBROKER.APIBrokerAPI; export type NDBrokerAPI = NDBROKER.NDBrokerAPI; + export namespace APIBroker { + export type GetRebaseReq = APIBROKER.GetRebaseReq; + export type GetRebaseResp = APIBROKER.GetRebaseResp; + } + export namespace NDBroker { + export type AddSubAccountApiReq = NDBROKER.AddSubAccountApiReq; + export type AddSubAccountApiResp = NDBROKER.AddSubAccountApiResp; + export type AddSubAccountReq = NDBROKER.AddSubAccountReq; + export type AddSubAccountResp = NDBROKER.AddSubAccountResp; + export type DeleteSubAccountAPIReq = NDBROKER.DeleteSubAccountAPIReq; + export type DeleteSubAccountAPIResp = NDBROKER.DeleteSubAccountAPIResp; + export type GetBrokerInfoReq = NDBROKER.GetBrokerInfoReq; + export type GetBrokerInfoResp = NDBROKER.GetBrokerInfoResp; + export type GetDepositDetailReq = NDBROKER.GetDepositDetailReq; + export type GetDepositDetailResp = NDBROKER.GetDepositDetailResp; + export type GetDepositListData = NDBROKER.GetDepositListData; + export type GetDepositListReq = NDBROKER.GetDepositListReq; + export type GetDepositListResp = NDBROKER.GetDepositListResp; + export type GetRebaseReq = NDBROKER.GetRebaseReq; + export type GetRebaseResp = NDBROKER.GetRebaseResp; + export type GetSubAccountAPIData = NDBROKER.GetSubAccountAPIData; + export type GetSubAccountAPIReq = NDBROKER.GetSubAccountAPIReq; + export type GetSubAccountAPIResp = NDBROKER.GetSubAccountAPIResp; + export type GetSubAccountItems = NDBROKER.GetSubAccountItems; + export type GetSubAccountReq = NDBROKER.GetSubAccountReq; + export type GetSubAccountResp = NDBROKER.GetSubAccountResp; + export type GetTransferHistoryReq = NDBROKER.GetTransferHistoryReq; + export type GetTransferHistoryResp = NDBROKER.GetTransferHistoryResp; + export type GetWithdrawDetailReq = NDBROKER.GetWithdrawDetailReq; + export type GetWithdrawDetailResp = NDBROKER.GetWithdrawDetailResp; + export type ModifySubAccountApiReq = NDBROKER.ModifySubAccountApiReq; + export type ModifySubAccountApiResp = NDBROKER.ModifySubAccountApiResp; + export type TransferReq = NDBROKER.TransferReq; + export type TransferResp = NDBROKER.TransferResp; + } } diff --git a/sdk/node/src/generate/broker/ndbroker/export.template b/sdk/node/src/generate/broker/ndbroker/export.template new file mode 100644 index 00000000..cd411510 --- /dev/null +++ b/sdk/node/src/generate/broker/ndbroker/export.template @@ -0,0 +1,31 @@ +export namespace NDBroker { +export type AddSubAccountApiReq = NDBROKER.AddSubAccountApiReq; +export type AddSubAccountApiResp = NDBROKER.AddSubAccountApiResp; +export type AddSubAccountReq = NDBROKER.AddSubAccountReq; +export type AddSubAccountResp = NDBROKER.AddSubAccountResp; +export type DeleteSubAccountAPIReq = NDBROKER.DeleteSubAccountAPIReq; +export type DeleteSubAccountAPIResp = NDBROKER.DeleteSubAccountAPIResp; +export type GetBrokerInfoReq = NDBROKER.GetBrokerInfoReq; +export type GetBrokerInfoResp = NDBROKER.GetBrokerInfoResp; +export type GetDepositDetailReq = NDBROKER.GetDepositDetailReq; +export type GetDepositDetailResp = NDBROKER.GetDepositDetailResp; +export type GetDepositListData = NDBROKER.GetDepositListData; +export type GetDepositListReq = NDBROKER.GetDepositListReq; +export type GetDepositListResp = NDBROKER.GetDepositListResp; +export type GetRebaseReq = NDBROKER.GetRebaseReq; +export type GetRebaseResp = NDBROKER.GetRebaseResp; +export type GetSubAccountAPIData = NDBROKER.GetSubAccountAPIData; +export type GetSubAccountAPIReq = NDBROKER.GetSubAccountAPIReq; +export type GetSubAccountAPIResp = NDBROKER.GetSubAccountAPIResp; +export type GetSubAccountItems = NDBROKER.GetSubAccountItems; +export type GetSubAccountReq = NDBROKER.GetSubAccountReq; +export type GetSubAccountResp = NDBROKER.GetSubAccountResp; +export type GetTransferHistoryReq = NDBROKER.GetTransferHistoryReq; +export type GetTransferHistoryResp = NDBROKER.GetTransferHistoryResp; +export type GetWithdrawDetailReq = NDBROKER.GetWithdrawDetailReq; +export type GetWithdrawDetailResp = NDBROKER.GetWithdrawDetailResp; +export type ModifySubAccountApiReq = NDBROKER.ModifySubAccountApiReq; +export type ModifySubAccountApiResp = NDBROKER.ModifySubAccountApiResp; +export type TransferReq = NDBROKER.TransferReq; +export type TransferResp = NDBROKER.TransferResp; +} diff --git a/sdk/node/src/generate/copytrading/futures/export.template b/sdk/node/src/generate/copytrading/futures/export.template new file mode 100644 index 00000000..c08bee94 --- /dev/null +++ b/sdk/node/src/generate/copytrading/futures/export.template @@ -0,0 +1,24 @@ +export namespace Futures { +export type AddIsolatedMarginReq = FUTURES.AddIsolatedMarginReq; +export type AddIsolatedMarginResp = FUTURES.AddIsolatedMarginResp; +export type AddOrderReq = FUTURES.AddOrderReq; +export type AddOrderResp = FUTURES.AddOrderResp; +export type AddOrderTestReq = FUTURES.AddOrderTestReq; +export type AddOrderTestResp = FUTURES.AddOrderTestResp; +export type AddTPSLOrderReq = FUTURES.AddTPSLOrderReq; +export type AddTPSLOrderResp = FUTURES.AddTPSLOrderResp; +export type CancelOrderByClientOidReq = FUTURES.CancelOrderByClientOidReq; +export type CancelOrderByClientOidResp = FUTURES.CancelOrderByClientOidResp; +export type CancelOrderByIdReq = FUTURES.CancelOrderByIdReq; +export type CancelOrderByIdResp = FUTURES.CancelOrderByIdResp; +export type GetMaxOpenSizeReq = FUTURES.GetMaxOpenSizeReq; +export type GetMaxOpenSizeResp = FUTURES.GetMaxOpenSizeResp; +export type GetMaxWithdrawMarginReq = FUTURES.GetMaxWithdrawMarginReq; +export type GetMaxWithdrawMarginResp = FUTURES.GetMaxWithdrawMarginResp; +export type ModifyAutoDepositStatusReq = FUTURES.ModifyAutoDepositStatusReq; +export type ModifyAutoDepositStatusResp = FUTURES.ModifyAutoDepositStatusResp; +export type ModifyIsolatedMarginRiskLimtReq = FUTURES.ModifyIsolatedMarginRiskLimtReq; +export type ModifyIsolatedMarginRiskLimtResp = FUTURES.ModifyIsolatedMarginRiskLimtResp; +export type RemoveIsolatedMarginReq = FUTURES.RemoveIsolatedMarginReq; +export type RemoveIsolatedMarginResp = FUTURES.RemoveIsolatedMarginResp; +} diff --git a/sdk/node/src/generate/copytrading/index.ts b/sdk/node/src/generate/copytrading/index.ts index a41e1b15..f2a1a264 100644 --- a/sdk/node/src/generate/copytrading/index.ts +++ b/sdk/node/src/generate/copytrading/index.ts @@ -1,7 +1,31 @@ import * as FUTURES from './futures'; export const Copytrading = { - ...FUTURES, + Futures: FUTURES, }; export namespace Copytrading { export type FuturesAPI = FUTURES.FuturesAPI; + export namespace Futures { + export type AddIsolatedMarginReq = FUTURES.AddIsolatedMarginReq; + export type AddIsolatedMarginResp = FUTURES.AddIsolatedMarginResp; + export type AddOrderReq = FUTURES.AddOrderReq; + export type AddOrderResp = FUTURES.AddOrderResp; + export type AddOrderTestReq = FUTURES.AddOrderTestReq; + export type AddOrderTestResp = FUTURES.AddOrderTestResp; + export type AddTPSLOrderReq = FUTURES.AddTPSLOrderReq; + export type AddTPSLOrderResp = FUTURES.AddTPSLOrderResp; + export type CancelOrderByClientOidReq = FUTURES.CancelOrderByClientOidReq; + export type CancelOrderByClientOidResp = FUTURES.CancelOrderByClientOidResp; + export type CancelOrderByIdReq = FUTURES.CancelOrderByIdReq; + export type CancelOrderByIdResp = FUTURES.CancelOrderByIdResp; + export type GetMaxOpenSizeReq = FUTURES.GetMaxOpenSizeReq; + export type GetMaxOpenSizeResp = FUTURES.GetMaxOpenSizeResp; + export type GetMaxWithdrawMarginReq = FUTURES.GetMaxWithdrawMarginReq; + export type GetMaxWithdrawMarginResp = FUTURES.GetMaxWithdrawMarginResp; + export type ModifyAutoDepositStatusReq = FUTURES.ModifyAutoDepositStatusReq; + export type ModifyAutoDepositStatusResp = FUTURES.ModifyAutoDepositStatusResp; + export type ModifyIsolatedMarginRiskLimtReq = FUTURES.ModifyIsolatedMarginRiskLimtReq; + export type ModifyIsolatedMarginRiskLimtResp = FUTURES.ModifyIsolatedMarginRiskLimtResp; + export type RemoveIsolatedMarginReq = FUTURES.RemoveIsolatedMarginReq; + export type RemoveIsolatedMarginResp = FUTURES.RemoveIsolatedMarginResp; + } } diff --git a/sdk/node/src/generate/earn/earn/export.template b/sdk/node/src/generate/earn/earn/export.template new file mode 100644 index 00000000..9e1b2e9b --- /dev/null +++ b/sdk/node/src/generate/earn/earn/export.template @@ -0,0 +1,26 @@ +export namespace Earn { +export type GetAccountHoldingItems = EARN.GetAccountHoldingItems; +export type GetAccountHoldingReq = EARN.GetAccountHoldingReq; +export type GetAccountHoldingResp = EARN.GetAccountHoldingResp; +export type GetETHStakingProductsData = EARN.GetETHStakingProductsData; +export type GetETHStakingProductsReq = EARN.GetETHStakingProductsReq; +export type GetETHStakingProductsResp = EARN.GetETHStakingProductsResp; +export type GetKcsStakingProductsData = EARN.GetKcsStakingProductsData; +export type GetKcsStakingProductsReq = EARN.GetKcsStakingProductsReq; +export type GetKcsStakingProductsResp = EARN.GetKcsStakingProductsResp; +export type GetPromotionProductsData = EARN.GetPromotionProductsData; +export type GetPromotionProductsReq = EARN.GetPromotionProductsReq; +export type GetPromotionProductsResp = EARN.GetPromotionProductsResp; +export type GetRedeemPreviewReq = EARN.GetRedeemPreviewReq; +export type GetRedeemPreviewResp = EARN.GetRedeemPreviewResp; +export type GetSavingsProductsData = EARN.GetSavingsProductsData; +export type GetSavingsProductsReq = EARN.GetSavingsProductsReq; +export type GetSavingsProductsResp = EARN.GetSavingsProductsResp; +export type GetStakingProductsData = EARN.GetStakingProductsData; +export type GetStakingProductsReq = EARN.GetStakingProductsReq; +export type GetStakingProductsResp = EARN.GetStakingProductsResp; +export type PurchaseReq = EARN.PurchaseReq; +export type PurchaseResp = EARN.PurchaseResp; +export type RedeemReq = EARN.RedeemReq; +export type RedeemResp = EARN.RedeemResp; +} diff --git a/sdk/node/src/generate/earn/index.ts b/sdk/node/src/generate/earn/index.ts index 1178265c..21531a17 100644 --- a/sdk/node/src/generate/earn/index.ts +++ b/sdk/node/src/generate/earn/index.ts @@ -1,7 +1,33 @@ import * as EARN from './earn'; export const Earn = { - ...EARN, + Earn: EARN, }; export namespace Earn { export type EarnAPI = EARN.EarnAPI; + export namespace Earn { + export type GetAccountHoldingItems = EARN.GetAccountHoldingItems; + export type GetAccountHoldingReq = EARN.GetAccountHoldingReq; + export type GetAccountHoldingResp = EARN.GetAccountHoldingResp; + export type GetETHStakingProductsData = EARN.GetETHStakingProductsData; + export type GetETHStakingProductsReq = EARN.GetETHStakingProductsReq; + export type GetETHStakingProductsResp = EARN.GetETHStakingProductsResp; + export type GetKcsStakingProductsData = EARN.GetKcsStakingProductsData; + export type GetKcsStakingProductsReq = EARN.GetKcsStakingProductsReq; + export type GetKcsStakingProductsResp = EARN.GetKcsStakingProductsResp; + export type GetPromotionProductsData = EARN.GetPromotionProductsData; + export type GetPromotionProductsReq = EARN.GetPromotionProductsReq; + export type GetPromotionProductsResp = EARN.GetPromotionProductsResp; + export type GetRedeemPreviewReq = EARN.GetRedeemPreviewReq; + export type GetRedeemPreviewResp = EARN.GetRedeemPreviewResp; + export type GetSavingsProductsData = EARN.GetSavingsProductsData; + export type GetSavingsProductsReq = EARN.GetSavingsProductsReq; + export type GetSavingsProductsResp = EARN.GetSavingsProductsResp; + export type GetStakingProductsData = EARN.GetStakingProductsData; + export type GetStakingProductsReq = EARN.GetStakingProductsReq; + export type GetStakingProductsResp = EARN.GetStakingProductsResp; + export type PurchaseReq = EARN.PurchaseReq; + export type PurchaseResp = EARN.PurchaseResp; + export type RedeemReq = EARN.RedeemReq; + export type RedeemResp = EARN.RedeemResp; + } } diff --git a/sdk/node/src/generate/futures/fundingfees/export.template b/sdk/node/src/generate/futures/fundingfees/export.template new file mode 100644 index 00000000..701355d7 --- /dev/null +++ b/sdk/node/src/generate/futures/fundingfees/export.template @@ -0,0 +1,10 @@ +export namespace FundingFees { +export type GetCurrentFundingRateReq = FUNDINGFEES.GetCurrentFundingRateReq; +export type GetCurrentFundingRateResp = FUNDINGFEES.GetCurrentFundingRateResp; +export type GetPrivateFundingHistoryDataList = FUNDINGFEES.GetPrivateFundingHistoryDataList; +export type GetPrivateFundingHistoryReq = FUNDINGFEES.GetPrivateFundingHistoryReq; +export type GetPrivateFundingHistoryResp = FUNDINGFEES.GetPrivateFundingHistoryResp; +export type GetPublicFundingHistoryData = FUNDINGFEES.GetPublicFundingHistoryData; +export type GetPublicFundingHistoryReq = FUNDINGFEES.GetPublicFundingHistoryReq; +export type GetPublicFundingHistoryResp = FUNDINGFEES.GetPublicFundingHistoryResp; +} diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts index fded1da7..49ea891e 100644 --- a/sdk/node/src/generate/futures/index.ts +++ b/sdk/node/src/generate/futures/index.ts @@ -5,12 +5,12 @@ import * as MARKET from './market'; import * as FUTURESPRIVATE from './futuresprivate'; import * as FUTURESPUBLIC from './futurespublic'; export const Futures = { - ...ORDER, - ...POSITIONS, - ...FUNDINGFEES, - ...MARKET, - ...FUTURESPRIVATE, - ...FUTURESPUBLIC, + Order: ORDER, + Positions: POSITIONS, + FundingFees: FUNDINGFEES, + Market: MARKET, + FuturesPrivate: FUTURESPRIVATE, + FuturesPublic: FUTURESPUBLIC, }; export namespace Futures { export type OrderAPI = ORDER.OrderAPI; @@ -19,4 +19,133 @@ export namespace Futures { export type MarketAPI = MARKET.MarketAPI; export type FuturesPrivateWS = FUTURESPRIVATE.FuturesPrivateWS; export type FuturesPublicWS = FUTURESPUBLIC.FuturesPublicWS; + export namespace Order { + export type AddOrderReq = ORDER.AddOrderReq; + export type AddOrderResp = ORDER.AddOrderResp; + export type AddOrderTestReq = ORDER.AddOrderTestReq; + export type AddOrderTestResp = ORDER.AddOrderTestResp; + export type AddTPSLOrderReq = ORDER.AddTPSLOrderReq; + export type AddTPSLOrderResp = ORDER.AddTPSLOrderResp; + export type BatchAddOrdersData = ORDER.BatchAddOrdersData; + export type BatchAddOrdersItem = ORDER.BatchAddOrdersItem; + export type BatchAddOrdersReq = ORDER.BatchAddOrdersReq; + export type BatchAddOrdersResp = ORDER.BatchAddOrdersResp; + export type BatchCancelOrdersClientOidsList = ORDER.BatchCancelOrdersClientOidsList; + export type BatchCancelOrdersData = ORDER.BatchCancelOrdersData; + export type BatchCancelOrdersReq = ORDER.BatchCancelOrdersReq; + export type BatchCancelOrdersResp = ORDER.BatchCancelOrdersResp; + export type CancelAllOrdersV1Req = ORDER.CancelAllOrdersV1Req; + export type CancelAllOrdersV1Resp = ORDER.CancelAllOrdersV1Resp; + export type CancelAllOrdersV3Req = ORDER.CancelAllOrdersV3Req; + export type CancelAllOrdersV3Resp = ORDER.CancelAllOrdersV3Resp; + export type CancelAllStopOrdersReq = ORDER.CancelAllStopOrdersReq; + export type CancelAllStopOrdersResp = ORDER.CancelAllStopOrdersResp; + export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; + export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; + export type CancelOrderByIdReq = ORDER.CancelOrderByIdReq; + export type CancelOrderByIdResp = ORDER.CancelOrderByIdResp; + export type GetOpenOrderValueReq = ORDER.GetOpenOrderValueReq; + export type GetOpenOrderValueResp = ORDER.GetOpenOrderValueResp; + export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; + export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; + export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; + export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; + export type GetOrderListItems = ORDER.GetOrderListItems; + export type GetOrderListReq = ORDER.GetOrderListReq; + export type GetOrderListResp = ORDER.GetOrderListResp; + export type GetRecentClosedOrdersData = ORDER.GetRecentClosedOrdersData; + export type GetRecentClosedOrdersReq = ORDER.GetRecentClosedOrdersReq; + export type GetRecentClosedOrdersResp = ORDER.GetRecentClosedOrdersResp; + export type GetRecentTradeHistoryData = ORDER.GetRecentTradeHistoryData; + export type GetRecentTradeHistoryReq = ORDER.GetRecentTradeHistoryReq; + export type GetRecentTradeHistoryResp = ORDER.GetRecentTradeHistoryResp; + export type GetStopOrderListItems = ORDER.GetStopOrderListItems; + export type GetStopOrderListReq = ORDER.GetStopOrderListReq; + export type GetStopOrderListResp = ORDER.GetStopOrderListResp; + export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; + export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; + export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; + } + export namespace FundingFees { + export type GetCurrentFundingRateReq = FUNDINGFEES.GetCurrentFundingRateReq; + export type GetCurrentFundingRateResp = FUNDINGFEES.GetCurrentFundingRateResp; + export type GetPrivateFundingHistoryDataList = FUNDINGFEES.GetPrivateFundingHistoryDataList; + export type GetPrivateFundingHistoryReq = FUNDINGFEES.GetPrivateFundingHistoryReq; + export type GetPrivateFundingHistoryResp = FUNDINGFEES.GetPrivateFundingHistoryResp; + export type GetPublicFundingHistoryData = FUNDINGFEES.GetPublicFundingHistoryData; + export type GetPublicFundingHistoryReq = FUNDINGFEES.GetPublicFundingHistoryReq; + export type GetPublicFundingHistoryResp = FUNDINGFEES.GetPublicFundingHistoryResp; + } + export namespace Positions { + export type AddIsolatedMarginReq = POSITIONS.AddIsolatedMarginReq; + export type AddIsolatedMarginResp = POSITIONS.AddIsolatedMarginResp; + export type GetCrossMarginLeverageReq = POSITIONS.GetCrossMarginLeverageReq; + export type GetCrossMarginLeverageResp = POSITIONS.GetCrossMarginLeverageResp; + export type GetIsolatedMarginRiskLimitData = POSITIONS.GetIsolatedMarginRiskLimitData; + export type GetIsolatedMarginRiskLimitReq = POSITIONS.GetIsolatedMarginRiskLimitReq; + export type GetIsolatedMarginRiskLimitResp = POSITIONS.GetIsolatedMarginRiskLimitResp; + export type GetMarginModeReq = POSITIONS.GetMarginModeReq; + export type GetMarginModeResp = POSITIONS.GetMarginModeResp; + export type GetMaxOpenSizeReq = POSITIONS.GetMaxOpenSizeReq; + export type GetMaxOpenSizeResp = POSITIONS.GetMaxOpenSizeResp; + export type GetMaxWithdrawMarginReq = POSITIONS.GetMaxWithdrawMarginReq; + export type GetMaxWithdrawMarginResp = POSITIONS.GetMaxWithdrawMarginResp; + export type GetPositionDetailsReq = POSITIONS.GetPositionDetailsReq; + export type GetPositionDetailsResp = POSITIONS.GetPositionDetailsResp; + export type GetPositionListData = POSITIONS.GetPositionListData; + export type GetPositionListReq = POSITIONS.GetPositionListReq; + export type GetPositionListResp = POSITIONS.GetPositionListResp; + export type GetPositionsHistoryItems = POSITIONS.GetPositionsHistoryItems; + export type GetPositionsHistoryReq = POSITIONS.GetPositionsHistoryReq; + export type GetPositionsHistoryResp = POSITIONS.GetPositionsHistoryResp; + export type ModifyAutoDepositStatusReq = POSITIONS.ModifyAutoDepositStatusReq; + export type ModifyAutoDepositStatusResp = POSITIONS.ModifyAutoDepositStatusResp; + export type ModifyIsolatedMarginRiskLimtReq = POSITIONS.ModifyIsolatedMarginRiskLimtReq; + export type ModifyIsolatedMarginRiskLimtResp = POSITIONS.ModifyIsolatedMarginRiskLimtResp; + export type ModifyMarginLeverageReq = POSITIONS.ModifyMarginLeverageReq; + export type ModifyMarginLeverageResp = POSITIONS.ModifyMarginLeverageResp; + export type RemoveIsolatedMarginReq = POSITIONS.RemoveIsolatedMarginReq; + export type RemoveIsolatedMarginResp = POSITIONS.RemoveIsolatedMarginResp; + export type SwitchMarginModeReq = POSITIONS.SwitchMarginModeReq; + export type SwitchMarginModeResp = POSITIONS.SwitchMarginModeResp; + } + export namespace Market { + export type Get24hrStatsResp = MARKET.Get24hrStatsResp; + export type GetAllSymbolsData = MARKET.GetAllSymbolsData; + export type GetAllSymbolsResp = MARKET.GetAllSymbolsResp; + export type GetAllTickersData = MARKET.GetAllTickersData; + export type GetAllTickersResp = MARKET.GetAllTickersResp; + export type GetFullOrderBookReq = MARKET.GetFullOrderBookReq; + export type GetFullOrderBookResp = MARKET.GetFullOrderBookResp; + export type GetInterestRateIndexDataList = MARKET.GetInterestRateIndexDataList; + export type GetInterestRateIndexReq = MARKET.GetInterestRateIndexReq; + export type GetInterestRateIndexResp = MARKET.GetInterestRateIndexResp; + export type GetKlinesReq = MARKET.GetKlinesReq; + export type GetKlinesResp = MARKET.GetKlinesResp; + export type GetMarkPriceReq = MARKET.GetMarkPriceReq; + export type GetMarkPriceResp = MARKET.GetMarkPriceResp; + export type GetPartOrderBookReq = MARKET.GetPartOrderBookReq; + export type GetPartOrderBookResp = MARKET.GetPartOrderBookResp; + export type GetPremiumIndexDataList = MARKET.GetPremiumIndexDataList; + export type GetPremiumIndexReq = MARKET.GetPremiumIndexReq; + export type GetPremiumIndexResp = MARKET.GetPremiumIndexResp; + export type GetPrivateTokenInstanceServers = MARKET.GetPrivateTokenInstanceServers; + export type GetPrivateTokenResp = MARKET.GetPrivateTokenResp; + export type GetPublicTokenInstanceServers = MARKET.GetPublicTokenInstanceServers; + export type GetPublicTokenResp = MARKET.GetPublicTokenResp; + export type GetServerTimeResp = MARKET.GetServerTimeResp; + export type GetServiceStatusResp = MARKET.GetServiceStatusResp; + export type GetSpotIndexPriceDataList = MARKET.GetSpotIndexPriceDataList; + export type GetSpotIndexPriceDataListDecomposionList = + MARKET.GetSpotIndexPriceDataListDecomposionList; + export type GetSpotIndexPriceReq = MARKET.GetSpotIndexPriceReq; + export type GetSpotIndexPriceResp = MARKET.GetSpotIndexPriceResp; + export type GetSymbolReq = MARKET.GetSymbolReq; + export type GetSymbolResp = MARKET.GetSymbolResp; + export type GetTickerReq = MARKET.GetTickerReq; + export type GetTickerResp = MARKET.GetTickerResp; + export type GetTradeHistoryData = MARKET.GetTradeHistoryData; + export type GetTradeHistoryReq = MARKET.GetTradeHistoryReq; + export type GetTradeHistoryResp = MARKET.GetTradeHistoryResp; + } } diff --git a/sdk/node/src/generate/futures/market/export.template b/sdk/node/src/generate/futures/market/export.template new file mode 100644 index 00000000..ddcc984c --- /dev/null +++ b/sdk/node/src/generate/futures/market/export.template @@ -0,0 +1,38 @@ +export namespace Market { +export type Get24hrStatsResp = MARKET.Get24hrStatsResp; +export type GetAllSymbolsData = MARKET.GetAllSymbolsData; +export type GetAllSymbolsResp = MARKET.GetAllSymbolsResp; +export type GetAllTickersData = MARKET.GetAllTickersData; +export type GetAllTickersResp = MARKET.GetAllTickersResp; +export type GetFullOrderBookReq = MARKET.GetFullOrderBookReq; +export type GetFullOrderBookResp = MARKET.GetFullOrderBookResp; +export type GetInterestRateIndexDataList = MARKET.GetInterestRateIndexDataList; +export type GetInterestRateIndexReq = MARKET.GetInterestRateIndexReq; +export type GetInterestRateIndexResp = MARKET.GetInterestRateIndexResp; +export type GetKlinesReq = MARKET.GetKlinesReq; +export type GetKlinesResp = MARKET.GetKlinesResp; +export type GetMarkPriceReq = MARKET.GetMarkPriceReq; +export type GetMarkPriceResp = MARKET.GetMarkPriceResp; +export type GetPartOrderBookReq = MARKET.GetPartOrderBookReq; +export type GetPartOrderBookResp = MARKET.GetPartOrderBookResp; +export type GetPremiumIndexDataList = MARKET.GetPremiumIndexDataList; +export type GetPremiumIndexReq = MARKET.GetPremiumIndexReq; +export type GetPremiumIndexResp = MARKET.GetPremiumIndexResp; +export type GetPrivateTokenInstanceServers = MARKET.GetPrivateTokenInstanceServers; +export type GetPrivateTokenResp = MARKET.GetPrivateTokenResp; +export type GetPublicTokenInstanceServers = MARKET.GetPublicTokenInstanceServers; +export type GetPublicTokenResp = MARKET.GetPublicTokenResp; +export type GetServerTimeResp = MARKET.GetServerTimeResp; +export type GetServiceStatusResp = MARKET.GetServiceStatusResp; +export type GetSpotIndexPriceDataList = MARKET.GetSpotIndexPriceDataList; +export type GetSpotIndexPriceDataListDecomposionList = MARKET.GetSpotIndexPriceDataListDecomposionList; +export type GetSpotIndexPriceReq = MARKET.GetSpotIndexPriceReq; +export type GetSpotIndexPriceResp = MARKET.GetSpotIndexPriceResp; +export type GetSymbolReq = MARKET.GetSymbolReq; +export type GetSymbolResp = MARKET.GetSymbolResp; +export type GetTickerReq = MARKET.GetTickerReq; +export type GetTickerResp = MARKET.GetTickerResp; +export type GetTradeHistoryData = MARKET.GetTradeHistoryData; +export type GetTradeHistoryReq = MARKET.GetTradeHistoryReq; +export type GetTradeHistoryResp = MARKET.GetTradeHistoryResp; +} diff --git a/sdk/node/src/generate/futures/order/export.template b/sdk/node/src/generate/futures/order/export.template new file mode 100644 index 00000000..bd050449 --- /dev/null +++ b/sdk/node/src/generate/futures/order/export.template @@ -0,0 +1,47 @@ +export namespace Order { +export type AddOrderReq = ORDER.AddOrderReq; +export type AddOrderResp = ORDER.AddOrderResp; +export type AddOrderTestReq = ORDER.AddOrderTestReq; +export type AddOrderTestResp = ORDER.AddOrderTestResp; +export type AddTPSLOrderReq = ORDER.AddTPSLOrderReq; +export type AddTPSLOrderResp = ORDER.AddTPSLOrderResp; +export type BatchAddOrdersData = ORDER.BatchAddOrdersData; +export type BatchAddOrdersItem = ORDER.BatchAddOrdersItem; +export type BatchAddOrdersReq = ORDER.BatchAddOrdersReq; +export type BatchAddOrdersResp = ORDER.BatchAddOrdersResp; +export type BatchCancelOrdersClientOidsList = ORDER.BatchCancelOrdersClientOidsList; +export type BatchCancelOrdersData = ORDER.BatchCancelOrdersData; +export type BatchCancelOrdersReq = ORDER.BatchCancelOrdersReq; +export type BatchCancelOrdersResp = ORDER.BatchCancelOrdersResp; +export type CancelAllOrdersV1Req = ORDER.CancelAllOrdersV1Req; +export type CancelAllOrdersV1Resp = ORDER.CancelAllOrdersV1Resp; +export type CancelAllOrdersV3Req = ORDER.CancelAllOrdersV3Req; +export type CancelAllOrdersV3Resp = ORDER.CancelAllOrdersV3Resp; +export type CancelAllStopOrdersReq = ORDER.CancelAllStopOrdersReq; +export type CancelAllStopOrdersResp = ORDER.CancelAllStopOrdersResp; +export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; +export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; +export type CancelOrderByIdReq = ORDER.CancelOrderByIdReq; +export type CancelOrderByIdResp = ORDER.CancelOrderByIdResp; +export type GetOpenOrderValueReq = ORDER.GetOpenOrderValueReq; +export type GetOpenOrderValueResp = ORDER.GetOpenOrderValueResp; +export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; +export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; +export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; +export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; +export type GetOrderListItems = ORDER.GetOrderListItems; +export type GetOrderListReq = ORDER.GetOrderListReq; +export type GetOrderListResp = ORDER.GetOrderListResp; +export type GetRecentClosedOrdersData = ORDER.GetRecentClosedOrdersData; +export type GetRecentClosedOrdersReq = ORDER.GetRecentClosedOrdersReq; +export type GetRecentClosedOrdersResp = ORDER.GetRecentClosedOrdersResp; +export type GetRecentTradeHistoryData = ORDER.GetRecentTradeHistoryData; +export type GetRecentTradeHistoryReq = ORDER.GetRecentTradeHistoryReq; +export type GetRecentTradeHistoryResp = ORDER.GetRecentTradeHistoryResp; +export type GetStopOrderListItems = ORDER.GetStopOrderListItems; +export type GetStopOrderListReq = ORDER.GetStopOrderListReq; +export type GetStopOrderListResp = ORDER.GetStopOrderListResp; +export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; +export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; +export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; +} diff --git a/sdk/node/src/generate/futures/positions/export.template b/sdk/node/src/generate/futures/positions/export.template new file mode 100644 index 00000000..77218cc8 --- /dev/null +++ b/sdk/node/src/generate/futures/positions/export.template @@ -0,0 +1,33 @@ +export namespace Positions { +export type AddIsolatedMarginReq = POSITIONS.AddIsolatedMarginReq; +export type AddIsolatedMarginResp = POSITIONS.AddIsolatedMarginResp; +export type GetCrossMarginLeverageReq = POSITIONS.GetCrossMarginLeverageReq; +export type GetCrossMarginLeverageResp = POSITIONS.GetCrossMarginLeverageResp; +export type GetIsolatedMarginRiskLimitData = POSITIONS.GetIsolatedMarginRiskLimitData; +export type GetIsolatedMarginRiskLimitReq = POSITIONS.GetIsolatedMarginRiskLimitReq; +export type GetIsolatedMarginRiskLimitResp = POSITIONS.GetIsolatedMarginRiskLimitResp; +export type GetMarginModeReq = POSITIONS.GetMarginModeReq; +export type GetMarginModeResp = POSITIONS.GetMarginModeResp; +export type GetMaxOpenSizeReq = POSITIONS.GetMaxOpenSizeReq; +export type GetMaxOpenSizeResp = POSITIONS.GetMaxOpenSizeResp; +export type GetMaxWithdrawMarginReq = POSITIONS.GetMaxWithdrawMarginReq; +export type GetMaxWithdrawMarginResp = POSITIONS.GetMaxWithdrawMarginResp; +export type GetPositionDetailsReq = POSITIONS.GetPositionDetailsReq; +export type GetPositionDetailsResp = POSITIONS.GetPositionDetailsResp; +export type GetPositionListData = POSITIONS.GetPositionListData; +export type GetPositionListReq = POSITIONS.GetPositionListReq; +export type GetPositionListResp = POSITIONS.GetPositionListResp; +export type GetPositionsHistoryItems = POSITIONS.GetPositionsHistoryItems; +export type GetPositionsHistoryReq = POSITIONS.GetPositionsHistoryReq; +export type GetPositionsHistoryResp = POSITIONS.GetPositionsHistoryResp; +export type ModifyAutoDepositStatusReq = POSITIONS.ModifyAutoDepositStatusReq; +export type ModifyAutoDepositStatusResp = POSITIONS.ModifyAutoDepositStatusResp; +export type ModifyIsolatedMarginRiskLimtReq = POSITIONS.ModifyIsolatedMarginRiskLimtReq; +export type ModifyIsolatedMarginRiskLimtResp = POSITIONS.ModifyIsolatedMarginRiskLimtResp; +export type ModifyMarginLeverageReq = POSITIONS.ModifyMarginLeverageReq; +export type ModifyMarginLeverageResp = POSITIONS.ModifyMarginLeverageResp; +export type RemoveIsolatedMarginReq = POSITIONS.RemoveIsolatedMarginReq; +export type RemoveIsolatedMarginResp = POSITIONS.RemoveIsolatedMarginResp; +export type SwitchMarginModeReq = POSITIONS.SwitchMarginModeReq; +export type SwitchMarginModeResp = POSITIONS.SwitchMarginModeResp; +} diff --git a/sdk/node/src/generate/margin/credit/export.template b/sdk/node/src/generate/margin/credit/export.template new file mode 100644 index 00000000..7b0b506e --- /dev/null +++ b/sdk/node/src/generate/margin/credit/export.template @@ -0,0 +1,20 @@ +export namespace Credit { +export type GetLoanMarketData = CREDIT.GetLoanMarketData; +export type GetLoanMarketInterestRateData = CREDIT.GetLoanMarketInterestRateData; +export type GetLoanMarketInterestRateReq = CREDIT.GetLoanMarketInterestRateReq; +export type GetLoanMarketInterestRateResp = CREDIT.GetLoanMarketInterestRateResp; +export type GetLoanMarketReq = CREDIT.GetLoanMarketReq; +export type GetLoanMarketResp = CREDIT.GetLoanMarketResp; +export type GetPurchaseOrdersItems = CREDIT.GetPurchaseOrdersItems; +export type GetPurchaseOrdersReq = CREDIT.GetPurchaseOrdersReq; +export type GetPurchaseOrdersResp = CREDIT.GetPurchaseOrdersResp; +export type GetRedeemOrdersItems = CREDIT.GetRedeemOrdersItems; +export type GetRedeemOrdersReq = CREDIT.GetRedeemOrdersReq; +export type GetRedeemOrdersResp = CREDIT.GetRedeemOrdersResp; +export type ModifyPurchaseReq = CREDIT.ModifyPurchaseReq; +export type ModifyPurchaseResp = CREDIT.ModifyPurchaseResp; +export type PurchaseReq = CREDIT.PurchaseReq; +export type PurchaseResp = CREDIT.PurchaseResp; +export type RedeemReq = CREDIT.RedeemReq; +export type RedeemResp = CREDIT.RedeemResp; +} diff --git a/sdk/node/src/generate/margin/debit/export.template b/sdk/node/src/generate/margin/debit/export.template new file mode 100644 index 00000000..dc59d4ba --- /dev/null +++ b/sdk/node/src/generate/margin/debit/export.template @@ -0,0 +1,17 @@ +export namespace Debit { +export type BorrowReq = DEBIT.BorrowReq; +export type BorrowResp = DEBIT.BorrowResp; +export type GetBorrowHistoryItems = DEBIT.GetBorrowHistoryItems; +export type GetBorrowHistoryReq = DEBIT.GetBorrowHistoryReq; +export type GetBorrowHistoryResp = DEBIT.GetBorrowHistoryResp; +export type GetInterestHistoryItems = DEBIT.GetInterestHistoryItems; +export type GetInterestHistoryReq = DEBIT.GetInterestHistoryReq; +export type GetInterestHistoryResp = DEBIT.GetInterestHistoryResp; +export type GetRepayHistoryItems = DEBIT.GetRepayHistoryItems; +export type GetRepayHistoryReq = DEBIT.GetRepayHistoryReq; +export type GetRepayHistoryResp = DEBIT.GetRepayHistoryResp; +export type ModifyLeverageReq = DEBIT.ModifyLeverageReq; +export type ModifyLeverageResp = DEBIT.ModifyLeverageResp; +export type RepayReq = DEBIT.RepayReq; +export type RepayResp = DEBIT.RepayResp; +} diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts index 8956ec47..1d97b0cf 100644 --- a/sdk/node/src/generate/margin/index.ts +++ b/sdk/node/src/generate/margin/index.ts @@ -6,13 +6,13 @@ import * as RISKLIMIT from './risklimit'; import * as MARGINPRIVATE from './marginprivate'; import * as MARGINPUBLIC from './marginpublic'; export const Margin = { - ...ORDER, - ...DEBIT, - ...CREDIT, - ...MARKET, - ...RISKLIMIT, - ...MARGINPRIVATE, - ...MARGINPUBLIC, + Order: ORDER, + Debit: DEBIT, + Credit: CREDIT, + Market: MARKET, + RiskLimit: RISKLIMIT, + MarginPrivate: MARGINPRIVATE, + MarginPublic: MARGINPUBLIC, }; export namespace Margin { export type OrderAPI = ORDER.OrderAPI; @@ -22,4 +22,92 @@ export namespace Margin { export type RiskLimitAPI = RISKLIMIT.RiskLimitAPI; export type MarginPrivateWS = MARGINPRIVATE.MarginPrivateWS; export type MarginPublicWS = MARGINPUBLIC.MarginPublicWS; + export namespace Order { + export type AddOrderReq = ORDER.AddOrderReq; + export type AddOrderResp = ORDER.AddOrderResp; + export type AddOrderTestReq = ORDER.AddOrderTestReq; + export type AddOrderTestResp = ORDER.AddOrderTestResp; + export type AddOrderTestV1Req = ORDER.AddOrderTestV1Req; + export type AddOrderTestV1Resp = ORDER.AddOrderTestV1Resp; + export type AddOrderV1Req = ORDER.AddOrderV1Req; + export type AddOrderV1Resp = ORDER.AddOrderV1Resp; + export type CancelAllOrdersBySymbolReq = ORDER.CancelAllOrdersBySymbolReq; + export type CancelAllOrdersBySymbolResp = ORDER.CancelAllOrdersBySymbolResp; + export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; + export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; + export type CancelOrderByOrderIdReq = ORDER.CancelOrderByOrderIdReq; + export type CancelOrderByOrderIdResp = ORDER.CancelOrderByOrderIdResp; + export type GetClosedOrdersItems = ORDER.GetClosedOrdersItems; + export type GetClosedOrdersReq = ORDER.GetClosedOrdersReq; + export type GetClosedOrdersResp = ORDER.GetClosedOrdersResp; + export type GetOpenOrdersData = ORDER.GetOpenOrdersData; + export type GetOpenOrdersReq = ORDER.GetOpenOrdersReq; + export type GetOpenOrdersResp = ORDER.GetOpenOrdersResp; + export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; + export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; + export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; + export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; + export type GetSymbolsWithOpenOrderReq = ORDER.GetSymbolsWithOpenOrderReq; + export type GetSymbolsWithOpenOrderResp = ORDER.GetSymbolsWithOpenOrderResp; + export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; + export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; + export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; + } + export namespace Credit { + export type GetLoanMarketData = CREDIT.GetLoanMarketData; + export type GetLoanMarketInterestRateData = CREDIT.GetLoanMarketInterestRateData; + export type GetLoanMarketInterestRateReq = CREDIT.GetLoanMarketInterestRateReq; + export type GetLoanMarketInterestRateResp = CREDIT.GetLoanMarketInterestRateResp; + export type GetLoanMarketReq = CREDIT.GetLoanMarketReq; + export type GetLoanMarketResp = CREDIT.GetLoanMarketResp; + export type GetPurchaseOrdersItems = CREDIT.GetPurchaseOrdersItems; + export type GetPurchaseOrdersReq = CREDIT.GetPurchaseOrdersReq; + export type GetPurchaseOrdersResp = CREDIT.GetPurchaseOrdersResp; + export type GetRedeemOrdersItems = CREDIT.GetRedeemOrdersItems; + export type GetRedeemOrdersReq = CREDIT.GetRedeemOrdersReq; + export type GetRedeemOrdersResp = CREDIT.GetRedeemOrdersResp; + export type ModifyPurchaseReq = CREDIT.ModifyPurchaseReq; + export type ModifyPurchaseResp = CREDIT.ModifyPurchaseResp; + export type PurchaseReq = CREDIT.PurchaseReq; + export type PurchaseResp = CREDIT.PurchaseResp; + export type RedeemReq = CREDIT.RedeemReq; + export type RedeemResp = CREDIT.RedeemResp; + } + export namespace RiskLimit { + export type GetMarginRiskLimitData = RISKLIMIT.GetMarginRiskLimitData; + export type GetMarginRiskLimitReq = RISKLIMIT.GetMarginRiskLimitReq; + export type GetMarginRiskLimitResp = RISKLIMIT.GetMarginRiskLimitResp; + } + export namespace Debit { + export type BorrowReq = DEBIT.BorrowReq; + export type BorrowResp = DEBIT.BorrowResp; + export type GetBorrowHistoryItems = DEBIT.GetBorrowHistoryItems; + export type GetBorrowHistoryReq = DEBIT.GetBorrowHistoryReq; + export type GetBorrowHistoryResp = DEBIT.GetBorrowHistoryResp; + export type GetInterestHistoryItems = DEBIT.GetInterestHistoryItems; + export type GetInterestHistoryReq = DEBIT.GetInterestHistoryReq; + export type GetInterestHistoryResp = DEBIT.GetInterestHistoryResp; + export type GetRepayHistoryItems = DEBIT.GetRepayHistoryItems; + export type GetRepayHistoryReq = DEBIT.GetRepayHistoryReq; + export type GetRepayHistoryResp = DEBIT.GetRepayHistoryResp; + export type ModifyLeverageReq = DEBIT.ModifyLeverageReq; + export type ModifyLeverageResp = DEBIT.ModifyLeverageResp; + export type RepayReq = DEBIT.RepayReq; + export type RepayResp = DEBIT.RepayResp; + } + export namespace Market { + export type GetCrossMarginSymbolsItems = MARKET.GetCrossMarginSymbolsItems; + export type GetCrossMarginSymbolsReq = MARKET.GetCrossMarginSymbolsReq; + export type GetCrossMarginSymbolsResp = MARKET.GetCrossMarginSymbolsResp; + export type GetETFInfoData = MARKET.GetETFInfoData; + export type GetETFInfoReq = MARKET.GetETFInfoReq; + export type GetETFInfoResp = MARKET.GetETFInfoResp; + export type GetIsolatedMarginSymbolsData = MARKET.GetIsolatedMarginSymbolsData; + export type GetIsolatedMarginSymbolsResp = MARKET.GetIsolatedMarginSymbolsResp; + export type GetMarginConfigResp = MARKET.GetMarginConfigResp; + export type GetMarkPriceDetailReq = MARKET.GetMarkPriceDetailReq; + export type GetMarkPriceDetailResp = MARKET.GetMarkPriceDetailResp; + export type GetMarkPriceListData = MARKET.GetMarkPriceListData; + export type GetMarkPriceListResp = MARKET.GetMarkPriceListResp; + } } diff --git a/sdk/node/src/generate/margin/market/export.template b/sdk/node/src/generate/margin/market/export.template new file mode 100644 index 00000000..e23b2f13 --- /dev/null +++ b/sdk/node/src/generate/margin/market/export.template @@ -0,0 +1,15 @@ +export namespace Market { +export type GetCrossMarginSymbolsItems = MARKET.GetCrossMarginSymbolsItems; +export type GetCrossMarginSymbolsReq = MARKET.GetCrossMarginSymbolsReq; +export type GetCrossMarginSymbolsResp = MARKET.GetCrossMarginSymbolsResp; +export type GetETFInfoData = MARKET.GetETFInfoData; +export type GetETFInfoReq = MARKET.GetETFInfoReq; +export type GetETFInfoResp = MARKET.GetETFInfoResp; +export type GetIsolatedMarginSymbolsData = MARKET.GetIsolatedMarginSymbolsData; +export type GetIsolatedMarginSymbolsResp = MARKET.GetIsolatedMarginSymbolsResp; +export type GetMarginConfigResp = MARKET.GetMarginConfigResp; +export type GetMarkPriceDetailReq = MARKET.GetMarkPriceDetailReq; +export type GetMarkPriceDetailResp = MARKET.GetMarkPriceDetailResp; +export type GetMarkPriceListData = MARKET.GetMarkPriceListData; +export type GetMarkPriceListResp = MARKET.GetMarkPriceListResp; +} diff --git a/sdk/node/src/generate/margin/order/export.template b/sdk/node/src/generate/margin/order/export.template new file mode 100644 index 00000000..e86cc74f --- /dev/null +++ b/sdk/node/src/generate/margin/order/export.template @@ -0,0 +1,31 @@ +export namespace Order { +export type AddOrderReq = ORDER.AddOrderReq; +export type AddOrderResp = ORDER.AddOrderResp; +export type AddOrderTestReq = ORDER.AddOrderTestReq; +export type AddOrderTestResp = ORDER.AddOrderTestResp; +export type AddOrderTestV1Req = ORDER.AddOrderTestV1Req; +export type AddOrderTestV1Resp = ORDER.AddOrderTestV1Resp; +export type AddOrderV1Req = ORDER.AddOrderV1Req; +export type AddOrderV1Resp = ORDER.AddOrderV1Resp; +export type CancelAllOrdersBySymbolReq = ORDER.CancelAllOrdersBySymbolReq; +export type CancelAllOrdersBySymbolResp = ORDER.CancelAllOrdersBySymbolResp; +export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; +export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; +export type CancelOrderByOrderIdReq = ORDER.CancelOrderByOrderIdReq; +export type CancelOrderByOrderIdResp = ORDER.CancelOrderByOrderIdResp; +export type GetClosedOrdersItems = ORDER.GetClosedOrdersItems; +export type GetClosedOrdersReq = ORDER.GetClosedOrdersReq; +export type GetClosedOrdersResp = ORDER.GetClosedOrdersResp; +export type GetOpenOrdersData = ORDER.GetOpenOrdersData; +export type GetOpenOrdersReq = ORDER.GetOpenOrdersReq; +export type GetOpenOrdersResp = ORDER.GetOpenOrdersResp; +export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; +export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; +export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; +export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; +export type GetSymbolsWithOpenOrderReq = ORDER.GetSymbolsWithOpenOrderReq; +export type GetSymbolsWithOpenOrderResp = ORDER.GetSymbolsWithOpenOrderResp; +export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; +export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; +export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; +} diff --git a/sdk/node/src/generate/margin/risklimit/export.template b/sdk/node/src/generate/margin/risklimit/export.template new file mode 100644 index 00000000..37a67802 --- /dev/null +++ b/sdk/node/src/generate/margin/risklimit/export.template @@ -0,0 +1,5 @@ +export namespace RiskLimit { +export type GetMarginRiskLimitData = RISKLIMIT.GetMarginRiskLimitData; +export type GetMarginRiskLimitReq = RISKLIMIT.GetMarginRiskLimitReq; +export type GetMarginRiskLimitResp = RISKLIMIT.GetMarginRiskLimitResp; +} diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index 42fc16dc..b7cf3923 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -3,14 +3,167 @@ import * as MARKET from './market'; import * as SPOTPRIVATE from './spotprivate'; import * as SPOTPUBLIC from './spotpublic'; export const Spot = { - ...ORDER, - ...MARKET, - ...SPOTPRIVATE, - ...SPOTPUBLIC, + Order: ORDER, + Market: MARKET, + SpotPrivate: SPOTPRIVATE, + SpotPublic: SPOTPUBLIC, }; export namespace Spot { export type OrderAPI = ORDER.OrderAPI; export type MarketAPI = MARKET.MarketAPI; export type SpotPrivateWS = SPOTPRIVATE.SpotPrivateWS; export type SpotPublicWS = SPOTPUBLIC.SpotPublicWS; + export namespace Order { + export type AddOcoOrderReq = ORDER.AddOcoOrderReq; + export type AddOcoOrderResp = ORDER.AddOcoOrderResp; + export type AddOrderOldReq = ORDER.AddOrderOldReq; + export type AddOrderOldResp = ORDER.AddOrderOldResp; + export type AddOrderReq = ORDER.AddOrderReq; + export type AddOrderResp = ORDER.AddOrderResp; + export type AddOrderSyncReq = ORDER.AddOrderSyncReq; + export type AddOrderSyncResp = ORDER.AddOrderSyncResp; + export type AddOrderTestOldReq = ORDER.AddOrderTestOldReq; + export type AddOrderTestOldResp = ORDER.AddOrderTestOldResp; + export type AddOrderTestReq = ORDER.AddOrderTestReq; + export type AddOrderTestResp = ORDER.AddOrderTestResp; + export type AddStopOrderReq = ORDER.AddStopOrderReq; + export type AddStopOrderResp = ORDER.AddStopOrderResp; + export type BatchAddOrdersData = ORDER.BatchAddOrdersData; + export type BatchAddOrdersOldData = ORDER.BatchAddOrdersOldData; + export type BatchAddOrdersOldOrderList = ORDER.BatchAddOrdersOldOrderList; + export type BatchAddOrdersOldReq = ORDER.BatchAddOrdersOldReq; + export type BatchAddOrdersOldResp = ORDER.BatchAddOrdersOldResp; + export type BatchAddOrdersOrderList = ORDER.BatchAddOrdersOrderList; + export type BatchAddOrdersReq = ORDER.BatchAddOrdersReq; + export type BatchAddOrdersResp = ORDER.BatchAddOrdersResp; + export type BatchAddOrdersSyncData = ORDER.BatchAddOrdersSyncData; + export type BatchAddOrdersSyncOrderList = ORDER.BatchAddOrdersSyncOrderList; + export type BatchAddOrdersSyncReq = ORDER.BatchAddOrdersSyncReq; + export type BatchAddOrdersSyncResp = ORDER.BatchAddOrdersSyncResp; + export type BatchCancelOcoOrdersReq = ORDER.BatchCancelOcoOrdersReq; + export type BatchCancelOcoOrdersResp = ORDER.BatchCancelOcoOrdersResp; + export type BatchCancelOrderOldReq = ORDER.BatchCancelOrderOldReq; + export type BatchCancelOrderOldResp = ORDER.BatchCancelOrderOldResp; + export type BatchCancelStopOrderReq = ORDER.BatchCancelStopOrderReq; + export type BatchCancelStopOrderResp = ORDER.BatchCancelStopOrderResp; + export type CancelAllOrdersBySymbolReq = ORDER.CancelAllOrdersBySymbolReq; + export type CancelAllOrdersBySymbolResp = ORDER.CancelAllOrdersBySymbolResp; + export type CancelAllOrdersFailedSymbols = ORDER.CancelAllOrdersFailedSymbols; + export type CancelAllOrdersResp = ORDER.CancelAllOrdersResp; + export type CancelOcoOrderByClientOidReq = ORDER.CancelOcoOrderByClientOidReq; + export type CancelOcoOrderByClientOidResp = ORDER.CancelOcoOrderByClientOidResp; + export type CancelOcoOrderByOrderIdReq = ORDER.CancelOcoOrderByOrderIdReq; + export type CancelOcoOrderByOrderIdResp = ORDER.CancelOcoOrderByOrderIdResp; + export type CancelOrderByClientOidOldReq = ORDER.CancelOrderByClientOidOldReq; + export type CancelOrderByClientOidOldResp = ORDER.CancelOrderByClientOidOldResp; + export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; + export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; + export type CancelOrderByClientOidSyncReq = ORDER.CancelOrderByClientOidSyncReq; + export type CancelOrderByClientOidSyncResp = ORDER.CancelOrderByClientOidSyncResp; + export type CancelOrderByOrderIdOldReq = ORDER.CancelOrderByOrderIdOldReq; + export type CancelOrderByOrderIdOldResp = ORDER.CancelOrderByOrderIdOldResp; + export type CancelOrderByOrderIdReq = ORDER.CancelOrderByOrderIdReq; + export type CancelOrderByOrderIdResp = ORDER.CancelOrderByOrderIdResp; + export type CancelOrderByOrderIdSyncReq = ORDER.CancelOrderByOrderIdSyncReq; + export type CancelOrderByOrderIdSyncResp = ORDER.CancelOrderByOrderIdSyncResp; + export type CancelPartialOrderReq = ORDER.CancelPartialOrderReq; + export type CancelPartialOrderResp = ORDER.CancelPartialOrderResp; + export type CancelStopOrderByClientOidReq = ORDER.CancelStopOrderByClientOidReq; + export type CancelStopOrderByClientOidResp = ORDER.CancelStopOrderByClientOidResp; + export type CancelStopOrderByOrderIdReq = ORDER.CancelStopOrderByOrderIdReq; + export type CancelStopOrderByOrderIdResp = ORDER.CancelStopOrderByOrderIdResp; + export type GetClosedOrdersItems = ORDER.GetClosedOrdersItems; + export type GetClosedOrdersReq = ORDER.GetClosedOrdersReq; + export type GetClosedOrdersResp = ORDER.GetClosedOrdersResp; + export type GetDCPResp = ORDER.GetDCPResp; + export type GetOcoOrderByClientOidReq = ORDER.GetOcoOrderByClientOidReq; + export type GetOcoOrderByClientOidResp = ORDER.GetOcoOrderByClientOidResp; + export type GetOcoOrderByOrderIdReq = ORDER.GetOcoOrderByOrderIdReq; + export type GetOcoOrderByOrderIdResp = ORDER.GetOcoOrderByOrderIdResp; + export type GetOcoOrderDetailByOrderIdOrders = ORDER.GetOcoOrderDetailByOrderIdOrders; + export type GetOcoOrderDetailByOrderIdReq = ORDER.GetOcoOrderDetailByOrderIdReq; + export type GetOcoOrderDetailByOrderIdResp = ORDER.GetOcoOrderDetailByOrderIdResp; + export type GetOcoOrderListItems = ORDER.GetOcoOrderListItems; + export type GetOcoOrderListReq = ORDER.GetOcoOrderListReq; + export type GetOcoOrderListResp = ORDER.GetOcoOrderListResp; + export type GetOpenOrdersData = ORDER.GetOpenOrdersData; + export type GetOpenOrdersReq = ORDER.GetOpenOrdersReq; + export type GetOpenOrdersResp = ORDER.GetOpenOrdersResp; + export type GetOrderByClientOidOldReq = ORDER.GetOrderByClientOidOldReq; + export type GetOrderByClientOidOldResp = ORDER.GetOrderByClientOidOldResp; + export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; + export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; + export type GetOrderByOrderIdOldReq = ORDER.GetOrderByOrderIdOldReq; + export type GetOrderByOrderIdOldResp = ORDER.GetOrderByOrderIdOldResp; + export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; + export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; + export type GetOrdersListOldItems = ORDER.GetOrdersListOldItems; + export type GetOrdersListOldReq = ORDER.GetOrdersListOldReq; + export type GetOrdersListOldResp = ORDER.GetOrdersListOldResp; + export type GetRecentOrdersListOldData = ORDER.GetRecentOrdersListOldData; + export type GetRecentOrdersListOldReq = ORDER.GetRecentOrdersListOldReq; + export type GetRecentOrdersListOldResp = ORDER.GetRecentOrdersListOldResp; + export type GetRecentTradeHistoryOldData = ORDER.GetRecentTradeHistoryOldData; + export type GetRecentTradeHistoryOldReq = ORDER.GetRecentTradeHistoryOldReq; + export type GetRecentTradeHistoryOldResp = ORDER.GetRecentTradeHistoryOldResp; + export type GetStopOrderByClientOidData = ORDER.GetStopOrderByClientOidData; + export type GetStopOrderByClientOidReq = ORDER.GetStopOrderByClientOidReq; + export type GetStopOrderByClientOidResp = ORDER.GetStopOrderByClientOidResp; + export type GetStopOrderByOrderIdReq = ORDER.GetStopOrderByOrderIdReq; + export type GetStopOrderByOrderIdResp = ORDER.GetStopOrderByOrderIdResp; + export type GetStopOrdersListItems = ORDER.GetStopOrdersListItems; + export type GetStopOrdersListReq = ORDER.GetStopOrdersListReq; + export type GetStopOrdersListResp = ORDER.GetStopOrdersListResp; + export type GetSymbolsWithOpenOrderResp = ORDER.GetSymbolsWithOpenOrderResp; + export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; + export type GetTradeHistoryOldItems = ORDER.GetTradeHistoryOldItems; + export type GetTradeHistoryOldReq = ORDER.GetTradeHistoryOldReq; + export type GetTradeHistoryOldResp = ORDER.GetTradeHistoryOldResp; + export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; + export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; + export type ModifyOrderReq = ORDER.ModifyOrderReq; + export type ModifyOrderResp = ORDER.ModifyOrderResp; + export type SetDCPReq = ORDER.SetDCPReq; + export type SetDCPResp = ORDER.SetDCPResp; + } + export namespace Market { + export type Get24hrStatsReq = MARKET.Get24hrStatsReq; + export type Get24hrStatsResp = MARKET.Get24hrStatsResp; + export type GetAllCurrenciesData = MARKET.GetAllCurrenciesData; + export type GetAllCurrenciesDataChains = MARKET.GetAllCurrenciesDataChains; + export type GetAllCurrenciesResp = MARKET.GetAllCurrenciesResp; + export type GetAllSymbolsData = MARKET.GetAllSymbolsData; + export type GetAllSymbolsReq = MARKET.GetAllSymbolsReq; + export type GetAllSymbolsResp = MARKET.GetAllSymbolsResp; + export type GetAllTickersResp = MARKET.GetAllTickersResp; + export type GetAllTickersTicker = MARKET.GetAllTickersTicker; + export type GetAnnouncementsItems = MARKET.GetAnnouncementsItems; + export type GetAnnouncementsReq = MARKET.GetAnnouncementsReq; + export type GetAnnouncementsResp = MARKET.GetAnnouncementsResp; + export type GetCurrencyChains = MARKET.GetCurrencyChains; + export type GetCurrencyReq = MARKET.GetCurrencyReq; + export type GetCurrencyResp = MARKET.GetCurrencyResp; + export type GetFiatPriceReq = MARKET.GetFiatPriceReq; + export type GetFiatPriceResp = MARKET.GetFiatPriceResp; + export type GetFullOrderBookReq = MARKET.GetFullOrderBookReq; + export type GetFullOrderBookResp = MARKET.GetFullOrderBookResp; + export type GetKlinesReq = MARKET.GetKlinesReq; + export type GetKlinesResp = MARKET.GetKlinesResp; + export type GetMarketListResp = MARKET.GetMarketListResp; + export type GetPartOrderBookReq = MARKET.GetPartOrderBookReq; + export type GetPartOrderBookResp = MARKET.GetPartOrderBookResp; + export type GetPrivateTokenInstanceServers = MARKET.GetPrivateTokenInstanceServers; + export type GetPrivateTokenResp = MARKET.GetPrivateTokenResp; + export type GetPublicTokenInstanceServers = MARKET.GetPublicTokenInstanceServers; + export type GetPublicTokenResp = MARKET.GetPublicTokenResp; + export type GetServerTimeResp = MARKET.GetServerTimeResp; + export type GetServiceStatusResp = MARKET.GetServiceStatusResp; + export type GetSymbolReq = MARKET.GetSymbolReq; + export type GetSymbolResp = MARKET.GetSymbolResp; + export type GetTickerReq = MARKET.GetTickerReq; + export type GetTickerResp = MARKET.GetTickerResp; + export type GetTradeHistoryData = MARKET.GetTradeHistoryData; + export type GetTradeHistoryReq = MARKET.GetTradeHistoryReq; + export type GetTradeHistoryResp = MARKET.GetTradeHistoryResp; + } } diff --git a/sdk/node/src/generate/spot/market/export.template b/sdk/node/src/generate/spot/market/export.template new file mode 100644 index 00000000..e1fcbff5 --- /dev/null +++ b/sdk/node/src/generate/spot/market/export.template @@ -0,0 +1,40 @@ +export namespace Market { +export type Get24hrStatsReq = MARKET.Get24hrStatsReq; +export type Get24hrStatsResp = MARKET.Get24hrStatsResp; +export type GetAllCurrenciesData = MARKET.GetAllCurrenciesData; +export type GetAllCurrenciesDataChains = MARKET.GetAllCurrenciesDataChains; +export type GetAllCurrenciesResp = MARKET.GetAllCurrenciesResp; +export type GetAllSymbolsData = MARKET.GetAllSymbolsData; +export type GetAllSymbolsReq = MARKET.GetAllSymbolsReq; +export type GetAllSymbolsResp = MARKET.GetAllSymbolsResp; +export type GetAllTickersResp = MARKET.GetAllTickersResp; +export type GetAllTickersTicker = MARKET.GetAllTickersTicker; +export type GetAnnouncementsItems = MARKET.GetAnnouncementsItems; +export type GetAnnouncementsReq = MARKET.GetAnnouncementsReq; +export type GetAnnouncementsResp = MARKET.GetAnnouncementsResp; +export type GetCurrencyChains = MARKET.GetCurrencyChains; +export type GetCurrencyReq = MARKET.GetCurrencyReq; +export type GetCurrencyResp = MARKET.GetCurrencyResp; +export type GetFiatPriceReq = MARKET.GetFiatPriceReq; +export type GetFiatPriceResp = MARKET.GetFiatPriceResp; +export type GetFullOrderBookReq = MARKET.GetFullOrderBookReq; +export type GetFullOrderBookResp = MARKET.GetFullOrderBookResp; +export type GetKlinesReq = MARKET.GetKlinesReq; +export type GetKlinesResp = MARKET.GetKlinesResp; +export type GetMarketListResp = MARKET.GetMarketListResp; +export type GetPartOrderBookReq = MARKET.GetPartOrderBookReq; +export type GetPartOrderBookResp = MARKET.GetPartOrderBookResp; +export type GetPrivateTokenInstanceServers = MARKET.GetPrivateTokenInstanceServers; +export type GetPrivateTokenResp = MARKET.GetPrivateTokenResp; +export type GetPublicTokenInstanceServers = MARKET.GetPublicTokenInstanceServers; +export type GetPublicTokenResp = MARKET.GetPublicTokenResp; +export type GetServerTimeResp = MARKET.GetServerTimeResp; +export type GetServiceStatusResp = MARKET.GetServiceStatusResp; +export type GetSymbolReq = MARKET.GetSymbolReq; +export type GetSymbolResp = MARKET.GetSymbolResp; +export type GetTickerReq = MARKET.GetTickerReq; +export type GetTickerResp = MARKET.GetTickerResp; +export type GetTradeHistoryData = MARKET.GetTradeHistoryData; +export type GetTradeHistoryReq = MARKET.GetTradeHistoryReq; +export type GetTradeHistoryResp = MARKET.GetTradeHistoryResp; +} diff --git a/sdk/node/src/generate/spot/order/export.template b/sdk/node/src/generate/spot/order/export.template new file mode 100644 index 00000000..2e26d6ae --- /dev/null +++ b/sdk/node/src/generate/spot/order/export.template @@ -0,0 +1,113 @@ +export namespace Order { +export type AddOcoOrderReq = ORDER.AddOcoOrderReq; +export type AddOcoOrderResp = ORDER.AddOcoOrderResp; +export type AddOrderOldReq = ORDER.AddOrderOldReq; +export type AddOrderOldResp = ORDER.AddOrderOldResp; +export type AddOrderReq = ORDER.AddOrderReq; +export type AddOrderResp = ORDER.AddOrderResp; +export type AddOrderSyncReq = ORDER.AddOrderSyncReq; +export type AddOrderSyncResp = ORDER.AddOrderSyncResp; +export type AddOrderTestOldReq = ORDER.AddOrderTestOldReq; +export type AddOrderTestOldResp = ORDER.AddOrderTestOldResp; +export type AddOrderTestReq = ORDER.AddOrderTestReq; +export type AddOrderTestResp = ORDER.AddOrderTestResp; +export type AddStopOrderReq = ORDER.AddStopOrderReq; +export type AddStopOrderResp = ORDER.AddStopOrderResp; +export type BatchAddOrdersData = ORDER.BatchAddOrdersData; +export type BatchAddOrdersOldData = ORDER.BatchAddOrdersOldData; +export type BatchAddOrdersOldOrderList = ORDER.BatchAddOrdersOldOrderList; +export type BatchAddOrdersOldReq = ORDER.BatchAddOrdersOldReq; +export type BatchAddOrdersOldResp = ORDER.BatchAddOrdersOldResp; +export type BatchAddOrdersOrderList = ORDER.BatchAddOrdersOrderList; +export type BatchAddOrdersReq = ORDER.BatchAddOrdersReq; +export type BatchAddOrdersResp = ORDER.BatchAddOrdersResp; +export type BatchAddOrdersSyncData = ORDER.BatchAddOrdersSyncData; +export type BatchAddOrdersSyncOrderList = ORDER.BatchAddOrdersSyncOrderList; +export type BatchAddOrdersSyncReq = ORDER.BatchAddOrdersSyncReq; +export type BatchAddOrdersSyncResp = ORDER.BatchAddOrdersSyncResp; +export type BatchCancelOcoOrdersReq = ORDER.BatchCancelOcoOrdersReq; +export type BatchCancelOcoOrdersResp = ORDER.BatchCancelOcoOrdersResp; +export type BatchCancelOrderOldReq = ORDER.BatchCancelOrderOldReq; +export type BatchCancelOrderOldResp = ORDER.BatchCancelOrderOldResp; +export type BatchCancelStopOrderReq = ORDER.BatchCancelStopOrderReq; +export type BatchCancelStopOrderResp = ORDER.BatchCancelStopOrderResp; +export type CancelAllOrdersBySymbolReq = ORDER.CancelAllOrdersBySymbolReq; +export type CancelAllOrdersBySymbolResp = ORDER.CancelAllOrdersBySymbolResp; +export type CancelAllOrdersFailedSymbols = ORDER.CancelAllOrdersFailedSymbols; +export type CancelAllOrdersResp = ORDER.CancelAllOrdersResp; +export type CancelOcoOrderByClientOidReq = ORDER.CancelOcoOrderByClientOidReq; +export type CancelOcoOrderByClientOidResp = ORDER.CancelOcoOrderByClientOidResp; +export type CancelOcoOrderByOrderIdReq = ORDER.CancelOcoOrderByOrderIdReq; +export type CancelOcoOrderByOrderIdResp = ORDER.CancelOcoOrderByOrderIdResp; +export type CancelOrderByClientOidOldReq = ORDER.CancelOrderByClientOidOldReq; +export type CancelOrderByClientOidOldResp = ORDER.CancelOrderByClientOidOldResp; +export type CancelOrderByClientOidReq = ORDER.CancelOrderByClientOidReq; +export type CancelOrderByClientOidResp = ORDER.CancelOrderByClientOidResp; +export type CancelOrderByClientOidSyncReq = ORDER.CancelOrderByClientOidSyncReq; +export type CancelOrderByClientOidSyncResp = ORDER.CancelOrderByClientOidSyncResp; +export type CancelOrderByOrderIdOldReq = ORDER.CancelOrderByOrderIdOldReq; +export type CancelOrderByOrderIdOldResp = ORDER.CancelOrderByOrderIdOldResp; +export type CancelOrderByOrderIdReq = ORDER.CancelOrderByOrderIdReq; +export type CancelOrderByOrderIdResp = ORDER.CancelOrderByOrderIdResp; +export type CancelOrderByOrderIdSyncReq = ORDER.CancelOrderByOrderIdSyncReq; +export type CancelOrderByOrderIdSyncResp = ORDER.CancelOrderByOrderIdSyncResp; +export type CancelPartialOrderReq = ORDER.CancelPartialOrderReq; +export type CancelPartialOrderResp = ORDER.CancelPartialOrderResp; +export type CancelStopOrderByClientOidReq = ORDER.CancelStopOrderByClientOidReq; +export type CancelStopOrderByClientOidResp = ORDER.CancelStopOrderByClientOidResp; +export type CancelStopOrderByOrderIdReq = ORDER.CancelStopOrderByOrderIdReq; +export type CancelStopOrderByOrderIdResp = ORDER.CancelStopOrderByOrderIdResp; +export type GetClosedOrdersItems = ORDER.GetClosedOrdersItems; +export type GetClosedOrdersReq = ORDER.GetClosedOrdersReq; +export type GetClosedOrdersResp = ORDER.GetClosedOrdersResp; +export type GetDCPResp = ORDER.GetDCPResp; +export type GetOcoOrderByClientOidReq = ORDER.GetOcoOrderByClientOidReq; +export type GetOcoOrderByClientOidResp = ORDER.GetOcoOrderByClientOidResp; +export type GetOcoOrderByOrderIdReq = ORDER.GetOcoOrderByOrderIdReq; +export type GetOcoOrderByOrderIdResp = ORDER.GetOcoOrderByOrderIdResp; +export type GetOcoOrderDetailByOrderIdOrders = ORDER.GetOcoOrderDetailByOrderIdOrders; +export type GetOcoOrderDetailByOrderIdReq = ORDER.GetOcoOrderDetailByOrderIdReq; +export type GetOcoOrderDetailByOrderIdResp = ORDER.GetOcoOrderDetailByOrderIdResp; +export type GetOcoOrderListItems = ORDER.GetOcoOrderListItems; +export type GetOcoOrderListReq = ORDER.GetOcoOrderListReq; +export type GetOcoOrderListResp = ORDER.GetOcoOrderListResp; +export type GetOpenOrdersData = ORDER.GetOpenOrdersData; +export type GetOpenOrdersReq = ORDER.GetOpenOrdersReq; +export type GetOpenOrdersResp = ORDER.GetOpenOrdersResp; +export type GetOrderByClientOidOldReq = ORDER.GetOrderByClientOidOldReq; +export type GetOrderByClientOidOldResp = ORDER.GetOrderByClientOidOldResp; +export type GetOrderByClientOidReq = ORDER.GetOrderByClientOidReq; +export type GetOrderByClientOidResp = ORDER.GetOrderByClientOidResp; +export type GetOrderByOrderIdOldReq = ORDER.GetOrderByOrderIdOldReq; +export type GetOrderByOrderIdOldResp = ORDER.GetOrderByOrderIdOldResp; +export type GetOrderByOrderIdReq = ORDER.GetOrderByOrderIdReq; +export type GetOrderByOrderIdResp = ORDER.GetOrderByOrderIdResp; +export type GetOrdersListOldItems = ORDER.GetOrdersListOldItems; +export type GetOrdersListOldReq = ORDER.GetOrdersListOldReq; +export type GetOrdersListOldResp = ORDER.GetOrdersListOldResp; +export type GetRecentOrdersListOldData = ORDER.GetRecentOrdersListOldData; +export type GetRecentOrdersListOldReq = ORDER.GetRecentOrdersListOldReq; +export type GetRecentOrdersListOldResp = ORDER.GetRecentOrdersListOldResp; +export type GetRecentTradeHistoryOldData = ORDER.GetRecentTradeHistoryOldData; +export type GetRecentTradeHistoryOldReq = ORDER.GetRecentTradeHistoryOldReq; +export type GetRecentTradeHistoryOldResp = ORDER.GetRecentTradeHistoryOldResp; +export type GetStopOrderByClientOidData = ORDER.GetStopOrderByClientOidData; +export type GetStopOrderByClientOidReq = ORDER.GetStopOrderByClientOidReq; +export type GetStopOrderByClientOidResp = ORDER.GetStopOrderByClientOidResp; +export type GetStopOrderByOrderIdReq = ORDER.GetStopOrderByOrderIdReq; +export type GetStopOrderByOrderIdResp = ORDER.GetStopOrderByOrderIdResp; +export type GetStopOrdersListItems = ORDER.GetStopOrdersListItems; +export type GetStopOrdersListReq = ORDER.GetStopOrdersListReq; +export type GetStopOrdersListResp = ORDER.GetStopOrdersListResp; +export type GetSymbolsWithOpenOrderResp = ORDER.GetSymbolsWithOpenOrderResp; +export type GetTradeHistoryItems = ORDER.GetTradeHistoryItems; +export type GetTradeHistoryOldItems = ORDER.GetTradeHistoryOldItems; +export type GetTradeHistoryOldReq = ORDER.GetTradeHistoryOldReq; +export type GetTradeHistoryOldResp = ORDER.GetTradeHistoryOldResp; +export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; +export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; +export type ModifyOrderReq = ORDER.ModifyOrderReq; +export type ModifyOrderResp = ORDER.ModifyOrderResp; +export type SetDCPReq = ORDER.SetDCPReq; +export type SetDCPResp = ORDER.SetDCPResp; +} diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index a7fcebc8..4a9473e2 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-02-14'; +export const SdkGenerateDate = '2025-02-17'; diff --git a/sdk/node/src/generate/viplending/index.ts b/sdk/node/src/generate/viplending/index.ts index f500c95f..a9109ea4 100644 --- a/sdk/node/src/generate/viplending/index.ts +++ b/sdk/node/src/generate/viplending/index.ts @@ -1,7 +1,15 @@ import * as VIPLENDING from './viplending'; export const Viplending = { - ...VIPLENDING, + VIPLending: VIPLENDING, }; export namespace Viplending { export type VIPLendingAPI = VIPLENDING.VIPLendingAPI; + export namespace VIPLending { + export type GetAccountDetailLtv = VIPLENDING.GetAccountDetailLtv; + export type GetAccountDetailMargins = VIPLENDING.GetAccountDetailMargins; + export type GetAccountDetailOrders = VIPLENDING.GetAccountDetailOrders; + export type GetAccountDetailResp = VIPLENDING.GetAccountDetailResp; + export type GetAccountsData = VIPLENDING.GetAccountsData; + export type GetAccountsResp = VIPLENDING.GetAccountsResp; + } } diff --git a/sdk/node/src/generate/viplending/viplending/export.template b/sdk/node/src/generate/viplending/viplending/export.template new file mode 100644 index 00000000..72e76d9d --- /dev/null +++ b/sdk/node/src/generate/viplending/viplending/export.template @@ -0,0 +1,8 @@ +export namespace VIPLending { +export type GetAccountDetailLtv = VIPLENDING.GetAccountDetailLtv; +export type GetAccountDetailMargins = VIPLENDING.GetAccountDetailMargins; +export type GetAccountDetailOrders = VIPLENDING.GetAccountDetailOrders; +export type GetAccountDetailResp = VIPLENDING.GetAccountDetailResp; +export type GetAccountsData = VIPLENDING.GetAccountsData; +export type GetAccountsResp = VIPLENDING.GetAccountsResp; +} From dd6c7468207ae7ecccc4891e8e9da6c8b4102183 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 18 Feb 2025 11:47:49 +0800 Subject: [PATCH 083/106] feat(nodejs): fix api --- sdk/node/example/src/js/example_api.js | 16 +++++++------- .../src/internal/infra/default_transport.ts | 22 ++++++++++++++++--- .../e2e/rest/account_test/account_fee.test.ts | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/sdk/node/example/src/js/example_api.js b/sdk/node/example/src/js/example_api.js index da2cfac8..6ec6fe88 100644 --- a/sdk/node/example/src/js/example_api.js +++ b/sdk/node/example/src/js/example_api.js @@ -66,7 +66,7 @@ async function accountServiceExample(accountService) { // Get fee api const feeApi = accountService.getFeeApi(); - const getActualFeeReq = Account.GetSpotActualFeeReq.builder() + const getActualFeeReq = Account.Fee.GetSpotActualFeeReq.builder() .setSymbols('BTC-USDT,ETH-USDT') .build(); @@ -89,11 +89,11 @@ async function spotServiceExample(spotService) { const orderApi = spotService.getOrderApi(); // Add limit order - const addOrderReq = Spot.AddOrderSyncReq.builder() + const addOrderReq = Spot.Order.AddOrderSyncReq.builder() .setClientOid(randomUUID().toString()) - .setSide(Spot.AddOrderSyncReq.SideEnum.BUY) + .setSide(Spot.Order.AddOrderSyncReq.SideEnum.BUY) .setSymbol('BTC-USDT') - .setType(Spot.AddOrderSyncReq.TypeEnum.LIMIT) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) .setRemark('sdk_example') .setPrice('10000') .setSize('0.001') @@ -104,7 +104,7 @@ async function spotServiceExample(spotService) { // Query order detail const orderId = addOrderResp.orderId; - const queryOrderDetailReq = Spot.GetOrderByOrderIdReq.builder() + const queryOrderDetailReq = Spot.Order.GetOrderByOrderIdReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -112,7 +112,7 @@ async function spotServiceExample(spotService) { console.log(`Order detail: ${JSON.stringify(orderDetailResp)}`); // Cancel order - const cancelOrderReq = Spot.CancelOrderByOrderIdSyncReq.builder() + const cancelOrderReq = Spot.Order.CancelOrderByOrderIdSyncReq.builder() .setOrderId(orderId) .setSymbol('BTC-USDT') .build(); @@ -130,9 +130,9 @@ async function futuresServiceExample(futuresService) { const start = Date.now() - 10 * 60 * 1000; const end = Date.now(); - const getKlineReq = Futures.GetKlinesReq.builder() + const getKlineReq = Futures.Market.GetKlinesReq.builder() .setSymbol(symbol.symbol) - .setGranularity(Futures.GetKlinesReq.GranularityEnum._1) + .setGranularity(Futures.Market.GetKlinesReq.GranularityEnum._1) .setFrom(start) .setTo(end) .build(); diff --git a/sdk/node/src/internal/infra/default_transport.ts b/sdk/node/src/internal/infra/default_transport.ts index 91a1e551..f43ea060 100644 --- a/sdk/node/src/internal/infra/default_transport.ts +++ b/sdk/node/src/internal/infra/default_transport.ts @@ -175,7 +175,7 @@ export class DefaultTransport implements Transport { }); } - private rawQuery(queryDict: Record): string { + private encodeQuery(queryDict: Record): string { return Object.entries(queryDict) .map(([key, value]) => { if (Array.isArray(value)) { @@ -186,6 +186,17 @@ export class DefaultTransport implements Transport { .join('&'); } + private rawQuery(queryDict: Record): string { + return Object.entries(queryDict) + .map(([key, value]) => { + if (Array.isArray(value)) { + return value.map((val) => `${key}=${val}`).join('&'); + } + return `${key}=${value}`; + }) + .join('&'); + } + private processRequest( requestObj: Serializable | null, broker: boolean, @@ -200,6 +211,7 @@ export class DefaultTransport implements Transport { const rawUrl = path; let reqBody = null; let queryPath = path; + let rawPath = path; if (requestAsJson) { if (requestObj) { @@ -221,10 +233,14 @@ export class DefaultTransport implements Transport { } } - const queryParams = this.rawQuery(queryObj); + const queryParams = this.encodeQuery(queryObj); + const rawParams = this.rawQuery(queryObj); if (queryParams) { queryPath = `${path}?${queryParams}`; } + if (rawParams) { + rawPath = `${path}?${rawParams}`; + } } } else if (method === 'POST') { if (requestObj) { @@ -249,7 +265,7 @@ export class DefaultTransport implements Transport { } // Use queryPath instead of rawUrl for signature - this.processHeaders(reqBody, queryPath, config, method, broker); + this.processHeaders(reqBody, rawPath, config, method, broker); return config; } diff --git a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts index 78968f7e..ece0e960 100644 --- a/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts +++ b/sdk/node/tests/e2e/rest/account_test/account_fee.test.ts @@ -65,7 +65,7 @@ describe('Auto Test', () => { * /api/v1/trade-fees */ let builder = GetSpotActualFeeReq.builder(); - builder.setSymbols('BTC-USDT'); + builder.setSymbols('BTC-USDT,ETH-USDT'); let req = builder.build(); let resp = api.getSpotActualFee(req); return resp.then(result => { From 72db4398f0240d0ef7c62af6f1f686b793e48130 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Tue, 18 Feb 2025 11:59:10 +0800 Subject: [PATCH 084/106] test(nodejs): add some websocket test --- sdk/node/tests/robustness/ws/resource.test.ts | 134 +++++++++++++++++- 1 file changed, 128 insertions(+), 6 deletions(-) diff --git a/sdk/node/tests/robustness/ws/resource.test.ts b/sdk/node/tests/robustness/ws/resource.test.ts index 12513c1a..6d552c20 100644 --- a/sdk/node/tests/robustness/ws/resource.test.ts +++ b/sdk/node/tests/robustness/ws/resource.test.ts @@ -11,14 +11,27 @@ import { promisify } from 'util'; import { TickerEvent } from '@generate/spot/spotpublic/model_ticker_event'; import { TickerV2Event } from '@generate/futures/futurespublic/model_ticker_v2_event'; import { WebSocketEvent } from '@model/websocket_option'; +import { platform } from 'os'; const execAsync = promisify(exec); - async function getProcessTCPConnections(): Promise { try { - const { stdout } = await execAsync(`ss -tn | grep ESTAB | wc -l`); - return parseInt(stdout.trim(), 10); + const isWindows = platform() === 'win32'; + let command = ''; + + if (isWindows) { + // Windows + command = `cmd.exe /c "chcp 437 > nul && netstat -n"`; + const { stdout } = await execAsync(command); + // count ESTABLISHED lines + return stdout.split('\n').filter(line => line.includes('ESTABLISHED')).length; + } else { + // Linux use ss command + command = `ss -tn | grep ESTAB | wc -l`; + const { stdout } = await execAsync(command); + return parseInt(stdout.trim(), 10); + } } catch (error) { console.error('Error getting TCP connections:', error); return -1; @@ -34,13 +47,11 @@ function getMemoryUsage(): { heapUsed: number, heapTotal: number, rss: number } }; } - function logMemoryUsage() { const usage = getMemoryUsage(); console.log(`Memory Usage - Heap Used: ${usage.heapUsed}MB, Heap Total: ${usage.heapTotal}MB, RSS: ${usage.rss}MB`); } - async function verifyResourceCleanup(initialTCP: number, initialMemory: ReturnType) { await new Promise(resolve => setTimeout(resolve, 2000)); @@ -204,7 +215,7 @@ describe('WebSocket Robustness Test', () => { }); // Test WebSocket memory leak - jest.setTimeout(120000); + jest.setTimeout(1200); test('test websocket memory leak', async () => { let connected = false; const wsClients: { ws: any, type: string }[] = []; @@ -488,4 +499,115 @@ describe('WebSocket Robustness Test', () => { await spotPublicWS.stop().catch(console.error); } }); + + // Test duplicate subscriptions should throw error + test('test duplicateSubscriptionstest', async () => { + let connected = false; + let disconnected = false; + const CLEANUP_TIMEOUT = 2000; // Wait 2 seconds for cleanup + + const wsOption = new WebSocketClientOptionBuilder() + .withReconnect(false) // Disable auto-reconnect for this test + .withDialTimeout(5000) + .withEventCallback((event: WebSocketEvent, msg: string) => { + console.log(`WebSocket Event: ${event}, Message: ${msg}`); + if (event === WebSocketEvent.EventConnected) { + connected = true; + } else if (event === WebSocketEvent.EventDisconnected) { + disconnected = true; + } + }) + .build(); + + const clientOption = new ClientOptionBuilder() + .setKey('') + .setSecret('') + .setPassphrase('') + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + const spotPublicWS = wsService.newSpotPublicWS(); + + try { + // Start WebSocket client + await spotPublicWS.start(); + + // Wait for connection to be established + await new Promise((resolve, reject) => { + const checkConnection = () => { + if (connected) { + clearInterval(interval); + clearTimeout(timeout); + resolve(); + } + }; + const interval = setInterval(checkConnection, 100); + const timeout = setTimeout(() => { + clearInterval(interval); + reject(new Error('Connection timeout')); + }, 5000); + }); + + // First subscription + const subscription1 = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { + console.log('First subscription received message:', data); + }); + + // Second subscription to the same topic should throw error + let error: Error | null = null; + try { + await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { + console.log('Second subscription received message:', data); + }); + } catch (e) { + error = e as Error; + } + expect(error).not.toBeNull(); + expect(error?.message).toContain('already subscribed'); + + // Clean up + console.log('Starting cleanup...'); + await spotPublicWS.unSubscribe(subscription1); + await spotPublicWS.stop(); + + // Wait for disconnect event + await new Promise((resolve, reject) => { + const checkDisconnection = () => { + if (disconnected) { + clearInterval(interval); + clearTimeout(timeout); + resolve(); + } + }; + const interval = setInterval(checkDisconnection, 100); + const timeout = setTimeout(() => { + clearInterval(interval); + reject(new Error('Disconnect timeout')); + }, CLEANUP_TIMEOUT); + }); + + // Additional wait for system to clean up resources + await new Promise(resolve => setTimeout(resolve, CLEANUP_TIMEOUT)); + + } catch (error) { + console.error('Test error:', error); + throw error; + } finally { + // Force cleanup in case of errors + try { + if (!disconnected) { + await spotPublicWS.stop(); + // Wait for resources to be cleaned up + await new Promise(resolve => setTimeout(resolve, CLEANUP_TIMEOUT)); + } + } catch (error) { + console.error('Error in final cleanup:', error); + } + } + }, 30000); // Set test timeout to 30 seconds }); From a820253077d36be230ee18faf0ff0021ec143891 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 18 Feb 2025 14:32:49 +0800 Subject: [PATCH 085/106] feat(nodejs): fix websocket export --- generate.mk | 2 +- .../plugin/generator/NodeSdkGenerator.java | 2 + .../sdk/plugin/SdkGeneratorTest.java | 2 +- sdk/node/README.md | 4 +- sdk/node/example/src/ts/example_ws.ts | 124 +++++++++--------- .../futures/futuresprivate/export.template | 11 ++ .../futures/futurespublic/export.template | 12 ++ sdk/node/src/generate/futures/index.ts | 23 ++++ sdk/node/src/generate/margin/index.ts | 12 ++ .../margin/marginprivate/export.template | 6 + .../margin/marginpublic/export.template | 4 + sdk/node/src/generate/spot/index.ts | 30 +++++ .../generate/spot/spotprivate/export.template | 6 + .../generate/spot/spotpublic/export.template | 22 ++++ sdk/node/src/generate/version.ts | 2 +- 15 files changed, 194 insertions(+), 68 deletions(-) create mode 100644 sdk/node/src/generate/futures/futuresprivate/export.template create mode 100644 sdk/node/src/generate/futures/futurespublic/export.template create mode 100644 sdk/node/src/generate/margin/marginprivate/export.template create mode 100644 sdk/node/src/generate/margin/marginpublic/export.template create mode 100644 sdk/node/src/generate/spot/spotprivate/export.template create mode 100644 sdk/node/src/generate/spot/spotpublic/export.template diff --git a/generate.mk b/generate.mk index 5fdb15a2..6957e056 100644 --- a/generate.mk +++ b/generate.mk @@ -93,7 +93,7 @@ WS_FILES := $(wildcard ./spec/ws/*.json) generate-postman: $(call generate-postman-func) -generate: $(patsubst ./spec/rest/api/%.json,generate-rest-%, $(REST_FILES)) $(patsubst ./spec/rest/entry/%.json,generate-entry-%, $(ENTRY_FILES)) $(patsubst ./spec/ws/%.json,generate-ws-%, $(WS_FILES)) +generate: $(patsubst ./spec/rest/api/%.json,generate-rest-%, $(REST_FILES)) $(patsubst ./spec/ws/%.json,generate-ws-%, $(WS_FILES)) $(patsubst ./spec/rest/entry/%.json,generate-entry-%, $(ENTRY_FILES)) generate-rest-%: ./spec/rest/api/%.json | force $(eval service=$*) diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index e0e8c905..4bb42be1 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -122,6 +122,7 @@ public void processOpts() { apiTemplateFiles.put("api_ws.mustache", ".ts"); additionalProperties.put("WS_MODE", "true"); supportingFiles.add(new SupportingFile("module.mustache", String.format("./%s/%s/index.ts", service, formatPackage(subService)))); + supportingFiles.add(new SupportingFile("module_exports_template.mustache", String.format("./%s/%s/export.template", service, formatPackage(subService)))); break; } case WS_TEST: { @@ -550,6 +551,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List { String path = (String) m.get("importPath"); diff --git a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java index 7704de1d..fee2fac6 100644 --- a/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java +++ b/generator/plugin/src/test/java/com/kucoin/universal/sdk/plugin/SdkGeneratorTest.java @@ -10,7 +10,7 @@ public class SdkGeneratorTest { private static final String SDK_NAME = "node-sdk"; private static final String SPEC_NAME = "../../spec/rest/api/openapi-spot-market.json"; private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-spot.json"; - private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json"; + private static final String WS_SPEC_NAME = "../../spec/ws/openapi-spot-public.json"; private static final String OUTPUT_DIR = "./out"; private static final String CSV_PATH = "../../spec"; diff --git a/sdk/node/README.md b/sdk/node/README.md index 36a53fb4..453d7a06 100644 --- a/sdk/node/README.md +++ b/sdk/node/README.md @@ -64,13 +64,13 @@ function example() { const spotMarketApi = kucoinRestService.getSpotService().getMarketApi(); // Create request by interface - let request = Spot.GetPartOrderBookReq.create({ + let request = Spot.Market.GetPartOrderBookReq.create({ 'symbol': 'BTC-USDT', 'size': '20', }) // Or create request by builder - request = Spot.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); + request = Spot.Market.GetPartOrderBookReq.builder().setSize('20').setSymbol('BTC-USDT').build(); // Query for part orderbook depth data. (aggregated by price) spotMarketApi.getPartOrderBook(request).then((result) => { diff --git a/sdk/node/example/src/ts/example_ws.ts b/sdk/node/example/src/ts/example_ws.ts index bc4748dd..70d9146b 100644 --- a/sdk/node/example/src/ts/example_ws.ts +++ b/sdk/node/example/src/ts/example_ws.ts @@ -1,63 +1,61 @@ -// import { -// ClientOptionBuilder, -// DefaultClient, -// GlobalApiEndpoint, -// GlobalBrokerApiEndpoint, -// GlobalFuturesApiEndpoint, -// WebSocketClientOptionBuilder, -// Account, -// Spot, -// } from 'kucoin-universal-sdk'; -// -// -// function delay(ms: number): Promise { -// return new Promise((resolve) => setTimeout(resolve, ms)); -// } -// -// function wsExample() { -// const key = process.env.API_KEY || ''; -// const secret = process.env.API_SECRET || ''; -// const passphrase = process.env.API_PASSPHRASE || ''; -// -// const websocketClientOption = new WebSocketClientOptionBuilder().build(); -// -// const clientOption = new ClientOptionBuilder() -// .setKey(key) -// .setSecret(secret) -// .setPassphrase(passphrase) -// .setSpotEndpoint(GlobalApiEndpoint) -// .setFuturesEndpoint(GlobalFuturesApiEndpoint) -// .setBrokerEndpoint(GlobalBrokerApiEndpoint) -// .setWebSocketClientOption(websocketClientOption) -// .build(); -// -// const client = new DefaultClient(clientOption); -// const wsService = client.wsService(); -// -// spotWsExample(wsService.newSpotPublicWS()); -// } -// -// -// async function spotWsExample(spotPublic: Spot.SpotPublicWS) { -// -// await spotPublic.start() -// -// -// -// let subid = spotPublic.allTickers((topic: string, subject: string, data: Spot.) => { -// console.log(data); -// }); -// -// await subid -// .then(async (id) => { -// await delay(5000); -// return id; -// }) -// .then((id) => { -// return spotPublic.unSubscribe(id); -// }).then(() => { -// return spotPublic.stop -// }); -// } -// -// wsExample() \ No newline at end of file +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, + Account, + Spot, +} from 'kucoin-universal-sdk'; + + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function wsExample() { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + + spotWsExample(wsService.newSpotPublicWS()); +} + + +async function spotWsExample(spotPublic: Spot.SpotPublicWS) { + + await spotPublic.start() + + let subid = spotPublic.allTickers((topic: string, subject: string, data: Spot.SpotPublic.AllTickersEvent) => { + console.log(data); + }); + + await subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return spotPublic.unSubscribe(id); + }).then(() => { + return spotPublic.stop + }); +} + +wsExample() \ No newline at end of file diff --git a/sdk/node/src/generate/futures/futuresprivate/export.template b/sdk/node/src/generate/futures/futuresprivate/export.template new file mode 100644 index 00000000..6c79d0dc --- /dev/null +++ b/sdk/node/src/generate/futures/futuresprivate/export.template @@ -0,0 +1,11 @@ +export namespace FuturesPrivate { +export type AllOrderEvent = FUTURESPRIVATE.AllOrderEvent; +export type AllPositionEvent = FUTURESPRIVATE.AllPositionEvent; +export type BalanceEvent = FUTURESPRIVATE.BalanceEvent; +export type CrossLeverageDataValue = FUTURESPRIVATE.CrossLeverageDataValue; +export type CrossLeverageEvent = FUTURESPRIVATE.CrossLeverageEvent; +export type MarginModeEvent = FUTURESPRIVATE.MarginModeEvent; +export type OrderEvent = FUTURESPRIVATE.OrderEvent; +export type PositionEvent = FUTURESPRIVATE.PositionEvent; +export type StopOrdersEvent = FUTURESPRIVATE.StopOrdersEvent; +} diff --git a/sdk/node/src/generate/futures/futurespublic/export.template b/sdk/node/src/generate/futures/futurespublic/export.template new file mode 100644 index 00000000..5613abcc --- /dev/null +++ b/sdk/node/src/generate/futures/futurespublic/export.template @@ -0,0 +1,12 @@ +export namespace FuturesPublic { +export type AnnouncementEvent = FUTURESPUBLIC.AnnouncementEvent; +export type ExecutionEvent = FUTURESPUBLIC.ExecutionEvent; +export type InstrumentEvent = FUTURESPUBLIC.InstrumentEvent; +export type KlinesEvent = FUTURESPUBLIC.KlinesEvent; +export type OrderbookIncrementEvent = FUTURESPUBLIC.OrderbookIncrementEvent; +export type OrderbookLevel50Event = FUTURESPUBLIC.OrderbookLevel50Event; +export type OrderbookLevel5Event = FUTURESPUBLIC.OrderbookLevel5Event; +export type SymbolSnapshotEvent = FUTURESPUBLIC.SymbolSnapshotEvent; +export type TickerV1Event = FUTURESPUBLIC.TickerV1Event; +export type TickerV2Event = FUTURESPUBLIC.TickerV2Event; +} diff --git a/sdk/node/src/generate/futures/index.ts b/sdk/node/src/generate/futures/index.ts index 49ea891e..346e86f2 100644 --- a/sdk/node/src/generate/futures/index.ts +++ b/sdk/node/src/generate/futures/index.ts @@ -66,6 +66,17 @@ export namespace Futures { export type GetTradeHistoryReq = ORDER.GetTradeHistoryReq; export type GetTradeHistoryResp = ORDER.GetTradeHistoryResp; } + export namespace FuturesPrivate { + export type AllOrderEvent = FUTURESPRIVATE.AllOrderEvent; + export type AllPositionEvent = FUTURESPRIVATE.AllPositionEvent; + export type BalanceEvent = FUTURESPRIVATE.BalanceEvent; + export type CrossLeverageDataValue = FUTURESPRIVATE.CrossLeverageDataValue; + export type CrossLeverageEvent = FUTURESPRIVATE.CrossLeverageEvent; + export type MarginModeEvent = FUTURESPRIVATE.MarginModeEvent; + export type OrderEvent = FUTURESPRIVATE.OrderEvent; + export type PositionEvent = FUTURESPRIVATE.PositionEvent; + export type StopOrdersEvent = FUTURESPRIVATE.StopOrdersEvent; + } export namespace FundingFees { export type GetCurrentFundingRateReq = FUNDINGFEES.GetCurrentFundingRateReq; export type GetCurrentFundingRateResp = FUNDINGFEES.GetCurrentFundingRateResp; @@ -109,6 +120,18 @@ export namespace Futures { export type SwitchMarginModeReq = POSITIONS.SwitchMarginModeReq; export type SwitchMarginModeResp = POSITIONS.SwitchMarginModeResp; } + export namespace FuturesPublic { + export type AnnouncementEvent = FUTURESPUBLIC.AnnouncementEvent; + export type ExecutionEvent = FUTURESPUBLIC.ExecutionEvent; + export type InstrumentEvent = FUTURESPUBLIC.InstrumentEvent; + export type KlinesEvent = FUTURESPUBLIC.KlinesEvent; + export type OrderbookIncrementEvent = FUTURESPUBLIC.OrderbookIncrementEvent; + export type OrderbookLevel50Event = FUTURESPUBLIC.OrderbookLevel50Event; + export type OrderbookLevel5Event = FUTURESPUBLIC.OrderbookLevel5Event; + export type SymbolSnapshotEvent = FUTURESPUBLIC.SymbolSnapshotEvent; + export type TickerV1Event = FUTURESPUBLIC.TickerV1Event; + export type TickerV2Event = FUTURESPUBLIC.TickerV2Event; + } export namespace Market { export type Get24hrStatsResp = MARKET.Get24hrStatsResp; export type GetAllSymbolsData = MARKET.GetAllSymbolsData; diff --git a/sdk/node/src/generate/margin/index.ts b/sdk/node/src/generate/margin/index.ts index 1d97b0cf..4820da31 100644 --- a/sdk/node/src/generate/margin/index.ts +++ b/sdk/node/src/generate/margin/index.ts @@ -22,6 +22,14 @@ export namespace Margin { export type RiskLimitAPI = RISKLIMIT.RiskLimitAPI; export type MarginPrivateWS = MARGINPRIVATE.MarginPrivateWS; export type MarginPublicWS = MARGINPUBLIC.MarginPublicWS; + export namespace MarginPrivate { + export type CrossMarginPositionAssetListValue = + MARGINPRIVATE.CrossMarginPositionAssetListValue; + export type CrossMarginPositionEvent = MARGINPRIVATE.CrossMarginPositionEvent; + export type IsolatedMarginPositionChangeAssetsValue = + MARGINPRIVATE.IsolatedMarginPositionChangeAssetsValue; + export type IsolatedMarginPositionEvent = MARGINPRIVATE.IsolatedMarginPositionEvent; + } export namespace Order { export type AddOrderReq = ORDER.AddOrderReq; export type AddOrderResp = ORDER.AddOrderResp; @@ -78,6 +86,10 @@ export namespace Margin { export type GetMarginRiskLimitReq = RISKLIMIT.GetMarginRiskLimitReq; export type GetMarginRiskLimitResp = RISKLIMIT.GetMarginRiskLimitResp; } + export namespace MarginPublic { + export type IndexPriceEvent = MARGINPUBLIC.IndexPriceEvent; + export type MarkPriceEvent = MARGINPUBLIC.MarkPriceEvent; + } export namespace Debit { export type BorrowReq = DEBIT.BorrowReq; export type BorrowResp = DEBIT.BorrowResp; diff --git a/sdk/node/src/generate/margin/marginprivate/export.template b/sdk/node/src/generate/margin/marginprivate/export.template new file mode 100644 index 00000000..892612d7 --- /dev/null +++ b/sdk/node/src/generate/margin/marginprivate/export.template @@ -0,0 +1,6 @@ +export namespace MarginPrivate { +export type CrossMarginPositionAssetListValue = MARGINPRIVATE.CrossMarginPositionAssetListValue; +export type CrossMarginPositionEvent = MARGINPRIVATE.CrossMarginPositionEvent; +export type IsolatedMarginPositionChangeAssetsValue = MARGINPRIVATE.IsolatedMarginPositionChangeAssetsValue; +export type IsolatedMarginPositionEvent = MARGINPRIVATE.IsolatedMarginPositionEvent; +} diff --git a/sdk/node/src/generate/margin/marginpublic/export.template b/sdk/node/src/generate/margin/marginpublic/export.template new file mode 100644 index 00000000..780657db --- /dev/null +++ b/sdk/node/src/generate/margin/marginpublic/export.template @@ -0,0 +1,4 @@ +export namespace MarginPublic { +export type IndexPriceEvent = MARGINPUBLIC.IndexPriceEvent; +export type MarkPriceEvent = MARGINPUBLIC.MarkPriceEvent; +} diff --git a/sdk/node/src/generate/spot/index.ts b/sdk/node/src/generate/spot/index.ts index b7cf3923..83bb3259 100644 --- a/sdk/node/src/generate/spot/index.ts +++ b/sdk/node/src/generate/spot/index.ts @@ -126,6 +126,12 @@ export namespace Spot { export type SetDCPReq = ORDER.SetDCPReq; export type SetDCPResp = ORDER.SetDCPResp; } + export namespace SpotPrivate { + export type AccountEvent = SPOTPRIVATE.AccountEvent; + export type AccountRelationContext = SPOTPRIVATE.AccountRelationContext; + export type OrderV1Event = SPOTPRIVATE.OrderV1Event; + export type OrderV2Event = SPOTPRIVATE.OrderV2Event; + } export namespace Market { export type Get24hrStatsReq = MARKET.Get24hrStatsReq; export type Get24hrStatsResp = MARKET.Get24hrStatsResp; @@ -166,4 +172,28 @@ export namespace Spot { export type GetTradeHistoryReq = MARKET.GetTradeHistoryReq; export type GetTradeHistoryResp = MARKET.GetTradeHistoryResp; } + export namespace SpotPublic { + export type AllTickersEvent = SPOTPUBLIC.AllTickersEvent; + export type KlinesEvent = SPOTPUBLIC.KlinesEvent; + export type MarketSnapshotData = SPOTPUBLIC.MarketSnapshotData; + export type MarketSnapshotDataMarketChange1h = SPOTPUBLIC.MarketSnapshotDataMarketChange1h; + export type MarketSnapshotDataMarketChange24h = + SPOTPUBLIC.MarketSnapshotDataMarketChange24h; + export type MarketSnapshotDataMarketChange4h = SPOTPUBLIC.MarketSnapshotDataMarketChange4h; + export type MarketSnapshotEvent = SPOTPUBLIC.MarketSnapshotEvent; + export type OrderbookIncrementChanges = SPOTPUBLIC.OrderbookIncrementChanges; + export type OrderbookIncrementEvent = SPOTPUBLIC.OrderbookIncrementEvent; + export type OrderbookLevel1Event = SPOTPUBLIC.OrderbookLevel1Event; + export type OrderbookLevel50Changes = SPOTPUBLIC.OrderbookLevel50Changes; + export type OrderbookLevel50Event = SPOTPUBLIC.OrderbookLevel50Event; + export type OrderbookLevel5Event = SPOTPUBLIC.OrderbookLevel5Event; + export type SymbolSnapshotData = SPOTPUBLIC.SymbolSnapshotData; + export type SymbolSnapshotDataMarketChange1h = SPOTPUBLIC.SymbolSnapshotDataMarketChange1h; + export type SymbolSnapshotDataMarketChange24h = + SPOTPUBLIC.SymbolSnapshotDataMarketChange24h; + export type SymbolSnapshotDataMarketChange4h = SPOTPUBLIC.SymbolSnapshotDataMarketChange4h; + export type SymbolSnapshotEvent = SPOTPUBLIC.SymbolSnapshotEvent; + export type TickerEvent = SPOTPUBLIC.TickerEvent; + export type TradeEvent = SPOTPUBLIC.TradeEvent; + } } diff --git a/sdk/node/src/generate/spot/spotprivate/export.template b/sdk/node/src/generate/spot/spotprivate/export.template new file mode 100644 index 00000000..5103b665 --- /dev/null +++ b/sdk/node/src/generate/spot/spotprivate/export.template @@ -0,0 +1,6 @@ +export namespace SpotPrivate { +export type AccountEvent = SPOTPRIVATE.AccountEvent; +export type AccountRelationContext = SPOTPRIVATE.AccountRelationContext; +export type OrderV1Event = SPOTPRIVATE.OrderV1Event; +export type OrderV2Event = SPOTPRIVATE.OrderV2Event; +} diff --git a/sdk/node/src/generate/spot/spotpublic/export.template b/sdk/node/src/generate/spot/spotpublic/export.template new file mode 100644 index 00000000..16a735e2 --- /dev/null +++ b/sdk/node/src/generate/spot/spotpublic/export.template @@ -0,0 +1,22 @@ +export namespace SpotPublic { +export type AllTickersEvent = SPOTPUBLIC.AllTickersEvent; +export type KlinesEvent = SPOTPUBLIC.KlinesEvent; +export type MarketSnapshotData = SPOTPUBLIC.MarketSnapshotData; +export type MarketSnapshotDataMarketChange1h = SPOTPUBLIC.MarketSnapshotDataMarketChange1h; +export type MarketSnapshotDataMarketChange24h = SPOTPUBLIC.MarketSnapshotDataMarketChange24h; +export type MarketSnapshotDataMarketChange4h = SPOTPUBLIC.MarketSnapshotDataMarketChange4h; +export type MarketSnapshotEvent = SPOTPUBLIC.MarketSnapshotEvent; +export type OrderbookIncrementChanges = SPOTPUBLIC.OrderbookIncrementChanges; +export type OrderbookIncrementEvent = SPOTPUBLIC.OrderbookIncrementEvent; +export type OrderbookLevel1Event = SPOTPUBLIC.OrderbookLevel1Event; +export type OrderbookLevel50Changes = SPOTPUBLIC.OrderbookLevel50Changes; +export type OrderbookLevel50Event = SPOTPUBLIC.OrderbookLevel50Event; +export type OrderbookLevel5Event = SPOTPUBLIC.OrderbookLevel5Event; +export type SymbolSnapshotData = SPOTPUBLIC.SymbolSnapshotData; +export type SymbolSnapshotDataMarketChange1h = SPOTPUBLIC.SymbolSnapshotDataMarketChange1h; +export type SymbolSnapshotDataMarketChange24h = SPOTPUBLIC.SymbolSnapshotDataMarketChange24h; +export type SymbolSnapshotDataMarketChange4h = SPOTPUBLIC.SymbolSnapshotDataMarketChange4h; +export type SymbolSnapshotEvent = SPOTPUBLIC.SymbolSnapshotEvent; +export type TickerEvent = SPOTPUBLIC.TickerEvent; +export type TradeEvent = SPOTPUBLIC.TradeEvent; +} diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 4a9473e2..0cd05b00 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-02-17'; +export const SdkGenerateDate = '2025-02-18'; From 8bfd6a053624ea52fee030f44a0b5c7cf7dfe0fc Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 19 Feb 2025 10:13:07 +0800 Subject: [PATCH 086/106] feat(nodejs): add more example and export ws interface --- .../plugin/generator/NodeSdkGenerator.java | 5 + .../src/js/example_arbitrage_strategy.js | 393 ++++++++++++++++ .../example/src/js/example_ma_strategy.js | 161 +++++++ .../example/src/js/example_realtime_kline.js | 125 ++++++ sdk/node/example/src/js/example_sign.js | 128 ++++++ sdk/node/example/src/js/example_ws.js | 57 +++ .../src/ts/example_arbitrage_strategy.ts | 420 ++++++++++++++++++ .../example/src/ts/example_ma_strategy.ts | 160 +++++++ .../example/src/ts/example_realtime_kline.ts | 137 ++++++ sdk/node/example/src/ts/example_sign.ts | 137 ++++++ sdk/node/src/generate/service/index.ts | 27 +- 11 files changed, 1741 insertions(+), 9 deletions(-) create mode 100644 sdk/node/example/src/js/example_arbitrage_strategy.js create mode 100644 sdk/node/example/src/js/example_ma_strategy.js create mode 100644 sdk/node/example/src/js/example_realtime_kline.js create mode 100644 sdk/node/example/src/js/example_sign.js create mode 100644 sdk/node/example/src/js/example_ws.js create mode 100644 sdk/node/example/src/ts/example_arbitrage_strategy.ts create mode 100644 sdk/node/example/src/ts/example_ma_strategy.ts create mode 100644 sdk/node/example/src/ts/example_realtime_kline.ts create mode 100644 sdk/node/example/src/ts/example_sign.ts diff --git a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java index 4bb42be1..092640c7 100644 --- a/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java +++ b/generator/plugin/src/main/java/com/kucoin/universal/sdk/plugin/generator/NodeSdkGenerator.java @@ -670,6 +670,11 @@ public Map postProcessSupportingFileData(Map obj services.forEach(s -> { serviceExports.add(String.format("export * from \"./%s_api\"", s)); + + Map specialKeywords = Map.of("copytrading", "CopyTrading", "viplending", "VIPLending"); + String service = formatService(specialKeywords.getOrDefault(s, s)); + + serviceExports.add(String.format("export type {%s} from \"./%s_api\"", service+"Service", s)); generatedExports.add(String.format("export * from \"./%s\"", s)); }); diff --git a/sdk/node/example/src/js/example_arbitrage_strategy.js b/sdk/node/example/src/js/example_arbitrage_strategy.js new file mode 100644 index 00000000..16915d8d --- /dev/null +++ b/sdk/node/example/src/js/example_arbitrage_strategy.js @@ -0,0 +1,393 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ +const { + Account, + Futures, + Margin, + Spot, + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} = require('kucoin-universal-sdk'); + +const crypto = require("crypto"); + +const SPOT_SYMBOL = "DOGE-USDT"; +const FUTURES_SYMBOL = "DOGEUSDTM"; +const BASE_CURRENCY = "USDT"; +const MAX_PLACE_ORDER_WAIT_TIME_SEC = 15; + +const MarketSide = { + BUY: "buy", + SELL: "sell" +}; + +const MarketType = { + SPOT: "SPOT", + MARGIN: "MARGIN", + FUTURES: "FUTURES" +}; + +async function checkAvailableBalance(accountService, price, amount, marketType) { + /** + * Checks if the available balance is sufficient for the trade. + */ + const tradeValue = price * amount; + + if (marketType === MarketType.SPOT) { + const getSpotAccountResp = await accountService.getAccountApi().getSpotAccountList( + Account.Account.GetSpotAccountListReq.builder() + .setType(Account.Account.GetSpotAccountListReq.TypeEnum.TRADE) + .setCurrency(BASE_CURRENCY) + .build() + ); + const spotAvailableBalance = getSpotAccountResp.data.reduce((sum, accountData) => sum + parseFloat(accountData.available), 0); + console.info(`[SPOT] Available ${BASE_CURRENCY} balance: ${spotAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return spotAvailableBalance >= tradeValue; + } else if (marketType === MarketType.FUTURES) { + const futuresAvailableBalance = (await accountService.getAccountApi().getFuturesAccount( + Account.Account.GetFuturesAccountReq.builder() + .setCurrency(BASE_CURRENCY) + .build() + )).availableBalance; + console.info(`[FUTURES] Available ${BASE_CURRENCY} balance: ${futuresAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return futuresAvailableBalance >= tradeValue; + } else { + const marginAvailableBalance = parseFloat((await accountService.getAccountApi().getCrossMarginAccount( + Account.Account.GetCrossMarginAccountReq.builder() + .setQueryType(Account.Account.GetCrossMarginAccountReq.QueryTypeEnum.MARGIN) + .setQuoteCurrency(Account.Account.GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT) + .build() + )).totalAssetOfQuoteCurrency); + console.info(`[MARGIN] Available ${BASE_CURRENCY} balance: ${marginAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return marginAvailableBalance >= tradeValue; + } +} + +async function getLastTradedPrice(spotService, futuresService) { + /** + * Fetches the last traded price for the specified spot and futures symbols. + */ + const spotPrice = parseFloat( + (await spotService.getMarketApi().getTicker(Spot.Market.GetTickerReq.builder().setSymbol(SPOT_SYMBOL).build())).price + ); + + const futuresPrice = + (await futuresService.getMarketApi().getSymbol(Spot.Market.GetSymbolReq.builder().setSymbol(FUTURES_SYMBOL).build())) + .lastTradePrice; + + console.info(`[PRICE] Spot Price: ${spotPrice.toFixed(5)}, Futures Price: ${futuresPrice.toFixed(5)}`); + + return [spotPrice, futuresPrice]; +} + +async function fundingRateArbitrageStrategy( + futuresService, + spotService, + marginService, + accountService, + amount, + threshold +) { + /** + * Funding Rate Arbitrage Strategy. + */ + try { + // Step 1: Fetch funding rate + const fundingRateReq = Futures.FundingFees.GetCurrentFundingRateReq.builder().setSymbol(FUTURES_SYMBOL).build(); + const fundingRate = + (await futuresService.getFundingFeesApi().getCurrentFundingRate(fundingRateReq)).value * 100; + console.info(`[STRATEGY] Funding rate for ${FUTURES_SYMBOL}: ${fundingRate.toFixed(6)}%`); + + // Step 2: Check if funding rate meets the threshold for arbitrage + if (Math.abs(fundingRate) < threshold) { + console.info( + `[STRATEGY] No arbitrage opportunity: Funding rate (${fundingRate.toFixed( + 6 + )}%) below threshold (${threshold}).` + ); + return; + } + + // Step 3: Fetch the latest spot and futures prices + const [spotPrice, futuresPrice] = await getLastTradedPrice(spotService, futuresService); + + // Calculate futures order amount in contracts + const futuresMultiplier = + (await futuresService.getMarketApi().getSymbol(Futures.Market.GetSymbolReq.builder().setSymbol(FUTURES_SYMBOL).build())) + .multiplier; + const futuresAmount = Math.ceil(amount / futuresMultiplier); + + // Step 4: Execute arbitrage based on funding rate direction + if (fundingRate > 0) { + console.info("[STRATEGY] Positive funding rate detected. Executing LONG spot and SHORT futures arbitrage."); + + // Ensure sufficient balance for the spot and futures accounts + if (!(await checkAvailableBalance(accountService, spotPrice, amount, MarketType.SPOT))) { + console.warn("[STRATEGY] Insufficient balance in spot account."); + return; + } + if (!(await checkAvailableBalance(accountService, futuresPrice, amount, MarketType.FUTURES))) { + console.warn("[STRATEGY] Insufficient balance in futures account."); + return; + } + + // Execute orders + if (!(await addSpotOrderWaitFill(spotService, SPOT_SYMBOL, MarketSide.BUY, amount, spotPrice))) { + console.warn("[STRATEGY] Failed to execute spot order."); + return; + } + if (!(await addFuturesOrderWaitFill(futuresService, FUTURES_SYMBOL, MarketSide.SELL, futuresAmount, futuresPrice))) { + console.warn("[STRATEGY] Failed to execute futures order."); + return; + } + } else { + console.info( + "[STRATEGY] Negative funding rate detected. Executing SHORT margin and LONG futures arbitrage." + ); + + // Ensure sufficient balance for the margin and futures accounts + if (!(await checkAvailableBalance(accountService, spotPrice, amount, MarketType.MARGIN))) { + console.warn("[STRATEGY] Insufficient balance in margin account."); + return; + } + if (!(await checkAvailableBalance(accountService, futuresPrice, amount, MarketType.FUTURES))) { + console.warn("[STRATEGY] Insufficient balance in futures account."); + return; + } + + // Execute orders + if (!(await addMarginOrderWaitFill(marginService, SPOT_SYMBOL, amount, spotPrice))) { + console.warn("[STRATEGY] Failed to execute margin order."); + return; + } + if (!(await addFuturesOrderWaitFill(futuresService, FUTURES_SYMBOL, MarketSide.BUY, futuresAmount, futuresPrice))) { + console.warn("[STRATEGY] Failed to execute futures order."); + return; + } + } + + console.info("[STRATEGY] Arbitrage execution completed successfully."); + } catch (error) { + console.error(`[STRATEGY] Error executing arbitrage strategy: ${error}`); + } +} + +async function addSpotOrderWaitFill(spotService, symbol, side, amount, price) { + /** + * Places a spot order and waits for it to be filled + * within a specified timeout. + */ + const addOrderSyncReq = Spot.Order.AddOrderSyncReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side === MarketSide.BUY ? Spot.Order.AddOrderSyncReq.SideEnum.BUY : Spot.Order.AddOrderSyncReq.SideEnum.SELL) + .setSymbol(symbol) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark("arbitrage") + .setPrice(price.toFixed(4)) + .setSize(amount.toFixed(4)) + .build(); + + const order = await spotService.getOrderApi().addOrderSync(addOrderSyncReq); + console.info( + `[SPOT ORDER] Placed ${side.toUpperCase()} order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + const orderDetail = await spotService + .getOrderApi() + .getOrderByOrderId(Spot.Order.GetOrderByOrderIdReq.builder().setSymbol(symbol).setOrderId(order.orderId).build()); + + if (!orderDetail.active) { + console.info( + `[SPOT ORDER] Order filled successfully: ${side.toUpperCase()} ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + + console.info("[SPOT ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + + console.warn( + `[SPOT ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await spotService + .getOrderApi() + .cancelOrderByOrderIdSync(Spot.Order.CancelOrderByOrderIdSyncReq.builder().setOrderId(order.orderId).setSymbol(symbol).build()); + + if (cancelResp.status !== Spot.Order.CancelOrderByOrderIdSyncResp.StatusEnum.DONE) { + throw new Error(`[SPOT ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[SPOT ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function addFuturesOrderWaitFill(futuresService, symbol, side, amount, price) { + /** + * Places a futures order and waits for it to be filled within a specified timeout. + */ + const addOrderReq = Futures.Order.AddOrderReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side === MarketSide.BUY ? Futures.Order.AddOrderReq.SideEnum.BUY : Futures.Order.AddOrderReq.SideEnum.SELL) + .setSymbol(symbol) + .setType(Futures.Order.AddOrderReq.TypeEnum.LIMIT) + .setRemark("arbitrage") + .setPrice(price.toFixed(4)) + .setLeverage(1) + .setSize(amount) + .build(); + + const order = await futuresService.getOrderApi().addOrder(addOrderReq); + console.info( + `[FUTURES ORDER] Placed ${side.toUpperCase()} order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + console.info("[FUTURES ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + + const orderDetail = await futuresService + .getOrderApi() + .getOrderByOrderId(Futures.Order.GetOrderByOrderIdReq.builder().setOrderId(order.orderId).build()); + + if (orderDetail.status === Futures.Order.GetOrderByOrderIdResp.StatusEnum.DONE) { + console.info( + `[FUTURES ORDER] Order filled successfully: ${side.toUpperCase()} ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + } + + console.warn( + `[FUTURES ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await futuresService + .getOrderApi() + .cancelOrderById(Futures.Order.CancelOrderByIdReq.builder().setOrderId(order.orderId).build()); + + if (!cancelResp.cancelledOrderIds.includes(order.orderId)) { + throw new Error(`[FUTURES ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[FUTURES ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function addMarginOrderWaitFill(marginService, symbol, amount, price) { + /** + * Places a margin order and waits for it to be filled within a specified timeout. + */ + const addOrderReq = Margin.Order.AddOrderReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(Margin.Order.AddOrderReq.SideEnum.BUY) + .setSymbol(symbol) + .setType(Margin.Order.AddOrderReq.TypeEnum.LIMIT) + .setIsIsolated(false) + .setAutoBorrow(true) + .setAutoRepay(true) + .setPrice(price.toFixed(4)) + .setSize(amount.toFixed(4)) + .build(); + + const order = await marginService.getOrderApi().addOrder(addOrderReq); + console.info( + `[MARGIN ORDER] Placed SELL order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + console.info("[MARGIN ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + + const orderDetail = await marginService + .getOrderApi() + .getOrderByOrderId(Margin.Order.GetOrderByOrderIdReq.builder().setSymbol(symbol).setOrderId(order.orderId).build()); + + if (!orderDetail.active) { + console.info( + `[MARGIN ORDER] Order filled successfully: SELL ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + } + + console.warn( + `[MARGIN ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await marginService + .getOrderApi() + .cancelOrderByOrderId(Margin.Order.CancelOrderByOrderIdReq.builder().setOrderId(order.orderId).setSymbol(symbol).build()); + + if (!cancelResp.orderId) { + throw new Error(`[MARGIN ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[MARGIN ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function main() { + /** + * Main function to run the funding rate arbitrage strategy for a specific duration. + */ + console.info("Initializing APIs..."); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + const kucoinRestService = client.restService(); + + const futuresService = kucoinRestService.getFuturesService(); + const spotService = kucoinRestService.getSpotService(); + const marginService = kucoinRestService.getMarginService(); + const accountService = kucoinRestService.getAccountService(); + + const amount = 100; // Amount to trade + const threshold = 0.005; // Minimum profit threshold + + console.info("Starting funding rate arbitrage strategy..."); + await fundingRateArbitrageStrategy(futuresService, spotService, marginService, accountService, amount, threshold); +} + +main().catch((error) => { + console.error("Error running arbitrage strategy:", error); +}); diff --git a/sdk/node/example/src/js/example_ma_strategy.js b/sdk/node/example/src/js/example_ma_strategy.js new file mode 100644 index 00000000..94a7a519 --- /dev/null +++ b/sdk/node/example/src/js/example_ma_strategy.js @@ -0,0 +1,161 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ + +const crypto = require("crypto"); +const { + Account, + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder, +} = require("kucoin-universal-sdk"); + +const Action = { + BUY: "buy", + SELL: "sell", + SKIP: "skip" +}; + +async function simpleMovingAverageStrategy(api, symbol, shortWindow, longWindow, endTime) { + const startTime = endTime - longWindow * 60; + console.info(`Querying kline data: Start=${new Date(startTime * 1000)}, End=${new Date(endTime * 1000)}`); + + const getKlineReq = Spot.Market.GetKlinesReq.builder() + .setSymbol(symbol) + .setType(Spot.Market.GetKlinesReq.TypeEnum._1MIN) + .setStartAt(startTime) + .setEndAt(endTime) + .build(); + + const klineResp = await api.getKlines(getKlineReq); + const prices = klineResp.data.map(data => parseFloat(data[2])); + + const shortMa = prices.slice(-shortWindow).reduce((sum, price) => sum + price, 0) / shortWindow; + const longMa = prices.slice(-longWindow).reduce((sum, price) => sum + price, 0) / longWindow; + + console.info(`Short MA: ${shortMa}, Long MA: ${longMa}`); + + if (shortMa > longMa) return Action.BUY; + if (shortMa < longMa) return Action.SELL; + return Action.SKIP; +} + +async function getLastTradePrice(marketApi, symbol) { + const getStatReq = Spot.Market.Get24hrStatsReq.builder().setSymbol(symbol).build(); + const statResp = await marketApi.get24hrStats(getStatReq); + return parseFloat(statResp.last); +} + +async function checkAvailableBalance(accountApi, lastTradePrice, amount, action) { + const currency = action === Action.BUY ? "USDT" : "DOGE"; + console.info(`Checking balance for ${currency}`); + + const getAccountReq = Account.Account.GetSpotAccountListReq.builder() + .setType(Account.Account.GetSpotAccountListReq.TypeEnum.TRADE) + .setCurrency(currency) + .build(); + + const getAccountResp = await accountApi.getSpotAccountList(getAccountReq); + const availableBalance = getAccountResp.data.reduce((sum, account) => sum + parseFloat(account.available), 0); + console.info(`Available ${currency} balance: ${availableBalance}`); + + return action === Action.BUY ? lastTradePrice * amount <= availableBalance : amount <= availableBalance; +} + +async function placeOrder(orderApi, symbol, action, lastTradePrice, amount, priceDelta) { + const openOrderReq = Spot.Order.GetOpenOrdersReq.builder().setSymbol(symbol).build(); + const openOrderResp = await orderApi.getOpenOrders(openOrderReq); + + if (openOrderResp.data.length > 0) { + console.info(`Found open orders for ${symbol}. Cancelling...`); + const cancelAllReq = Spot.Order.CancelAllOrdersBySymbolReq.builder().setSymbol(symbol).build(); + await orderApi.cancelAllOrdersBySymbol(cancelAllReq); + } + + const side = action === Action.BUY ? Spot.Order.AddOrderSyncReq.SideEnum.BUY : Spot.Order.AddOrderSyncReq.SideEnum.SELL; + const price = lastTradePrice * (action === Action.BUY ? (1 - priceDelta) : (1 + priceDelta)); + + console.info(`Placing ${side} order for ${symbol} at ${price}`); + + const addOrderReq = Spot.Order.AddOrderSyncReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side) + .setSymbol(symbol) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark("ma") + .setPrice(price.toFixed(2)) + .setSize(amount.toFixed(8)) + .build(); + + await orderApi.addOrderSync(addOrderReq); +} + +async function maExample() { + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + const marketApi = client.restService().getSpotService().getMarketApi(); + const accountApi = client.restService().getAccountService().getAccountApi(); + const orderApi = client.restService().getSpotService().getOrderApi(); + + const SYMBOL = "DOGE-USDT"; + const ORDER_AMOUNT = 10; + const PRICE_DELTA = 0.1; + + console.info("Starting the moving average strategy using K-line data. Press Ctrl+C to stop."); + try { + while (true) { + const currentTime = Math.floor(Date.now() / 1000); + const action = await simpleMovingAverageStrategy(marketApi, SYMBOL, 10, 30, currentTime); + if (action !== Action.SKIP) { + const lastPrice = await getLastTradePrice(marketApi, SYMBOL); + console.info(`Last trade price for ${SYMBOL}: ${lastPrice}`); + const sufficientBalance = await checkAvailableBalance(accountApi, lastPrice, ORDER_AMOUNT, action); + if (sufficientBalance) { + console.info("Sufficient balance available. Attempting to place the order..."); + await placeOrder(orderApi, SYMBOL, action, lastPrice, ORDER_AMOUNT, PRICE_DELTA); + } else { + console.info("Insufficient balance. Skipping the trade..."); + } + } + console.info("Waiting for 1 minute before the next run..."); + await new Promise(resolve => setTimeout(resolve, 60000)); + } + } catch (err) { + console.error("Strategy stopped due to error:", err); + } +} + +maExample(); diff --git a/sdk/node/example/src/js/example_realtime_kline.js b/sdk/node/example/src/js/example_realtime_kline.js new file mode 100644 index 00000000..ef3752a7 --- /dev/null +++ b/sdk/node/example/src/js/example_realtime_kline.js @@ -0,0 +1,125 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ +const { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} = require("kucoin-universal-sdk"); + +const klineData = {}; + +const timeInterval = 60; + +function onTradeData(topic, subject, tradeEvent) { + const symbol = tradeEvent.symbol; + const price = parseFloat(tradeEvent.price); + const size = parseFloat(tradeEvent.size); + const timestamp = Math.floor(Number(tradeEvent.time) / 1_000_000_000); + + const periodStart = Math.floor(timestamp / timeInterval) * timeInterval; + const periodEnd = periodStart + timeInterval; + + if (!klineData[periodStart]) { + klineData[periodStart] = {}; + } + + if (!klineData[periodStart][symbol]) { + klineData[periodStart][symbol] = { + open: price, + high: price, + low: price, + close: price, + volume: size, + startTime: periodStart, + endTime: periodEnd, + }; + } else { + const kline = klineData[periodStart][symbol]; + kline.high = Math.max(kline.high, price); + kline.low = Math.min(kline.low, price); + kline.close = price; + kline.volume += size; + } + + console.info( + `KLine for ${symbol} @ ${new Date(periodStart * 1000).toISOString()}:`, + klineData[periodStart][symbol] + ); +} + +function printKlineData() { + const sortedKeys = Object.keys(klineData) + .map(Number) + .sort((a, b) => a - b); + + for (const periodStart of sortedKeys) { + console.info(`\nTime Period: ${new Date(periodStart * 1000).toISOString()}`); + for (const symbol in klineData[periodStart]) { + const kline = klineData[periodStart][symbol]; + console.info(` Symbol: ${symbol}`); + console.info(` Open: ${kline.open}`); + console.info(` High: ${kline.high}`); + console.info(` Low: ${kline.low}`); + console.info(` Close: ${kline.close}`); + console.info(` Volume: ${kline.volume}`); + console.info(` Start Time: ${new Date(kline.startTime * 1000).toISOString()}`); + console.info(` End Time: ${new Date(kline.endTime * 1000).toISOString()}`); + } + } +} + +async function main() { + console.info("Initializing WebSocket connection..."); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ""; + const secret = process.env.API_SECRET || ""; + const passphrase = process.env.API_PASSPHRASE || ""; + + // Set specific options, others will fall back to default values + const wsClientOption = new WebSocketClientOptionBuilder().build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsClientOption) + .build(); + + const client = new DefaultClient(clientOption); + + const spotPublic = client.wsService().newSpotPublicWS(); + await spotPublic.start(); + + // Subscribe to trade data + const subId = spotPublic.trade(["BTC-USDT", "ETH-USDT"], onTradeData); + + // Keep the connection open for 180 seconds + await new Promise((resolve) => setTimeout(resolve, 180_000)); + + // Unsubscribe and stop WebSocket connection + await spotPublic.unSubscribe(await subId); + await spotPublic.stop(); + + // Print collected K-Line data + printKlineData(); +} + +main().catch((error) => { + console.error("Error running WebSocket client:", error); +}); diff --git a/sdk/node/example/src/js/example_sign.js b/sdk/node/example/src/js/example_sign.js new file mode 100644 index 00000000..edc9422d --- /dev/null +++ b/sdk/node/example/src/js/example_sign.js @@ -0,0 +1,128 @@ +const crypto = require("crypto"); +const axios = require("axios"); + +class KcSigner { + constructor(apiKey, apiSecret, apiPassphrase) { + /** + * KcSigner contains information about `apiKey`, `apiSecret`, `apiPassphrase` + * and provides methods to sign and generate headers for API requests. + */ + this.apiKey = apiKey || ""; + this.apiSecret = apiSecret || ""; + this.apiPassphrase = apiPassphrase || ""; + + if (apiPassphrase && apiSecret) { + this.apiPassphrase = this.sign(apiPassphrase, apiSecret); + } + + if (!apiKey || !apiSecret || !apiPassphrase) { + console.warn("API token is empty. Access is restricted to public interfaces only."); + } + } + + sign(plain, key) { + return crypto.createHmac("sha256", key).update(plain).digest("base64"); + } + + headers(plain) { + /** + * Headers method generates and returns a map of signature headers needed for API authorization. + * It takes a plain string as an argument to help form the signature. The outputs are a set of API headers. + */ + const timestamp = Date.now().toString(); + const signature = this.sign(timestamp + plain, this.apiSecret); + + return { + "KC-API-KEY": this.apiKey, + "KC-API-PASSPHRASE": this.apiPassphrase, + "KC-API-TIMESTAMP": timestamp, + "KC-API-SIGN": signature, + "KC-API-KEY-VERSION": "2", + "Content-Type": "application/json", + }; + } +} + +async function processHeaders(signer, body, rawUrl, method) { + /** + * Creates and returns headers for API authentication. + */ + const payload = method + rawUrl + body; + return signer.headers(payload); +} + +async function getTradeFees(signer, axiosInstance) { + const endpoint = "https://api.kucoin.com"; + const path = "/api/v1/trade-fees"; + const method = "GET"; + const queryParams = new URLSearchParams({symbols: "BTC-USDT"}).toString(); + + const fullPath = `${endpoint}${path}?${queryParams}`; + const rawUrl = `${path}?${queryParams}`; + + const headers = await processHeaders(signer, "", rawUrl, method); + const config = { + method, + url: fullPath, + headers, + }; + + try { + const response = await axiosInstance(config); + console.log(response.data); + } catch (error) { + console.error("Error fetching trade fees:", error); + } +} + +async function addLimitOrder(signer, axiosInstance) { + const endpoint = "https://api.kucoin.com"; + const path = "/api/v1/hf/orders"; + const method = "POST"; + + const orderData = JSON.stringify({ + clientOid: crypto.randomUUID(), + side: "buy", + symbol: "BTC-USDT", + type: "limit", + price: "10000", + size: "0.001", + }); + + const fullPath = `${endpoint}${path}`; + const rawUrl = path; + + const headers = await processHeaders(signer, orderData, rawUrl, method); + const config = { + method, + url: fullPath, + headers, + data: orderData, + }; + + try { + const response = await axiosInstance(config); + console.log(response.data); + } catch (error) { + console.error("Error placing limit order:", error); + } +} + +async function main() { + /** + * Main function to execute API calls. + */ + const key = process.env.API_KEY || ""; + const secret = process.env.API_SECRET || ""; + const passphrase = process.env.API_PASSPHRASE || ""; + + const axiosInstance = axios.create(); + const signer = new KcSigner(key, secret, passphrase); + + await getTradeFees(signer, axiosInstance); + await addLimitOrder(signer, axiosInstance); +} + +main().catch((error) => { + console.error("Error executing main function:", error); +}); diff --git a/sdk/node/example/src/js/example_ws.js b/sdk/node/example/src/js/example_ws.js new file mode 100644 index 00000000..8e00f775 --- /dev/null +++ b/sdk/node/example/src/js/example_ws.js @@ -0,0 +1,57 @@ +const { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + WebSocketClientOptionBuilder, +} = require("kucoin-universal-sdk"); + +function delay(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function wsExample() { + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + const websocketClientOption = new WebSocketClientOptionBuilder().build(); + + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(websocketClientOption) + .build(); + + const client = new DefaultClient(clientOption); + const wsService = client.wsService(); + + spotWsExample(wsService.newSpotPublicWS()); +} + +async function spotWsExample(spotPublic) { + await spotPublic.start(); + + let subid = spotPublic.allTickers((topic, subject, data) => { + console.log(data); + }); + + await subid + .then(async (id) => { + await delay(5000); + return id; + }) + .then((id) => { + return spotPublic.unSubscribe(id); + }) + .then(() => { + return spotPublic.stop(); + }); +} + +wsExample(); diff --git a/sdk/node/example/src/ts/example_arbitrage_strategy.ts b/sdk/node/example/src/ts/example_arbitrage_strategy.ts new file mode 100644 index 00000000..3144699c --- /dev/null +++ b/sdk/node/example/src/ts/example_arbitrage_strategy.ts @@ -0,0 +1,420 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ +import { + Account, + AccountService, + Futures, + FuturesService, + Margin, + MarginService, + Spot, + SpotService, + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + TransportOptionBuilder, +} from 'kucoin-universal-sdk'; + +const SPOT_SYMBOL = "DOGE-USDT"; +const FUTURES_SYMBOL = "DOGEUSDTM"; +const BASE_CURRENCY = "USDT"; +const MAX_PLACE_ORDER_WAIT_TIME_SEC = 15; + +enum MarketSide { + BUY = "buy", + SELL = "sell" +} + +enum MarketType { + SPOT = "SPOT", + MARGIN = "MARGIN", + FUTURES = "FUTURES" +} + +async function checkAvailableBalance(accountService: AccountService, price: number, amount: number, + marketType: MarketType): Promise { + /** + * Checks if the available balance is sufficient for the trade. + * + * @param accountService - The account API client instance. + * @param price - The price of the asset. + * @param amount - The amount of the asset to trade. + * @param marketType - The type of the market. + * @returns True if the balance is sufficient, False otherwise. + */ + const tradeValue = price * amount; + + if (marketType === MarketType.SPOT) { + const getSpotAccountResp = await accountService.getAccountApi().getSpotAccountList( + Account.Account.GetSpotAccountListReq.builder() + .setType(Account.Account.GetSpotAccountListReq.TypeEnum.TRADE) + .setCurrency(BASE_CURRENCY) + .build() + ); + const spotAvailableBalance = getSpotAccountResp.data.reduce((sum, accountData) => sum + parseFloat(accountData.available), 0); + console.info(`[SPOT] Available ${BASE_CURRENCY} balance: ${spotAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return spotAvailableBalance >= tradeValue; + } else if (marketType === MarketType.FUTURES) { + const futuresAvailableBalance = (await accountService.getAccountApi().getFuturesAccount( + Account.Account.GetFuturesAccountReq.builder() + .setCurrency(BASE_CURRENCY) + .build() + )).availableBalance; + console.info(`[FUTURES] Available ${BASE_CURRENCY} balance: ${futuresAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return futuresAvailableBalance >= tradeValue; + } else { + const marginAvailableBalance = parseFloat((await accountService.getAccountApi().getCrossMarginAccount( + Account.Account.GetCrossMarginAccountReq.builder() + .setQueryType(Account.Account.GetCrossMarginAccountReq.QueryTypeEnum.MARGIN) + .setQuoteCurrency(Account.Account.GetCrossMarginAccountReq.QuoteCurrencyEnum.USDT) + .build() + )).totalAssetOfQuoteCurrency); + console.info(`[MARGIN] Available ${BASE_CURRENCY} balance: ${marginAvailableBalance.toFixed(2)}, Required: ${tradeValue.toFixed(2)}`); + return marginAvailableBalance >= tradeValue; + } +} + + +async function getLastTradedPrice(spotService: SpotService, futuresService: FuturesService): Promise<[number, number]> { + /** + * Fetches the last traded price for the specified spot and futures symbols. + */ + const spotPrice = parseFloat( + (await spotService.getMarketApi().getTicker(Spot.Market.GetTickerReq.builder().setSymbol(SPOT_SYMBOL).build())).price + ); + + const futuresPrice = + (await futuresService.getMarketApi().getSymbol(Spot.Market.GetSymbolReq.builder().setSymbol(FUTURES_SYMBOL).build())) + .lastTradePrice + + console.info(`[PRICE] Spot Price: ${spotPrice.toFixed(5)}, Futures Price: ${futuresPrice.toFixed(5)}`); + + return [spotPrice, futuresPrice]; +} + +async function fundingRateArbitrageStrategy( + futuresService: FuturesService, + spotService: SpotService, + marginService: MarginService, + accountService: AccountService, + amount: number, + threshold: number +): Promise { + /** + * Funding Rate Arbitrage Strategy. + */ + try { + // Step 1: Fetch funding rate + const fundingRateReq = Futures.FundingFees.GetCurrentFundingRateReq.builder().setSymbol(FUTURES_SYMBOL).build(); + const fundingRate = + (await futuresService.getFundingFeesApi().getCurrentFundingRate(fundingRateReq)).value * 100; + console.info(`[STRATEGY] Funding rate for ${FUTURES_SYMBOL}: ${fundingRate.toFixed(6)}%`); + + // Step 2: Check if funding rate meets the threshold for arbitrage + if (Math.abs(fundingRate) < threshold) { + console.info( + `[STRATEGY] No arbitrage opportunity: Funding rate (${fundingRate.toFixed( + 6 + )}%) below threshold (${threshold}).` + ); + return; + } + + // Step 3: Fetch the latest spot and futures prices + const [spotPrice, futuresPrice] = await getLastTradedPrice(spotService, futuresService); + + // Calculate futures order amount in contracts + const futuresMultiplier = + (await futuresService.getMarketApi().getSymbol(Futures.Market.GetSymbolReq.builder().setSymbol(FUTURES_SYMBOL).build())) + .multiplier + const futuresAmount = Math.ceil(amount / futuresMultiplier); + + // Step 4: Execute arbitrage based on funding rate direction + if (fundingRate > 0) { + console.info("[STRATEGY] Positive funding rate detected. Executing LONG spot and SHORT futures arbitrage."); + + // Ensure sufficient balance for the spot and futures accounts + if (!(await checkAvailableBalance(accountService, spotPrice, amount, MarketType.SPOT))) { + console.warn("[STRATEGY] Insufficient balance in spot account."); + return; + } + if (!(await checkAvailableBalance(accountService, futuresPrice, amount, MarketType.FUTURES))) { + console.warn("[STRATEGY] Insufficient balance in futures account."); + return; + } + + // Execute orders + if (!(await addSpotOrderWaitFill(spotService, SPOT_SYMBOL, MarketSide.BUY, amount, spotPrice))) { + console.warn("[STRATEGY] Failed to execute spot order."); + return; + } + if (!(await addFuturesOrderWaitFill(futuresService, FUTURES_SYMBOL, MarketSide.SELL, futuresAmount, futuresPrice))) { + console.warn("[STRATEGY] Failed to execute futures order."); + return; + } + } else { + console.info( + "[STRATEGY] Negative funding rate detected. Executing SHORT margin and LONG futures arbitrage." + ); + + // Ensure sufficient balance for the margin and futures accounts + if (!(await checkAvailableBalance(accountService, spotPrice, amount, MarketType.MARGIN))) { + console.warn("[STRATEGY] Insufficient balance in margin account."); + return; + } + if (!(await checkAvailableBalance(accountService, futuresPrice, amount, MarketType.FUTURES))) { + console.warn("[STRATEGY] Insufficient balance in futures account."); + return; + } + + // Execute orders + if (!(await addMarginOrderWaitFill(marginService, SPOT_SYMBOL, amount, spotPrice))) { + console.warn("[STRATEGY] Failed to execute margin order."); + return; + } + if (!(await addFuturesOrderWaitFill(futuresService, FUTURES_SYMBOL, MarketSide.BUY, futuresAmount, futuresPrice))) { + console.warn("[STRATEGY] Failed to execute futures order."); + return; + } + } + + console.info("[STRATEGY] Arbitrage execution completed successfully."); + } catch (error) { + console.error(`[STRATEGY] Error executing arbitrage strategy: ${error}`); + } +} + +async function addSpotOrderWaitFill( + spotService: SpotService, + symbol: string, + side: MarketSide, + amount: number, + price: number +): Promise { + /** + * Places a spot order and waits for it to be filled + within a specified timeout. + */ + const addOrderSyncReq = Spot.Order.AddOrderSyncReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side === MarketSide.BUY ? Spot.Order.AddOrderSyncReq.SideEnum.BUY : Spot.Order.AddOrderSyncReq.SideEnum.SELL) + .setSymbol(symbol) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark("arbitrage") + .setPrice(price.toFixed(4)) + .setSize(amount.toFixed(4)) + .build(); + + const order = await spotService.getOrderApi().addOrderSync(addOrderSyncReq); + console.info( + `[SPOT ORDER] Placed ${side.toUpperCase()} order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + const orderDetail = await spotService + .getOrderApi() + .getOrderByOrderId(Spot.Order.GetOrderByOrderIdReq.builder().setSymbol(symbol).setOrderId(order.orderId).build()); + + if (!orderDetail.active) { + console.info( + `[SPOT ORDER] Order filled successfully: ${side.toUpperCase()} ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + + console.info("[SPOT ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + + console.warn( + `[SPOT ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await spotService + .getOrderApi() + .cancelOrderByOrderIdSync(Spot.Order.CancelOrderByOrderIdSyncReq.builder().setOrderId(order.orderId).setSymbol(symbol).build()); + + if (cancelResp.status !== Spot.Order.CancelOrderByOrderIdSyncResp.StatusEnum.DONE) { + throw new Error(`[SPOT ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[SPOT ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function addFuturesOrderWaitFill( + futuresService: FuturesService, + symbol: string, + side: MarketSide, + amount: number, + price: number +): Promise { + /** + * Places a futures order and waits for it to be filled within a specified timeout. + */ + const addOrderReq = Futures.Order.AddOrderReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side === MarketSide.BUY ? Futures.Order.AddOrderReq.SideEnum.BUY : Futures.Order.AddOrderReq.SideEnum.SELL) + .setSymbol(symbol) + .setType(Futures.Order.AddOrderReq.TypeEnum.LIMIT) + .setRemark("arbitrage") + .setPrice(price.toFixed(4)) + .setLeverage(1) + .setSize(amount) + .build(); + + const order = await futuresService.getOrderApi().addOrder(addOrderReq); + console.info( + `[FUTURES ORDER] Placed ${side.toUpperCase()} order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + console.info("[FUTURES ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + + const orderDetail = await futuresService + .getOrderApi() + .getOrderByOrderId(Futures.Order.GetOrderByOrderIdReq.builder().setOrderId(order.orderId).build()); + + if (orderDetail.status === Futures.Order.GetOrderByOrderIdResp.StatusEnum.DONE) { + console.info( + `[FUTURES ORDER] Order filled successfully: ${side.toUpperCase()} ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + } + + console.warn( + `[FUTURES ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await futuresService + .getOrderApi() + .cancelOrderById(Futures.Order.CancelOrderByIdReq.builder().setOrderId(order.orderId).build()); + + if (!cancelResp.cancelledOrderIds.includes(order.orderId)) { + throw new Error(`[FUTURES ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[FUTURES ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function addMarginOrderWaitFill( + marginService: MarginService, + symbol: string, + amount: number, + price: number +): Promise { + /** + * Places a margin order and waits for it to be filled within a specified timeout. + */ + const addOrderReq = Margin.Order.AddOrderReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(Margin.Order.AddOrderReq.SideEnum.BUY) + .setSymbol(symbol) + .setType(Margin.Order.AddOrderReq.TypeEnum.LIMIT) + .setIsIsolated(false) + .setAutoBorrow(true) + .setAutoRepay(true) + .setPrice(price.toFixed(4)) + .setSize(amount.toFixed(4)) + .build(); + + const order = await marginService.getOrderApi().addOrder(addOrderReq); + console.info( + `[MARGIN ORDER] Placed SELL order for ${amount} ${symbol} at ${price.toFixed(6)}. Order ID: ${order.orderId}` + ); + + const deadline = Date.now() + MAX_PLACE_ORDER_WAIT_TIME_SEC * 1000; + while (Date.now() < deadline) { + console.info("[MARGIN ORDER] Checking order status in 1 second..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + + const orderDetail = await marginService + .getOrderApi() + .getOrderByOrderId(Margin.Order.GetOrderByOrderIdReq.builder().setSymbol(symbol).setOrderId(order.orderId).build()); + + if (!orderDetail.active) { + console.info( + `[MARGIN ORDER] Order filled successfully: SELL ${amount} ${symbol}. Order ID: ${order.orderId}` + ); + return true; + } + } + + console.warn( + `[MARGIN ORDER] Order not filled within ${MAX_PLACE_ORDER_WAIT_TIME_SEC} seconds. Cancelling order...` + ); + + const cancelResp = await marginService + .getOrderApi() + .cancelOrderByOrderId(Margin.Order.CancelOrderByOrderIdReq.builder().setOrderId(order.orderId).setSymbol(symbol).build()); + + if (!cancelResp.orderId) { + throw new Error(`[MARGIN ORDER] Failed to cancel order. Order ID: ${order.orderId}`); + } + + console.info(`[MARGIN ORDER] Order cancelled successfully. Order ID: ${order.orderId}`); + return false; +} + +async function main() { + /** + * Main function to run the funding rate arbitrage strategy for a specific duration. + */ + console.info("Initializing APIs..."); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + const kucoinRestService = client.restService(); + + const futuresService: FuturesService = kucoinRestService.getFuturesService(); + const spotService: SpotService = kucoinRestService.getSpotService(); + const marginService: MarginService = kucoinRestService.getMarginService(); + const accountService: AccountService = kucoinRestService.getAccountService(); + + const amount = 100; // Amount to trade + const threshold = 0.005; // Minimum profit threshold + + console.info("Starting funding rate arbitrage strategy..."); + await fundingRateArbitrageStrategy(futuresService, spotService, marginService, accountService, amount, threshold); +} + +main().catch((error) => { + console.error("Error running arbitrage strategy:", error); +}); \ No newline at end of file diff --git a/sdk/node/example/src/ts/example_ma_strategy.ts b/sdk/node/example/src/ts/example_ma_strategy.ts new file mode 100644 index 00000000..63dd34c5 --- /dev/null +++ b/sdk/node/example/src/ts/example_ma_strategy.ts @@ -0,0 +1,160 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ + +import { + Account, + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + TransportOptionBuilder, +} from 'kucoin-universal-sdk'; + +enum Action { + BUY = "buy", + SELL = "sell", + SKIP = "skip" +} + +async function simpleMovingAverageStrategy(api: Spot.MarketAPI, symbol: string, shortWindow: number, longWindow: number, endTime: number): Promise { + const startTime = endTime - longWindow * 60; + console.info(`Querying kline data: Start=${new Date(startTime * 1000)}, End=${new Date(endTime * 1000)}`); + + const getKlineReq = Spot.Market.GetKlinesReq.builder() + .setSymbol(symbol) + .setType(Spot.Market.GetKlinesReq.TypeEnum._1MIN) + .setStartAt(startTime) + .setEndAt(endTime) + .build(); + + const klineResp = await api.getKlines(getKlineReq); + const prices = klineResp.data.map((data: any) => parseFloat(data[2])); + + const shortMa = prices.slice(-shortWindow).reduce((sum, price) => sum + price, 0) / shortWindow; + const longMa = prices.slice(-longWindow).reduce((sum, price) => sum + price, 0) / longWindow; + + console.info(`Short MA: ${shortMa}, Long MA: ${longMa}`); + + if (shortMa > longMa) return Action.BUY; + if (shortMa < longMa) return Action.SELL; + return Action.SKIP; +} + +async function getLastTradePrice(marketApi: Spot.MarketAPI, symbol: string): Promise { + const getStatReq = Spot.Market.Get24hrStatsReq.builder().setSymbol(symbol).build(); + const statResp = await marketApi.get24hrStats(getStatReq); + return parseFloat(statResp.last); +} + +async function checkAvailableBalance(accountApi: Account.AccountAPI, lastTradePrice: number, amount: number, action: Action): Promise { + const currency = action === Action.BUY ? "USDT" : "DOGE"; + console.info(`Checking balance for ${currency}`); + + const getAccountReq = Account.Account.GetSpotAccountListReq.builder() + .setType(Account.Account.GetSpotAccountListReq.TypeEnum.TRADE) + .setCurrency(currency) + .build(); + + const getAccountResp = await accountApi.getSpotAccountList(getAccountReq); + const availableBalance = getAccountResp.data.reduce((sum: number, account: any) => sum + parseFloat(account.available), 0); + console.info(`Available ${currency} balance: ${availableBalance}`); + + return action === Action.BUY ? lastTradePrice * amount <= availableBalance : amount <= availableBalance; +} + +async function placeOrder(orderApi: Spot.OrderAPI, symbol: string, action: Action, lastTradePrice: number, amount: number, priceDelta: number) { + const openOrderReq = Spot.Order.GetOpenOrdersReq.builder().setSymbol(symbol).build(); + const openOrderResp = await orderApi.getOpenOrders(openOrderReq); + + if (openOrderResp.data.length > 0) { + console.info(`Found open orders for ${symbol}. Cancelling...`); + const cancelAllReq = Spot.Order.CancelAllOrdersBySymbolReq.builder().setSymbol(symbol).build(); + await orderApi.cancelAllOrdersBySymbol(cancelAllReq); + } + + const side = action === Action.BUY ? Spot.Order.AddOrderSyncReq.SideEnum.BUY : Spot.Order.AddOrderSyncReq.SideEnum.SELL; + const price = lastTradePrice * (action === Action.BUY ? (1 - priceDelta) : (1 + priceDelta)); + + console.info(`Placing ${side} order for ${symbol} at ${price}`); + + const addOrderReq = Spot.Order.AddOrderSyncReq.builder() + .setClientOid(crypto.randomUUID()) + .setSide(side) + .setSymbol(symbol) + .setType(Spot.Order.AddOrderSyncReq.TypeEnum.LIMIT) + .setRemark("ma") + .setPrice(price.toFixed(2)) + .setSize(amount.toFixed(8)) + .build(); + + await orderApi.addOrderSync(addOrderReq); +} + +async function maExample() { + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ''; + const secret = process.env.API_SECRET || ''; + const passphrase = process.env.API_PASSPHRASE || ''; + + // Set specific options, others will fall back to default values + const httpTransportOption = new TransportOptionBuilder() + .setKeepAlive(true) + .setMaxConnsPerHost(10) + .setMaxIdleConns(10) + .build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setTransportOption(httpTransportOption) + .build(); + + const client = new DefaultClient(clientOption); + const marketApi = client.restService().getSpotService().getMarketApi(); + const accountApi = client.restService().getAccountService().getAccountApi(); + const orderApi = client.restService().getSpotService().getOrderApi(); + + const SYMBOL = "DOGE-USDT"; + const ORDER_AMOUNT = 10; + const PRICE_DELTA = 0.1; + + console.info("Starting the moving average strategy using K-line data. Press Ctrl+C to stop."); + try { + while (true) { + const currentTime = Math.floor(Date.now() / 1000); + const action = await simpleMovingAverageStrategy(marketApi, SYMBOL, 10, 30, currentTime); + if (action !== Action.SKIP) { + const lastPrice = await getLastTradePrice(marketApi, SYMBOL); + console.info(`Last trade price for ${SYMBOL}: ${lastPrice}`); + const sufficientBalance = await checkAvailableBalance(accountApi, lastPrice, ORDER_AMOUNT, action); + if (sufficientBalance) { + console.info("Sufficient balance available. Attempting to place the order..."); + await placeOrder(orderApi, SYMBOL, action, lastPrice, ORDER_AMOUNT, PRICE_DELTA); + } else { + console.info("Insufficient balance. Skipping the trade..."); + } + } + console.info("Waiting for 1 minute before the next run..."); + await new Promise(resolve => setTimeout(resolve, 60000)); + } + } catch (err) { + console.error("Strategy stopped due to error:", err); + } +} + +maExample() \ No newline at end of file diff --git a/sdk/node/example/src/ts/example_realtime_kline.ts b/sdk/node/example/src/ts/example_realtime_kline.ts new file mode 100644 index 00000000..a938dc06 --- /dev/null +++ b/sdk/node/example/src/ts/example_realtime_kline.ts @@ -0,0 +1,137 @@ +/** + * DISCLAIMER: + * This strategy is provided for educational and illustrative purposes only. It is not intended to be used as financial + * or investment advice. Trading cryptocurrencies involves significant risk, and you should carefully consider your + * investment objectives, level of experience, and risk appetite. Past performance of any trading strategy is not + * indicative of future results. + * + * The authors and contributors of this example are not responsible for any financial losses or damages that may occur + * from using this code. Use it at your own discretion and consult with a professional financial advisor if necessary. + */ +import { + ClientOptionBuilder, + DefaultClient, + GlobalApiEndpoint, + GlobalBrokerApiEndpoint, + GlobalFuturesApiEndpoint, + Spot, + WebSocketClientOptionBuilder, +} from 'kucoin-universal-sdk'; + + +interface KLine { + open: number; + high: number; + low: number; + close: number; + volume: number; + startTime: number; + endTime: number; +} + +const klineData: Record> = {}; + +const timeInterval = 60; + +function onTradeData(topic: string, subject: string, tradeEvent: Spot.SpotPublic.TradeEvent): void { + const symbol = tradeEvent.symbol; + const price = parseFloat(tradeEvent.price); + const size = parseFloat(tradeEvent.size); + const timestamp = Math.floor(Number(tradeEvent.time) / 1_000_000_000); + + const periodStart = Math.floor(timestamp / timeInterval) * timeInterval; + const periodEnd = periodStart + timeInterval; + + if (!klineData[periodStart]) { + klineData[periodStart] = {}; + } + + if (!klineData[periodStart][symbol]) { + klineData[periodStart][symbol] = { + open: price, + high: price, + low: price, + close: price, + volume: size, + startTime: periodStart, + endTime: periodEnd, + }; + } else { + const kline = klineData[periodStart][symbol]; + kline.high = Math.max(kline.high, price); + kline.low = Math.min(kline.low, price); + kline.close = price; + kline.volume += size; + } + + console.info( + `KLine for ${symbol} @ ${new Date(periodStart * 1000).toISOString()}:`, + klineData[periodStart][symbol] + ); +} + +function printKlineData(): void { + const sortedKeys = Object.keys(klineData) + .map(Number) + .sort((a, b) => a - b); + + for (const periodStart of sortedKeys) { + console.info(`\nTime Period: ${new Date(periodStart * 1000).toISOString()}`); + for (const symbol in klineData[periodStart]) { + const kline = klineData[periodStart][symbol]; + console.info(` Symbol: ${symbol}`); + console.info(` Open: ${kline.open}`); + console.info(` High: ${kline.high}`); + console.info(` Low: ${kline.low}`); + console.info(` Close: ${kline.close}`); + console.info(` Volume: ${kline.volume}`); + console.info(` Start Time: ${new Date(kline.startTime * 1000).toISOString()}`); + console.info(` End Time: ${new Date(kline.endTime * 1000).toISOString()}`); + } + } +} + +async function main() { + console.info("Initializing WebSocket connection..."); + + // Retrieve API secret information from environment variables + const key = process.env.API_KEY || ""; + const secret = process.env.API_SECRET || ""; + const passphrase = process.env.API_PASSPHRASE || ""; + + // Set specific options, others will fall back to default values + const wsClientOption = new WebSocketClientOptionBuilder().build(); + + // Create a client using the specified options + const clientOption = new ClientOptionBuilder() + .setKey(key) + .setSecret(secret) + .setPassphrase(passphrase) + .setSpotEndpoint(GlobalApiEndpoint) + .setFuturesEndpoint(GlobalFuturesApiEndpoint) + .setBrokerEndpoint(GlobalBrokerApiEndpoint) + .setWebSocketClientOption(wsClientOption) + .build(); + + const client = new DefaultClient(clientOption); + + const spotPublic = client.wsService().newSpotPublicWS(); + await spotPublic.start(); + + // Subscribe to trade data + const subId = spotPublic.trade(["BTC-USDT", "ETH-USDT"], onTradeData); + + // Keep the connection open for 180 seconds + await new Promise((resolve) => setTimeout(resolve, 180_000)); + + // Unsubscribe and stop WebSocket connection + await spotPublic.unSubscribe(await subId); + await spotPublic.stop(); + + // Print collected K-Line data + printKlineData(); +} + +main().catch((error) => { + console.error("Error running WebSocket client:", error); +}); \ No newline at end of file diff --git a/sdk/node/example/src/ts/example_sign.ts b/sdk/node/example/src/ts/example_sign.ts new file mode 100644 index 00000000..3a77355e --- /dev/null +++ b/sdk/node/example/src/ts/example_sign.ts @@ -0,0 +1,137 @@ +import crypto from "crypto"; +import axios, {AxiosInstance, AxiosRequestConfig} from "axios"; + +class KcSigner { + private apiKey: string; + private apiSecret: string; + private apiPassphrase: string; + + constructor(apiKey: string, apiSecret: string, apiPassphrase: string) { + /** + * KcSigner contains information about `apiKey`, `apiSecret`, `apiPassphrase` + * and provides methods to sign and generate headers for API requests. + */ + this.apiKey = apiKey || ""; + this.apiSecret = apiSecret || ""; + this.apiPassphrase = apiPassphrase || ""; + + if (apiPassphrase && apiSecret) { + this.apiPassphrase = this.sign(apiPassphrase, apiSecret); + } + + if (!apiKey || !apiSecret || !apiPassphrase) { + console.warn("API token is empty. Access is restricted to public interfaces only."); + } + } + + private sign(plain: string, key: string): string { + return crypto.createHmac("sha256", key).update(plain).digest("base64"); + } + + public headers(plain: string): Record { + /** + * Headers method generates and returns a map of signature headers needed for API authorization. + * It takes a plain string as an argument to help form the signature. The outputs are a set of API headers. + */ + const timestamp = Date.now().toString(); + const signature = this.sign(timestamp + plain, this.apiSecret); + + return { + "KC-API-KEY": this.apiKey, + "KC-API-PASSPHRASE": this.apiPassphrase, + "KC-API-TIMESTAMP": timestamp, + "KC-API-SIGN": signature, + "KC-API-KEY-VERSION": "2", + "Content-Type": "application/json", + }; + } +} + +async function processHeaders( + signer: KcSigner, + body: string, + rawUrl: string, + method: string +): Promise> { + /** + * Creates and returns headers for API authentication. + */ + const payload = method + rawUrl + body; + return signer.headers(payload); +} + +async function getTradeFees(signer: KcSigner, axiosInstance: AxiosInstance) { + const endpoint = "https://api.kucoin.com"; + const path = "/api/v1/trade-fees"; + const method = "GET"; + const queryParams = new URLSearchParams({symbols: "BTC-USDT"}).toString(); + + const fullPath = `${endpoint}${path}?${queryParams}`; + const rawUrl = `${path}?${queryParams}`; + + const headers = await processHeaders(signer, "", rawUrl, method); + const config: AxiosRequestConfig = { + method, + url: fullPath, + headers, + }; + + try { + const response = await axiosInstance(config); + console.log(response.data); + } catch (error) { + console.error("Error fetching trade fees:", error); + } +} + +async function addLimitOrder(signer: KcSigner, axiosInstance: AxiosInstance) { + const endpoint = "https://api.kucoin.com"; + const path = "/api/v1/hf/orders"; + const method = "POST"; + + const orderData = JSON.stringify({ + clientOid: crypto.randomUUID(), + side: "buy", + symbol: "BTC-USDT", + type: "limit", + price: "10000", + size: "0.001", + }); + + const fullPath = `${endpoint}${path}`; + const rawUrl = path; + + const headers = await processHeaders(signer, orderData, rawUrl, method); + const config: AxiosRequestConfig = { + method, + url: fullPath, + headers, + data: orderData, + }; + + try { + const response = await axiosInstance(config); + console.log(response.data); + } catch (error) { + console.error("Error placing limit order:", error); + } +} + +async function main() { + /** + * Main function to execute API calls. + */ + const key = process.env.API_KEY || ""; + const secret = process.env.API_SECRET || ""; + const passphrase = process.env.API_PASSPHRASE || ""; + + const axiosInstance = axios.create(); + const signer = new KcSigner(key, secret, passphrase); + + await getTradeFees(signer, axiosInstance); + await addLimitOrder(signer, axiosInstance); +} + +main().catch((error) => { + console.error("Error executing main function:", error); +}); diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts index 753e6c6b..3057fab3 100644 --- a/sdk/node/src/generate/service/index.ts +++ b/sdk/node/src/generate/service/index.ts @@ -1,9 +1,18 @@ -export * from './account_api'; -export * from './affiliate_api'; -export * from './broker_api'; -export * from './copytrading_api'; -export * from './earn_api'; -export * from './futures_api'; -export * from './margin_api'; -export * from './spot_api'; -export * from './viplending_api'; +export * from "./account_api" +export * from "./affiliate_api" +export * from "./broker_api" +export * from "./copytrading_api" +export * from "./earn_api" +export * from "./futures_api" +export * from "./margin_api" +export * from "./spot_api" +export * from "./viplending_api" +export type {AccountService} from "./account_api" +export type {AffiliateService} from "./affiliate_api" +export type {BrokerService} from "./broker_api" +export type {CopyTradingService} from "./copytrading_api" +export type {EarnService} from "./earn_api" +export type {FuturesService} from "./futures_api" +export type {MarginService} from "./margin_api" +export type {SpotService} from "./spot_api" +export type {VIPLendingService} from "./viplending_api" From 5bc9b7e98e30410d4b1c254f869ff2fa9dd7ec4f Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Thu, 20 Feb 2025 10:23:32 +0800 Subject: [PATCH 087/106] feat(nodejs): remove extra log --- sdk/node/src/internal/infra/default_ws_service.ts | 10 +++++----- sdk/node/src/internal/infra/message_worker.js | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 9238bce7..d078acf9 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -292,7 +292,7 @@ export class DefaultWsService implements WebSocketService { // Check if already subscribed if (!created) { - logger.info(`Already subscribed: ${subId}`); + logger.warn(`Already subscribed: ${subId}`); return Promise.reject(new Error('Already subscribed')); } @@ -336,20 +336,20 @@ export class DefaultWsService implements WebSocketService { subEvent.response = true; callbackManager.remove(id); - logger.info('[DEBUG] callback removed for id:', id); + logger.info('callback removed for id:', id); this.client .write(subEvent, this.wsOption.writeTimeout) .then(() => { - logger.info('[DEBUG] unsubscribe message sent successfully'); + logger.info('unsubscribe message sent successfully'); resolve(); }) .catch((e) => { - logger.error('[DEBUG] Failed to send unsubscribe message:', e); + logger.error('Failed to send unsubscribe message:', e); reject(e); }); } catch (e) { - logger.error('[DEBUG] unsubscribe error:', e); + logger.error('unsubscribe error:', e); reject(e); } }); diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index e71c940a..a4215e53 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -43,7 +43,6 @@ parentPort.on('message', (message) => { ws.on('message', (data) => { const parsedMessage = parseMessage(data); if (parsedMessage) { - logger.info('[Worker] Received message:', parsedMessage); parentPort.postMessage({ type: 'message', data: JSON.stringify(parsedMessage), From dbcadde68b30071416f30332ec259218e183b63c Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 20 Feb 2025 11:05:05 +0800 Subject: [PATCH 088/106] test(nodejs): update test for private channel --- sdk/node/tests/e2e/ws/futures/private.test.ts | 198 +++++++----------- sdk/node/tests/e2e/ws/margin/private.test.ts | 20 +- sdk/node/tests/e2e/ws/spot/private.test.ts | 52 +---- 3 files changed, 84 insertions(+), 186 deletions(-) diff --git a/sdk/node/tests/e2e/ws/futures/private.test.ts b/sdk/node/tests/e2e/ws/futures/private.test.ts index 6208c833..4fdb9794 100644 --- a/sdk/node/tests/e2e/ws/futures/private.test.ts +++ b/sdk/node/tests/e2e/ws/futures/private.test.ts @@ -51,14 +51,14 @@ describe('Futures Private WebSocket API Tests', () => { }); afterAll(() => { - // TODO - // return api.stop(); + return api.stop(); }); test('allOrder subscription test', (done) => { (async () => { let subid = await api.allOrder( async (topic: string, subject: string, item: AllOrderEvent) => { + console.log(item); expect(item).toBeDefined(); expect(item.symbol).toEqual(expect.any(String)); expect(item.side).toEqual(expect.any(String)); @@ -74,7 +74,6 @@ describe('Futures Private WebSocket API Tests', () => { expect(item.status).toEqual(expect.any(String)); expect(item.ts).toEqual(expect.any(Number)); expect(item.tradeType).toEqual(expect.any(String)); - console.log(item); api.unSubscribe(subid).then(() => { done(); @@ -90,6 +89,7 @@ describe('Futures Private WebSocket API Tests', () => { (async () => { let subid = await api.allPosition( async (topic: string, subject: string, item: AllPositionEvent) => { + console.log(item); expect(item.symbol).toEqual(expect.any(String)); expect(item.crossMode).toEqual(expect.any(Boolean)); expect(item.delevPercentage).toEqual(expect.any(Number)); @@ -113,30 +113,6 @@ describe('Futures Private WebSocket API Tests', () => { expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); expect(item.avgEntryPrice).toEqual(expect.any(Number)); - expect(item.liquidationPrice).toEqual(expect.any(Number)); - expect(item.bankruptPrice).toEqual(expect.any(Number)); - expect(item.settleCurrency).toEqual(expect.any(String)); - expect(item.marginMode).toEqual(expect.any(String)); - expect(item.positionSide).toEqual(expect.any(String)); - expect(item.leverage).toEqual(expect.any(Number)); - expect(item.autoDeposit).toEqual(expect.any(Boolean)); - expect(item.maintMarginReq).toEqual(expect.any(Number)); - expect(item.riskLimit).toEqual(expect.any(Number)); - expect(item.realLeverage).toEqual(expect.any(Number)); - expect(item.posCross).toEqual(expect.any(Number)); - expect(item.posComm).toEqual(expect.any(Number)); - expect(item.posLoss).toEqual(expect.any(Number)); - expect(item.posFunding).toEqual(expect.any(Number)); - expect(item.posMaint).toEqual(expect.any(Number)); - expect(item.maintMargin).toEqual(expect.any(Number)); - expect(item.fundingTime).toEqual(expect.any(Number)); - expect(item.qty).toEqual(expect.any(Number)); - expect(item.fundingRate).toEqual(expect.any(Number)); - expect(item.fundingFee).toEqual(expect.any(Number)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.success).toEqual(expect.any(Boolean)); - expect(item.msg).toEqual(expect.any(String)); - console.log(item); api.unSubscribe(subid).then(() => { done(); @@ -152,23 +128,26 @@ describe('Futures Private WebSocket API Tests', () => { (async () => { let subid = await api.balance( async (topic: string, subject: string, item: BalanceEvent) => { - expect(item.crossPosMargin).toEqual(expect.any(String)); - expect(item.isolatedOrderMargin).toEqual(expect.any(String)); - expect(item.holdBalance).toEqual(expect.any(String)); - expect(item.equity).toEqual(expect.any(String)); - expect(item.version).toEqual(expect.any(String)); - expect(item.availableBalance).toEqual(expect.any(String)); - expect(item.isolatedPosMargin).toEqual(expect.any(String)); - expect(item.walletBalance).toEqual(expect.any(String)); - expect(item.isolatedFundingFeeMargin).toEqual(expect.any(String)); - expect(item.crossUnPnl).toEqual(expect.any(String)); - expect(item.totalCrossMargin).toEqual(expect.any(String)); - expect(item.currency).toEqual(expect.any(String)); - expect(item.isolatedUnPnl).toEqual(expect.any(String)); - expect(item.crossOrderMargin).toEqual(expect.any(String)); - expect(item.timestamp).toEqual(expect.any(String)); console.log(item); - + try { + expect(item.crossPosMargin).toEqual(expect.any(String)); + expect(item.isolatedOrderMargin).toEqual(expect.any(String)); + expect(item.holdBalance).toEqual(expect.any(String)); + expect(item.equity).toEqual(expect.any(String)); + expect(item.version).toEqual(expect.any(String)); + expect(item.availableBalance).toEqual(expect.any(String)); + expect(item.isolatedPosMargin).toEqual(expect.any(String)); + expect(item.walletBalance).toEqual(expect.any(String)); + expect(item.isolatedFundingFeeMargin).toEqual(expect.any(String)); + expect(item.crossUnPnl).toEqual(expect.any(String)); + expect(item.totalCrossMargin).toEqual(expect.any(String)); + expect(item.currency).toEqual(expect.any(String)); + expect(item.isolatedUnPnl).toEqual(expect.any(String)); + expect(item.crossOrderMargin).toEqual(expect.any(String)); + expect(item.timestamp).toEqual(expect.any(String)); + } catch (e) { + fail(e); + } api.unSubscribe(subid).then(() => { done(); }); @@ -202,7 +181,6 @@ describe('Futures Private WebSocket API Tests', () => { (async () => { let subid = await api.marginMode( async (topic: string, subject: string, item: MarginModeEvent) => { - expect(item.SYMBOL).toEqual(expect.any(String)); console.log(item); api.unSubscribe(subid).then(() => { done(); @@ -220,28 +198,23 @@ describe('Futures Private WebSocket API Tests', () => { 'XBTUSDTM', async (topic: string, subject: string, item: OrderEvent) => { console.log(item); - expect(item.symbol).toEqual(expect.any(String)); - expect(item.orderType).toEqual(expect.any(String)); - expect(item.side).toEqual(expect.any(String)); - expect(item.canceledSize).toEqual(expect.any(String)); - expect(item.orderId).toEqual(expect.any(String)); - expect(item.marginMode).toEqual(expect.any(String)); - expect(item.type).toEqual(expect.any(String)); - expect(item.orderTime).toEqual(expect.any(Number)); - expect(item.size).toEqual(expect.any(String)); - expect(item.filledSize).toEqual(expect.any(String)); - expect(item.price).toEqual(expect.any(String)); - expect(item.remainSize).toEqual(expect.any(String)); - expect(item.status).toEqual(expect.any(String)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.liquidity).toEqual(expect.any(String)); - expect(item.feeType).toEqual(expect.any(String)); - expect(item.matchPrice).toEqual(expect.any(String)); - expect(item.matchSize).toEqual(expect.any(String)); - expect(item.tradeId).toEqual(expect.any(String)); - expect(item.oldSize).toEqual(expect.any(String)); - expect(item.clientOid).toEqual(expect.any(String)); - expect(item.tradeType).toEqual(expect.any(String)); + try { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.side).toEqual(expect.any(String)); + expect(item.canceledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.type).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.size).toEqual(expect.any(String)); + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + expect(item.remainSize).toEqual(expect.any(String)); + expect(item.status).toEqual(expect.any(String)); + expect(item.ts).toEqual(expect.any(Number)); + } catch (e) { + done(e); + } api.unSubscribe(subid).then(() => { done(); }); @@ -255,55 +228,41 @@ describe('Futures Private WebSocket API Tests', () => { test('position subscription test', (done) => { (async () => { let subid = await api.position( - 'XBTUSDTM', + 'DOGEUSDTM', async (topic: string, subject: string, item: PositionEvent) => { console.log(item); - expect(item.symbol).toEqual(expect.any(String)); - expect(item.crossMode).toEqual(expect.any(Boolean)); - expect(item.delevPercentage).toEqual(expect.any(Number)); - expect(item.openingTimestamp).toEqual(expect.any(Number)); - expect(item.currentTimestamp).toEqual(expect.any(Number)); - expect(item.currentQty).toEqual(expect.any(Number)); - expect(item.currentCost).toEqual(expect.any(Number)); - expect(item.currentComm).toEqual(expect.any(Number)); - expect(item.unrealisedCost).toEqual(expect.any(Number)); - expect(item.realisedGrossCost).toEqual(expect.any(Number)); - expect(item.realisedCost).toEqual(expect.any(Number)); - expect(item.isOpen).toEqual(expect.any(Boolean)); - expect(item.markPrice).toEqual(expect.any(Number)); - expect(item.markValue).toEqual(expect.any(Number)); - expect(item.posCost).toEqual(expect.any(Number)); - expect(item.posInit).toEqual(expect.any(Number)); - expect(item.posMargin).toEqual(expect.any(Number)); - expect(item.realisedGrossPnl).toEqual(expect.any(Number)); - expect(item.realisedPnl).toEqual(expect.any(Number)); - expect(item.unrealisedPnl).toEqual(expect.any(Number)); - expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); - expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); - expect(item.avgEntryPrice).toEqual(expect.any(Number)); - expect(item.liquidationPrice).toEqual(expect.any(Number)); - expect(item.bankruptPrice).toEqual(expect.any(Number)); - expect(item.settleCurrency).toEqual(expect.any(String)); - expect(item.marginMode).toEqual(expect.any(String)); - expect(item.positionSide).toEqual(expect.any(String)); - expect(item.leverage).toEqual(expect.any(Number)); - expect(item.autoDeposit).toEqual(expect.any(Boolean)); - expect(item.maintMarginReq).toEqual(expect.any(Number)); - expect(item.riskLimit).toEqual(expect.any(Number)); - expect(item.realLeverage).toEqual(expect.any(Number)); - expect(item.posCross).toEqual(expect.any(Number)); - expect(item.posComm).toEqual(expect.any(Number)); - expect(item.posLoss).toEqual(expect.any(Number)); - expect(item.posFunding).toEqual(expect.any(Number)); - expect(item.posMaint).toEqual(expect.any(Number)); - expect(item.maintMargin).toEqual(expect.any(Number)); - expect(item.fundingTime).toEqual(expect.any(Number)); - expect(item.qty).toEqual(expect.any(Number)); - expect(item.fundingRate).toEqual(expect.any(Number)); - expect(item.fundingFee).toEqual(expect.any(Number)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.success).toEqual(expect.any(Boolean)); - expect(item.msg).toEqual(expect.any(String)); + try { + expect(item.symbol).toEqual(expect.any(String)); + expect(item.crossMode).toEqual(expect.any(Boolean)); + expect(item.delevPercentage).toEqual(expect.any(Number)); + expect(item.openingTimestamp).toEqual(expect.any(Number)); + expect(item.currentTimestamp).toEqual(expect.any(Number)); + expect(item.currentQty).toEqual(expect.any(Number)); + expect(item.currentCost).toEqual(expect.any(Number)); + expect(item.currentComm).toEqual(expect.any(Number)); + expect(item.unrealisedCost).toEqual(expect.any(Number)); + expect(item.realisedGrossCost).toEqual(expect.any(Number)); + expect(item.realisedCost).toEqual(expect.any(Number)); + expect(item.isOpen).toEqual(expect.any(Boolean)); + expect(item.markPrice).toEqual(expect.any(Number)); + expect(item.markValue).toEqual(expect.any(Number)); + expect(item.posCost).toEqual(expect.any(Number)); + expect(item.posInit).toEqual(expect.any(Number)); + expect(item.realisedGrossPnl).toEqual(expect.any(Number)); + expect(item.realisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnl).toEqual(expect.any(Number)); + expect(item.unrealisedPnlPcnt).toEqual(expect.any(Number)); + expect(item.unrealisedRoePcnt).toEqual(expect.any(Number)); + expect(item.avgEntryPrice).toEqual(expect.any(Number)); + expect(item.liquidationPrice).toEqual(expect.any(Number)); + expect(item.bankruptPrice).toEqual(expect.any(Number)); + expect(item.settleCurrency).toEqual(expect.any(String)); + expect(item.marginMode).toEqual(expect.any(String)); + expect(item.positionSide).toEqual(expect.any(String)); + expect(item.leverage).toEqual(expect.any(Number)); + } catch (e) { + done(e); + } api.unSubscribe(subid).then(() => { done(); }); @@ -319,19 +278,6 @@ describe('Futures Private WebSocket API Tests', () => { let subid = await api.stopOrders( async (topic: string, subject: string, item: StopOrdersEvent) => { console.log(item); - expect(item.createdAt).toEqual(expect.any(Number)); - expect(item.marginMode).toEqual(expect.any(String)); - expect(item.orderId).toEqual(expect.any(String)); - expect(item.orderPrice).toEqual(expect.any(String)); - expect(item.orderType).toEqual(expect.any(String)); - expect(item.side).toEqual(expect.any(String)); - expect(item.size).toEqual(expect.any(Number)); - expect(item.stop).toEqual(expect.any(String)); - expect(item.stopPrice).toEqual(expect.any(String)); - expect(item.stopPriceType).toEqual(expect.any(String)); - expect(item.symbol).toEqual(expect.any(String)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.type).toEqual(expect.any(String)); api.unSubscribe(subid).then(() => { done(); }); diff --git a/sdk/node/tests/e2e/ws/margin/private.test.ts b/sdk/node/tests/e2e/ws/margin/private.test.ts index 0865e78c..d214914c 100644 --- a/sdk/node/tests/e2e/ws/margin/private.test.ts +++ b/sdk/node/tests/e2e/ws/margin/private.test.ts @@ -45,8 +45,7 @@ describe('Margin Private WebSocket API Tests', () => { }); afterAll(() => { - // TODO - // return api.stop(); + return api.stop(); }); test('crossMarginPosition subscription test', (done) => { @@ -54,14 +53,6 @@ describe('Margin Private WebSocket API Tests', () => { let subid = await api.crossMarginPosition( async (topic: string, subject: string, item: CrossMarginPositionEvent) => { console.log(item); - expect(item.debtRatio).toEqual(expect.any(Number)); - expect(item.totalAsset).toEqual(expect.any(Number)); - expect(item.marginCoefficientTotalAsset).toEqual(expect.any(String)); - expect(item.totalDebt).toEqual(expect.any(String)); - expect(item.assetList).toEqual(expect.any(Object)); - expect(item.debtList).toEqual(expect.any(Object)); - expect(item.timestamp).toEqual(expect.any(Number)); - expect(item.type).toEqual(expect.any(String)); api.unSubscribe(subid).then(() => { done(); }); @@ -75,16 +66,9 @@ describe('Margin Private WebSocket API Tests', () => { test('isolatedMarginPosition subscription test', (done) => { (async () => { let subid = await api.isolatedMarginPosition( - 'BTC-USDT', + 'DOGE-USDT', async (topic: string, subject: string, item: IsolatedMarginPositionEvent) => { console.log(item); - expect(item.tag).toEqual(expect.any(String)); - expect(item.status).toEqual(expect.any(String)); - expect(item.statusBizType).toEqual(expect.any(String)); - expect(item.accumulatedPrincipal).toEqual(expect.any(String)); - expect(item.changeAssets).toEqual(expect.any(Object)); - expect(item.timestamp).toEqual(expect.any(Number)); - api.unSubscribe(subid).then(() => { done(); }); diff --git a/sdk/node/tests/e2e/ws/spot/private.test.ts b/sdk/node/tests/e2e/ws/spot/private.test.ts index e68f492c..60330377 100644 --- a/sdk/node/tests/e2e/ws/spot/private.test.ts +++ b/sdk/node/tests/e2e/ws/spot/private.test.ts @@ -37,8 +37,7 @@ describe('Spot Private WebSocket API Tests', () => { }); afterAll(() => { - // TODO - // return api.stop(); + return api.stop(); }); test('account subscription test', (done) => { @@ -72,29 +71,15 @@ describe('Spot Private WebSocket API Tests', () => { let subid = await api.orderV1( async (topic: string, subject: string, item: OrderV1Event) => { console.log(item); - expect(item.canceledSize).toEqual(expect.any(String)); - expect(item.clientOid).toEqual(expect.any(String)); - expect(item.filledSize).toEqual(expect.any(String)); - expect(item.orderId).toEqual(expect.any(String)); - expect(item.orderTime).toEqual(expect.any(Number)); - expect(item.orderType).toEqual(expect.any(String)); - expect(item.originSize).toEqual(expect.any(String)); - expect(item.price).toEqual(expect.any(String)); - expect(item.remainFunds).toEqual(expect.any(String)); - expect(item.remainSize).toEqual(expect.any(String)); - expect(item.side).toEqual(expect.any(String)); - expect(item.size).toEqual(expect.any(String)); - expect(item.status).toEqual(expect.any(String)); - expect(item.symbol).toEqual(expect.any(String)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.type).toEqual(expect.any(String)); - expect(item.oldSize).toEqual(expect.any(String)); - expect(item.feeType).toEqual(expect.any(String)); - expect(item.liquidity).toEqual(expect.any(String)); - expect(item.matchPrice).toEqual(expect.any(String)); - expect(item.matchSize).toEqual(expect.any(String)); - expect(item.tradeId).toEqual(expect.any(String)); - + try { + expect(item.filledSize).toEqual(expect.any(String)); + expect(item.orderId).toEqual(expect.any(String)); + expect(item.orderTime).toEqual(expect.any(Number)); + expect(item.orderType).toEqual(expect.any(String)); + expect(item.price).toEqual(expect.any(String)); + } catch (e) { + done(e); + } api.unSubscribe(subid).then(() => { done(); }); @@ -110,28 +95,11 @@ describe('Spot Private WebSocket API Tests', () => { let subid = await api.orderV2( async (topic: string, subject: string, item: OrderV2Event) => { console.log(item); - expect(item.canceledSize).toEqual(expect.any(String)); - expect(item.clientOid).toEqual(expect.any(String)); expect(item.filledSize).toEqual(expect.any(String)); expect(item.orderId).toEqual(expect.any(String)); expect(item.orderTime).toEqual(expect.any(Number)); expect(item.orderType).toEqual(expect.any(String)); - expect(item.originSize).toEqual(expect.any(String)); expect(item.price).toEqual(expect.any(String)); - expect(item.remainFunds).toEqual(expect.any(String)); - expect(item.remainSize).toEqual(expect.any(String)); - expect(item.side).toEqual(expect.any(String)); - expect(item.size).toEqual(expect.any(String)); - expect(item.status).toEqual(expect.any(String)); - expect(item.symbol).toEqual(expect.any(String)); - expect(item.ts).toEqual(expect.any(Number)); - expect(item.type).toEqual(expect.any(String)); - expect(item.oldSize).toEqual(expect.any(String)); - expect(item.feeType).toEqual(expect.any(String)); - expect(item.liquidity).toEqual(expect.any(String)); - expect(item.matchPrice).toEqual(expect.any(String)); - expect(item.matchSize).toEqual(expect.any(String)); - expect(item.tradeId).toEqual(expect.any(String)); api.unSubscribe(subid).then(() => { done(); }); From 71a21cbcfb2dbeb5880b5983e1917950ce509f81 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Thu, 20 Feb 2025 11:46:28 +0800 Subject: [PATCH 089/106] feat(nodejs): add ci --- .../workflows/upload-nodejs-sdk-package.yml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/upload-nodejs-sdk-package.yml diff --git a/.github/workflows/upload-nodejs-sdk-package.yml b/.github/workflows/upload-nodejs-sdk-package.yml new file mode 100644 index 00000000..d8dda356 --- /dev/null +++ b/.github/workflows/upload-nodejs-sdk-package.yml @@ -0,0 +1,50 @@ +name: Upload Nodejs SDK Package + +on: + workflow_dispatch: + inputs: + publish: + description: "Publish Nodejs SDK to NPM" + required: false + default: "false" + +permissions: + contents: read + packages: write + id-token: write + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + cache-dependency-path: sdk/node/package-lock.json + + - name: Install Dependencies + working-directory: sdk/node + run: npm ci + + - name: Build Project + working-directory: sdk/node + run: npm run build + + - name: Dry Run Package Publishing + if: github.event.inputs.publish == 'false' + working-directory: sdk/node + run: npm publish --dry-run + + - name: Publish Package to npm + if: github.event.inputs.publish == 'true' + working-directory: sdk/node + run: npm publish --provenance --access public --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 4cca16a5cd3d15bb844c6c797c4681b79e49653f Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 21 Feb 2025 11:55:03 +0800 Subject: [PATCH 090/106] feat(nodejs): add comment --- sdk/node/example/src/js/example_api.js | 5 +++ .../src/internal/infra/default_ws_client.ts | 21 ++++++++---- sdk/node/src/internal/infra/message_worker.js | 32 +++---------------- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/sdk/node/example/src/js/example_api.js b/sdk/node/example/src/js/example_api.js index 6ec6fe88..5314f42b 100644 --- a/sdk/node/example/src/js/example_api.js +++ b/sdk/node/example/src/js/example_api.js @@ -56,6 +56,11 @@ async function restExample() { await futuresServiceExample(kucoinRestService.getFuturesService()); } +/** @typedef {import('kucoin-universal-sdk').AccountService} AccountService */ + +/** + * @param {AccountService} accountService + */ async function accountServiceExample(accountService) { // Get account api const accountApi = accountService.getAccountApi(); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 903d42df..d37493e2 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -62,11 +62,13 @@ class MessageQueue extends Readable { /** * MessageWriter implements a message writer using Node.js streams + * TODO: move to worker */ class MessageWriter extends Writable { constructor(private worker: Worker) { super({ objectMode: true, + // TODO parameters highWaterMark: 256 }); } @@ -154,6 +156,7 @@ export class WebSocketClient { return this.dial() .then(() => { this.connected = true; + // TODO fix duplicated this.notifyEvent(WebSocketEvent.EventConnected, ''); this.run(); }) @@ -173,6 +176,7 @@ export class WebSocketClient { this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); } + // TODO fix // Initialize message writer this.messageWriter = new MessageWriter(this.worker); this.writeMsgQueue.pipe(this.messageWriter); @@ -258,28 +262,26 @@ export class WebSocketClient { case 'close': this.onClose(message.code, message.reason); break; + case 'welcome': + break; } }); // Handle worker errors this.worker.addListener('error', (error: Error) => { logger.error('Worker error:', error); + // TODO fix reject nothing reject(error); }); - // Handle worker exit - this.worker.addListener('exit', (code: number) => { - if (code !== 0) { - logger.error(`Worker stopped with exit code ${code}`); - } - }); - // Send connect command to worker this.worker.postMessage({ command: 'connect', wsUrl }); + // TODO fix wait welcome message + // if timeout clean resource // Set timeout for welcome message setTimeout(() => { if (!this.welcomeReceived) { @@ -302,7 +304,9 @@ export class WebSocketClient { // error callback private onError(error: Error): void { + // TODO ack event memory leak logger.error('WebSocket error:', error); + // TODO fix this.disconnected = true; } @@ -411,6 +415,8 @@ export class WebSocketClient { write(ms: WsMessage, timeout: number): Promise { return new Promise((resolve, reject) => { + // TODO: post to worker directly + // clean resource if error if (!this.connected) { reject(new Error('Not connected')); return; @@ -449,6 +455,7 @@ export class WebSocketClient { const timeSinceLastPing = currentTime - (this.lastPingTime || 0); + // TODO do not disconnected if (timeSinceLastPing >= interval) { const pingMsg = this.newPingMessage(); try { diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index a4215e53..9374c946 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -16,12 +16,14 @@ let ws = null; function parseMessage(data) { try { const message = JSON.parse(data.toString()); + // TODO remove // Add topic field if not present if (!message.topic && message.type) { message.topic = message.type; } return message; } catch (error) { + // TODO notify user logger.error('[Worker] Error parsing message:', error); return null; } @@ -45,6 +47,7 @@ parentPort.on('message', (message) => { if (parsedMessage) { parentPort.postMessage({ type: 'message', + // TODO fix data: JSON.stringify(parsedMessage), }); } @@ -69,6 +72,7 @@ parentPort.on('message', (message) => { } else if (message.command === 'send' && ws) { // Send message through WebSocket const data = message.data; + // TODO remove if (typeof data === 'object') { ws.send(JSON.stringify(data)); } else { @@ -88,11 +92,6 @@ parentPort.on('message', (message) => { } }); -// Handle errors -parentPort.on('error', (error) => { - logger.error('[Worker] Error event:', error); -}); - // Handle close parentPort.on('close', () => { logger.info('[Worker] Close event: Worker is shutting down'); @@ -102,28 +101,5 @@ parentPort.on('close', () => { } }); -// Keep the worker alive -process.on('exit', () => { - logger.info('[Worker] Process exit event received'); - if (ws) { - ws.close(); - ws = null; - } -}); - -// Handle uncaught exceptions -process.on('uncaughtException', (error) => { - logger.error('[Worker] Uncaught exception:', error); - if (ws) { - ws.close(); - ws = null; - } -}); - -// Handle unhandled rejections -process.on('unhandledRejection', (reason) => { - logger.error('[Worker] Unhandled rejection:', reason); -}); - // Log worker startup logger.info('[Worker] Started and ready to process messages at:', new Date().toISOString()); From 6c37c4c215122ca295d736b2980a0e83cadb5bb0 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 14:17:57 +0800 Subject: [PATCH 091/106] feat(nodejs): modify some todo --- .../src/internal/infra/default_ws_client.ts | 15 +++++++++++---- sdk/node/src/internal/infra/message_worker.js | 18 ++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index d37493e2..e702e0ac 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -72,7 +72,7 @@ class MessageWriter extends Writable { highWaterMark: 256 }); } - + _write(message: WsMessage, encoding: string, callback: (error?: Error | null) => void): void { try { // Send message through worker @@ -80,11 +80,21 @@ class MessageWriter extends Writable { command: 'send', data: message }); + + + if (this.writableLength >= this.writableHighWaterMark) { + logger.warn('Buffer full, write() returning false'); + } + callback(); } catch (error) { callback(error as Error); } } + + _final(callback: (error?: Error | null) => void): void { + callback(); + } } // WebSocketClient class, used to manage WebSocket connection and its related operations @@ -455,18 +465,15 @@ export class WebSocketClient { const timeSinceLastPing = currentTime - (this.lastPingTime || 0); - // TODO do not disconnected if (timeSinceLastPing >= interval) { const pingMsg = this.newPingMessage(); try { this.write(pingMsg, timeout).catch((e) => { logger.error('[KeepAlive] Heartbeat ping error:', e); - this.disconnected = true; }); } catch (e) { logger.error('[KeepAlive] Heartbeat ping error:', e); this.metric.pingErr++; - this.disconnected = true; } this.lastPingTime = currentTime; } diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index 9374c946..5c782e7e 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -16,15 +16,14 @@ let ws = null; function parseMessage(data) { try { const message = JSON.parse(data.toString()); - // TODO remove - // Add topic field if not present - if (!message.topic && message.type) { - message.topic = message.type; - } return message; } catch (error) { - // TODO notify user logger.error('[Worker] Error parsing message:', error); + // Notify main thread about parsing error + parentPort.postMessage({ + type: 'error', + error: `Failed to parse WebSocket message: ${error.message}`, + }); return null; } } @@ -72,12 +71,7 @@ parentPort.on('message', (message) => { } else if (message.command === 'send' && ws) { // Send message through WebSocket const data = message.data; - // TODO remove - if (typeof data === 'object') { - ws.send(JSON.stringify(data)); - } else { - ws.send(data); - } + ws.send(JSON.stringify(data)); } else if (message.command === 'close' && ws) { // Close WebSocket connection ws.close(); From 120cae8e80eb3ab41873434037f54be75538b7e9 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 16:01:54 +0800 Subject: [PATCH 092/106] feat(nodejs):send data to work directly --- .../src/internal/infra/default_ws_client.ts | 71 +++---------------- 1 file changed, 11 insertions(+), 60 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index e702e0ac..f5128273 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,6 +1,6 @@ import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; -import { Readable, Writable } from 'stream'; +import { Readable } from 'stream'; import path from 'path'; import { WsMessage } from '../../model/common'; @@ -60,43 +60,6 @@ class MessageQueue extends Readable { } } -/** - * MessageWriter implements a message writer using Node.js streams - * TODO: move to worker - */ -class MessageWriter extends Writable { - constructor(private worker: Worker) { - super({ - objectMode: true, - // TODO parameters - highWaterMark: 256 - }); - } - - _write(message: WsMessage, encoding: string, callback: (error?: Error | null) => void): void { - try { - // Send message through worker - this.worker.postMessage({ - command: 'send', - data: message - }); - - - if (this.writableLength >= this.writableHighWaterMark) { - logger.warn('Buffer full, write() returning false'); - } - - callback(); - } catch (error) { - callback(error as Error); - } - } - - _final(callback: (error?: Error | null) => void): void { - callback(); - } -} - // WebSocketClient class, used to manage WebSocket connection and its related operations export class WebSocketClient { private options: WebSocketClientOption; @@ -113,7 +76,6 @@ export class WebSocketClient { private reconnectClosed: boolean; private readMsgQueue: MessageQueue; - private writeMsgQueue: MessageQueue; private ackEvents: Map; private metric: { pingSuccess: number; pingErr: number }; @@ -122,7 +84,6 @@ export class WebSocketClient { private eventEmitter: EventEmitter; private lastPingTime: number | null; - private messageWriter: MessageWriter | null = null; public worker: Worker | null = null; constructor( @@ -144,8 +105,6 @@ export class WebSocketClient { // Message queues this.readMsgQueue = new MessageQueue(options.readMessageBuffer); - this.writeMsgQueue = new MessageQueue(options.writeMessageBuffer); - this.ackEvents = new Map(); this.metric = { pingSuccess: 0, pingErr: 0 }; @@ -185,11 +144,6 @@ export class WebSocketClient { if (!this.keepAliveInterval) { this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); } - - // TODO fix - // Initialize message writer - this.messageWriter = new MessageWriter(this.worker); - this.writeMsgQueue.pipe(this.messageWriter); } // Stop the WebSocket client @@ -432,18 +386,16 @@ export class WebSocketClient { return; } - const msg: WriteMsg = { msg: ms, resolve, reject }; - if (!ms.id) { - reject(new Error('Message ID is undefined')); - return; - } - - // write message to queue and check if it reaches the max size - if (this.writeMsgQueue.enqueue(ms)) { - this.ackEvents.set(ms.id, msg); - this.writeMsgQueue._read(1); - } else { - reject(new Error('Write buffer is full')); + try { + // Send message to worker directly + this.worker.postMessage({ + command: 'send', + data: ms + }); + resolve(); + } catch (error) { + logger.error('Failed to send message:', error); + reject(error); } }); } @@ -507,7 +459,6 @@ export class WebSocketClient { this.readMsgQueue.clear(); // Clear write message queue and reject pending promises - this.writeMsgQueue.clear(); this.ackEvents.forEach((writeMsg) => { writeMsg.reject(new Error('WebSocket connection closed')); }); From 312944b27c9b9cf5ebca0b7ea7ef6663bb93dbcc Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Fri, 21 Feb 2025 16:55:19 +0800 Subject: [PATCH 093/106] feat(nodejs): update js doc --- sdk/node/example/src/js/example_api.js | 17 +++++++++--- .../src/js/example_arbitrage_strategy.js | 27 +++++++++++++++++++ .../example/src/js/example_ma_strategy.js | 18 +++++++++++++ .../example/src/js/example_realtime_kline.js | 4 +++ sdk/node/example/src/js/example_ws.js | 4 +++ 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/sdk/node/example/src/js/example_api.js b/sdk/node/example/src/js/example_api.js index 5314f42b..9b61bb58 100644 --- a/sdk/node/example/src/js/example_api.js +++ b/sdk/node/example/src/js/example_api.js @@ -10,7 +10,11 @@ const { TransportOptionBuilder, } = require('kucoin-universal-sdk'); -const { randomUUID } = require('crypto'); +/** @typedef {import('kucoin-universal-sdk').AccountService} AccountService */ +/** @typedef {import('kucoin-universal-sdk').SpotService} SpotService */ +/** @typedef {import('kucoin-universal-sdk').FuturesService} FuturesService */ + +const {randomUUID} = require('crypto'); async function restExample() { console.log('Starting REST example'); @@ -56,10 +60,8 @@ async function restExample() { await futuresServiceExample(kucoinRestService.getFuturesService()); } -/** @typedef {import('kucoin-universal-sdk').AccountService} AccountService */ - /** - * @param {AccountService} accountService + * @param {AccountService} accountService */ async function accountServiceExample(accountService) { // Get account api @@ -90,6 +92,9 @@ async function accountServiceExample(accountService) { }); } +/** + * @param {SpotService} spotService + */ async function spotServiceExample(spotService) { const orderApi = spotService.getOrderApi(); @@ -125,6 +130,10 @@ async function spotServiceExample(spotService) { console.log(`Cancel order success, id: ${cancelOrderResp.orderId}`); } + +/** + * @param {FuturesService} futuresService + */ async function futuresServiceExample(futuresService) { const marketApi = futuresService.getMarketApi(); const allSymbolResp = await marketApi.getAllSymbols(); diff --git a/sdk/node/example/src/js/example_arbitrage_strategy.js b/sdk/node/example/src/js/example_arbitrage_strategy.js index 16915d8d..1a9c6538 100644 --- a/sdk/node/example/src/js/example_arbitrage_strategy.js +++ b/sdk/node/example/src/js/example_arbitrage_strategy.js @@ -23,6 +23,11 @@ const { const crypto = require("crypto"); +/** @typedef {import('kucoin-universal-sdk').AccountService} AccountService */ +/** @typedef {import('kucoin-universal-sdk').SpotService} SpotService */ +/** @typedef {import('kucoin-universal-sdk').FuturesService} FuturesService */ +/** @typedef {import('kucoin-universal-sdk').MarginService} MarginService */ + const SPOT_SYMBOL = "DOGE-USDT"; const FUTURES_SYMBOL = "DOGEUSDTM"; const BASE_CURRENCY = "USDT"; @@ -39,6 +44,9 @@ const MarketType = { FUTURES: "FUTURES" }; +/** + * @param {AccountService} accountService + */ async function checkAvailableBalance(accountService, price, amount, marketType) { /** * Checks if the available balance is sufficient for the trade. @@ -75,6 +83,10 @@ async function checkAvailableBalance(accountService, price, amount, marketType) } } +/** + * @param {SpotService} spotService + * @param {FuturesService} futuresService + */ async function getLastTradedPrice(spotService, futuresService) { /** * Fetches the last traded price for the specified spot and futures symbols. @@ -92,6 +104,12 @@ async function getLastTradedPrice(spotService, futuresService) { return [spotPrice, futuresPrice]; } +/** + * @param {SpotService} spotService + * @param {FuturesService} futuresService + * @param {MarginService} marginService + * @param {AccountService} accountService + */ async function fundingRateArbitrageStrategy( futuresService, spotService, @@ -184,6 +202,9 @@ async function fundingRateArbitrageStrategy( } } +/** + * @param {SpotService} spotService + */ async function addSpotOrderWaitFill(spotService, symbol, side, amount, price) { /** * Places a spot order and waits for it to be filled @@ -237,6 +258,9 @@ async function addSpotOrderWaitFill(spotService, symbol, side, amount, price) { return false; } +/** + * @param {FuturesService} futuresService + */ async function addFuturesOrderWaitFill(futuresService, symbol, side, amount, price) { /** * Places a futures order and waits for it to be filled within a specified timeout. @@ -290,6 +314,9 @@ async function addFuturesOrderWaitFill(futuresService, symbol, side, amount, pri return false; } +/** + * @param {MarginService} marginService + */ async function addMarginOrderWaitFill(marginService, symbol, amount, price) { /** * Places a margin order and waits for it to be filled within a specified timeout. diff --git a/sdk/node/example/src/js/example_ma_strategy.js b/sdk/node/example/src/js/example_ma_strategy.js index 94a7a519..1d65cd2f 100644 --- a/sdk/node/example/src/js/example_ma_strategy.js +++ b/sdk/node/example/src/js/example_ma_strategy.js @@ -21,12 +21,20 @@ const { TransportOptionBuilder, } = require("kucoin-universal-sdk"); +/** @typedef {import('kucoin-universal-sdk').Spot.MarketAPI} MarketAPI */ +/** @typedef {import('kucoin-universal-sdk').Spot.OrderAPI} OrderApi */ +/** @typedef {import('kucoin-universal-sdk').Account.AccountAPI} AccountApi */ + + const Action = { BUY: "buy", SELL: "sell", SKIP: "skip" }; +/** + * @param {MarketAPI} api + */ async function simpleMovingAverageStrategy(api, symbol, shortWindow, longWindow, endTime) { const startTime = endTime - longWindow * 60; console.info(`Querying kline data: Start=${new Date(startTime * 1000)}, End=${new Date(endTime * 1000)}`); @@ -51,12 +59,19 @@ async function simpleMovingAverageStrategy(api, symbol, shortWindow, longWindow, return Action.SKIP; } +/** + * @param {MarketAPI} marketApi + */ async function getLastTradePrice(marketApi, symbol) { const getStatReq = Spot.Market.Get24hrStatsReq.builder().setSymbol(symbol).build(); const statResp = await marketApi.get24hrStats(getStatReq); return parseFloat(statResp.last); } + +/** + * @param {AccountApi} accountApi + */ async function checkAvailableBalance(accountApi, lastTradePrice, amount, action) { const currency = action === Action.BUY ? "USDT" : "DOGE"; console.info(`Checking balance for ${currency}`); @@ -73,6 +88,9 @@ async function checkAvailableBalance(accountApi, lastTradePrice, amount, action) return action === Action.BUY ? lastTradePrice * amount <= availableBalance : amount <= availableBalance; } +/** + * @param {OrderApi} orderApi + */ async function placeOrder(orderApi, symbol, action, lastTradePrice, amount, priceDelta) { const openOrderReq = Spot.Order.GetOpenOrdersReq.builder().setSymbol(symbol).build(); const openOrderResp = await orderApi.getOpenOrders(openOrderReq); diff --git a/sdk/node/example/src/js/example_realtime_kline.js b/sdk/node/example/src/js/example_realtime_kline.js index ef3752a7..80f98f5e 100644 --- a/sdk/node/example/src/js/example_realtime_kline.js +++ b/sdk/node/example/src/js/example_realtime_kline.js @@ -21,6 +21,10 @@ const klineData = {}; const timeInterval = 60; +/** @typedef {import('kucoin-universal-sdk').Spot.SpotPublic.TradeEvent} TradeEvent*/ +/** + * @param {TradeEvent} tradeEvent + */ function onTradeData(topic, subject, tradeEvent) { const symbol = tradeEvent.symbol; const price = parseFloat(tradeEvent.price); diff --git a/sdk/node/example/src/js/example_ws.js b/sdk/node/example/src/js/example_ws.js index 8e00f775..1337ea28 100644 --- a/sdk/node/example/src/js/example_ws.js +++ b/sdk/node/example/src/js/example_ws.js @@ -34,6 +34,10 @@ function wsExample() { spotWsExample(wsService.newSpotPublicWS()); } +/** @typedef {import('kucoin-universal-sdk').Spot.SpotPublicWS} SpotPublicWS*/ +/** + * @param {SpotPublicWS} spotPublic + */ async function spotWsExample(spotPublic) { await spotPublic.start(); From 9192e8f6b43644c73caddead0911887f8c3d0287 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 17:01:01 +0800 Subject: [PATCH 094/106] feat(nodejs): add read buffer --- .../src/internal/infra/default_ws_client.ts | 69 +----------- .../src/internal/infra/default_ws_service.ts | 106 +++++++++++++++--- 2 files changed, 93 insertions(+), 82 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index f5128273..5eb2ace3 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,6 +1,6 @@ import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; -import { Readable } from 'stream'; + import path from 'path'; import { WsMessage } from '../../model/common'; @@ -21,44 +21,6 @@ export interface WriteMsg { reject: (reason?: any) => void; } -/** - * MessageQueue implements a message queue using Node.js streams - */ -class MessageQueue extends Readable { - private messages: WsMessage[] = []; - private maxSize: number; - - constructor(maxSize: number = 1024) { - super({ - objectMode: true, - highWaterMark: maxSize - }); - this.maxSize = maxSize; - } - - _read(size: number): void { - while (this.messages.length > 0 && size > 0) { - const message = this.messages.shift(); - if (!this.push(message)) { - break; - } - size--; - } - } - - enqueue(message: WsMessage): boolean { - if (this.messages.length >= this.maxSize) { - return false; - } - this.messages.push(message); - this._read(1); - return true; - } - - clear(): void { - this.messages = []; - } -} // WebSocketClient class, used to manage WebSocket connection and its related operations export class WebSocketClient { @@ -75,7 +37,7 @@ export class WebSocketClient { private closed: boolean; private reconnectClosed: boolean; - private readMsgQueue: MessageQueue; + private ackEvents: Map; private metric: { pingSuccess: number; pingErr: number }; @@ -103,8 +65,6 @@ export class WebSocketClient { this.reconnectClosed = false; this.welcomeReceived = false; - // Message queues - this.readMsgQueue = new MessageQueue(options.readMessageBuffer); this.ackEvents = new Map(); this.metric = { pingSuccess: 0, pingErr: 0 }; @@ -313,18 +273,7 @@ export class WebSocketClient { break; case MessageType.Message: - if (!this.shutdown && !this.closed) { - this.notifyEvent(WebSocketEvent.EventMessageReceived, ''); - // queue message - if (this.readMsgQueue.enqueue(m)) { - this.readMsgQueue._read(1); - } else { - this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); - logger.warn('Read buffer full'); - } - } break; - case MessageType.PongMessage: this.notifyEvent(WebSocketEvent.EventPongReceived, ''); logger.debug('PONG received'); @@ -367,13 +316,7 @@ export class WebSocketClient { } } - /** - * Read a single message from the queue and remove it - * @returns The first message in the queue, or undefined if queue is empty - */ - read(): WsMessage | undefined { - return this.readMsgQueue.read(); - } + // write message write(ms: WsMessage, timeout: number): Promise { @@ -381,8 +324,7 @@ export class WebSocketClient { // TODO: post to worker directly // clean resource if error - if (!this.connected) { - reject(new Error('Not connected')); + if (!this.connected || !this.worker) { return; } @@ -455,8 +397,7 @@ export class WebSocketClient { // Clear all message queues and cleanup resources private clearMessageQueues(): void { - // Clear read message queue - this.readMsgQueue.clear(); + // Clear write message queue and reject pending promises this.ackEvents.forEach((writeMsg) => { diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index d078acf9..fab4c979 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -15,6 +15,39 @@ import { EventEmitter } from 'events'; import { Worker } from 'worker_threads'; import { logger } from '@src/common'; +const { Readable } = require('stream'); + +class BoundedReadable extends Readable { + private readonly maxSize: number; + + constructor(maxSize: number) { + super({ + objectMode: true, + highWaterMark: maxSize + }); + this.maxSize = maxSize; + } + + addMessage(message: WsMessage): boolean { + if (this.readableLength >= this.readableHighWaterMark) { + logger.warn(`Dropping: ${JSON.stringify(message)}`); + return false; + } + + this.push(message); + return true; + } + + _read(): void { + + } + + destroy(): void { + this.push(null); + super.destroy(); + } +} + /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. * It manages WebSocket connections, subscriptions, and message handling with automatic reconnection support. @@ -33,6 +66,7 @@ export class DefaultWsService implements WebSocketService { private recoveryLoop?: NodeJS.Timeout; private readonly eventEmitter: EventEmitter; private messageWorker?: Worker; + private messageBuffer: BoundedReadable; /** * Creates a new instance of DefaultWsService @@ -77,6 +111,14 @@ export class DefaultWsService implements WebSocketService { this.wsOption, this.eventEmitter, ); + + // Initialize message buffer + this.messageBuffer = new BoundedReadable(this.wsOption.readMessageBuffer || 1024); + + // Handle message consumption + this.messageBuffer.on('readable', () => { + this.processMessages(); + }); } /** @@ -141,21 +183,10 @@ export class DefaultWsService implements WebSocketService { return; } - const callbackManager = this.topicManager.getCallbackManager(wsMessage.topic); - if (!callbackManager) { - return; - } - - const callback = callbackManager.get(wsMessage.topic); - if (!callback) { - return; - } - - try { - callback.onMessage(wsMessage); - } catch (err) { - logger.error('[Main] Error processing message in main thread:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); + // Add message to buffer instead of processing directly + if (!this.messageBuffer.addMessage(wsMessage)) { + logger.warn('[Main] Message buffer full, dropping message'); + this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); } } catch (err) { logger.error('[Main] Error parsing message:', err); @@ -175,9 +206,45 @@ export class DefaultWsService implements WebSocketService { logger.error('[Main] Worker stopped with non-zero exit code'); } }); - } catch (error) { - logger.error('[Main] Error in message loop:', error); - throw error; + } catch (err) { + logger.error('[Main] Error in message loop:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); + } + } + + private async processMessages(): Promise { + try { + let message; + // Read messages from buffer while available + while (null !== (message = this.messageBuffer.read())) { + if (!message || !message.topic) { + logger.warn('[Main] Invalid message format:', message); + continue; + } + + const callbackManager = this.topicManager.getCallbackManager(message.topic); + if (!callbackManager) { + continue; + } + + const callback = callbackManager.get(message.topic); + if (!callback) { + continue; + } + + try { + await callback.onMessage(message); + } catch (err) { + logger.error('[Main] Error processing message:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); + } + + // Small delay to prevent blocking + await new Promise(resolve => setTimeout(resolve, 0)); + } + } catch (err) { + logger.error('[Main] Error in message processing loop:', err); + this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); } } @@ -268,6 +335,9 @@ export class DefaultWsService implements WebSocketService { // Stop the WebSocket client this.client.stop().then(() => { logger.debug('WebSocket service stopped'); + if (this.messageBuffer) { + this.messageBuffer.destroy(); + } resolve(); }); }); From 2ecdaf0448115e7cd9ed49523b2cce99e9ff50c0 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 18:41:54 +0800 Subject: [PATCH 095/106] =?UTF-8?q?fix(nodejs)=EF=BC=9Afix=20duplicated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/node/src/internal/infra/default_ws_client.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 5eb2ace3..ff8b615e 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -85,8 +85,6 @@ export class WebSocketClient { return this.dial() .then(() => { this.connected = true; - // TODO fix duplicated - this.notifyEvent(WebSocketEvent.EventConnected, ''); this.run(); }) .catch((err) => { @@ -470,7 +468,6 @@ export class WebSocketClient { try { await this.dial(); - this.notifyEvent(WebSocketEvent.EventConnected, ''); this.connected = true; this.closed = false; this.run(); From e51c413da2422189a086e24f64436bcba21a3776 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 18:51:04 +0800 Subject: [PATCH 096/106] =?UTF-8?q?fix(nodejs)=EF=BC=9Aack=20event=20memor?= =?UTF-8?q?y=20leak?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/node/src/internal/infra/default_ws_client.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index ff8b615e..f4242d83 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -226,10 +226,15 @@ export class WebSocketClient { // error callback private onError(error: Error): void { - // TODO ack event memory leak logger.error('WebSocket error:', error); - // TODO fix + + // Clear all pending ack events to prevent memory leak + this.clearMessageQueues(); + + // Update connection status this.disconnected = true; + this.connected = false; + } // close callback @@ -319,8 +324,6 @@ export class WebSocketClient { // write message write(ms: WsMessage, timeout: number): Promise { return new Promise((resolve, reject) => { - - // TODO: post to worker directly // clean resource if error if (!this.connected || !this.worker) { return; From 4b92dfd282e8ce6c29f7f8fed6092490cfcca4e3 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Fri, 21 Feb 2025 19:21:46 +0800 Subject: [PATCH 097/106] =?UTF-8?q?fix(nodejs)=EF=BC=9Afix=20clean=20resou?= =?UTF-8?q?rce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/node/src/internal/infra/default_ws_client.ts | 10 ++++++---- sdk/node/src/internal/infra/message_worker.js | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index f4242d83..9724d10b 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -192,8 +192,9 @@ export class WebSocketClient { // Handle worker errors this.worker.addListener('error', (error: Error) => { logger.error('Worker error:', error); - // TODO fix reject nothing - reject(error); + this.close(); // Clean up resources + this.disconnected = true; + this.connected = false; }); // Send connect command to worker @@ -202,11 +203,12 @@ export class WebSocketClient { wsUrl }); - // TODO fix wait welcome message - // if timeout clean resource // Set timeout for welcome message setTimeout(() => { if (!this.welcomeReceived) { + this.close(); // Close the connection + this.disconnected = true; + this.connected = false; reject(new Error('Did not receive welcome message')); } }, 5000); diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index 5c782e7e..65dc86d3 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -46,7 +46,6 @@ parentPort.on('message', (message) => { if (parsedMessage) { parentPort.postMessage({ type: 'message', - // TODO fix data: JSON.stringify(parsedMessage), }); } From 84f4a1f74f178e3a978c0c21aa60043af0098b68 Mon Sep 17 00:00:00 2001 From: DylanJiang11 Date: Sat, 22 Feb 2025 00:48:57 +0800 Subject: [PATCH 098/106] =?UTF-8?q?fix(nodejs)=EF=BC=9Amove=20buffer=20in?= =?UTF-8?q?=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/internal/infra/default_ws_client.ts | 92 ++++++++++----- .../src/internal/infra/default_ws_service.ts | 110 +----------------- 2 files changed, 72 insertions(+), 130 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 9724d10b..c5eb66cb 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,8 +1,6 @@ import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; - import path from 'path'; - import { WsMessage } from '../../model/common'; import { MessageType } from '../../model/constant'; import { WebSocketClientOption } from '../../model/websocket_option'; @@ -21,6 +19,39 @@ export interface WriteMsg { reject: (reason?: any) => void; } +const { Readable } = require('stream'); + +class BoundedReadable extends Readable { + private readonly maxSize: number; + + constructor(maxSize: number) { + super({ + objectMode: true, + highWaterMark: maxSize + }); + this.maxSize = maxSize; + } + + addMessage(message: WsMessage): boolean { + if (this.readableLength >= this.readableHighWaterMark) { + logger.warn(`Dropping: ${JSON.stringify(message)}`); + return false; + } + + this.push(message); + return true; + } + + _read(): void { + + } + + destroy(): void { + this.push(null); + super.destroy(); + } +} + // WebSocketClient class, used to manage WebSocket connection and its related operations export class WebSocketClient { @@ -37,8 +68,6 @@ export class WebSocketClient { private closed: boolean; private reconnectClosed: boolean; - - private ackEvents: Map; private metric: { pingSuccess: number; pingErr: number }; private keepAliveInterval: NodeJS.Timeout | null; @@ -47,6 +76,7 @@ export class WebSocketClient { private lastPingTime: number | null; public worker: Worker | null = null; + public messageBuffer: BoundedReadable; constructor( tokenProvider: WsTokenProvider, @@ -65,13 +95,13 @@ export class WebSocketClient { this.reconnectClosed = false; this.welcomeReceived = false; - this.ackEvents = new Map(); this.metric = { pingSuccess: 0, pingErr: 0 }; this.keepAliveInterval = null; this.eventEmitter = externalEventEmitter || new EventEmitter(); this.lastPingTime = null; + this.messageBuffer = new BoundedReadable(this.options.readMessageBuffer || 1024); this.reconnect(); } @@ -129,6 +159,11 @@ export class WebSocketClient { // Clear message queues this.clearMessageQueues(); + if(this.messageBuffer) + { + this.messageBuffer.destroy(); + } + // Reset state this.disconnected = true; this.connected = false; @@ -168,7 +203,7 @@ export class WebSocketClient { return; } - // Handle worker messages + // Handle all worker messages through the message event this.worker.addListener('message', (message: any) => { switch (message.type) { case 'open': @@ -189,12 +224,24 @@ export class WebSocketClient { } }); - // Handle worker errors + // Handle worker thread crashes this.worker.addListener('error', (error: Error) => { - logger.error('Worker error:', error); - this.close(); // Clean up resources + logger.error('Worker thread crashed:', error); + this.close(); this.disconnected = true; this.connected = false; + reject(new Error(`Worker thread crashed: ${error.message}`)); + }); + + // Handle worker thread exit + this.worker.addListener('exit', (code: number) => { + if (code !== 0) { // Non-zero exit code means abnormal exit + logger.error('Worker thread exited with code:', code); + this.close(); + this.disconnected = true; + this.connected = false; + reject(new Error(`Worker thread exited with code: ${code}`)); + } }); // Send connect command to worker @@ -276,12 +323,14 @@ export class WebSocketClient { this.welcomeReceived = true; logger.info('Welcome message received.'); break; - case MessageType.Message: + if(!this.messageBuffer.addMessage(m)) + { + this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); + } break; case MessageType.PongMessage: this.notifyEvent(WebSocketEvent.EventPongReceived, ''); - logger.debug('PONG received'); this.handleAckEvent(m); break; @@ -321,9 +370,7 @@ export class WebSocketClient { } } - - - // write message + // write message to work thread write(ms: WsMessage, timeout: number): Promise { return new Promise((resolve, reject) => { // clean resource if error @@ -363,7 +410,9 @@ export class WebSocketClient { if (timeSinceLastPing >= interval) { - const pingMsg = this.newPingMessage(); + const pingMsg = new WsMessage(); + pingMsg.id = Date.now().toString(); + pingMsg.type = MessageType.PingMessage; try { this.write(pingMsg, timeout).catch((e) => { logger.error('[KeepAlive] Heartbeat ping error:', e); @@ -401,7 +450,6 @@ export class WebSocketClient { // Clear all message queues and cleanup resources private clearMessageQueues(): void { - // Clear write message queue and reject pending promises this.ackEvents.forEach((writeMsg) => { writeMsg.reject(new Error('WebSocket connection closed')); @@ -424,20 +472,13 @@ export class WebSocketClient { return tokens[Math.floor(Math.random() * tokens.length)]; } - private newPingMessage(): WsMessage { - const pingMessage = new WsMessage(); - pingMessage.id = Date.now().toString(); - pingMessage.type = MessageType.PingMessage; - return pingMessage; - } - // Check if the client has been reconnected - isReconnected(): boolean { + public isReconnected(): boolean { return this.reconnected; } // Clear the reconnected flag - clearReconnectedFlag(): void { + public clearReconnectedFlag(): void { this.reconnected = false; } @@ -445,7 +486,6 @@ export class WebSocketClient { const reconnectLoop = async () => { while (!this.reconnectClosed) { if (this.disconnected && !this.shutdown) { - logger.info('Broken WebSocket connection, starting reconnection'); try { await this.close(); } catch (err) { diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index fab4c979..cecef542 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -15,38 +15,7 @@ import { EventEmitter } from 'events'; import { Worker } from 'worker_threads'; import { logger } from '@src/common'; -const { Readable } = require('stream'); - -class BoundedReadable extends Readable { - private readonly maxSize: number; - - constructor(maxSize: number) { - super({ - objectMode: true, - highWaterMark: maxSize - }); - this.maxSize = maxSize; - } - - addMessage(message: WsMessage): boolean { - if (this.readableLength >= this.readableHighWaterMark) { - logger.warn(`Dropping: ${JSON.stringify(message)}`); - return false; - } - - this.push(message); - return true; - } - - _read(): void { - - } - destroy(): void { - this.push(null); - super.destroy(); - } -} /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. @@ -62,11 +31,8 @@ export class DefaultWsService implements WebSocketService { private topicManager: TopicManager; private client: WebSocketClient; private stopSignal: boolean = false; - private messageLoop?: NodeJS.Timeout; private recoveryLoop?: NodeJS.Timeout; private readonly eventEmitter: EventEmitter; - private messageWorker?: Worker; - private messageBuffer: BoundedReadable; /** * Creates a new instance of DefaultWsService @@ -112,11 +78,9 @@ export class DefaultWsService implements WebSocketService { this.eventEmitter, ); - // Initialize message buffer - this.messageBuffer = new BoundedReadable(this.wsOption.readMessageBuffer || 1024); // Handle message consumption - this.messageBuffer.on('readable', () => { + this.client.messageBuffer.on('readable', () => { this.processMessages(); }); } @@ -157,68 +121,14 @@ export class DefaultWsService implements WebSocketService { } } - /** - * Starts the message processing loop using a dedicated Worker Thread - */ - private startMessageLoop(): void { - try { - if (!this.client.worker) { - throw new Error('Worker not initialized in client'); - } - - // Handle messages from worker - this.client.worker.addListener('message', (msg: any) => { - if (this.stopSignal) { - return; - } - if (msg.type !== 'message') { - return; - } - - try { - const wsMessage = JSON.parse(msg.data); - if (!wsMessage || !wsMessage.topic) { - logger.warn('[Main] Received message without topic:', wsMessage); - return; - } - - // Add message to buffer instead of processing directly - if (!this.messageBuffer.addMessage(wsMessage)) { - logger.warn('[Main] Message buffer full, dropping message'); - this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); - } - } catch (err) { - logger.error('[Main] Error parsing message:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); - } - }); - - // Handle worker errors - this.client.worker.addListener('error', (error: Error) => { - logger.error('[Main] Worker thread error:', error); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(error)); - }); - - // Handle worker exit - this.client.worker.addListener('exit', (code: number) => { - if (code !== 0 && !this.stopSignal) { - logger.error('[Main] Worker stopped with non-zero exit code'); - } - }); - } catch (err) { - logger.error('[Main] Error in message loop:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); - } - } private async processMessages(): Promise { try { let message; // Read messages from buffer while available - while (null !== (message = this.messageBuffer.read())) { + while (null !== (message = this.client.messageBuffer.read())) { if (!message || !message.topic) { - logger.warn('[Main] Invalid message format:', message); continue; } @@ -301,7 +211,6 @@ export class DefaultWsService implements WebSocketService { .start() .then(() => { this.stopSignal = false; - this.startMessageLoop(); this.startRecoveryLoop(); }) .catch((err) => { @@ -318,15 +227,8 @@ export class DefaultWsService implements WebSocketService { this.stopSignal = true; return new Promise((resolve) => { - // Terminate worker and clear intervals - if (this.messageWorker) { - this.messageWorker.terminate(); - this.messageWorker = undefined; - } - if (this.messageLoop) { - clearInterval(this.messageLoop); - this.messageLoop = undefined; - } + + if (this.recoveryLoop) { clearInterval(this.recoveryLoop); this.recoveryLoop = undefined; @@ -335,8 +237,8 @@ export class DefaultWsService implements WebSocketService { // Stop the WebSocket client this.client.stop().then(() => { logger.debug('WebSocket service stopped'); - if (this.messageBuffer) { - this.messageBuffer.destroy(); + if (this.client.messageBuffer) { + this.client.messageBuffer.destroy(); } resolve(); }); From 251b98c6397149e786d6723167d0b4a4de2f0172 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Mon, 24 Feb 2025 21:37:26 +0800 Subject: [PATCH 099/106] feat(nodejs): update websocket implements --- sdk/node/src/common/logger/logger.js | 14 +- .../internal/infra/default_ws_client.test.ts | 183 +++++ .../src/internal/infra/default_ws_client.ts | 685 +++++++----------- .../src/internal/infra/default_ws_service.ts | 312 +++----- sdk/node/src/internal/infra/message_data.js | 12 + sdk/node/src/internal/infra/message_worker.js | 169 +++-- sdk/node/src/internal/interfaces/websocket.ts | 27 +- sdk/node/src/internal/util/util.ts | 57 ++ sdk/node/src/model/common.ts | 3 +- 9 files changed, 703 insertions(+), 759 deletions(-) create mode 100644 sdk/node/src/internal/infra/default_ws_client.test.ts create mode 100644 sdk/node/src/internal/infra/message_data.js create mode 100644 sdk/node/src/internal/util/util.ts diff --git a/sdk/node/src/common/logger/logger.js b/sdk/node/src/common/logger/logger.js index 3404ae1f..ef396267 100644 --- a/sdk/node/src/common/logger/logger.js +++ b/sdk/node/src/common/logger/logger.js @@ -2,17 +2,17 @@ const LOG_LEVELS = ['debug', 'info', 'warn', 'error']; let options = { level: 'info', - format: (level, message, meta) => { + format: (level, message) => { const time = new Date().toISOString(); - const metaStr = meta && meta.length > 0 ? JSON.stringify(meta) : ''; - return `${time} [${level.toUpperCase()}] ${message}${metaStr ? ` ${metaStr}` : ''}`; - } + let metaStr = ''; + return `${time} [${level.toUpperCase()}] ${message} `; + }, }; const logger = { log: (level, message, ...meta) => { if (shouldLog(level)) { - console.log(options.format(level, message, meta)); + console.log(options.format(level, message), ...meta); } }, info: (message, ...meta) => logger.log('info', message, ...meta), @@ -22,7 +22,7 @@ const logger = { setGlobalLogger: (newLogger, newOptions) => { Object.assign(logger, newLogger); options = newOptions || options; - } + }, }; function shouldLog(level) { @@ -31,4 +31,4 @@ function shouldLog(level) { return levelIndex >= currentIndex; } -module.exports = { logger }; \ No newline at end of file +module.exports = { logger }; diff --git a/sdk/node/src/internal/infra/default_ws_client.test.ts b/sdk/node/src/internal/infra/default_ws_client.test.ts new file mode 100644 index 00000000..105be07e --- /dev/null +++ b/sdk/node/src/internal/infra/default_ws_client.test.ts @@ -0,0 +1,183 @@ +import { WebSocket, WebSocketServer } from 'ws'; +import { createServer, Server } from 'http'; +import { DEFAULT_WEBSOCKET_CLIENT_OPTION, MessageType, WsMessage } from '@src/model'; +import { randomUUID } from 'crypto'; +import { WsToken, WsTokenProvider } from '@internal/interfaces/websocket'; +import { WebSocketClient } from '@internal/infra/default_ws_client'; + +const DEFAULT_TOKEN_INFO: WsToken = { + token: '', + pingInterval: 1000, + endpoint: '', + protocol: '', + encrypt: true, + pingTimeout: 1000, +}; + +function createMessage(id: string, type: MessageType): WsMessage { + let m = new WsMessage(); + m.id = id; + m.type = type; + return m; +} + +function createWebSocketServer(handler: (ws: WebSocket) => void): Server { + const server = createServer(); + const wss = new WebSocketServer({ server }); + wss.on('connection', handler); + server.listen(0); + return server; +} + +function mockWebSocketHandler1(ws: WebSocket) { + console.log('[server] New connection'); + + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + ws.on('message', (message) => { + const m: WsMessage = JSON.parse(message.toString()); + + switch (m.type) { + case MessageType.PingMessage: + ws.send(JSON.stringify(createMessage(m.id, MessageType.PongMessage))); + break; + + case MessageType.SubscribeMessage: + console.log('[server] Received subscribe message'); + ws.send(JSON.stringify(createMessage(m.id, MessageType.AckMessage))); + + setTimeout(() => { + for (let i = 0; i < 10; i++) { + ws.send(JSON.stringify(createMessage(i.toString(), MessageType.Message))); + } + }, 10); + break; + } + }); + + ws.on('close', () => { + console.log('[server] Connection closed'); + }); +} + +export function mockWebSocketHandlerTimeout(ws: WebSocket) { + ws.on('message', (message) => {}); + + ws.on('close', () => {}); +} + +export function mockWebSocketHandler2(ws: WebSocket) { + console.log('[server2] New connection'); + + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + ws.on('message', (message) => { + const m: WsMessage = JSON.parse(message.toString()); + + switch (m.type) { + case MessageType.PingMessage: + ws.send(JSON.stringify(createMessage(m.id, MessageType.PongMessage))); + break; + + case MessageType.SubscribeMessage: + console.log('[server2] Received subscribe message'); + ws.close(); + break; + } + }); + + ws.on('close', () => { + console.log('[server2] Connection closed'); + }); +} + +class mockProvider implements WsTokenProvider { + constructor(private wsToken: WsToken) {} + + getToken(): Promise { + return Promise.resolve([this.wsToken]); + } + + close(): Promise { + return Promise.resolve(undefined); + } +} + +function testByMockServer(handler: (ws: WebSocket) => void): Promise { + let server = createWebSocketServer(handler); + return new Promise((resolve, reject) => { + server.on('listening', () => { + let port = 0; + const address = server.address(); + if (typeof address === 'object' && address) { + port = address.port; + } + resolve(port); + }); + + server.on('error', (err) => { + reject(err); + }); + }); +} + +describe('WS Transport Test', () => { + test('test client connect error', () => { + return testByMockServer(mockWebSocketHandler2) + .then(() => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + + let client = new WebSocketClient( + new mockProvider(DEFAULT_TOKEN_INFO), + DEFAULT_WEBSOCKET_CLIENT_OPTION, + ); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start(); + }) + .catch((err) => { + expect(err).toBeDefined(); + }); + }); + + test('test client connect/disconnect', () => { + return testByMockServer(mockWebSocketHandlerTimeout).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient( + new mockProvider(DEFAULT_TOKEN_INFO), + DEFAULT_WEBSOCKET_CLIENT_OPTION, + ); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + return client.stop(); + }); + }); + }); + + test('test client timeout', () => { + return testByMockServer(mockWebSocketHandlerTimeout).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient( + new mockProvider(DEFAULT_TOKEN_INFO), + DEFAULT_WEBSOCKET_CLIENT_OPTION, + ); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + return client.stop(); + }); + }); + }); +}); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index c5eb66cb..b42c1d77 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -1,468 +1,318 @@ -import WebSocket, { Data as WebSocketData } from 'ws'; import { EventEmitter } from 'events'; import path from 'path'; -import { WsMessage } from '../../model/common'; -import { MessageType } from '../../model/constant'; -import { WebSocketClientOption } from '../../model/websocket_option'; -import { WebSocketEvent } from '../../model/websocket_option'; -import { WsToken, WsTokenProvider } from '../interfaces/websocket'; +import { WsMessage } from '@model/common'; +import { MessageType } from '@model/constant'; +import { + DEFAULT_WEBSOCKET_CLIENT_OPTION, + WebSocketClientOption, + WebSocketEvent, +} from '@model/websocket_option'; +import { + WebsocketTransport, + WebsocketTransportEvents, + WsToken, + WsTokenProvider, +} from '@internal/interfaces/websocket'; import fs from 'fs'; import { Worker } from 'worker_threads'; import { logger } from '@src/common'; - -/** - * WriteMsg represents a message to be written to the WebSocket connection - */ -export interface WriteMsg { - msg: WsMessage; - resolve: (value: void | PromiseLike) => void; - reject: (reason?: any) => void; +import { EventType } from './message_data'; +import { retryPromise, withTimeout } from '@internal/util/util'; +import { Readable } from 'stream'; + +enum ConnectionState { + DISCONNECTED = 0, + CONNECTING = 1, + CONNECTED = 2, } -const { Readable } = require('stream'); - -class BoundedReadable extends Readable { - private readonly maxSize: number; - - constructor(maxSize: number) { - super({ - objectMode: true, - highWaterMark: maxSize - }); - this.maxSize = maxSize; - } - - addMessage(message: WsMessage): boolean { - if (this.readableLength >= this.readableHighWaterMark) { - logger.warn(`Dropping: ${JSON.stringify(message)}`); - return false; - } - - this.push(message); - return true; - } - - _read(): void { - - } - - destroy(): void { - this.push(null); - super.destroy(); - } +interface WorkerMessage { + type: EventType; + data: any; + error: Error; } +interface WriteMsg { + msg: WsMessage; + resolve: (value: void) => void; + reject: (reason?: any) => void; +} // WebSocketClient class, used to manage WebSocket connection and its related operations -export class WebSocketClient { +export class WebSocketClient extends EventEmitter implements WebsocketTransport { private options: WebSocketClientOption; - private conn: WebSocket | null; - private connected: boolean; - private shutdown: boolean; - private disconnected: boolean; - private reconnected: boolean; - + private state: ConnectionState; private tokenProvider: WsTokenProvider; + private keepAliveInterval: any; + private shutdown: boolean; private tokenInfo: WsToken | null; - private closed: boolean; - private reconnectClosed: boolean; - private ackEvents: Map; - private metric: { pingSuccess: number; pingErr: number }; - private keepAliveInterval: NodeJS.Timeout | null; - private welcomeReceived: boolean; - private eventEmitter: EventEmitter; - private lastPingTime: number | null; - - public worker: Worker | null = null; - public messageBuffer: BoundedReadable; - - constructor( - tokenProvider: WsTokenProvider, - options: WebSocketClientOption, - externalEventEmitter?: EventEmitter - ) { + + private worker: Worker | null = null; + private messageBuffer: Readable; + + constructor(tokenProvider: WsTokenProvider, options: WebSocketClientOption) { + super(); this.options = options; - this.conn = null; - this.connected = false; - this.shutdown = false; - this.disconnected = false; - this.reconnected = false; + this.state = ConnectionState.DISCONNECTED; this.tokenProvider = tokenProvider; this.tokenInfo = null; - this.closed = false; - this.reconnectClosed = false; - this.welcomeReceived = false; - + this.shutdown = false; this.ackEvents = new Map(); - this.metric = { pingSuccess: 0, pingErr: 0 }; - this.keepAliveInterval = null; - this.eventEmitter = externalEventEmitter || new EventEmitter(); - - this.lastPingTime = null; - this.messageBuffer = new BoundedReadable(this.options.readMessageBuffer || 1024); - this.reconnect(); + this.messageBuffer = new Readable({ + objectMode: true, + highWaterMark: + this.options.readMessageBuffer || DEFAULT_WEBSOCKET_CLIENT_OPTION.readMessageBuffer, + read(size) {}, + }); + this.messageBuffer.on('data', (data) => { + this.emit('message', data); + }); } - // # Start the WebSocket client start(): Promise { - if (this.connected) { + if (this.state != ConnectionState.DISCONNECTED) { logger.warn('WebSocket client is already connected.'); return Promise.resolve(); } - + this.state = ConnectionState.CONNECTING; return this.dial() .then(() => { - this.connected = true; - this.run(); + this.state = ConnectionState.CONNECTED; + this.keepAliveInterval = setInterval( + () => this.keepAlive(), + this.tokenInfo!.pingInterval * 1000, + ); }) .catch((err) => { - logger.error('Failed to start WebSocket client:', err); + this.state = ConnectionState.DISCONNECTED; + logger.error('Failed to start webSocket client:', err); throw err; }); } - // Start the message processing and keep-alive - private run(): void { - if (!this.worker) { - throw new Error('Worker not initialized'); - } - - if (!this.keepAliveInterval) { - this.keepAliveInterval = setInterval(() => this.keepAlive(), 1000); - } - } - - // Stop the WebSocket client stop(): Promise { this.shutdown = true; - this.clearResources(); + return this.close().finally(() => { + this.emit('event', WebSocketEvent.EventClientShutdown, ''); + }); + } - if (this.worker) { - this.worker.postMessage({ command: 'close' }); - this.worker.terminate(); - this.worker = null; + write(ms: WsMessage, timeout: number): Promise { + if (this.state != ConnectionState.CONNECTED || this.shutdown) { + return Promise.reject(new Error('Not connected or shutting down')); } - return Promise.resolve(); + return withTimeout((resolve, reject) => { + try { + this.ackEvents.set(ms.id, { + msg: ms, + resolve: resolve, + reject: reject, + }); + + // @ts-ignore + this.worker.postMessage({ + type: EventType.MESSAGE, + data: ms, + }); + } catch (error) { + logger.error('Failed to send message:', error); + this.ackEvents.delete(ms.id); + reject(error); + } + }, timeout); } - // Clear all resources - private clearResources(): void { - // Clear intervals + on( + event: K, + listener: WebsocketTransportEvents[K], + ): this { + return super.on(event, listener); + } + + emit( + event: K, + ...args: Parameters + ): boolean { + return super.emit(event, ...args); + } + + private close(): Promise { + // clear intervals if (this.keepAliveInterval) { clearInterval(this.keepAliveInterval); this.keepAliveInterval = null; } - // Clear message queues - this.clearMessageQueues(); + // clear acks + this.ackEvents.forEach((writeMsg) => { + writeMsg.reject(new Error('WebSocket connection closed')); + }); + this.ackEvents.clear(); - if(this.messageBuffer) - { - this.messageBuffer.destroy(); + // set stats + this.state = ConnectionState.DISCONNECTED; + this.emit('event', WebSocketEvent.EventDisconnected, ''); + + // delete worker + if (this.worker) { + this.worker.postMessage({ type: EventType.CLOSED }); + let worker = this.worker; + this.worker = null; + return worker.terminate().then(); } - // Reset state - this.disconnected = true; - this.connected = false; - this.welcomeReceived = false; - this.lastPingTime = null; + return Promise.resolve(); } // dial connects to the WebSocket server private dial(): Promise { - return this.tokenProvider - .getToken() - .then((tokenInfos) => { - this.tokenInfo = this.randomEndpoint(tokenInfos); - - // create WebSocket connection parameters - const queryParams = new URLSearchParams({ - connectId: Date.now().toString(), - token: this.tokenInfo.token, - }); - - // create WebSocket URL - const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; - - // Get the worker file path relative to the compiled js file - const workerPath = path.join(__dirname, 'message_worker.js'); - - if (!fs.existsSync(workerPath)) { - throw new Error(`Worker file not found at path: ${workerPath}. Please ensure the project is built.`); - } + return this.tokenProvider.getToken().then((tokenInfos) => { + this.tokenInfo = this.randomEndpoint(tokenInfos); - // Create a new worker thread - this.worker = new Worker(workerPath); - - return new Promise((resolve, reject) => { - if (!this.worker) { - reject(new Error('Failed to create worker')); - return; - } - - // Handle all worker messages through the message event - this.worker.addListener('message', (message: any) => { - switch (message.type) { - case 'open': - this.onOpen(); - resolve(); - break; - case 'message': - this.onMessage(message.data); - break; - case 'error': - this.onError(new Error(message.error)); - break; - case 'close': - this.onClose(message.code, message.reason); - break; - case 'welcome': - break; - } - }); - - // Handle worker thread crashes - this.worker.addListener('error', (error: Error) => { - logger.error('Worker thread crashed:', error); - this.close(); - this.disconnected = true; - this.connected = false; - reject(new Error(`Worker thread crashed: ${error.message}`)); - }); - - // Handle worker thread exit - this.worker.addListener('exit', (code: number) => { - if (code !== 0) { // Non-zero exit code means abnormal exit - logger.error('Worker thread exited with code:', code); - this.close(); - this.disconnected = true; - this.connected = false; - reject(new Error(`Worker thread exited with code: ${code}`)); - } - }); - - // Send connect command to worker - this.worker.postMessage({ - command: 'connect', - wsUrl - }); - - // Set timeout for welcome message - setTimeout(() => { - if (!this.welcomeReceived) { - this.close(); // Close the connection - this.disconnected = true; - this.connected = false; - reject(new Error('Did not receive welcome message')); - } - }, 5000); - }); - }) - .catch((err) => { - logger.error('Failed to dial WebSocket server:', err); - throw err; + // create WebSocket connection parameters + const queryParams = new URLSearchParams({ + connectId: Date.now().toString(), + token: this.tokenInfo.token, }); - } - // open callback - private onOpen(): void { - logger.info('WebSocket connection opened.'); - this.notifyEvent(WebSocketEvent.EventConnected, 'WebSocket connection opened.'); - } + // create WebSocket URL + const wsUrl = `${this.tokenInfo.endpoint}?${queryParams.toString()}`; - // error callback - private onError(error: Error): void { - logger.error('WebSocket error:', error); - - // Clear all pending ack events to prevent memory leak - this.clearMessageQueues(); - - // Update connection status - this.disconnected = true; - this.connected = false; - - } + // Get the worker file path relative to the compiled js file + const workerPath = path.join(__dirname, 'message_worker.js'); - // close callback - private onClose(code: number, reason: string): void { - logger.debug(`WebSocket closed with code ${code}: ${reason}`); - this.disconnected = true; + if (!fs.existsSync(workerPath)) { + throw new Error( + `Worker file not found at path: ${workerPath}. Please ensure the project is built.`, + ); + } - // Clear resources - this.clearResources(); + // Create a new worker thread + this.worker = new Worker(workerPath); - // Notify event - this.notifyEvent(WebSocketEvent.EventDisconnected, `${code}:${reason}`); + return new Promise((resolve, reject) => { + if (!this.worker) { + reject(new Error('Failed to create worker')); + return; + } - // Handle reconnection if needed - if (!this.shutdown && !this.reconnectClosed) { - this.reconnect(); - } + // Handle all worker messages through the message event + this.worker.addListener('message', (message: WorkerMessage) => { + switch (message.type) { + case EventType.INIT_RESULT: + const error = message.error; + if (error) { + logger.error(`init websocket error`, error); + reject(error); + } else { + resolve(); + this.emit('event', WebSocketEvent.EventConnected, ''); + } + break; + case EventType.MESSAGE: + case EventType.ERROR: + this.onMessage(message); + break; + case EventType.CLOSED: + this.onClose(message.data.code, message.data.reason); + break; + } + }); + + // Init underlying connection + this.worker.postMessage({ + type: EventType.INIT, + data: wsUrl, + }); + }); + }); } // receive message callback - private onMessage(message: string): void { - if (this.shutdown || this.closed) { - logger.debug('Ignoring message as client is shutting down or closed'); + private onMessage(message: WorkerMessage): void { + if (this.state != ConnectionState.CONNECTED) { + logger.warn('Ignoring message as client is disconnected', message); + return; + } + + // error message + if (message.type == EventType.ERROR) { + logger.warn(`Got error message, error=${message.error}`); + if (message.data?.id) { + this.handleAckEvent(message.data.id, message.data.error); + } return; } let m: WsMessage; try { - m = JSON.parse(message); + m = JSON.parse(message.data); } catch (e) { logger.error('Failed to parse message:', e); return; } switch (m.type) { - case MessageType.WelcomeMessage: - this.welcomeReceived = true; - logger.info('Welcome message received.'); - break; case MessageType.Message: - if(!this.messageBuffer.addMessage(m)) - { - this.notifyEvent(WebSocketEvent.EventReadBufferFull, ''); + if (!this.messageBuffer.push(m)) { + this.emit('event', WebSocketEvent.EventReadBufferFull, ''); } break; - case MessageType.PongMessage: - this.notifyEvent(WebSocketEvent.EventPongReceived, ''); - this.handleAckEvent(m); + case MessageType.PongMessage: { + this.emit('event', WebSocketEvent.EventPongReceived, ''); + this.handleAckEvent(m.id, null); break; - - case MessageType.AckMessage: - case MessageType.ErrorMessage: - this.handleAckEvent(m); + } + case MessageType.AckMessage: { + this.handleAckEvent(m.id, null); break; - + } + case MessageType.ErrorMessage: { + const errorMsg = String(m.data); + this.emit('event', WebSocketEvent.EventErrorReceived, String(errorMsg)); + this.handleAckEvent(m.id, new Error(errorMsg)); + break; + } default: logger.warn('Unknown message type:', m.type); } } - // Handle acknowledgment events (pong, ack, error) - private handleAckEvent(m: WsMessage): void { - if (!m.id) return; - - const data = this.ackEvents.get(m.id); - if (!data) return; - - this.ackEvents.delete(m.id); - - if (m.type === MessageType.PongMessage) { - logger.debug('[HandleAckEvent] Handling pong message'); - this.metric.pingSuccess++; - data.resolve(); + private handleAckEvent(id: string, err: Error | null): void { + const data = this.ackEvents.get(id); + if (!data) { + logger.warn('Unknown ack event id: ', id); return; } - - if (m.type === MessageType.ErrorMessage) { - const error = m.data; - this.notifyEvent(WebSocketEvent.EventErrorReceived, error); - data.reject(new Error(error)); - this.metric.pingErr++; + this.ackEvents.delete(id); + if (err) { + data.reject(err); } else { data.resolve(); } } - // write message to work thread - write(ms: WsMessage, timeout: number): Promise { - return new Promise((resolve, reject) => { - // clean resource if error - if (!this.connected || !this.worker) { - return; - } - - try { - // Send message to worker directly - this.worker.postMessage({ - command: 'send', - data: ms - }); - resolve(); - } catch (error) { - logger.error('Failed to send message:', error); - reject(error); - } - }); - } - - // keep-alive - private keepAlive(): void { - - if (!this.tokenInfo || this.shutdown || this.closed) { - return; - } - - if (this.disconnected || !this.connected) { - return; - } - - const interval = this.tokenInfo.pingInterval / 1000; - const timeout = this.tokenInfo.pingTimeout / 1000; - const currentTime = Date.now() / 1000; - const timeSinceLastPing = currentTime - (this.lastPingTime || 0); - - - if (timeSinceLastPing >= interval) { - const pingMsg = new WsMessage(); - pingMsg.id = Date.now().toString(); - pingMsg.type = MessageType.PingMessage; - try { - this.write(pingMsg, timeout).catch((e) => { - logger.error('[KeepAlive] Heartbeat ping error:', e); - }); - } catch (e) { - logger.error('[KeepAlive] Heartbeat ping error:', e); - this.metric.pingErr++; - } - this.lastPingTime = currentTime; - } - } + // close callback + private onClose(code: number, reason: string): void { + logger.warn(`WebSocket closed with code ${code}: ${reason}`); + this.emit('event', WebSocketEvent.EventDisconnected, `${code}:${reason}`); - public close(): void { - if (this.worker) { - this.worker.postMessage({ command: 'close' }); - this.worker.terminate(); - this.worker = null; - } - // Clear intervals - if (this.keepAliveInterval) { - clearInterval(this.keepAliveInterval); - this.keepAliveInterval = null; + // Handle reconnection if needed + if (!this.shutdown) { + this.reconnect(); } - - // Clear message queues - this.clearMessageQueues(); - - // Reset state - this.disconnected = true; - this.connected = false; - this.welcomeReceived = false; - this.lastPingTime = null; } - // Clear all message queues and cleanup resources - private clearMessageQueues(): void { - - // Clear write message queue and reject pending promises - this.ackEvents.forEach((writeMsg) => { - writeMsg.reject(new Error('WebSocket connection closed')); + private keepAlive(): void { + const pingMsg = new WsMessage(); + pingMsg.id = Date.now().toString(); + pingMsg.type = MessageType.PingMessage; + this.write(pingMsg, this.options.writeTimeout).catch((e) => { + logger.error('keepalive ping error:', e); }); - this.ackEvents.clear(); - } - - private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { - try { - this.eventEmitter.emit('ws_event', event, msg); - } catch (err) { - logger.error('Exception in notify_event:', err); - } } private randomEndpoint(tokens: WsToken[]): WsToken { @@ -472,71 +322,38 @@ export class WebSocketClient { return tokens[Math.floor(Math.random() * tokens.length)]; } - // Check if the client has been reconnected - public isReconnected(): boolean { - return this.reconnected; - } - - // Clear the reconnected flag - public clearReconnectedFlag(): void { - this.reconnected = false; - } - - private async reconnect(): Promise { - const reconnectLoop = async () => { - while (!this.reconnectClosed) { - if (this.disconnected && !this.shutdown) { - try { - await this.close(); - } catch (err) { - logger.error('Error closing connection:', err); - } - - this.notifyEvent(WebSocketEvent.EventTryReconnect, ''); - this.disconnected = false; - - let attempt = 0; - let reconnected = false; - - while ( - !reconnected && - this.options.reconnect && - (this.options.reconnectAttempts === -1 || - attempt < this.options.reconnectAttempts) - ) { - logger.info( - `Reconnecting in ${this.options.reconnectInterval/1000} seconds... (attempt ${attempt + 1}/${this.options.reconnectAttempts})`, - ); - await new Promise((resolve) => - setTimeout(resolve, this.options.reconnectInterval), - ); - - try { - await this.dial(); - this.connected = true; - this.closed = false; - this.run(); - reconnected = true; - this.reconnected = true; - logger.info('Successfully reconnected to WebSocket server'); - } catch (err) { - logger.error(`Reconnect attempt ${attempt + 1} failed:`, err); - attempt++; - } - } - - if (!reconnected) { - this.notifyEvent(WebSocketEvent.EventClientFail, 'Failed to reconnect after all attempts'); - logger.error('Failed to reconnect after all attempts.'); - } - } - await new Promise((resolve) => setTimeout(resolve, 1000)); - } - }; - - reconnectLoop().catch((err) => { - logger.error('Critical error in reconnect loop:', err); - this.notifyEvent(WebSocketEvent.EventClientFail, `Critical error: ${err.message}`); - }); + private reconnect(): Promise { + if (!this.shutdown && this.options.reconnect) { + this.emit('event', WebSocketEvent.EventTryReconnect, ''); + + const maxAttempts = + this.options.reconnectAttempts == -1 + ? Number.MAX_VALUE + : this.options.reconnectAttempts; + + return this.close() + .then(() => { + return retryPromise( + () => { + return this.start(); + }, + maxAttempts, + this.options.reconnectInterval, + ).then(() => {}); + }) + .then(() => { + logger.info('Successfully reconnected to WebSocket server'); + this.emit('reconnected'); + }) + .catch((e: Error) => { + this.emit( + 'event', + WebSocketEvent.EventClientFail, + 'Failed to reconnect after all attempts', + ); + logger.error('Failed to reconnect after all attempts.'); + }); + } + return Promise.reject('Reconnect disabled'); } } diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index cecef542..cec012f9 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -3,7 +3,7 @@ import { ClientOption } from '@model/client_option'; import { DomainType, MessageType } from '@model/constant'; import { DefaultTransport } from './default_transport'; -import { CallbackManager, TopicManager } from './default_ws_callback'; +import { TopicManager } from './default_ws_callback'; import { WebSocketClient } from './default_ws_client'; import { DefaultWsTokenProvider } from './default_ws_token_provider'; import { WebSocketClientOption, WebSocketEvent } from '@src/model'; @@ -12,247 +12,62 @@ import { SubInfo } from '@internal/util/sub'; import { WsMessage } from '@model/common'; import { randomUUID } from 'crypto'; import { EventEmitter } from 'events'; -import { Worker } from 'worker_threads'; import { logger } from '@src/common'; - - /** * DefaultWsService implements the WebSocket service interface for handling real-time data communication. * It manages WebSocket connections, subscriptions, and message handling with automatic reconnection support. */ export class DefaultWsService implements WebSocketService { - private readonly option: ClientOption; private readonly wsOption: WebSocketClientOption; - private readonly domain: DomainType; private readonly privateChannel: boolean; - private readonly versionString: string; private readonly tokenTransport: DefaultTransport; private topicManager: TopicManager; private client: WebSocketClient; - private stopSignal: boolean = false; - private recoveryLoop?: NodeJS.Timeout; private readonly eventEmitter: EventEmitter; - /** - * Creates a new instance of DefaultWsService - * @param option - Client configuration options including WebSocket settings - * @param domain - The domain type for the WebSocket connection - * @param privateChannel - Whether this is a private channel connection - * @param versionString - SDK version string - */ constructor( option: ClientOption, domain: DomainType, privateChannel: boolean, versionString: string, ) { - this.option = option; if (!option.webSocketClientOption) { throw new Error('WebSocketClientOption is undefined'); } this.wsOption = option.webSocketClientOption; - this.domain = domain; this.privateChannel = privateChannel; - this.versionString = versionString; this.tokenTransport = new DefaultTransport(option, versionString); this.topicManager = new TopicManager(); - - // init EventEmitter this.eventEmitter = new EventEmitter(); - - // if config eventCallback, register as event listener - if (this.wsOption.eventCallback) { - this.eventEmitter.on('ws_event', (event: WebSocketEvent, msg: string, msg2: string) => { - try { - this.wsOption.eventCallback!(event, msg); - } catch (err) { - logger.error('Exception in eventCallback:', err); - } - }); - } - + this.eventEmitter.on('event', (event: WebSocketEvent, msg: string) => { + if (this.wsOption.eventCallback) { + this.wsOption.eventCallback(event, msg); + } + }); this.client = new WebSocketClient( new DefaultWsTokenProvider(this.tokenTransport, domain, privateChannel), this.wsOption, - this.eventEmitter, ); - - - // Handle message consumption - this.client.messageBuffer.on('readable', () => { - this.processMessages(); + this.client.on('event', (event: WebSocketEvent, msg: string) => { + this.eventEmitter.emit('event', event, msg); + }); + this.client.on('message', (message: WsMessage) => { + this.processMessages(message); + }); + this.client.on('reconnected', () => { + this.recovery(); }); } - /** - * Notifies subscribers of WebSocket events through the configured callback - * @param event - Event type identifier - * @param msg - Primary message content - * @param msg2 - Optional secondary message content - */ - private notifyEvent(event: WebSocketEvent, msg: string, msg2: string = ''): void { - try { - // use EventEmitter send event - this.eventEmitter.emit('ws_event', event, msg, msg2); - } catch (err) { - logger.error('Exception in notify_event:', err); - } - } - - /** - * Resubscribes to topics after a reconnection - * @param callbackManager - The callback manager containing subscription information - */ - private async resubscribe(callbackManager: CallbackManager): Promise { - const subInfoList = callbackManager.getSubInfo(); - for (const sub of subInfoList) { - try { - if (sub.callback) { - const subId = await this.subscribe(sub.prefix, sub.args, sub.callback); - this.notifyEvent(WebSocketEvent.EventReSubscribeOK, subId); - } - } catch (err) { - this.notifyEvent( - WebSocketEvent.EventReSubscribeError, - `id: ${sub.toId()}, err: ${err}`, - ); - } - } - } - - - - private async processMessages(): Promise { - try { - let message; - // Read messages from buffer while available - while (null !== (message = this.client.messageBuffer.read())) { - if (!message || !message.topic) { - continue; - } - - const callbackManager = this.topicManager.getCallbackManager(message.topic); - if (!callbackManager) { - continue; - } - - const callback = callbackManager.get(message.topic); - if (!callback) { - continue; - } - - try { - await callback.onMessage(message); - } catch (err) { - logger.error('[Main] Error processing message:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); - } - - // Small delay to prevent blocking - await new Promise(resolve => setTimeout(resolve, 0)); - } - } catch (err) { - logger.error('[Main] Error in message processing loop:', err); - this.notifyEvent(WebSocketEvent.EventCallbackError, String(err)); - } - } - - /** - * Starts the recovery loop for handling reconnection scenarios - * Monitors connection status and triggers resubscription when reconnected - * Checks every 1000ms (1 second) for reconnection events - */ - private startRecoveryLoop(): void { - this.recoveryLoop = setInterval(async () => { - if (this.stopSignal) { - if (this.recoveryLoop) clearInterval(this.recoveryLoop); - return; - } - - if (this.client.isReconnected()) { - logger.info('WebSocket client reconnected, resubscribe...'); - - const oldTopicManager = this.topicManager; - this.topicManager = new TopicManager(); - - try { - const resubscribePromises: Promise[] = []; - oldTopicManager.range((key, value) => { - if (!value.isEmpty()) { - resubscribePromises.push(this.resubscribe(value)); - } - return true; - }); - - await Promise.all(resubscribePromises); - logger.info('All topics resubscribed successfully'); - } catch (err) { - logger.error('Error during resubscribe:', err); - this.notifyEvent( - WebSocketEvent.EventReSubscribeError, - `Failed to resubscribe: ${err}`, - ); - this.topicManager = oldTopicManager; - } - - this.client.clearReconnectedFlag(); - } - }, 1000); - } - - /** - * Starts the WebSocket service - * Initializes the client connection and starts message processing and recovery loops - * @throws Error if client initialization fails - */ start(): Promise { - return this.client - .start() - .then(() => { - this.stopSignal = false; - this.startRecoveryLoop(); - }) - .catch((err) => { - logger.error('Failed to start client:', err); - throw err; - }); + return this.client.start(); } - /** - * Stops the message processing and cleans up resources - */ stop(): Promise { - logger.debug('Stopping WebSocket service...'); - this.stopSignal = true; - - return new Promise((resolve) => { - - - if (this.recoveryLoop) { - clearInterval(this.recoveryLoop); - this.recoveryLoop = undefined; - } - - // Stop the WebSocket client - this.client.stop().then(() => { - logger.debug('WebSocket service stopped'); - if (this.client.messageBuffer) { - this.client.messageBuffer.destroy(); - } - resolve(); - }); - }); + return this.client.stop(); } - /** - * Subscribes to a topic with specified arguments - * @param prefix - Topic prefix identifier - * @param args - Array of subscription arguments - * @param callback - Callback function to handle incoming messages for this subscription - * @returns Promise resolving to subscription ID - * @throws Error if subscription fails or is already subscribed - */ subscribe(prefix: string, args: string[], callback: WebSocketMessageCallback): Promise { // Create subscription info with prefix, args, and callback const subInfo = new SubInfo(prefix, args || [], callback); @@ -288,42 +103,79 @@ export class DefaultWsService implements WebSocketService { }); } - /** - * Unsubscribes from a topic using the subscription ID - * @param id - Subscription ID to unsubscribe - * @throws Error if unsubscribe operation fails - */ unsubscribe(id: string): Promise { return new Promise((resolve, reject) => { - try { - const subInfo = SubInfo.fromId(id); - const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); + const subInfo = SubInfo.fromId(id); + const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); + + const subEvent = new WsMessage(); + + subEvent.id = randomUUID().toString(); + subEvent.type = MessageType.UnsubscribeMessage; + subEvent.topic = subInfo.subTopic(); + subEvent.privateChannel = this.privateChannel; + subEvent.response = true; + + this.client + .write(subEvent, this.wsOption.writeTimeout) + .then(() => { + callbackManager.remove(id); + logger.info('callback removed for id:', id); + resolve(); + }) + .catch((e) => { + logger.error('Failed to send unsubscribe message:', e); + reject(e); + }); + }); + } - const subEvent = new WsMessage(); + private processMessages(message: WsMessage) { + const callbackManager = this.topicManager.getCallbackManager(message.topic); + if (!callbackManager) { + logger.warn(`Unknown topic: ${message.topic}`); + return; + } - subEvent.id = randomUUID().toString(); - subEvent.type = MessageType.UnsubscribeMessage; - subEvent.topic = subInfo.subTopic(); - subEvent.privateChannel = this.privateChannel; - subEvent.response = true; + const callback = callbackManager.get(message.topic); + if (!callback) { + logger.warn(`Unknown callback for topic: ${message.topic}`); + return; + } - callbackManager.remove(id); - logger.info('callback removed for id:', id); + try { + callback.onMessage(message); + } catch (err) { + logger.error('Error processing callback', err); + this.eventEmitter.emit('event', WebSocketEvent.EventCallbackError, String(err)); + } + } + + private recovery(): void { + logger.info('WebSocket client reconnected, resubscribe...'); - this.client - .write(subEvent, this.wsOption.writeTimeout) - .then(() => { - logger.info('unsubscribe message sent successfully'); - resolve(); - }) - .catch((e) => { - logger.error('Failed to send unsubscribe message:', e); - reject(e); - }); - } catch (e) { - logger.error('unsubscribe error:', e); - reject(e); + const oldTopicManager = this.topicManager; + this.topicManager = new TopicManager(); + + oldTopicManager.range((key, value) => { + for (const sub of value.getSubInfo()) { + if (sub.callback) { + this.subscribe(sub.prefix, sub.args, sub.callback) + .then((id) => { + logger.info(`Resubscribe success, id:${id}`); + this.eventEmitter.emit('event', WebSocketEvent.EventReSubscribeOK, id); + }) + .catch((err) => { + logger.info(`Resubscribe error, id:${sub.toId()}, err:${err}`); + this.eventEmitter.emit( + 'event', + WebSocketEvent.EventReSubscribeError, + err.toString(), + ); + }); + } } + return true; }); } } diff --git a/sdk/node/src/internal/infra/message_data.js b/sdk/node/src/internal/infra/message_data.js new file mode 100644 index 00000000..850e8efd --- /dev/null +++ b/sdk/node/src/internal/infra/message_data.js @@ -0,0 +1,12 @@ +/** + * @readonly + * @enum {string} + */ +const EventType = Object.freeze({ + INIT: 'init', + INIT_RESULT: 'init_result', + MESSAGE: 'message', + ERROR: 'error', + CLOSED: 'close', +}); +module.exports = { EventType }; diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index 65dc86d3..33dbe28a 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -1,10 +1,16 @@ const { parentPort } = require('worker_threads'); const WebSocket = require('ws'); const { logger } = require('../../common/logger/logger'); +const { EventType } = require('./message_data'); -// Log worker initialization -logger.info('[Worker] Initializing worker thread'); +/** + * @typedef {Object} Message + * @property {string} type + * @property {any} data + * @property {Error} error + */ +logger.info('[Worker] Initializing worker thread'); if (!parentPort) { logger.error('[Worker] parentPort is null - worker must be run as a worker thread'); process.exit(1); @@ -12,87 +18,98 @@ if (!parentPort) { let ws = null; -// Parse WebSocket message -function parseMessage(data) { - try { - const message = JSON.parse(data.toString()); - return message; - } catch (error) { - logger.error('[Worker] Error parsing message:', error); - // Notify main thread about parsing error - parentPort.postMessage({ - type: 'error', - error: `Failed to parse WebSocket message: ${error.message}`, - }); - return null; - } -} - // Handle messages from the main thread -parentPort.on('message', (message) => { - try { - if (message.command === 'connect') { - // Create WebSocket connection - ws = new WebSocket(message.wsUrl); +parentPort.on( + 'message', + /** @param {Message} message */ (message) => { + try { + switch (message.type) { + case EventType.INIT: { + ws = new WebSocket(message.data); - // Handle WebSocket events - ws.on('open', () => { - logger.info('[Worker] WebSocket connection opened'); - parentPort.postMessage({ type: 'open' }); - }); + ws.on('open', () => { + logger.info('[Worker] WebSocket connection opened'); + parentPort.postMessage({ + type: EventType.INIT_RESULT, + data: null, + error: null, + }); + }); - ws.on('message', (data) => { - const parsedMessage = parseMessage(data); - if (parsedMessage) { - parentPort.postMessage({ - type: 'message', - data: JSON.stringify(parsedMessage), + ws.on('error', (err) => { + // TODO Test error + logger.error('[Worker] WebSocket connection error:', err); + parentPort.postMessage({ + type: EventType.INIT_RESULT, + data: null, + error: err, + }); }); - } - }); - ws.on('error', (error) => { - logger.error('[Worker] WebSocket error:', error); - parentPort.postMessage({ - type: 'error', - error: error.message, - }); - }); + ws.on('message', (data) => { + parentPort.postMessage({ + type: EventType.MESSAGE, + data: data, + error: null, + }); + }); - ws.on('close', (code, reason) => { - logger.info('[Worker] WebSocket closed:', code, reason); - parentPort.postMessage({ - type: 'close', - code, - reason, - }); + ws.on('close', (code, reason) => { + logger.info('[Worker] WebSocket closed:', code, reason); + parentPort.postMessage({ + type: EventType.CLOSED, + data: { code: code, reason: reason }, + error: code !== 1000 ? new Error(`WebSocket closed: ${reason}`) : null, + }); + ws = null; + }); + break; + } + case EventType.MESSAGE: { + if (!ws || ws.readyState !== WebSocket.OPEN) { + logger.error(`[Worker] websocket not initialized`); + parentPort.postMessage({ + type: EventType.ERROR, + data: message.data, + error: new Error(`Websocket not initialized`), + }); + return; + } + + ws.send(JSON.stringify(message.data), (err) => { + // write fail, notify master + if (err) { + logger.error(`[Worker] Websocket write error:${err}]`); + parentPort.postMessage({ + type: EventType.ERROR, + data: message.data, + error: err, + }); + } + }); + break; + } + case EventType.CLOSED: { + logger.info('[Worker] Close event: Worker is shutting down'); + if (ws) { + ws.close(); + ws = null; + } + break; + } + default: { + break; + } + } + } catch (error) { + logger.error('[Worker] Unexpected error:', error); + parentPort.postMessage({ + type: message.type === EventType.INIT ? EventType.INIT_RESULT : EventType.ERROR, + data: message.data, + error: error, }); - } else if (message.command === 'send' && ws) { - // Send message through WebSocket - const data = message.data; - ws.send(JSON.stringify(data)); - } else if (message.command === 'close' && ws) { - // Close WebSocket connection - ws.close(); - ws = null; } - } catch (error) { - logger.error('[Worker] Error handling message:', error); - parentPort.postMessage({ - type: 'error', - error: error instanceof Error ? error.message : String(error), - }); - } -}); - -// Handle close -parentPort.on('close', () => { - logger.info('[Worker] Close event: Worker is shutting down'); - if (ws) { - ws.close(); - ws = null; - } -}); - + }, +); // Log worker startup logger.info('[Worker] Started and ready to process messages at:', new Date().toISOString()); diff --git a/sdk/node/src/internal/interfaces/websocket.ts b/sdk/node/src/internal/interfaces/websocket.ts index 476d1efb..56551035 100644 --- a/sdk/node/src/internal/interfaces/websocket.ts +++ b/sdk/node/src/internal/interfaces/websocket.ts @@ -1,5 +1,6 @@ // WsToken represents the token and API endpoint for a WebSocket connection import { WsMessage } from '@model/common'; +import { WebSocketEvent } from '@src/model'; export interface WsToken { token: string; @@ -67,6 +68,12 @@ export interface WebSocketService { unsubscribe(id: string): Promise; } +export interface WebsocketTransportEvents { + message: (data: WsMessage) => void; + event: (event: WebSocketEvent, msg: string) => void; + reconnected: () => void; +} + // WebsocketTransport defines methods required for managing a WebSocket connection. export interface WebsocketTransport { /** @@ -83,21 +90,19 @@ export interface WebsocketTransport { /** * Writes a message to the WebSocket connection. - * @param context The context for the operation. * @param message The message to send. + * @param timeout The timeout in milliseconds * @returns A channel (promise) that resolves when the message is sent or rejects with an error. */ - write(context: any, message: WsMessage): Promise; - - /** - * Reads messages from the WebSocket connection. - * @returns A channel (promise) that resolves to the received message or rejects with an error. - */ - read(): Promise; + write(message: WsMessage, timeout: number): Promise; /** - * A channel that signals when the WebSocket connection is reconnected. - * @returns A promise that resolves when the connection is reconnected. + * Subscribes to WebSocket events. + * @param event The event name. + * @param listener The callback function for the event. */ - reconnected(): Promise; + on( + event: K, + listener: WebsocketTransportEvents[K], + ): this; } diff --git a/sdk/node/src/internal/util/util.ts b/sdk/node/src/internal/util/util.ts new file mode 100644 index 00000000..7028edfa --- /dev/null +++ b/sdk/node/src/internal/util/util.ts @@ -0,0 +1,57 @@ +import { logger } from '@src/common'; + +function sleep(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export function retryPromise(fn: any, maxRetries: number, delay: number) { + return new Promise((resolve, reject) => { + function attempt(remaining: number) { + fn() + .then(resolve) + .catch(async (err: any) => { + if (remaining <= 1) { + reject(err); + } else { + logger.warn(`Retrying... ${maxRetries - remaining + 1}/${maxRetries}`); + await sleep(delay); + attempt(remaining - 1); + } + }); + } + + attempt(maxRetries); + }); +} + +export function withTimeout( + executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void, + timeoutMs: number, +): Promise { + return new Promise((outerResolve, outerReject) => { + let handled = false; + const timeout = setTimeout(() => { + if (!handled) { + handled = true; + outerReject(new Error(`Timeout after ${timeoutMs}ms`)); + } + }, timeoutMs); + + executor( + (value) => { + if (!handled) { + handled = true; + clearTimeout(timeout); + outerResolve(value); + } + }, + (error) => { + if (!handled) { + handled = true; + clearTimeout(timeout); + outerReject(error); + } + }, + ); + }); +} diff --git a/sdk/node/src/model/common.ts b/sdk/node/src/model/common.ts index 5f54ec13..5c06093c 100644 --- a/sdk/node/src/model/common.ts +++ b/sdk/node/src/model/common.ts @@ -89,7 +89,7 @@ export class WsMessage { /** * A unique identifier for the message */ - id?: string; + id: string; /** * The type of the message (e.g., WelcomeMessage) */ @@ -120,6 +120,7 @@ export class WsMessage { data: any; constructor() { + this.id = '' this.topic = ''; this.subject = ''; } From 5cc8e1d4b187f6214451ea761fe96805a09ead50 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 25 Feb 2025 16:50:21 +0800 Subject: [PATCH 100/106] feat(nodejs): update websocket implements --- .../internal/infra/default_ws_client.test.ts | 162 ++++++++++++++++-- .../src/internal/infra/default_ws_client.ts | 142 +++++++++------ sdk/node/src/internal/infra/message_data.js | 1 - sdk/node/src/internal/infra/message_worker.js | 14 +- sdk/node/src/internal/util/util.ts | 22 --- 5 files changed, 245 insertions(+), 96 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.test.ts b/sdk/node/src/internal/infra/default_ws_client.test.ts index 105be07e..4f5889ac 100644 --- a/sdk/node/src/internal/infra/default_ws_client.test.ts +++ b/sdk/node/src/internal/infra/default_ws_client.test.ts @@ -66,6 +66,58 @@ export function mockWebSocketHandlerTimeout(ws: WebSocket) { ws.on('close', () => {}); } +export function mockWebSocketHandlerClose(ws: WebSocket) { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + setTimeout(() => { + console.log('[server] New connection close it'); + ws.close(); + }, 1000); +} + +let x = 0; + +export function mockWebSocketHandlerReconnect(ws: WebSocket) { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + if (x == 0) { + setTimeout(() => { + console.log('[server] New connection close it'); + ws.close(); + }, 1000); + } + x += 1; +} + +export function mockWebSocketHandlerEcho(ws: WebSocket) { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + ws.on('upgrade', (data) => { + console.log(data); + }); + + ws.on('open', (socket: WebSocket) => { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + }); + + ws.on('message', (message) => { + ws.send(message.toString()); + }); + + ws.on('close', () => { + console.log('[server] Connection closed'); + }); +} + +export function mockWebSocketHandlerPingPong(ws: WebSocket) { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + ws.on('message', (message) => { + let x = WsMessage.fromJson(message.toString()); + ws.send(JSON.stringify(createMessage(x.id, MessageType.PongMessage))); + }); +} + export function mockWebSocketHandler2(ws: WebSocket) { console.log('[server2] New connection'); @@ -143,15 +195,55 @@ describe('WS Transport Test', () => { }); }); + test('test client connect', () => { + return testByMockServer(mockWebSocketHandlerEcho).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + return new Promise((resolve, reject) => { + setTimeout(resolve, 1000); + }); + }); + }); + }); + + test('test client ping/pong', () => { + return testByMockServer(mockWebSocketHandlerPingPong).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + token.pingInterval = 0.1; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + return new Promise((resolve, reject) => { + setTimeout(resolve, 4000); + }); + }); + }); + }); + test('test client connect/disconnect', () => { - return testByMockServer(mockWebSocketHandlerTimeout).then((port) => { + return testByMockServer(mockWebSocketHandlerEcho).then((port) => { let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + let token = DEFAULT_TOKEN_INFO; token.endpoint = `http://127.0.0.1:${port}`; - let client = new WebSocketClient( - new mockProvider(DEFAULT_TOKEN_INFO), - DEFAULT_WEBSOCKET_CLIENT_OPTION, - ); + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); client.on('event', function (event, mes) { console.log('[client] Received event', event, mes); }); @@ -165,18 +257,68 @@ describe('WS Transport Test', () => { test('test client timeout', () => { return testByMockServer(mockWebSocketHandlerTimeout).then((port) => { let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client + .start() + .then(() => { + return client.stop(); + }) + .catch((err) => { + expect(err).toBeDefined(); + }); + }); + }); + + test('test remote close', () => { + return testByMockServer(mockWebSocketHandlerClose).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + option.reconnect = false; + let token = DEFAULT_TOKEN_INFO; token.endpoint = `http://127.0.0.1:${port}`; - let client = new WebSocketClient( - new mockProvider(DEFAULT_TOKEN_INFO), - DEFAULT_WEBSOCKET_CLIENT_OPTION, - ); + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); client.on('event', function (event, mes) { console.log('[client] Received event', event, mes); }); return client.start().then(() => { - return client.stop(); + return new Promise((resolve, reject) => { + setTimeout(resolve, 4000); + }); + }); + }); + }); + + test('test reconnect', () => { + return testByMockServer(mockWebSocketHandlerReconnect).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + option.reconnect = true; + option.reconnectAttempts = 3; + option.reconnectInterval = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + return new Promise((resolve, reject) => { + setTimeout(resolve, 4000); + }).then(()=> { + return client.stop(); + }); }); }); }); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index b42c1d77..3464f1c7 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -17,7 +17,7 @@ import fs from 'fs'; import { Worker } from 'worker_threads'; import { logger } from '@src/common'; import { EventType } from './message_data'; -import { retryPromise, withTimeout } from '@internal/util/util'; +import { withTimeout } from '@internal/util/util'; import { Readable } from 'stream'; enum ConnectionState { @@ -45,6 +45,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport private tokenProvider: WsTokenProvider; private keepAliveInterval: any; private shutdown: boolean; + private reconnecting = false; private tokenInfo: WsToken | null; private ackEvents: Map; @@ -84,6 +85,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport () => this.keepAlive(), this.tokenInfo!.pingInterval * 1000, ); + this.emit('event', WebSocketEvent.EventConnected, ''); }) .catch((err) => { this.state = ConnectionState.DISCONNECTED; @@ -140,6 +142,8 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport } private close(): Promise { + logger.info('closing websocket client'); + // clear intervals if (this.keepAliveInterval) { clearInterval(this.keepAliveInterval); @@ -161,7 +165,13 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport this.worker.postMessage({ type: EventType.CLOSED }); let worker = this.worker; this.worker = null; - return worker.terminate().then(); + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, 1000); + }).then(() => { + return worker.terminate().then(); + }); } return Promise.resolve(); @@ -193,33 +203,40 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport // Create a new worker thread this.worker = new Worker(workerPath); - return new Promise((resolve, reject) => { + return withTimeout((resolve, reject) => { if (!this.worker) { reject(new Error('Failed to create worker')); return; } - // Handle all worker messages through the message event - this.worker.addListener('message', (message: WorkerMessage) => { - switch (message.type) { - case EventType.INIT_RESULT: - const error = message.error; - if (error) { - logger.error(`init websocket error`, error); - reject(error); - } else { + this.worker.once('message', (message: WorkerMessage) => { + if (message.type === EventType.MESSAGE) { + try { + let m = WsMessage.fromJson(message.data); + if (m.type == MessageType.WelcomeMessage) { + logger.info(`receive welcome message, ready to process message`); + + // Handle all worker messages through the message event + this.worker!.addListener('message', (message: WorkerMessage) => { + switch (message.type) { + case EventType.MESSAGE: + case EventType.ERROR: + this.onMessage(message); + break; + case EventType.CLOSED: + this.onClose(message.data.code, message.data.reason); + break; + } + }); resolve(); - this.emit('event', WebSocketEvent.EventConnected, ''); + return; } - break; - case EventType.MESSAGE: - case EventType.ERROR: - this.onMessage(message); - break; - case EventType.CLOSED: - this.onClose(message.data.code, message.data.reason); - break; + } catch (e) { + reject(e); + return; + } } + reject(new Error(`Failed to init worker connection, msg:${message.error}`)); }); // Init underlying connection @@ -227,6 +244,11 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport type: EventType.INIT, data: wsUrl, }); + }, this.options.dialTimeout).catch((err) => { + logger.error(`failed to create worker`, err); + return this.close().then(() => { + throw err; + }); }); }); } @@ -298,7 +320,6 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport // close callback private onClose(code: number, reason: string): void { logger.warn(`WebSocket closed with code ${code}: ${reason}`); - this.emit('event', WebSocketEvent.EventDisconnected, `${code}:${reason}`); // Handle reconnection if needed if (!this.shutdown) { @@ -323,37 +344,52 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport } private reconnect(): Promise { - if (!this.shutdown && this.options.reconnect) { - this.emit('event', WebSocketEvent.EventTryReconnect, ''); - - const maxAttempts = - this.options.reconnectAttempts == -1 - ? Number.MAX_VALUE - : this.options.reconnectAttempts; - - return this.close() - .then(() => { - return retryPromise( - () => { - return this.start(); - }, - maxAttempts, - this.options.reconnectInterval, - ).then(() => {}); - }) - .then(() => { - logger.info('Successfully reconnected to WebSocket server'); - this.emit('reconnected'); - }) - .catch((e: Error) => { - this.emit( - 'event', - WebSocketEvent.EventClientFail, - 'Failed to reconnect after all attempts', - ); - logger.error('Failed to reconnect after all attempts.'); - }); + if (this.reconnecting) { + return Promise.resolve(); } - return Promise.reject('Reconnect disabled'); + + return Promise.resolve() + .then(() => { + this.reconnecting = true; + }) + .then(() => { + return this.close(); + }) + .then(() => { + if (!this.shutdown && this.options.reconnect) { + this.emit('event', WebSocketEvent.EventTryReconnect, ''); + + const maxAttempts = + this.options.reconnectAttempts == -1 + ? Number.MAX_VALUE + : this.options.reconnectAttempts; + + return Promise.resolve().then(async () => { + for (let i = 0; i < maxAttempts; i++) { + logger.warn(`reconnecting... ${i}/${maxAttempts}`); + await new Promise((resolve) => { + setTimeout(resolve, this.options.reconnectInterval); + }); + try { + await this.start(); + logger.info('Successfully reconnected to WebSocket server'); + this.emit('reconnected'); + return; + } catch (e) { + logger.error(`reconnecting fail:`, e); + } + } + this.emit( + 'event', + WebSocketEvent.EventClientFail, + 'Failed to reconnect after all attempts', + ); + logger.error('Failed to reconnect after all attempts.'); + }); + } + }) + .finally(async () => { + this.reconnecting = false; + }); } } diff --git a/sdk/node/src/internal/infra/message_data.js b/sdk/node/src/internal/infra/message_data.js index 850e8efd..422191dd 100644 --- a/sdk/node/src/internal/infra/message_data.js +++ b/sdk/node/src/internal/infra/message_data.js @@ -4,7 +4,6 @@ */ const EventType = Object.freeze({ INIT: 'init', - INIT_RESULT: 'init_result', MESSAGE: 'message', ERROR: 'error', CLOSED: 'close', diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index 33dbe28a..61240f99 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -29,18 +29,12 @@ parentPort.on( ws.on('open', () => { logger.info('[Worker] WebSocket connection opened'); - parentPort.postMessage({ - type: EventType.INIT_RESULT, - data: null, - error: null, - }); }); ws.on('error', (err) => { - // TODO Test error logger.error('[Worker] WebSocket connection error:', err); parentPort.postMessage({ - type: EventType.INIT_RESULT, + type: EventType.ERROR, data: null, error: err, }); @@ -49,7 +43,7 @@ parentPort.on( ws.on('message', (data) => { parentPort.postMessage({ type: EventType.MESSAGE, - data: data, + data: data.toString(), error: null, }); }); @@ -90,7 +84,7 @@ parentPort.on( break; } case EventType.CLOSED: { - logger.info('[Worker] Close event: Worker is shutting down'); + logger.info('[Worker] shutdown the worker'); if (ws) { ws.close(); ws = null; @@ -104,7 +98,7 @@ parentPort.on( } catch (error) { logger.error('[Worker] Unexpected error:', error); parentPort.postMessage({ - type: message.type === EventType.INIT ? EventType.INIT_RESULT : EventType.ERROR, + type: EventType.ERROR, data: message.data, error: error, }); diff --git a/sdk/node/src/internal/util/util.ts b/sdk/node/src/internal/util/util.ts index 7028edfa..47145945 100644 --- a/sdk/node/src/internal/util/util.ts +++ b/sdk/node/src/internal/util/util.ts @@ -1,29 +1,7 @@ -import { logger } from '@src/common'; - function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } -export function retryPromise(fn: any, maxRetries: number, delay: number) { - return new Promise((resolve, reject) => { - function attempt(remaining: number) { - fn() - .then(resolve) - .catch(async (err: any) => { - if (remaining <= 1) { - reject(err); - } else { - logger.warn(`Retrying... ${maxRetries - remaining + 1}/${maxRetries}`); - await sleep(delay); - attempt(remaining - 1); - } - }); - } - - attempt(maxRetries); - }); -} - export function withTimeout( executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void, timeoutMs: number, From 5a5c5db004384a3f3219eeaf3f3aedf74fc32589 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 25 Feb 2025 17:15:02 +0800 Subject: [PATCH 101/106] feat(nodejs): update websocket implements --- .../internal/infra/default_ws_client.test.ts | 54 ++++++++++++++++++- .../src/internal/infra/default_ws_client.ts | 12 +++-- sdk/node/src/internal/util/util.ts | 8 ++- sdk/node/tests/e2e/ws/spot/public.test.ts | 6 +-- 4 files changed, 71 insertions(+), 9 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.test.ts b/sdk/node/src/internal/infra/default_ws_client.test.ts index 4f5889ac..6c60eec9 100644 --- a/sdk/node/src/internal/infra/default_ws_client.test.ts +++ b/sdk/node/src/internal/infra/default_ws_client.test.ts @@ -133,7 +133,7 @@ export function mockWebSocketHandler2(ws: WebSocket) { case MessageType.SubscribeMessage: console.log('[server2] Received subscribe message'); - ws.close(); + ws.send(JSON.stringify(createMessage(m.id, MessageType.AckMessage))); break; } }); @@ -316,10 +316,60 @@ describe('WS Transport Test', () => { return client.start().then(() => { return new Promise((resolve, reject) => { setTimeout(resolve, 4000); - }).then(()=> { + }).then(() => { return client.stop(); }); }); }); }); + + test('test read write', () => { + return testByMockServer(mockWebSocketHandler2).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + option.reconnect = true; + option.reconnectAttempts = 3; + option.reconnectInterval = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + let x = createMessage(randomUUID(), MessageType.SubscribeMessage); + return client.write(x, 1000); + }).then(()=> { + return client.stop(); + }); + }); + }); + + test('test write timeout', () => { + return testByMockServer(mockWebSocketHandler2).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + option.reconnect = true; + option.reconnectAttempts = 3; + option.reconnectInterval = 1000; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); + }); + + return client.start().then(() => { + let x = createMessage(randomUUID(), MessageType.SubscribeMessage); + return client.write(x, 0); + }).then(()=> { + return client.stop(); + }).catch((err) => { + expect(err).toBeDefined(); + }); + }); + }); }); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 3464f1c7..1dc2b3bd 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -17,7 +17,7 @@ import fs from 'fs'; import { Worker } from 'worker_threads'; import { logger } from '@src/common'; import { EventType } from './message_data'; -import { withTimeout } from '@internal/util/util'; +import { TimeoutError, withTimeout } from '@internal/util/util'; import { Readable } from 'stream'; enum ConnectionState { @@ -106,7 +106,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport return Promise.reject(new Error('Not connected or shutting down')); } - return withTimeout((resolve, reject) => { + return withTimeout((resolve, reject) => { try { this.ackEvents.set(ms.id, { msg: ms, @@ -124,7 +124,13 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport this.ackEvents.delete(ms.id); reject(error); } - }, timeout); + }, timeout).catch((err) => { + if (err instanceof TimeoutError) { + logger.error('Send message timeout, id:', ms.id); + this.ackEvents.delete(ms.id); + throw err; + } + }); } on( diff --git a/sdk/node/src/internal/util/util.ts b/sdk/node/src/internal/util/util.ts index 47145945..8d0f665d 100644 --- a/sdk/node/src/internal/util/util.ts +++ b/sdk/node/src/internal/util/util.ts @@ -2,6 +2,12 @@ function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } +export class TimeoutError extends Error { + constructor(private timeoutMs: number) { + super(`Timeout after ${timeoutMs}ms`); + } +} + export function withTimeout( executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void, timeoutMs: number, @@ -11,7 +17,7 @@ export function withTimeout( const timeout = setTimeout(() => { if (!handled) { handled = true; - outerReject(new Error(`Timeout after ${timeoutMs}ms`)); + outerReject(new TimeoutError(timeoutMs)); } }, timeoutMs); diff --git a/sdk/node/tests/e2e/ws/spot/public.test.ts b/sdk/node/tests/e2e/ws/spot/public.test.ts index 230f2e7a..0a956b78 100644 --- a/sdk/node/tests/e2e/ws/spot/public.test.ts +++ b/sdk/node/tests/e2e/ws/spot/public.test.ts @@ -54,11 +54,11 @@ describe('Spot Public WebSocket API Tests', () => { // Get the Restful Service const wsService = client.wsService(); api = wsService.newSpotPublicWS(); - await api.start(); + return api.start(); }); afterAll(() => { - api.stop(); + return api.stop(); }); test('allTickers test', () => { @@ -71,7 +71,7 @@ describe('Spot Public WebSocket API Tests', () => { expect(data.sequence).toEqual(expect.anything()); expect(data.size).toEqual(expect.anything()); expect(data.time).toEqual(expect.anything()); - console.log(data); + // console.log(data); }); return subid From dd683b84c5c8a35f96bd3c9dbc242a94f00288d0 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 25 Feb 2025 17:45:27 +0800 Subject: [PATCH 102/106] feat(nodejs): update model --- .../main/resources/node-sdk/model_ws.mustache | 2 +- sdk/node/example/src/ts/example_ws.ts | 4 +-- .../futuresprivate/model_all_order_event.ts | 2 +- .../model_all_position_event.ts | 2 +- .../futuresprivate/model_balance_event.ts | 2 +- .../model_cross_leverage_event.ts | 2 +- .../futuresprivate/model_margin_mode_event.ts | 2 +- .../futuresprivate/model_order_event.ts | 2 +- .../futuresprivate/model_position_event.ts | 2 +- .../futuresprivate/model_stop_orders_event.ts | 2 +- .../futurespublic/model_announcement_event.ts | 2 +- .../futurespublic/model_execution_event.ts | 2 +- .../futurespublic/model_instrument_event.ts | 2 +- .../futurespublic/model_klines_event.ts | 2 +- .../model_orderbook_increment_event.ts | 2 +- .../model_orderbook_level50_event.ts | 2 +- .../model_orderbook_level5_event.ts | 2 +- .../model_symbol_snapshot_event.ts | 2 +- .../futurespublic/model_ticker_v1_event.ts | 2 +- .../futurespublic/model_ticker_v2_event.ts | 2 +- .../model_cross_margin_position_event.ts | 2 +- .../model_isolated_margin_position_event.ts | 2 +- .../marginpublic/model_index_price_event.ts | 2 +- .../marginpublic/model_mark_price_event.ts | 2 +- sdk/node/src/generate/service/index.ts | 36 +++++++++---------- .../spot/spotprivate/model_account_event.ts | 2 +- .../spot/spotprivate/model_order_v1_event.ts | 2 +- .../spot/spotprivate/model_order_v2_event.ts | 2 +- .../spotpublic/model_all_tickers_event.ts | 2 +- .../spot/spotpublic/model_klines_event.ts | 2 +- .../spotpublic/model_market_snapshot_event.ts | 2 +- .../model_orderbook_increment_event.ts | 2 +- .../model_orderbook_level1_event.ts | 2 +- .../model_orderbook_level50_event.ts | 2 +- .../model_orderbook_level5_event.ts | 2 +- .../spotpublic/model_symbol_snapshot_event.ts | 2 +- .../spot/spotpublic/model_ticker_event.ts | 2 +- .../spot/spotpublic/model_trade_event.ts | 2 +- sdk/node/src/generate/version.ts | 2 +- 39 files changed, 57 insertions(+), 57 deletions(-) diff --git a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache index 0f2c8b9e..aafda055 100644 --- a/generator/plugin/src/main/resources/node-sdk/model_ws.mustache +++ b/generator/plugin/src/main/resources/node-sdk/model_ws.mustache @@ -40,7 +40,7 @@ export class {{classname}} implements Serializable{ * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/example/src/ts/example_ws.ts b/sdk/node/example/src/ts/example_ws.ts index 70d9146b..b1fd33d5 100644 --- a/sdk/node/example/src/ts/example_ws.ts +++ b/sdk/node/example/src/ts/example_ws.ts @@ -43,7 +43,7 @@ async function spotWsExample(spotPublic: Spot.SpotPublicWS) { await spotPublic.start() let subid = spotPublic.allTickers((topic: string, subject: string, data: Spot.SpotPublic.AllTickersEvent) => { - console.log(data); + console.log(topic, subject, data.time, data.bestAsk, data.bestBid); }); await subid @@ -54,7 +54,7 @@ async function spotWsExample(spotPublic: Spot.SpotPublicWS) { .then((id) => { return spotPublic.unSubscribe(id); }).then(() => { - return spotPublic.stop + return spotPublic.stop() }); } diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts index 6473fc35..021dcbf8 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_order_event.ts @@ -129,7 +129,7 @@ export class AllOrderEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts index 52a79280..c81a2476 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_all_position_event.ts @@ -255,7 +255,7 @@ export class AllPositionEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts index e2dd6546..054d644f 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_balance_event.ts @@ -103,7 +103,7 @@ export class BalanceEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts index f16bc5be..70272987 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_cross_leverage_event.ts @@ -20,7 +20,7 @@ export class CrossLeverageEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts index 2beaf5c8..7983da6e 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_margin_mode_event.ts @@ -19,7 +19,7 @@ export class MarginModeEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts index 4d8b868d..fc97d2a0 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_order_event.ts @@ -129,7 +129,7 @@ export class OrderEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts index d6618421..ada2a1bb 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_position_event.ts @@ -255,7 +255,7 @@ export class PositionEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts index 185b8007..5745466c 100644 --- a/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts +++ b/sdk/node/src/generate/futures/futuresprivate/model_stop_orders_event.ts @@ -91,7 +91,7 @@ export class StopOrdersEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts index b1525c60..3d25ce96 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_announcement_event.ts @@ -37,7 +37,7 @@ export class AnnouncementEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts index d9c23e96..3fb5675e 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_execution_event.ts @@ -67,7 +67,7 @@ export class ExecutionEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts index 399d7531..359ebf45 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_instrument_event.ts @@ -37,7 +37,7 @@ export class InstrumentEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts index 5823a9be..45df75f2 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_klines_event.ts @@ -31,7 +31,7 @@ export class KlinesEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts index 997c57ad..b836f951 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_increment_event.ts @@ -31,7 +31,7 @@ export class OrderbookIncrementEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts index 8fdcff80..8f60c3f7 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level50_event.ts @@ -43,7 +43,7 @@ export class OrderbookLevel50Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts index 8392ea04..633c1701 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_orderbook_level5_event.ts @@ -43,7 +43,7 @@ export class OrderbookLevel5Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts index 38f70ec9..5629e4f2 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_symbol_snapshot_event.ts @@ -73,7 +73,7 @@ export class SymbolSnapshotEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts index 97543e09..36fa8bda 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v1_event.ts @@ -79,7 +79,7 @@ export class TickerV1Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts index 3b8e511f..87558f07 100644 --- a/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts +++ b/sdk/node/src/generate/futures/futurespublic/model_ticker_v2_event.ts @@ -55,7 +55,7 @@ export class TickerV2Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts index bfb921b5..78c322a3 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_cross_margin_position_event.ts @@ -62,7 +62,7 @@ export class CrossMarginPositionEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts index 2761f09b..7a74b61e 100644 --- a/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts +++ b/sdk/node/src/generate/margin/marginprivate/model_isolated_margin_position_event.ts @@ -50,7 +50,7 @@ export class IsolatedMarginPositionEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts index 9fdc12bc..af3cd6ba 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_index_price_event.ts @@ -37,7 +37,7 @@ export class IndexPriceEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts index 407db0f6..e239c02f 100644 --- a/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts +++ b/sdk/node/src/generate/margin/marginpublic/model_mark_price_event.ts @@ -37,7 +37,7 @@ export class MarkPriceEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/service/index.ts b/sdk/node/src/generate/service/index.ts index 3057fab3..a6b60ee9 100644 --- a/sdk/node/src/generate/service/index.ts +++ b/sdk/node/src/generate/service/index.ts @@ -1,18 +1,18 @@ -export * from "./account_api" -export * from "./affiliate_api" -export * from "./broker_api" -export * from "./copytrading_api" -export * from "./earn_api" -export * from "./futures_api" -export * from "./margin_api" -export * from "./spot_api" -export * from "./viplending_api" -export type {AccountService} from "./account_api" -export type {AffiliateService} from "./affiliate_api" -export type {BrokerService} from "./broker_api" -export type {CopyTradingService} from "./copytrading_api" -export type {EarnService} from "./earn_api" -export type {FuturesService} from "./futures_api" -export type {MarginService} from "./margin_api" -export type {SpotService} from "./spot_api" -export type {VIPLendingService} from "./viplending_api" +export * from './account_api'; +export * from './affiliate_api'; +export * from './broker_api'; +export * from './copytrading_api'; +export * from './earn_api'; +export * from './futures_api'; +export * from './margin_api'; +export * from './spot_api'; +export * from './viplending_api'; +export type { AccountService } from './account_api'; +export type { AffiliateService } from './affiliate_api'; +export type { BrokerService } from './broker_api'; +export type { CopyTradingService } from './copytrading_api'; +export type { EarnService } from './earn_api'; +export type { FuturesService } from './futures_api'; +export type { MarginService } from './margin_api'; +export type { SpotService } from './spot_api'; +export type { VIPLendingService } from './viplending_api'; diff --git a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts index 6c6208a2..0cf0795c 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_account_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_account_event.ts @@ -80,7 +80,7 @@ export class AccountEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts index 527b8534..ce8d1110 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v1_event.ts @@ -121,7 +121,7 @@ export class OrderV1Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts index 770add73..244b5e9a 100644 --- a/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts +++ b/sdk/node/src/generate/spot/spotprivate/model_order_v2_event.ts @@ -121,7 +121,7 @@ export class OrderV2Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts index 359aec42..87343498 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_all_tickers_event.ts @@ -61,7 +61,7 @@ export class AllTickersEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts index b6a2d366..e270791b 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_klines_event.ts @@ -31,7 +31,7 @@ export class KlinesEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts index 792f468f..7be15adc 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_market_snapshot_event.ts @@ -26,7 +26,7 @@ export class MarketSnapshotEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts index d6afd823..03dbed34 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_increment_event.ts @@ -44,7 +44,7 @@ export class OrderbookIncrementEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts index 1dd1b664..210f62b9 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level1_event.ts @@ -31,7 +31,7 @@ export class OrderbookLevel1Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts index 57dc6306..dc2a13be 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level50_event.ts @@ -44,7 +44,7 @@ export class OrderbookLevel50Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts index 023fcddb..cef35dfb 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_orderbook_level5_event.ts @@ -31,7 +31,7 @@ export class OrderbookLevel5Event implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts index 5d23f7a9..add73f44 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_symbol_snapshot_event.ts @@ -26,7 +26,7 @@ export class SymbolSnapshotEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts index 2d083903..45b61ec0 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_ticker_event.ts @@ -61,7 +61,7 @@ export class TickerEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts index e78a40d0..ebfd740e 100644 --- a/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts +++ b/sdk/node/src/generate/spot/spotpublic/model_trade_event.ts @@ -73,7 +73,7 @@ export class TradeEvent implements Response { * common response */ @Exclude() - private commonResponse?: WsMessage; + commonResponse?: WsMessage; setCommonResponse(response: WsMessage): void { this.commonResponse = response; diff --git a/sdk/node/src/generate/version.ts b/sdk/node/src/generate/version.ts index 0cd05b00..1121f7be 100644 --- a/sdk/node/src/generate/version.ts +++ b/sdk/node/src/generate/version.ts @@ -1,2 +1,2 @@ export const SdkVersion = 'v0.1.0-alpha'; -export const SdkGenerateDate = '2025-02-18'; +export const SdkGenerateDate = '2025-02-25'; From f6119130d64818a184a2432da57e0c42e3783164 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Tue, 25 Feb 2025 18:00:29 +0800 Subject: [PATCH 103/106] feat(nodejs): update websocket option --- sdk/node/README.md | 2 - .../internal/infra/default_ws_client.test.ts | 96 ++++++++++++++++--- sdk/node/src/model/websocket_option.ts | 26 ----- 3 files changed, 83 insertions(+), 41 deletions(-) diff --git a/sdk/node/README.md b/sdk/node/README.md index 453d7a06..412ff797 100644 --- a/sdk/node/README.md +++ b/sdk/node/README.md @@ -169,9 +169,7 @@ This section provides details about the configurable parameters for both HTTP an | `reconnectAttempts` | `number` | Maximum number of reconnection attempts; `-1` for unlimited attempts. | -1 | | `reconnectInterval` | `number` | Interval between reconnection attempts in milliseconds. | 5000 (5 seconds) | | `dialTimeout` | `number` | Timeout duration for establishing a WebSocket connection in milliseconds. | 10000 (10 seconds) | -| `readBufferBytes` | `number` | I/O buffer size in bytes. | 2048000 | | `readMessageBuffer` | `number` | Buffer size for reading messages in the queue. | 1024 | -| `writeMessageBuffer` | `number` | Buffer size for writing messages in the queue. | 256 | | `writeTimeout` | `number` | Timeout for sending messages in milliseconds. | 30000 (30 seconds) | | `eventCallback` | `Optional` | A callback function to handle WebSocket events. | None | diff --git a/sdk/node/src/internal/infra/default_ws_client.test.ts b/sdk/node/src/internal/infra/default_ws_client.test.ts index 6c60eec9..756ab989 100644 --- a/sdk/node/src/internal/infra/default_ws_client.test.ts +++ b/sdk/node/src/internal/infra/default_ws_client.test.ts @@ -143,6 +143,31 @@ export function mockWebSocketHandler2(ws: WebSocket) { }); } +export function mockWebSocketHandlerReadBufferFull(ws: WebSocket) { + ws.send(JSON.stringify(createMessage(randomUUID(), MessageType.WelcomeMessage))); + + ws.on('message', (message) => { + const m: WsMessage = JSON.parse(message.toString()); + + switch (m.type) { + case MessageType.PingMessage: + ws.send(JSON.stringify(createMessage(m.id, MessageType.PongMessage))); + break; + + case MessageType.SubscribeMessage: + console.log('[server2] Received subscribe message'); + ws.send(JSON.stringify(createMessage(m.id, MessageType.AckMessage))); + ws.send(JSON.stringify(createMessage(m.id, MessageType.Message))); + ws.send(JSON.stringify(createMessage(m.id, MessageType.Message))); + break; + } + }); + + ws.on('close', () => { + console.log('[server2] Connection closed'); + }); +} + class mockProvider implements WsTokenProvider { constructor(private wsToken: WsToken) {} @@ -338,12 +363,15 @@ describe('WS Transport Test', () => { console.log('[client] Received event', event, mes); }); - return client.start().then(() => { - let x = createMessage(randomUUID(), MessageType.SubscribeMessage); - return client.write(x, 1000); - }).then(()=> { - return client.stop(); - }); + return client + .start() + .then(() => { + let x = createMessage(randomUUID(), MessageType.SubscribeMessage); + return client.write(x, 1000); + }) + .then(() => { + return client.stop(); + }); }); }); @@ -362,14 +390,56 @@ describe('WS Transport Test', () => { console.log('[client] Received event', event, mes); }); - return client.start().then(() => { - let x = createMessage(randomUUID(), MessageType.SubscribeMessage); - return client.write(x, 0); - }).then(()=> { - return client.stop(); - }).catch((err) => { - expect(err).toBeDefined(); + return client + .start() + .then(() => { + let x = createMessage(randomUUID(), MessageType.SubscribeMessage); + return client.write(x, 0); + }) + .then(() => { + return client.stop(); + }) + .catch((err) => { + expect(err).toBeDefined(); + }); + }); + }); + + test('test read buffer full', () => { + return testByMockServer(mockWebSocketHandlerReadBufferFull).then((port) => { + let option = DEFAULT_WEBSOCKET_CLIENT_OPTION; + option.dialTimeout = 1000; + option.reconnect = true; + option.reconnectAttempts = 3; + option.reconnectInterval = 1000; + option.readMessageBuffer = 1; + + let token = DEFAULT_TOKEN_INFO; + token.endpoint = `http://127.0.0.1:${port}`; + let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); + client.on('event', function (event, mes) { + console.log('[client] Received event', event, mes); }); + + let count = 0; + client.on('message', async function (message) { + await new Promise((resolve, reject) => { + setTimeout(resolve, 1000); + }); + console.log('[client] Received message', message, count++, new Date().toString()); + }); + + return client + .start() + .then(() => { + let x = createMessage(randomUUID(), MessageType.SubscribeMessage); + return client.write(x, 1000); + }) + .then(() => { + return new Promise((resolve, reject) => { + setTimeout(resolve, 4000); + }); + }); }); }); }); diff --git a/sdk/node/src/model/websocket_option.ts b/sdk/node/src/model/websocket_option.ts index a6f8973f..240b3a79 100644 --- a/sdk/node/src/model/websocket_option.ts +++ b/sdk/node/src/model/websocket_option.ts @@ -42,18 +42,10 @@ export interface WebSocketClientOption { * Timeout for establishing a WebSocket connection (milliseconds); default: 10000 */ dialTimeout: number; - /** - * I/O buffer size in bytes; default: 2048000 - */ - readBufferBytes: number; /** * Read buffer for messages; default: 1024 */ readMessageBuffer: number; - /** - * Write buffer for messages; default: 256 - */ - writeMessageBuffer: number; /** * Write timeout (milliseconds); default: 30000 */ @@ -72,9 +64,7 @@ export const DEFAULT_WEBSOCKET_CLIENT_OPTION: WebSocketClientOption = { reconnectAttempts: -1, reconnectInterval: 5000, // 5 seconds dialTimeout: 10000, // 10 seconds - readBufferBytes: 2048000, readMessageBuffer: 1024, - writeMessageBuffer: 256, writeTimeout: 30000, // 30 seconds }; @@ -120,14 +110,6 @@ export class WebSocketClientOptionBuilder { return this; } - /** - * Set the I/O buffer size in bytes - */ - withReadBufferBytes(readBufferBytes: number): WebSocketClientOptionBuilder { - this.option.readBufferBytes = readBufferBytes; - return this; - } - /** * Set the read buffer size for messages */ @@ -136,14 +118,6 @@ export class WebSocketClientOptionBuilder { return this; } - /** - * Set the write buffer size for messages - */ - withWriteMessageBuffer(writeMessageBuffer: number): WebSocketClientOptionBuilder { - this.option.writeMessageBuffer = writeMessageBuffer; - return this; - } - /** * Set the write timeout (milliseconds) */ From 21f444bc971a438514148f1b832f8eeb50bec651 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 26 Feb 2025 14:19:00 +0800 Subject: [PATCH 104/106] feat(nodejs): add more tests --- .../internal/infra/default_ws_client.test.ts | 2 +- .../src/internal/infra/default_ws_client.ts | 4 +- .../src/internal/infra/default_ws_service.ts | 8 +- sdk/node/tests/robustness/ws/resource.test.ts | 624 +++++------------- 4 files changed, 172 insertions(+), 466 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.test.ts b/sdk/node/src/internal/infra/default_ws_client.test.ts index 756ab989..04f6ad71 100644 --- a/sdk/node/src/internal/infra/default_ws_client.test.ts +++ b/sdk/node/src/internal/infra/default_ws_client.test.ts @@ -247,7 +247,7 @@ describe('WS Transport Test', () => { let token = DEFAULT_TOKEN_INFO; token.endpoint = `http://127.0.0.1:${port}`; - token.pingInterval = 0.1; + token.pingInterval = 100; let client = new WebSocketClient(new mockProvider(DEFAULT_TOKEN_INFO), option); client.on('event', function (event, mes) { console.log('[client] Received event', event, mes); diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index 1dc2b3bd..eeeef7b0 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -83,7 +83,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport this.state = ConnectionState.CONNECTED; this.keepAliveInterval = setInterval( () => this.keepAlive(), - this.tokenInfo!.pingInterval * 1000, + this.tokenInfo!.pingInterval, ); this.emit('event', WebSocketEvent.EventConnected, ''); }) @@ -339,6 +339,8 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport pingMsg.type = MessageType.PingMessage; this.write(pingMsg, this.options.writeTimeout).catch((e) => { logger.error('keepalive ping error:', e); + }).then(()=> { + logger.debug('send ping success'); }); } diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index cec012f9..359b8922 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -42,7 +42,11 @@ export class DefaultWsService implements WebSocketService { this.eventEmitter = new EventEmitter(); this.eventEmitter.on('event', (event: WebSocketEvent, msg: string) => { if (this.wsOption.eventCallback) { - this.wsOption.eventCallback(event, msg); + try { + this.wsOption.eventCallback(event, msg); + } catch (e) { + logger.error(`call event callback error, event: ${event}`, e); + } } }); this.client = new WebSocketClient( @@ -65,7 +69,7 @@ export class DefaultWsService implements WebSocketService { } stop(): Promise { - return this.client.stop(); + return Promise.all([this.tokenTransport.close(), this.client.stop()]).then(); } subscribe(prefix: string, args: string[], callback: WebSocketMessageCallback): Promise { diff --git a/sdk/node/tests/robustness/ws/resource.test.ts b/sdk/node/tests/robustness/ws/resource.test.ts index 6d552c20..da65da14 100644 --- a/sdk/node/tests/robustness/ws/resource.test.ts +++ b/sdk/node/tests/robustness/ws/resource.test.ts @@ -6,130 +6,51 @@ import { WebSocketClientOptionBuilder, } from '@model/index'; import { DefaultClient } from '@api/index'; -import { exec } from 'child_process'; -import { promisify } from 'util'; +import { execSync } from 'child_process'; +import { AllTickersEvent } from '@generate/spot/spotpublic/model_all_tickers_event'; import { TickerEvent } from '@generate/spot/spotpublic/model_ticker_event'; -import { TickerV2Event } from '@generate/futures/futurespublic/model_ticker_v2_event'; import { WebSocketEvent } from '@model/websocket_option'; -import { platform } from 'os'; -const execAsync = promisify(exec); - -async function getProcessTCPConnections(): Promise { +// only work on macOS/Linux +function getProcessTCPConnectionsWithLsof(): number { try { - const isWindows = platform() === 'win32'; - let command = ''; - - if (isWindows) { - // Windows - command = `cmd.exe /c "chcp 437 > nul && netstat -n"`; - const { stdout } = await execAsync(command); - // count ESTABLISHED lines - return stdout.split('\n').filter(line => line.includes('ESTABLISHED')).length; - } else { - // Linux use ss command - command = `ss -tn | grep ESTAB | wc -l`; - const { stdout } = await execAsync(command); - return parseInt(stdout.trim(), 10); - } + const result = execSync(`lsof -iTCP -n -P | grep ${process.pid} | wc -l`); + return parseInt(result.toString().trim(), 10) || 0; } catch (error) { - console.error('Error getting TCP connections:', error); - return -1; + console.error(`Error executing lsof: ${error}`); + return 0; } } -function getMemoryUsage(): { heapUsed: number, heapTotal: number, rss: number } { +function getMemoryUsage(): { heapUsed: number; heapTotal: number; rss: number } { const memUsage = process.memoryUsage(); return { - heapUsed: Math.round(memUsage.heapUsed / 1024 / 1024), // MB + heapUsed: Math.round(memUsage.heapUsed / 1024 / 1024), // MB heapTotal: Math.round(memUsage.heapTotal / 1024 / 1024), // MB - rss: Math.round(memUsage.rss / 1024 / 1024) // MB + rss: Math.round(memUsage.rss / 1024 / 1024), // MB }; } function logMemoryUsage() { const usage = getMemoryUsage(); - console.log(`Memory Usage - Heap Used: ${usage.heapUsed}MB, Heap Total: ${usage.heapTotal}MB, RSS: ${usage.rss}MB`); -} - -async function verifyResourceCleanup(initialTCP: number, initialMemory: ReturnType) { - - await new Promise(resolve => setTimeout(resolve, 2000)); - - const currentTCP = await getProcessTCPConnections(); - const tcpDiff = currentTCP - initialTCP; - - const currentMemory = getMemoryUsage(); - const memoryDiff = { - heapUsed: currentMemory.heapUsed - initialMemory.heapUsed, - heapTotal: currentMemory.heapTotal - initialMemory.heapTotal, - rss: currentMemory.rss - initialMemory.rss - }; - - console.log('\nResource Cleanup Verification:'); - console.log(`TCP Connections - Initial: ${initialTCP}, Current: ${currentTCP}, Diff: ${tcpDiff}`); - console.log('Memory Usage Diff:'); - console.log(`- Heap Used: ${memoryDiff.heapUsed}MB`); - console.log(`- Heap Total: ${memoryDiff.heapTotal}MB`); - console.log(`- RSS: ${memoryDiff.rss}MB`); - - // 返回验证结果 - return { - tcpLeaked: tcpDiff > 0, - memoryLeaked: memoryDiff.heapUsed > 50, // 允许50MB的误差 - tcpDiff, - memoryDiff - }; + console.log( + `Memory Usage - Heap Used: ${usage.heapUsed}MB, Heap Total: ${usage.heapTotal}MB, RSS: ${usage.rss}MB`, + ); } describe('WebSocket Robustness Test', () => { - let initialTCP: number; - let initialMemory: ReturnType; - - beforeEach(async () => { - initialTCP = await getProcessTCPConnections(); - initialMemory = getMemoryUsage(); - console.log('\nInitial Resource State:'); - console.log(`TCP Connections: ${initialTCP}`); - logMemoryUsage(); - }); - - afterEach(async () => { - const result = await verifyResourceCleanup(initialTCP, initialMemory); - - if (result.tcpLeaked) { - console.warn(`Warning: TCP connections may be leaking (${result.tcpDiff} unreleased connections)`); - } - if (result.memoryLeaked) { - console.warn(`Warning: Memory may be leaking (${result.memoryDiff.heapUsed}MB increase in heap usage)`); - } - - expect(result.tcpLeaked).toBe(false); - expect(result.memoryLeaked).toBe(false); - }); - - // Test WebSocket connection leak - test('test websocket connection leak', async () => { - let spotConnected = false; - let futuresConnected = false; - const wsClients: { ws: any, type: string }[] = []; - + // Test single connection + test('test single connection', async () => { const wsOption = new WebSocketClientOptionBuilder() .withReconnect(true) .withReconnectInterval(1000) .withDialTimeout(5000) .withEventCallback((event: WebSocketEvent, msg: string) => { console.log(`WebSocket Event: ${event}, Message: ${msg}`); - if (event === WebSocketEvent.EventConnected) { - if (msg.includes('spot')) { - spotConnected = true; - } else if (msg.includes('futures')) { - futuresConnected = true; - } - } }) .build(); + let start = getProcessTCPConnectionsWithLsof(); const clientOption = new ClientOptionBuilder() .setKey('') .setSecret('') @@ -142,96 +63,42 @@ describe('WebSocket Robustness Test', () => { const client = new DefaultClient(clientOption); const wsService = client.wsService(); + const spotPublicWS = wsService.newSpotPublicWS(); - try { - console.log(`Before connections: ${await getProcessTCPConnections()}`); - - // Subscribe to some topics - const subscriptionPromises = []; - for (let i = 0; i < 5; i++) { - const spotPublicWS = wsService.newSpotPublicWS(); - const futuresPublicWS = wsService.newFuturesPublicWS(); - - wsClients.push({ ws: spotPublicWS, type: 'spot' }); - wsClients.push({ ws: futuresPublicWS, type: 'futures' }); - - // Start WebSocket clients - await spotPublicWS.start(); - await futuresPublicWS.start(); - - // Wait for connections to be established - await new Promise((resolve) => { - const checkConnections = () => { - if (spotConnected && futuresConnected) { - resolve(); - } - }; - const interval = setInterval(checkConnections, 100); - setTimeout(() => { - clearInterval(interval); - resolve(); // Resolve anyway after timeout - }, 5000); - }); - - // Reset flags for next iteration - spotConnected = false; - futuresConnected = false; - - // Subscribe to some topics and store both the WS instance and subscription ID - const spotPromise = spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => {}) - .then(subId => ({ ws: spotPublicWS, subId })); - const futuresPromise = futuresPublicWS.tickerV2('XBTUSDTM', (topic: string, subject: string, data: TickerV2Event) => {}) - .then(subId => ({ ws: futuresPublicWS, subId })); - - subscriptionPromises.push(spotPromise, futuresPromise); - } - - // Wait for all subscriptions to be established - const subscriptions = await Promise.all(subscriptionPromises); - - // Wait for a moment to ensure all connections are active - await new Promise(resolve => setTimeout(resolve, 5000)); - - console.log(`Current connections: ${await getProcessTCPConnections()}`); - - // Clean up - console.log('Cleaning up subscriptions...'); - await Promise.all(subscriptions.map(sub => sub.ws.unSubscribe(sub.subId))); - - console.log('Stopping WebSocket clients...'); - await Promise.all(wsClients.map(client => client.ws.stop())); - - // Wait for connections to close - await new Promise(resolve => setTimeout(resolve, 2000)); - - console.log(`After connections: ${await getProcessTCPConnections()}`); - } catch (error) { - console.error('Error:', error); - throw error; - } finally { - // Ensure all WebSocket clients are stopped - await Promise.all(wsClients.map(client => client.ws.stop().catch(console.error))); - } + // Start WebSocket client + return spotPublicWS + .start() + .then(() => { + return spotPublicWS.ticker( + ['BTC-USDT'], + (topic: string, subject: string, data: TickerEvent) => { + console.log('Received message:', data); + }, + ); + }) + .then((id) => { + return spotPublicWS.unSubscribe(id); + }) + .then(() => { + return spotPublicWS.stop(); + }) + .then(() => { + expect(getProcessTCPConnectionsWithLsof()).toEqual(start); + }); }); - // Test WebSocket memory leak - jest.setTimeout(1200); - test('test websocket memory leak', async () => { - let connected = false; - const wsClients: { ws: any, type: string }[] = []; - + // Test WebSocket connection leak + test('test websocket connection leak', async () => { const wsOption = new WebSocketClientOptionBuilder() .withReconnect(true) .withReconnectInterval(1000) .withDialTimeout(5000) .withEventCallback((event: WebSocketEvent, msg: string) => { console.log(`WebSocket Event: ${event}, Message: ${msg}`); - if (event === WebSocketEvent.EventConnected) { - connected = true; - } }) .build(); + let start = getProcessTCPConnectionsWithLsof(); const clientOption = new ClientOptionBuilder() .setKey('') .setSecret('') @@ -245,119 +112,43 @@ describe('WebSocket Robustness Test', () => { const client = new DefaultClient(clientOption); const wsService = client.wsService(); - let messageCount = 0; - let elapsedSeconds = 0; - const subscriptions: any[] = []; - - console.log(`Before connections: ${await getProcessTCPConnections()}`); - - try { - while (elapsedSeconds < 30) { - elapsedSeconds++; - logMemoryUsage(); - - if (elapsedSeconds % 5 === 0) { - const spotPublicWS = wsService.newSpotPublicWS(); - const futuresPublicWS = wsService.newFuturesPublicWS(); - - wsClients.push({ ws: spotPublicWS, type: 'spot' }); - wsClients.push({ ws: futuresPublicWS, type: 'futures' }); - - // Start WebSocket clients - await spotPublicWS.start(); - await futuresPublicWS.start(); - - // Wait for connections to be established - await new Promise((resolve) => { - const checkConnection = () => { - if (connected) { - resolve(); - } - }; - const interval = setInterval(checkConnection, 100); - setTimeout(() => { - clearInterval(interval); - resolve(); // Resolve anyway after timeout - }, 5000); - }); - - // Reset flag - connected = false; - - const spotSub = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { - messageCount++; - }); - const futuresSub = await futuresPublicWS.tickerV2('XBTUSDTM', (topic: string, subject: string, data: TickerV2Event) => { - messageCount++; - }); - - subscriptions.push( - { ws: spotPublicWS, subId: spotSub }, - { ws: futuresPublicWS, subId: futuresSub } - ); - - console.log(`Current connections: ${await getProcessTCPConnections()}`); - } - - // 等待1秒 - await new Promise(resolve => setTimeout(resolve, 1000)); - } - - // Clean up - console.log('Cleaning up subscriptions...'); - for (const sub of subscriptions) { - try { - await sub.ws.unSubscribe(sub.subId); - } catch (error) { - console.error('Error unsubscribing:', error); - } - } - - console.log('Stopping WebSocket clients...'); - for (const client of wsClients) { - try { - await client.ws.stop(); - } catch (error) { - console.error('Error stopping client:', error); - } - } - - // Wait for connections to close - await new Promise(resolve => setTimeout(resolve, 2000)); - console.log(`After connections: ${await getProcessTCPConnections()}`); - - } catch (error) { - console.error('Test error:', error); - throw error; - } finally { - // 确保所有WebSocket客户端都被停止 - console.log('Final cleanup in finally block...'); - for (const client of wsClients) { - try { - await client.ws.stop(); - } catch (error) { - console.error('Error in final cleanup:', error); - } - } + let promises = []; + + for (let i = 0; i < 10; i++) { + const spotPublicWS = wsService.newSpotPublicWS(); + promises.push( + spotPublicWS + .start() + .then(() => { + return new Promise((resolve) => { + console.log('TCP connection:', getProcessTCPConnectionsWithLsof()); + setTimeout(resolve, 1000); + }); + }) + .then(() => { + return spotPublicWS.stop(); + }), + ); } - }); - // Test WebSocket reconnection - test('test websocket reconnection', async () => { - let connected = false; + return Promise.all(promises).then(() => { + expect(getProcessTCPConnectionsWithLsof()).toEqual(start); + }); + }); + // Test WebSocket memory leak + jest.setTimeout(1200000); + test('test websocket memory leak', async () => { const wsOption = new WebSocketClientOptionBuilder() .withReconnect(true) .withReconnectInterval(1000) .withDialTimeout(5000) .withEventCallback((event: WebSocketEvent, msg: string) => { console.log(`WebSocket Event: ${event}, Message: ${msg}`); - if (event === WebSocketEvent.EventConnected) { - connected = true; - } }) .build(); + let start = getProcessTCPConnectionsWithLsof(); const clientOption = new ClientOptionBuilder() .setKey('') .setSecret('') @@ -370,73 +161,64 @@ describe('WebSocket Robustness Test', () => { const client = new DefaultClient(clientOption); const wsService = client.wsService(); - const spotPublicWS = wsService.newSpotPublicWS(); - - try { - console.log(`Before connections: ${await getProcessTCPConnections()}`); - // Start WebSocket client - await spotPublicWS.start(); - - // Wait for connection to be established - await new Promise((resolve) => { - const checkConnection = () => { - if (connected) { - resolve(); - } - }; - const interval = setInterval(checkConnection, 100); - setTimeout(() => { - clearInterval(interval); - resolve(); // Resolve anyway after timeout - }, 5000); - }); - - console.log(`After connection established: ${await getProcessTCPConnections()}`); - - // Reset flag - connected = false; - - // Subscribe to a topic - const subscription = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { - console.log('Received message:', data); - }); - - // Wait for some messages - await new Promise(resolve => setTimeout(resolve, 5000)); - - // Clean up - await spotPublicWS.unSubscribe(subscription); - await spotPublicWS.stop(); - - // Wait for connections to close - await new Promise(resolve => setTimeout(resolve, 2000)); - console.log(`After cleanup: ${await getProcessTCPConnections()}`); - } catch (error) { - console.error('Error:', error); - throw error; - } finally { - // Ensure WebSocket client is stopped - await spotPublicWS.stop().catch(console.error); + let promises = []; + let counter = 0; + logMemoryUsage(); + for (let i = 0; i < 5; i++) { + const spotPublicWS = wsService.newSpotPublicWS(); + promises.push( + spotPublicWS + .start() + .then(() => { + return spotPublicWS.allTickers( + (topic: string, subject: string, data: AllTickersEvent) => { + // do something to data + counter += data.time; + }, + ); + }) + .then((id) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(id); + }, 60000); + }); + }) + .then((id) => { + return spotPublicWS.unSubscribe(id); + }) + .then(() => { + return spotPublicWS.stop(); + }), + ); } + + return Promise.all(promises).then(() => { + expect(getProcessTCPConnectionsWithLsof()).toEqual(start); + logMemoryUsage(); + }); }); - // Test single connection - test('test single connection', async () => { - let connected = false; + // Test WebSocket reconnection + test('test websocket reconnection', (done) => { + let callback: () => Promise; const wsOption = new WebSocketClientOptionBuilder() .withReconnect(true) - .withReconnectInterval(1000) - .withDialTimeout(5000) + .withReconnectInterval(5000) + .withDialTimeout(1000) .withEventCallback((event: WebSocketEvent, msg: string) => { console.log(`WebSocket Event: ${event}, Message: ${msg}`); - if (event === WebSocketEvent.EventConnected) { - connected = true; + if (event === WebSocketEvent.EventReSubscribeOK) { + callback().then(() => { + done(); + }); } }) .build(); + let start = getProcessTCPConnectionsWithLsof(); const clientOption = new ClientOptionBuilder() .setKey('') .setSecret('') @@ -451,71 +233,30 @@ describe('WebSocket Robustness Test', () => { const wsService = client.wsService(); const spotPublicWS = wsService.newSpotPublicWS(); - try { - console.log(`Before connections: ${await getProcessTCPConnections()}`); - - // Start WebSocket client - await spotPublicWS.start(); - - // Wait for connection to be established - await new Promise((resolve) => { - const checkConnection = () => { - if (connected) { - resolve(); - } - }; - const interval = setInterval(checkConnection, 100); - setTimeout(() => { - clearInterval(interval); - resolve(); // Resolve anyway after timeout - }, 5000); - }); - - console.log(`After connection established: ${await getProcessTCPConnections()}`); - - // Reset flag - connected = false; - - // Subscribe to a topic - const subscription = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { - console.log('Received message:', data); + callback = () => { + return spotPublicWS.stop().then(() => { + expect(getProcessTCPConnectionsWithLsof()).toEqual(start); }); - - // Wait for some messages - await new Promise(resolve => setTimeout(resolve, 5000)); - - // Clean up - await spotPublicWS.unSubscribe(subscription); - await spotPublicWS.stop(); - - // Wait for connections to close - await new Promise(resolve => setTimeout(resolve, 2000)); - console.log(`After cleanup: ${await getProcessTCPConnections()}`); - } catch (error) { - console.error('Error:', error); - throw error; - } finally { - // Ensure WebSocket client is stopped - await spotPublicWS.stop().catch(console.error); - } + }; + + // Start WebSocket client + spotPublicWS.start().then(() => { + return spotPublicWS.ticker( + ['KCS-USDT'], + (topic: string, subject: string, data: TickerEvent) => { + console.log('Received message'); + }, + ); + }); }); // Test duplicate subscriptions should throw error - test('test duplicateSubscriptionstest', async () => { - let connected = false; - let disconnected = false; - const CLEANUP_TIMEOUT = 2000; // Wait 2 seconds for cleanup - + test('test duplicateSubscriptionstest', () => { const wsOption = new WebSocketClientOptionBuilder() - .withReconnect(false) // Disable auto-reconnect for this test + .withReconnect(false) .withDialTimeout(5000) .withEventCallback((event: WebSocketEvent, msg: string) => { console.log(`WebSocket Event: ${event}, Message: ${msg}`); - if (event === WebSocketEvent.EventConnected) { - connected = true; - } else if (event === WebSocketEvent.EventDisconnected) { - disconnected = true; - } }) .build(); @@ -533,81 +274,40 @@ describe('WebSocket Robustness Test', () => { const wsService = client.wsService(); const spotPublicWS = wsService.newSpotPublicWS(); - try { - // Start WebSocket client - await spotPublicWS.start(); - - // Wait for connection to be established - await new Promise((resolve, reject) => { - const checkConnection = () => { - if (connected) { - clearInterval(interval); - clearTimeout(timeout); - resolve(); - } - }; - const interval = setInterval(checkConnection, 100); - const timeout = setTimeout(() => { - clearInterval(interval); - reject(new Error('Connection timeout')); - }, 5000); - }); - - // First subscription - const subscription1 = await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { - console.log('First subscription received message:', data); - }); - - // Second subscription to the same topic should throw error - let error: Error | null = null; - try { - await spotPublicWS.ticker(['BTC-USDT'], (topic: string, subject: string, data: TickerEvent) => { - console.log('Second subscription received message:', data); - }); - } catch (e) { - error = e as Error; - } - expect(error).not.toBeNull(); - expect(error?.message).toContain('already subscribed'); - - // Clean up - console.log('Starting cleanup...'); - await spotPublicWS.unSubscribe(subscription1); - await spotPublicWS.stop(); - - // Wait for disconnect event - await new Promise((resolve, reject) => { - const checkDisconnection = () => { - if (disconnected) { - clearInterval(interval); - clearTimeout(timeout); - resolve(); - } - }; - const interval = setInterval(checkDisconnection, 100); - const timeout = setTimeout(() => { - clearInterval(interval); - reject(new Error('Disconnect timeout')); - }, CLEANUP_TIMEOUT); - }); - - // Additional wait for system to clean up resources - await new Promise(resolve => setTimeout(resolve, CLEANUP_TIMEOUT)); - - } catch (error) { - console.error('Test error:', error); - throw error; - } finally { - // Force cleanup in case of errors - try { - if (!disconnected) { - await spotPublicWS.stop(); - // Wait for resources to be cleaned up - await new Promise(resolve => setTimeout(resolve, CLEANUP_TIMEOUT)); + // Start WebSocket client + return spotPublicWS + .start() + .then(() => { + // First subscription + return spotPublicWS.ticker( + ['BTC-USDT'], + (topic: string, subject: string, data: TickerEvent) => { + console.log('First subscription received message:', data); + }, + ); + }) + .then(async (id) => { + let error: Error | null = null; + try { + await spotPublicWS.ticker( + ['BTC-USDT'], + (topic: string, subject: string, data: TickerEvent) => { + console.log('Second subscription received message:', data); + }, + ); + } catch (e) { + error = e as Error; } - } catch (error) { - console.error('Error in final cleanup:', error); - } - } - }, 30000); // Set test timeout to 30 seconds + expect(error).not.toBeNull(); + // Second subscription to the same topic should throw error + expect(error?.message).toContain('Already subscribed'); + return id; + }) + .then((id) => { + return spotPublicWS.unSubscribe(id); + }) + .then(() => { + return spotPublicWS.stop(); + }); + }); }); From 6e1305e6e3b0e3811bc8f5f6c8a285618393daf3 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 26 Feb 2025 14:40:17 +0800 Subject: [PATCH 105/106] feat(nodejs): fix logs --- .../src/internal/infra/default_ws_client.ts | 19 ++++++++++--------- .../src/internal/infra/default_ws_service.ts | 11 +++++++---- sdk/node/src/internal/infra/message_worker.js | 6 +++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/sdk/node/src/internal/infra/default_ws_client.ts b/sdk/node/src/internal/infra/default_ws_client.ts index eeeef7b0..d1df5f41 100644 --- a/sdk/node/src/internal/infra/default_ws_client.ts +++ b/sdk/node/src/internal/infra/default_ws_client.ts @@ -96,6 +96,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport stop(): Promise { this.shutdown = true; + logger.info('shutting down websocket client...'); return this.close().finally(() => { this.emit('event', WebSocketEvent.EventClientShutdown, ''); }); @@ -148,7 +149,7 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport } private close(): Promise { - logger.info('closing websocket client'); + logger.info('closing websocket client...'); // clear intervals if (this.keepAliveInterval) { @@ -325,10 +326,8 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport // close callback private onClose(code: number, reason: string): void { - logger.warn(`WebSocket closed with code ${code}: ${reason}`); - - // Handle reconnection if needed if (!this.shutdown) { + logger.warn(`WebSocket closed with code ${code}: ${reason}`); this.reconnect(); } } @@ -337,11 +336,13 @@ export class WebSocketClient extends EventEmitter implements WebsocketTransport const pingMsg = new WsMessage(); pingMsg.id = Date.now().toString(); pingMsg.type = MessageType.PingMessage; - this.write(pingMsg, this.options.writeTimeout).catch((e) => { - logger.error('keepalive ping error:', e); - }).then(()=> { - logger.debug('send ping success'); - }); + this.write(pingMsg, this.options.writeTimeout) + .catch((e) => { + logger.error('keepalive ping error:', e); + }) + .then(() => { + logger.debug('send ping success'); + }); } private randomEndpoint(tokens: WsToken[]): WsToken { diff --git a/sdk/node/src/internal/infra/default_ws_service.ts b/sdk/node/src/internal/infra/default_ws_service.ts index 359b8922..3237abcf 100644 --- a/sdk/node/src/internal/infra/default_ws_service.ts +++ b/sdk/node/src/internal/infra/default_ws_service.ts @@ -97,12 +97,15 @@ export class DefaultWsService implements WebSocketService { return this.client .write(subEvent, this.wsOption.writeTimeout) - .then(() => subId) + .then(() => { + logger.info(`subscribed id: ${subId}`); + return subId; + }) .catch((err) => { // Clean up on failure const callbackManager = this.topicManager.getCallbackManager(subInfo.prefix); callbackManager.remove(subId); - logger.error(`Subscribe error: ${err}`); + logger.error(`subscribe id: ${subId}, error`, err); throw err; }); } @@ -124,11 +127,11 @@ export class DefaultWsService implements WebSocketService { .write(subEvent, this.wsOption.writeTimeout) .then(() => { callbackManager.remove(id); - logger.info('callback removed for id:', id); + logger.info(`unsubscribe id: ${id}`); resolve(); }) .catch((e) => { - logger.error('Failed to send unsubscribe message:', e); + logger.error(`unsubscribe id: ${id}, error`, e); reject(e); }); }); diff --git a/sdk/node/src/internal/infra/message_worker.js b/sdk/node/src/internal/infra/message_worker.js index 61240f99..4c5aceba 100644 --- a/sdk/node/src/internal/infra/message_worker.js +++ b/sdk/node/src/internal/infra/message_worker.js @@ -49,7 +49,7 @@ parentPort.on( }); ws.on('close', (code, reason) => { - logger.info('[Worker] WebSocket closed:', code, reason); + logger.info('[Worker] WebSocket closed', code, reason); parentPort.postMessage({ type: EventType.CLOSED, data: { code: code, reason: reason }, @@ -84,7 +84,7 @@ parentPort.on( break; } case EventType.CLOSED: { - logger.info('[Worker] shutdown the worker'); + logger.info('[Worker] Shutting down the websocket connection...'); if (ws) { ws.close(); ws = null; @@ -106,4 +106,4 @@ parentPort.on( }, ); // Log worker startup -logger.info('[Worker] Started and ready to process messages at:', new Date().toISOString()); +logger.info('[Worker] Started and ready to process messages'); From 35ff71f6a4df2eb6b518d6584b82fe72ebdbd0a5 Mon Sep 17 00:00:00 2001 From: "Isaac.Tang" Date: Wed, 26 Feb 2025 14:58:12 +0800 Subject: [PATCH 106/106] doc(nodejs): update readme --- sdk/node/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/node/README.md b/sdk/node/README.md index 412ff797..faeec1dc 100644 --- a/sdk/node/README.md +++ b/sdk/node/README.md @@ -125,10 +125,11 @@ This section provides specific considerations and recommendations for using the - Spot public/private and Futures public/private services require 4 active WebSocket connections. #### Threading and Callbacks -- **Simple Thread Model**: +- **Thread Model**: - WebSocket services follow a simple thread model, ensuring callbacks are handled on a single thread. + - Although the above callback ensures single-threaded execution (guaranteed by Node.js's single-threaded model), the management of WebSocket connections, as well as message reception and transmission, is handled by a separate worker thread. - **Subscription Management**: - - Subscriptions are synchronous. A subscription is considered successful only after receiving an acknowledgment (ACK) from the server. + - A subscription is considered successful only after receiving an acknowledgment (ACK) from the server. - Each subscription has a unique ID, which can be used for unsubscribe. #### Data and Message Handling